Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small code reviews #283

Merged
merged 4 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 55 additions & 2 deletions sdl2-hyper-sonic-drivers/sdl2-hyper-sonic-drivers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,58 @@ void pcm_sound_append()
}
}
Raffaello marked this conversation as resolved.
Show resolved Hide resolved

//void adldune2filestest()
//{
// auto mixer = audio::make_mixer<audio::sdl2::Mixer>(8, 44100, 1024);
// mixer->init();
//
// auto device = devices::make_device<devices::Adlib, devices::Opl>(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<files::westwood::ADLFile>(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);
//}
Raffaello marked this conversation as resolved.
Show resolved Hide resolved

int main(int argc, char* argv[])
{
//newMixerTest();
Expand All @@ -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();
Raffaello marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Raffaello marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ namespace HyperSonicDrivers::devices
Adlib,
SbPro,
SbPro2,
MT32
Mt32
};
}
2 changes: 1 addition & 1 deletion sdl2-hyper-sonic-drivers/src/std/IDeviceTypesFormatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace std
case SbPro2:
str = "SbPro2";
break;
case MT32:
case Mt32:
str = "MT32";
break;
}
Raffaello marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand Down
Loading