mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-02 02:33:43 +01:00
Prevent bad noise when dragging volume slider
This commit is contained in:
1 parent
b1fa6b4671
commit
e0a09a8733
2 files changed
+10
-3
No files matched your search
@@ -737,9 +737,16 @@ void GameSettingsScreen::CreateAudioSettings(UI::ViewGroup *audioSettings) {
|
||||
uiVolume->SetZeroLabel(a->T("Mute"));
|
||||
uiVolume->SetLiveUpdate(true);
|
||||
uiVolume->OnChange.Add([](UI::EventParams &e) {
|
||||
static double lastTimePlayed = 0.0;
|
||||
double now = time_now_d();
|
||||
if (now - lastTimePlayed < 0.1) {
|
||||
return; // Don't play if we just played one, to avoid spamming when dragging.
|
||||
}
|
||||
lastTimePlayed = now;
|
||||
// Audio preview
|
||||
PlayUISound(UI::UISound::CONFIRM);
|
||||
});
|
||||
uiVolume->SetEnabledPtr(&g_Config.iUIVolume);
|
||||
|
||||
PopupSliderChoice *gamePreviewVolume = audioSettings->Add(new PopupSliderChoice(&g_Config.iGamePreviewVolume, VOLUME_OFF, VOLUMEHI_FULL, Config::GetDefaultValueInt(&g_Config.iGamePreviewVolume), a->T("Game preview volume"), screenManager()));
|
||||
gamePreviewVolume->SetFormat("%d%%");
|
||||
|
||||
Reference in new issue
Block a user