diff --git a/sdl2-hyper-sonic-drivers/sdl2-hyper-sonic-drivers.cpp b/sdl2-hyper-sonic-drivers/sdl2-hyper-sonic-drivers.cpp index c529c9af..b61e7fd9 100644 --- a/sdl2-hyper-sonic-drivers/sdl2-hyper-sonic-drivers.cpp +++ b/sdl2-hyper-sonic-drivers/sdl2-hyper-sonic-drivers.cpp @@ -62,9 +62,9 @@ void playNotes(hardware::PCSpeaker *pcSpeaker, const hardware::PCSpeaker::eWaveF { auto start = std::chrono::steady_clock::now(); pcSpeaker->play(waveForm, freq, length); - while (pcSpeaker->isActive()) { SDL_Delay(10); } + while (pcSpeaker->isPlaying()) { SDL_Delay(10); } pcSpeaker->play(waveForm, freq + 183, length * 2); - while (pcSpeaker->isActive()) { SDL_Delay(10); } + while (pcSpeaker->isPlaying()) { SDL_Delay(10); } auto end = std::chrono::steady_clock::now(); std::chrono::duration elapsed_seconds = end - start; std::cout << "Elapsed Time (s) = " << elapsed_seconds.count() << " --- Expected (s) ~=" << length + length * 2 << "\n"; diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/hardware/PCSpeaker.cpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/hardware/PCSpeaker.cpp index 3de27584..977ad085 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/hardware/PCSpeaker.cpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/hardware/PCSpeaker.cpp @@ -90,7 +90,7 @@ namespace HyperSonicDrivers::hardware _setRemainingSamples(delay); } - bool PCSpeaker::isActive() const noexcept + bool PCSpeaker::isPlaying() const noexcept { return _remainingSamples != 0; } diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/hardware/PCSpeaker.hpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/hardware/PCSpeaker.hpp index fdbd9a4b..de0f805d 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/hardware/PCSpeaker.hpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/hardware/PCSpeaker.hpp @@ -47,7 +47,7 @@ namespace HyperSonicDrivers::hardware void play(const eWaveForm waveForm, const int freq, const int32_t length); /** Stop the currently playing note after delay ms. */ void stop(const int32_t delay = 0); - bool isActive() const noexcept; + bool isPlaying() const noexcept; template uint32_t readBuffer(T* buffer, uint32_t numSamples); uint32_t getRate() const noexcept; uint8_t getChannels() const noexcept; diff --git a/sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/hardware/TestPCSpeaker.cpp b/sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/hardware/TestPCSpeaker.cpp index 4153e2dc..b89e8ad2 100644 --- a/sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/hardware/TestPCSpeaker.cpp +++ b/sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/hardware/TestPCSpeaker.cpp @@ -31,7 +31,7 @@ namespace HyperSonicDrivers::hardware { PCSpeaker pcSpeaker(44100, 8); pcSpeaker.play(PCSpeaker::eWaveForm::SINE, 440, 1); - EXPECT_TRUE(pcSpeaker.isActive()); + EXPECT_TRUE(pcSpeaker.isPlaying()); } TEST(PCSpeaker, readBuffer) @@ -74,7 +74,7 @@ namespace HyperSonicDrivers::hardware double tsum = 0.0; uint32_t dsum = 0; - while (pcSpeaker->isActive()) + while (pcSpeaker->isPlaying()) { uint32_t d = this->readbuf(); dsum += d;