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
@@ -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)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user