Skip to content

Commit

Permalink
revert accidental refactor to isPlaying
Browse files Browse the repository at this point in the history
  • Loading branch information
Raffaello committed Nov 12, 2023
1 parent 9890945 commit 4767248
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion sdl2-hyper-sonic-drivers/examples/adl-example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void adl_test(const OplEmulator emu, const OplType type, std::shared_ptr<audio::
{
//spdlog::info("is playing");
delayMillis(1000);
} while (adlDrv.isActive());
} while (adlDrv.isPlaying());
}

int main(int argc, char* argv[])
Expand Down
2 changes: 1 addition & 1 deletion sdl2-hyper-sonic-drivers/examples/mid-example.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void mid_test_run(drivers::MIDDriver& midDrv, const std::shared_ptr<audio::MIDI>
auto start_time = std::chrono::system_clock::now();
midDrv.setMidi(midi);
midDrv.play(0);
while (midDrv.isActive()) {
while (midDrv.isPlaying()) {
utils::delayMillis(1000);
}

Expand Down
2 changes: 1 addition & 1 deletion sdl2-hyper-sonic-drivers/examples/mt32-example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int main(int argc, char* argv[])
drivers::MIDDriver middrv(mt32, eChannelGroup::Music);
middrv.setMidi(midi);
middrv.play(0);
while (middrv.isActive())
while (middrv.isPlaying())
{
utils::delayMillis(100);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace HyperSonicDrivers::drivers
// TODO: it might not be required
//virtual void resume() = 0;

virtual bool isActive() const noexcept = 0;
virtual bool isPlaying() const noexcept = 0;

// TODO: it might not be required
//virtual bool isPaused() const noexcept = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ namespace HyperSonicDrivers::drivers
m_paused = false;
}

bool MIDDriver::isActive() const noexcept
bool MIDDriver::isPlaying() const noexcept
{
return m_isPlaying;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace HyperSonicDrivers::drivers
void pause() noexcept;
void resume() noexcept;

bool isActive() const noexcept override;
bool isPlaying() const noexcept override;

bool isPaused() const noexcept;
inline bool isTempoChanged() const noexcept { return m_midiTempoChanged; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ namespace HyperSonicDrivers::drivers::westwood
stopAllChannels();
}

bool ADLDriver::isActive() const noexcept
bool ADLDriver::isPlaying() const noexcept
{
bool res = false;
for (int i = 0; i <= NUM_CHANNELS; i++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace HyperSonicDrivers::drivers::westwood
void play(const uint8_t track) noexcept override;
void stop() noexcept override;

bool isActive() const noexcept override;
bool isPlaying() const noexcept override;
private:
void initDriver_();
void startSound_(const uint8_t track, const uint8_t volume);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace HyperSonicDrivers::audio::sdl2
drv1.setADLFile(af);

drv1.play(4);
while (drv1.isActive())
while (drv1.isPlaying())
r.renderBuffer(opl);

r.closeOutputFile();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace HyperSonicDrivers::drivers
IAudioDriverMock(const std::shared_ptr<devices::IDevice>& device) : IAudioDriver(device) {}
void play(const uint8_t track) noexcept override {};
void stop() noexcept override {};
bool isActive() const noexcept override { return false; };
bool isPlaying() const noexcept override { return false; };
};

TEST(IAudioDriver, cstor_nullptr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ namespace HyperSonicDrivers::drivers
MIDDriverMock middrv(device);
middrv.setMidi(midi);
middrv.play(0);
ASSERT_TRUE(middrv.isActive());
ASSERT_TRUE(middrv.isPlaying());
auto start = utils::getMillis<uint32_t>();
utils::delayMillis(20);
middrv.stop();
EXPECT_FALSE(middrv.isActive());
EXPECT_FALSE(middrv.isPlaying());
auto stop = utils::getMillis<uint32_t>();
EXPECT_LE(stop - start, 1 * 1000);
EXPECT_FALSE(middrv.isActive());
EXPECT_FALSE(middrv.isPlaying());
EXPECT_TRUE(device->isAcquired());
}
EXPECT_FALSE(device->isAcquired());
Expand Down

0 comments on commit 4767248

Please sign in to comment.