From 8b66a0f9388d80181f0c12b1420466a5d5f1c78c Mon Sep 17 00:00:00 2001 From: Raffaello Bertini Date: Tue, 14 Nov 2023 14:54:30 +0000 Subject: [PATCH 1/4] init --- .../sdl2-hyper-sonic-drivers.cpp | 57 ++++++++++++++++++- 1 file changed, 55 insertions(+), 2 deletions(-) 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(); From fed81d95a3dc31321860182990080e5e68dd54e0 Mon Sep 17 00:00:00 2001 From: Raffaello Bertini Date: Tue, 14 Nov 2023 15:01:43 +0000 Subject: [PATCH 2/4] rabbit code rev --- .../src/HyperSonicDrivers/audio/IMixer.hpp | 2 +- .../src/HyperSonicDrivers/audio/sdl2/Mixer.cpp | 2 +- .../src/HyperSonicDrivers/audio/sdl2/Mixer.hpp | 4 ++-- .../src/HyperSonicDrivers/devices/MT32.cpp | 2 +- .../src/HyperSonicDrivers/devices/types.hpp | 2 +- sdl2-hyper-sonic-drivers/src/std/IDeviceTypesFormatter.hpp | 2 +- .../test/HyperSonicDrivers/audio/IMixerMock.hpp | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) 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..0e354b8d 100644 --- a/sdl2-hyper-sonic-drivers/src/std/IDeviceTypesFormatter.hpp +++ b/sdl2-hyper-sonic-drivers/src/std/IDeviceTypesFormatter.hpp @@ -27,7 +27,7 @@ namespace std case SbPro2: str = "SbPro2"; break; - case 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 {}; From aa31f2d9f0498bb48f77c8d1b17b7c282cb18f4b Mon Sep 17 00:00:00 2001 From: Raffaello Bertini Date: Tue, 14 Nov 2023 15:03:40 +0000 Subject: [PATCH 3/4] update version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From 3697dee48adc49a756fd06fe5aa76aa4aee82623 Mon Sep 17 00:00:00 2001 From: Raffaello Bertini Date: Tue, 14 Nov 2023 15:06:56 +0000 Subject: [PATCH 4/4] code rev --- sdl2-hyper-sonic-drivers/src/std/IDeviceTypesFormatter.hpp | 2 +- .../test/std/IDeviceTypesFormatterTest.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sdl2-hyper-sonic-drivers/src/std/IDeviceTypesFormatter.hpp b/sdl2-hyper-sonic-drivers/src/std/IDeviceTypesFormatter.hpp index 0e354b8d..5b096d60 100644 --- a/sdl2-hyper-sonic-drivers/src/std/IDeviceTypesFormatter.hpp +++ b/sdl2-hyper-sonic-drivers/src/std/IDeviceTypesFormatter.hpp @@ -28,7 +28,7 @@ namespace std str = "SbPro2"; break; case Mt32: - str = "MT32"; + str = "Mt32"; break; } 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"); } }