diff --git a/Output/Sounds/ApplauseHigh.mp3 b/Output/Sounds/ApplauseHigh.mp3 index feef5379..d0054596 100644 Binary files a/Output/Sounds/ApplauseHigh.mp3 and b/Output/Sounds/ApplauseHigh.mp3 differ diff --git a/Output/Sounds/ApplauseLow.mp3 b/Output/Sounds/ApplauseLow.mp3 index b5a2ec9a..3537dd2e 100644 Binary files a/Output/Sounds/ApplauseLow.mp3 and b/Output/Sounds/ApplauseLow.mp3 differ diff --git a/Output/Sounds/ApplauseMid.mp3 b/Output/Sounds/ApplauseMid.mp3 index 0b40903a..88337788 100644 Binary files a/Output/Sounds/ApplauseMid.mp3 and b/Output/Sounds/ApplauseMid.mp3 differ diff --git a/Output/Sounds/ProgressBar.mp3 b/Output/Sounds/ProgressBar.mp3 new file mode 100644 index 00000000..cf9b0a7f Binary files /dev/null and b/Output/Sounds/ProgressBar.mp3 differ diff --git a/Output/Sounds/_readme.txt b/Output/Sounds/_readme.txt index 4037afd9..80166db5 100644 --- a/Output/Sounds/_readme.txt +++ b/Output/Sounds/_readme.txt @@ -1,6 +1,7 @@ ----- APPLAUSE SOUNDS HIGHSCORE SOUND +ELEVATING SOUND ----- for free without attribution (check pixabay content license) enjoy @@ -10,3 +11,4 @@ https://pixabay.com/de/sound-effects/small-applause-6695/ https://pixabay.com/de/sound-effects/short-crowd-cheer-6713/ https://pixabay.com/de/sound-effects/cheering-and-clapping-crowd-1-5995/ https://pixabay.com/de/sound-effects/achive-sound-132273/ +https://pixabay.com/sound-effects/stuttering-climax-31002/ diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index 82b9ddfe..0000ed4e 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -125,6 +125,7 @@ namespace Vocaluxe.Base public const string FileNameSoundApplauseMid = "ApplauseMid.mp3"; public const string FileNameSoundApplauseHigh = "ApplauseHigh.mp3"; public const string FileNameSoundHighscore = "Highscore.mp3"; + public const string FileNameSoundProgressBar = "ProgressBar.mp3"; public const string FolderNameSongs = "Songs"; public const string FolderNameProfiles = "Profiles"; diff --git a/Vocaluxe/Base/CSound.cs b/Vocaluxe/Base/CSound.cs index de503060..9b14fb1f 100644 --- a/Vocaluxe/Base/CSound.cs +++ b/Vocaluxe/Base/CSound.cs @@ -32,7 +32,8 @@ namespace Vocaluxe.Base ApplauseLow, ApplauseMid, ApplauseHigh, - Highscore + Highscore, + ProgressBar } static class CSound @@ -202,6 +203,9 @@ namespace Vocaluxe.Base case ESounds.Highscore: file = Path.Combine(file, CSettings.FileNameSoundHighscore); break; + case ESounds.ProgressBar: + file = Path.Combine(file, CSettings.FileNameSoundProgressBar); + break; default: return -1; } diff --git a/Vocaluxe/Screens/CScreenScore.cs b/Vocaluxe/Screens/CScreenScore.cs index fcbcc6dc..236930b9 100644 --- a/Vocaluxe/Screens/CScreenScore.cs +++ b/Vocaluxe/Screens/CScreenScore.cs @@ -255,6 +255,40 @@ namespace Vocaluxe.Screens } } + private int _ProgressBarSoundStream = -1; + + private void _PlayProgressBarSound(int maxPoints) + { + // Do not play in Karaoke Mode + if (CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_KARAOKE) + return; + + // Stop any previous ProgressBar sound + if (_ProgressBarSoundStream != -1) + { + CSound.Close(_ProgressBarSoundStream); + _ProgressBarSoundStream = -1; + } + + // Calculate duration: 10,000 points = 5 seconds + double duration = Math.Min(maxPoints / 10000.0, 1.0) * 5; + + // Play the sound + _ProgressBarSoundStream = PlaySound(ESounds.ProgressBar, CConfig.GameMusicVolume); + + // Schedule stop after duration and start Applause sound + Task.Run(async () => + { + await Task.Delay((int)(duration * 1000)); + if (_ProgressBarSoundStream != -1) + { + CSound.Close(_ProgressBarSoundStream); + _ProgressBarSoundStream = -1; + _PlayApplauseSound(maxPoints); + } + }); + } + private int _ApplauseStream = -1; private void _PlayApplauseSound(int maxPoints) @@ -304,7 +338,8 @@ namespace Vocaluxe.Screens players = _Points.GetPlayer(_Round, CGame.NumPlayers); int maxPoints = (int)Math.Round(players.Max(player => player.Points)); - _PlayApplauseSound(maxPoints); + _PlayProgressBarSound(maxPoints); + } else { @@ -323,7 +358,7 @@ namespace Vocaluxe.Screens players[p].Points = (int)Math.Round(players[p].Points / CGame.NumRounds); int maxPoints = (int)Math.Round(players.Max(player => player.Points)); - _PlayApplauseSound(maxPoints); + _PlayProgressBarSound(maxPoints); } for (int p = 0; p < players.Length; p++) @@ -432,6 +467,12 @@ namespace Vocaluxe.Screens CSound.Close(_ApplauseStream); _ApplauseStream = -1; } + + if (_ProgressBarSoundStream != -1) + { + CSound.Close(_ProgressBarSoundStream); + _ProgressBarSoundStream = -1; + } if (CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_KARAOKE) { diff --git a/VocaluxeLib/Menu/CProgressBar.cs b/VocaluxeLib/Menu/CProgressBar.cs index 22968f74..b95826b3 100644 --- a/VocaluxeLib/Menu/CProgressBar.cs +++ b/VocaluxeLib/Menu/CProgressBar.cs @@ -215,7 +215,15 @@ namespace VocaluxeLib.Menu { _Animate = animateInit; + // Reset progress values to the current target + _ProgressCurrent = 0f; + _ProgressLast = 0f; + _ProgressTarget = 0f; + _ProgressColors[0].Color.Get(_PartyModeID, out _ColorProgressLast); + + _AnimTimer.Reset(); + _AnimDuration = 0f; } public void Draw() @@ -343,9 +351,9 @@ namespace VocaluxeLib.Menu _AnimTimer.Restart(); //Calc animation duration in ms based on rect size and progress change if (_Direction == EDirection.Left || _Direction == EDirection.Right) - _AnimDuration = Math.Max(100f, (Rect.W * 0.015f * 1000) * Math.Abs(_ProgressTarget - _ProgressCurrent)); + _AnimDuration = Math.Max(100f, (Rect.W * 0.015f * 1000) * Math.Abs(_ProgressTarget - _ProgressCurrent) * 0.6f); else - _AnimDuration = Math.Max(100f, (Rect.H * 0.015f * 1000) * Math.Abs(_ProgressTarget - _ProgressCurrent)); + _AnimDuration = Math.Max(100f, (Rect.H * 0.015f * 1000) * Math.Abs(_ProgressTarget - _ProgressCurrent) * 0.6f); } } //Movement animation