diff --git a/CMakeLists.txt b/CMakeLists.txt index e552cd02..67268e26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE) endif() -project ("sdl2-hyper-sonic-drivers" VERSION 0.17.0 DESCRIPTION "SDL2 based Hyper-Sonic Drivers for emulating old soundcards") +project ("sdl2-hyper-sonic-drivers" VERSION 0.17.1 DESCRIPTION "SDL2 based Hyper-Sonic Drivers for emulating old soundcards") include (TestBigEndian) TEST_BIG_ENDIAN(IS_BIG_ENDIAN) if(IS_BIG_ENDIAN) diff --git a/sdl2-hyper-sonic-drivers/sdl2-hyper-sonic-drivers.cpp b/sdl2-hyper-sonic-drivers/sdl2-hyper-sonic-drivers.cpp index b61e7fd9..a735cfd5 100644 --- a/sdl2-hyper-sonic-drivers/sdl2-hyper-sonic-drivers.cpp +++ b/sdl2-hyper-sonic-drivers/sdl2-hyper-sonic-drivers.cpp @@ -410,6 +410,58 @@ void pcm_sound_append() } } +//void adldune2filestest() +//{ +// auto mixer = audio::make_mixer(8, 44100, 1024); +// mixer->init(); +// +// auto device = devices::make_device(mixer); +// drivers::westwood::ADLDriver drv(device, audio::mixer::eChannelGroup::Music); +// +// SDL_InitSubSystem(SDL_INIT_EVENTS); +// SDL_InitSubSystem(SDL_INIT_VIDEO); +// +// auto window = SDL_CreateWindow("a", 0, 0, 320, 200, 0); +// +// for (int f = 0; f <= 0; f++) +// { +// const std::string fn = "adl/DUNE" + std::to_string(f) + ".ADL"; +// utils::ILogger::instance->info(std::format("opening file: {}", fn), utils::ILogger::eCategory::Application); +// auto adlf = std::make_shared(fn); +// drv.setADLFile(adlf); +// for (int i = 0; i < adlf->getNumTracks(); i++) +// { +// utils::ILogger::instance->info(std::format("playing track: {}", i), utils::ILogger::eCategory::Application); +// drv.play(i); +// while (drv.isPlaying()) +// { +// utils::delayMillis(200); +// SDL_Event e; +// while (SDL_PollEvent(&e)) +// switch (e.type) +// { +// case SDL_QUIT: +// goto QUIT; +// case SDL_KEYDOWN: +// //case SDL_KEYUP: +// if (e.key.keysym.sym == SDLK_ESCAPE) +// goto QUIT; +// if (e.key.keysym.sym == SDLK_RETURN) +// drv.stop(); +// break; +// +// default: +// std::cout << "event: " << e.type << std::endl; +// } +// } +// drv.stopAllChannels(); +// utils::delayMillis(1000); +// } +// } +//QUIT: +// SDL_DestroyWindow(window); +//} + int main(int argc, char* argv[]) { //newMixerTest(); @@ -419,8 +471,9 @@ int main(int argc, char* argv[]) //midi_adlib(); //testMT32(); - pcm_sound_append(); - return 0; + //pcm_sound_append(); + //adldune2filestest(); + //return 0; //sdlMixer(); //SDL_Delay(100); //renderMixer(); diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/IMixer.hpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/IMixer.hpp index 4f1988b0..27f47e8d 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/IMixer.hpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/IMixer.hpp @@ -57,7 +57,7 @@ namespace HyperSonicDrivers::audio virtual bool isPaused(const uint8_t id) const noexcept = 0; virtual bool isActive() const noexcept = 0; - virtual bool isActive(const mixer::eChannelGroup group) = 0; + virtual bool isActive(const mixer::eChannelGroup group) const noexcept = 0; virtual bool isChannelGroupMuted(const mixer::eChannelGroup group) const noexcept = 0; virtual void muteChannelGroup(const mixer::eChannelGroup group) noexcept = 0; diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Mixer.cpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Mixer.cpp index 22a52037..3387299f 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Mixer.cpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Mixer.cpp @@ -150,7 +150,7 @@ namespace HyperSonicDrivers::audio::sdl2 { return !ch->isEnded(); }); } - bool Mixer::isActive(const mixer::eChannelGroup group) + bool Mixer::isActive(const mixer::eChannelGroup group) const noexcept { std::scoped_lock lck(m_mutex); diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Mixer.hpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Mixer.hpp index e8693568..0a249e7d 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Mixer.hpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Mixer.hpp @@ -44,9 +44,9 @@ namespace HyperSonicDrivers::audio::sdl2 bool isPaused(const uint8_t id) const noexcept override; bool isActive() const noexcept override; - bool isActive(const mixer::eChannelGroup group) override; + bool isActive(const mixer::eChannelGroup group) const noexcept override; - bool isChannelGroupMuted(const mixer::eChannelGroup group) const noexcept override;; + bool isChannelGroupMuted(const mixer::eChannelGroup group) const noexcept override; void muteChannelGroup(const mixer::eChannelGroup group) noexcept override; void unmuteChannelGroup(const mixer::eChannelGroup group) noexcept override; diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/devices/MT32.cpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/devices/MT32.cpp index ca89f6b3..d5a4a2d9 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/devices/MT32.cpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/devices/MT32.cpp @@ -34,7 +34,7 @@ namespace HyperSonicDrivers::devices eDeviceName MT32::getName() const noexcept { - return eDeviceName::MT32; + return eDeviceName::Mt32; } void MT32::lcd_message(const std::string& msg) noexcept diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/devices/types.hpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/devices/types.hpp index 52ac9ad0..e1074bfe 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/devices/types.hpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/devices/types.hpp @@ -13,6 +13,6 @@ namespace HyperSonicDrivers::devices Adlib, SbPro, SbPro2, - MT32 + Mt32 }; } diff --git a/sdl2-hyper-sonic-drivers/src/std/IDeviceTypesFormatter.hpp b/sdl2-hyper-sonic-drivers/src/std/IDeviceTypesFormatter.hpp index 97916edb..5b096d60 100644 --- a/sdl2-hyper-sonic-drivers/src/std/IDeviceTypesFormatter.hpp +++ b/sdl2-hyper-sonic-drivers/src/std/IDeviceTypesFormatter.hpp @@ -27,8 +27,8 @@ namespace std case SbPro2: str = "SbPro2"; break; - case MT32: - str = "MT32"; + case Mt32: + str = "Mt32"; break; } diff --git a/sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/audio/IMixerMock.hpp b/sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/audio/IMixerMock.hpp index 25f13482..7ea16a97 100644 --- a/sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/audio/IMixerMock.hpp +++ b/sdl2-hyper-sonic-drivers/test/HyperSonicDrivers/audio/IMixerMock.hpp @@ -44,7 +44,7 @@ namespace HyperSonicDrivers::audio bool isActive(const uint8_t id) const noexcept override { return true; }; bool isPaused(const uint8_t id) const noexcept override { return false; } bool isActive() const noexcept override { return true; }; - bool isActive(const mixer::eChannelGroup group) override { return true; }; + bool isActive(const mixer::eChannelGroup group) const noexcept override { return true; }; bool isChannelGroupMuted(const mixer::eChannelGroup group) const noexcept override { return false; }; void muteChannelGroup(const mixer::eChannelGroup group) noexcept override {}; void unmuteChannelGroup(const mixer::eChannelGroup group) noexcept override {}; diff --git a/sdl2-hyper-sonic-drivers/test/std/IDeviceTypesFormatterTest.cpp b/sdl2-hyper-sonic-drivers/test/std/IDeviceTypesFormatterTest.cpp index cfc0b437..d973ad67 100644 --- a/sdl2-hyper-sonic-drivers/test/std/IDeviceTypesFormatterTest.cpp +++ b/sdl2-hyper-sonic-drivers/test/std/IDeviceTypesFormatterTest.cpp @@ -6,7 +6,10 @@ namespace std { TEST(IDeviceTypesFormatter, Music) { - ASSERT_STRCASEEQ(std::format("{}", HyperSonicDrivers::devices::eDeviceName::Adlib).c_str(), "Adlib"); + EXPECT_STRCASEEQ(std::format("{}", HyperSonicDrivers::devices::eDeviceName::Adlib).c_str(), "Adlib"); + EXPECT_STRCASEEQ(std::format("{}", HyperSonicDrivers::devices::eDeviceName::Mt32).c_str(), "Mt32"); + EXPECT_STRCASEEQ(std::format("{}", HyperSonicDrivers::devices::eDeviceName::SbPro).c_str(), "SbPro"); + EXPECT_STRCASEEQ(std::format("{}", HyperSonicDrivers::devices::eDeviceName::SbPro2).c_str(), "SbPro2"); } }