Applause & Highscore Sound (#727)

* Add Rating & Applause Sounds

* Add Rating & Applause Sounds

* Add Rating & Applause Sounds

* Add Highscore Sound

* Add Highscore Sound

* Add Highscore Sound

* Add Highscore Sound

* Add Highscore Sound

* Delete Soundfile for better version

* Add Rating & Applause Sounds

* Add Rating & Applause Sounds

* Add Highscore Sound

* Add Highscore Sound

* Add Highscore Sound

* Add Highscore Sound

* Add Highscore Sound

* Add Rating & Applause Sounds

* Add Highscore Sound

* Add Highscore Sound

* Remove Rating Bar Sound (not working reliable)

* Remove Rating Bar Sound (not working reliable)

* Remove Rating Bar Sound (not working reliable)

* Remove Rating Bar Sound (not working reliable)

* Remove Rating Bar Sound (not working reliable)

* Update CScreenHighscore.cs

* Update CScreenScore.cs

* Update CScreenScore.cs

* Update CScreenHighscore.cs

* Update CScreenHighscore.cs

* Update CScreenScore.cs

* Update CScreenScore.cs

* Update Sounds

* Update Sounds

* Update Sounds

* Update Sounds

* Update Sounds

* Update CScreenScore.cs

* Update CScreenHighscore.cs

* Update CScreenHighscore.cs
This commit is contained in:
GRaff844 authored and GitHub committed 2024-11-18 11:45:42 +01:00
1 parent 4b253c2c8d
commit 9d8e20ef46
11 files changed
+113 -4

No files matched your search

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
IDList=
URL=https://www.pixabay.com/service/license-summary/
@@ -0,0 +1,5 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
IDList=
URL=https://www.pixabay.com/service/terms/
+12
View File
@@ -0,0 +1,12 @@
-----
APPLAUSE SOUNDS
HIGHSCORE SOUND
-----
for free without attribution (check pixabay content license)
enjoy
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/
+4
View File
@@ -120,6 +120,10 @@ namespace Vocaluxe.Base
public const string FileNameRequiredSkinElements = "RequiredSkinElements.xml"; public const string FileNameRequiredSkinElements = "RequiredSkinElements.xml";
public const string FileNameSoundT440 = "440Hz.mp3"; public const string FileNameSoundT440 = "440Hz.mp3";
public const string FileNameSoundApplauseLow = "ApplauseLow.mp3";
public const string FileNameSoundApplauseMid = "ApplauseMid.mp3";
public const string FileNameSoundApplauseHigh = "ApplauseHigh.mp3";
public const string FileNameSoundHighscore = "Highscore.mp3";
public const string FolderNameSongs = "Songs"; public const string FolderNameSongs = "Songs";
public const string FolderNameProfiles = "Profiles"; public const string FolderNameProfiles = "Profiles";
+17 -1
View File
@@ -28,7 +28,11 @@ namespace Vocaluxe.Base
{ {
enum ESounds enum ESounds
{ {
T440 T440,
ApplauseLow,
ApplauseMid,
ApplauseHigh,
Highscore
} }
static class CSound static class CSound
@@ -186,6 +190,18 @@ namespace Vocaluxe.Base
case ESounds.T440: case ESounds.T440:
file = Path.Combine(file, CSettings.FileNameSoundT440); file = Path.Combine(file, CSettings.FileNameSoundT440);
break; break;
case ESounds.ApplauseLow:
file = Path.Combine(file, CSettings.FileNameSoundApplauseLow);
break;
case ESounds.ApplauseMid:
file = Path.Combine(file, CSettings.FileNameSoundApplauseMid);
break;
case ESounds.ApplauseHigh:
file = Path.Combine(file, CSettings.FileNameSoundApplauseHigh);
break;
case ESounds.Highscore:
file = Path.Combine(file, CSettings.FileNameSoundHighscore);
break;
default: default:
return -1; return -1;
} }
+27 -2
View File
@@ -1,4 +1,4 @@
#region license #region license
// This file is part of Vocaluxe. // This file is part of Vocaluxe.
// //
// Vocaluxe is free software: you can redistribute it and/or modify // Vocaluxe is free software: you can redistribute it and/or modify
@@ -24,6 +24,7 @@ using VocaluxeLib;
using VocaluxeLib.Game; using VocaluxeLib.Game;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
using Vocaluxe.Lib.Sound;
namespace Vocaluxe.Screens namespace Vocaluxe.Screens
{ {
@@ -56,6 +57,17 @@ namespace Vocaluxe.Screens
get { return EMusicType.BackgroundPreview; } get { return EMusicType.BackgroundPreview; }
} }
private int _HighscoreStream = -1;
private bool _HasPlayedSound = false;
private static int PlaySound(ESounds sound, int volume)
{
int streamId = CSound.PlaySound(sound, false);
CSound.SetStreamVolume(streamId, volume);
return streamId;
}
public override void Init() public override void Init()
{ {
base.Init(); base.Init();
@@ -184,7 +196,13 @@ namespace Vocaluxe.Screens
_Texts[_TextDate[p]].Text = _Scores[_Round][_Pos + p].Date; _Texts[_TextDate[p]].Text = _Scores[_Round][_Pos + p].Date;
_ParticleEffects[_ParticleEffectNew[p]].Visible = _IsNewEntry(_Scores[_Round][_Pos + p].ID); _ParticleEffects[_ParticleEffectNew[p]].Visible = _IsNewEntry(_Scores[_Round][_Pos + p].ID);
}
if (_ParticleEffects[_ParticleEffectNew[p]].Visible && !_HasPlayedSound)
{
_HighscoreStream = CScreenHighscore.PlaySound(ESounds.Highscore, CConfig.GameMusicVolume);
_HasPlayedSound = true;
}
}
else else
{ {
_Texts[_TextNumber[p]].Visible = false; _Texts[_TextNumber[p]].Visible = false;
@@ -200,6 +218,7 @@ namespace Vocaluxe.Screens
public override void OnShow() public override void OnShow()
{ {
base.OnShow(); base.OnShow();
_HasPlayedSound = false;
_Round = 0; _Round = 0;
_Pos = 0; _Pos = 0;
_NewEntryIDs.Clear(); _NewEntryIDs.Clear();
@@ -348,6 +367,12 @@ namespace Vocaluxe.Screens
private void _LeaveScreen() private void _LeaveScreen()
{ {
if (_HighscoreStream != -1)
{
CSound.Close(_HighscoreStream);
_HighscoreStream = -1;
}
CParty.LeavingHighscore(); CParty.LeavingHighscore();
} }
} }
+43 -1
View File
@@ -1,4 +1,4 @@
#region license #region license
// This file is part of Vocaluxe. // This file is part of Vocaluxe.
// //
// Vocaluxe is free software: you can redistribute it and/or modify // Vocaluxe is free software: you can redistribute it and/or modify
@@ -19,12 +19,15 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Windows.Forms; using System.Windows.Forms;
using System.Linq;
using System.Threading.Tasks;
using Vocaluxe.Base; using Vocaluxe.Base;
using Vocaluxe.Base.Server; using Vocaluxe.Base.Server;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Game; using VocaluxeLib.Game;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
using Vocaluxe.Lib.Sound;
namespace Vocaluxe.Screens namespace Vocaluxe.Screens
{ {
@@ -250,6 +253,33 @@ namespace Vocaluxe.Screens
} }
} }
private int _ApplauseStream = -1;
private void _PlayApplauseSound(int maxPoints)
{
// Play the appropriate applause sound based on maxPoints
if (maxPoints >= 8000)
{
_ApplauseStream = PlaySound(ESounds.ApplauseHigh, CConfig.GameMusicVolume);
}
else if (maxPoints >= 5000)
{
_ApplauseStream = PlaySound(ESounds.ApplauseMid, CConfig.GameMusicVolume);
}
else if (maxPoints >= 2000)
{
_ApplauseStream = PlaySound(ESounds.ApplauseLow, CConfig.GameMusicVolume);
}
}
private static int PlaySound(ESounds sound, int volume)
{
int streamId = CSound.PlaySound(sound, false);
CSound.SetStreamVolume(streamId, volume);
return streamId;
}
private void _UpdateRatings() private void _UpdateRatings()
{ {
CSong song = null; CSong song = null;
@@ -264,6 +294,9 @@ namespace Vocaluxe.Screens
if (_Points.NumRounds > 1) if (_Points.NumRounds > 1)
_Texts[_TextSong].Text += " (" + (_Round + 1) + "/" + _Points.NumRounds + ")"; _Texts[_TextSong].Text += " (" + (_Round + 1) + "/" + _Points.NumRounds + ")";
players = _Points.GetPlayer(_Round, CGame.NumPlayers); players = _Points.GetPlayer(_Round, CGame.NumPlayers);
int maxPoints = (int)Math.Round(players.Max(player => player.Points));
_PlayApplauseSound(maxPoints);
} }
else else
{ {
@@ -280,6 +313,9 @@ namespace Vocaluxe.Screens
} }
for (int p = 0; p < players.Length; p++) for (int p = 0; p < players.Length; p++)
players[p].Points = (int)Math.Round(players[p].Points / CGame.NumRounds); players[p].Points = (int)Math.Round(players[p].Points / CGame.NumRounds);
int maxPoints = (int)Math.Round(players.Max(player => player.Points));
_PlayApplauseSound(maxPoints);
} }
for (int p = 0; p < players.Length; p++) for (int p = 0; p < players.Length; p++)
@@ -379,6 +415,12 @@ namespace Vocaluxe.Screens
private void _LeaveScreen() private void _LeaveScreen()
{ {
if (_ApplauseStream != -1)
{
CSound.Close(_ApplauseStream);
_ApplauseStream = -1;
}
CParty.LeavingScore(); CParty.LeavingScore();
} }
} }