Elevating sound for Progress Bar on Score screen (#772)
* Speed Fix * Add Elevating Sound * Add Elevating Sound * Add Elevating Sound * Add Elevating Sound * Add Elevating Sound * Add Elevating Sound * Add Elevating Sound * Update Applause Sound * Update Applause Sound * Update Applause Sound * Update Applause Sound * Add Elevating Sound * Add Elevating Sound * Add Elevating Sound * Speed Fix * Add Elevating Sound --------- Co-authored-by: Florian Ostertag <flokuep@users.noreply.github.com>
This commit is contained in:
1 parent
b971e3ba7e
commit
f6e56f70b9
9 files changed
+61
-5
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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/
|
||||
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user