cellMusic: fix volume. Qt needs a value between 0 and 1

This commit is contained in:
Megamouse 2025-02-04 00:21:33 +01:00
parent b5dbafb3e2
commit 9bccdf4f71

View file

@ -177,8 +177,8 @@ void qt_music_handler::set_volume(f32 volume)
Emu.BlockingCallFromMainThread([&volume, this]()
{
const int new_volume = std::max<int>(0, std::min<int>(volume * 100, 100));
music_log.notice("Setting volume to %d%%", new_volume);
const f32 new_volume = std::clamp(volume, 0.0f, 1.0f);
music_log.notice("Setting volume to %f", new_volume);
m_media_player->audioOutput()->setVolume(new_volume);
});
}
@ -190,8 +190,8 @@ f32 qt_music_handler::get_volume() const
Emu.BlockingCallFromMainThread([&volume, this]()
{
volume = std::max(0.f, std::min(m_media_player->audioOutput()->volume(), 1.f));
music_log.notice("Getting volume: %d%%", volume);
volume = std::clamp(m_media_player->audioOutput()->volume(), 0.0f, 1.0f);
music_log.notice("Getting volume: %f", volume);
});
return volume;