diff --git a/Output/Sounds/Highscore.mp3 b/Output/Sounds/Highscore.mp3 index 20991525..2cf83d0c 100644 Binary files a/Output/Sounds/Highscore.mp3 and b/Output/Sounds/Highscore.mp3 differ diff --git a/Output/Sounds/ProgressBar.mp3 b/Output/Sounds/ProgressBar.mp3 index cf9b0a7f..9a49aa31 100644 Binary files a/Output/Sounds/ProgressBar.mp3 and b/Output/Sounds/ProgressBar.mp3 differ diff --git a/Output/Sounds/Warning.mp3 b/Output/Sounds/Warning.mp3 new file mode 100644 index 00000000..a629c440 Binary files /dev/null and b/Output/Sounds/Warning.mp3 differ diff --git a/Output/Sounds/_readme.txt b/Output/Sounds/_readme.txt index 80166db5..01726ed2 100644 --- a/Output/Sounds/_readme.txt +++ b/Output/Sounds/_readme.txt @@ -2,6 +2,7 @@ APPLAUSE SOUNDS HIGHSCORE SOUND ELEVATING SOUND +WARNING SOUND ----- for free without attribution (check pixabay content license) enjoy @@ -10,5 +11,6 @@ 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/ -https://pixabay.com/sound-effects/stuttering-climax-31002/ +https://pixabay.com/sound-effects/film-special-effects-arcade-ui-6-229503/ +https://pixabay.com/sound-effects/film-special-effects-047747-high-score-fill-75680/ +https://pixabay.com/sound-effects/film-special-effects-error-call-to-attention-129258/ diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index 0000ed4e..d1bbd5fa 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -126,6 +126,7 @@ namespace Vocaluxe.Base public const string FileNameSoundApplauseHigh = "ApplauseHigh.mp3"; public const string FileNameSoundHighscore = "Highscore.mp3"; public const string FileNameSoundProgressBar = "ProgressBar.mp3"; + public const string FileNameSoundWarning = "Warning.mp3"; public const string FolderNameSongs = "Songs"; public const string FolderNameProfiles = "Profiles"; diff --git a/Vocaluxe/Base/CSound.cs b/Vocaluxe/Base/CSound.cs index 9b14fb1f..391f6292 100644 --- a/Vocaluxe/Base/CSound.cs +++ b/Vocaluxe/Base/CSound.cs @@ -33,7 +33,8 @@ namespace Vocaluxe.Base ApplauseMid, ApplauseHigh, Highscore, - ProgressBar + ProgressBar, + Warning } static class CSound @@ -206,6 +207,9 @@ namespace Vocaluxe.Base case ESounds.ProgressBar: file = Path.Combine(file, CSettings.FileNameSoundProgressBar); break; + case ESounds.Warning: + file = Path.Combine(file, CSettings.FileNameSoundWarning); + break; default: return -1; } diff --git a/Vocaluxe/Screens/CScreenHighscore.cs b/Vocaluxe/Screens/CScreenHighscore.cs index ba49b477..d238a016 100644 --- a/Vocaluxe/Screens/CScreenHighscore.cs +++ b/Vocaluxe/Screens/CScreenHighscore.cs @@ -58,7 +58,7 @@ namespace Vocaluxe.Screens } private int _HighscoreStream = -1; - private bool _HasPlayedSound = false; + private bool _HasPlayedHighscoreSound = false; private static int PlaySound(ESounds sound, int volume) { @@ -197,10 +197,10 @@ namespace Vocaluxe.Screens _ParticleEffects[_ParticleEffectNew[p]].Visible = _IsNewEntry(_Scores[_Round][_Pos + p].ID); - if (_ParticleEffects[_ParticleEffectNew[p]].Visible && !_HasPlayedSound) + if (_ParticleEffects[_ParticleEffectNew[p]].Visible && !_HasPlayedHighscoreSound) { _HighscoreStream = CScreenHighscore.PlaySound(ESounds.Highscore, CConfig.SoundEffectVolume); - _HasPlayedSound = true; + _HasPlayedHighscoreSound = true; } } else @@ -218,7 +218,7 @@ namespace Vocaluxe.Screens public override void OnShow() { base.OnShow(); - _HasPlayedSound = false; + _HasPlayedHighscoreSound = false; _Round = 0; _Pos = 0; _NewEntryIDs.Clear(); diff --git a/Vocaluxe/Screens/CScreenMain.cs b/Vocaluxe/Screens/CScreenMain.cs index e1f2a424..1461eabd 100644 --- a/Vocaluxe/Screens/CScreenMain.cs +++ b/Vocaluxe/Screens/CScreenMain.cs @@ -19,6 +19,7 @@ using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib; using VocaluxeLib.Menu; +using Vocaluxe.Lib.Sound; namespace Vocaluxe.Screens { @@ -39,6 +40,17 @@ namespace Vocaluxe.Screens private const string _TextWarningProfiles = "TextWarningProfiles"; private const string _TextRelease = "TextRelease"; + private int _WarningStream = -1; + private bool _HasPlayedWarningSound = false; + + private static int PlaySound(ESounds sound, int volume) + { + int streamId = CSound.PlaySound(sound, false); + CSound.SetStreamVolume(streamId, volume); + + return streamId; + } + //CParticleEffect Snowflakes; public override void Init() { @@ -71,19 +83,23 @@ namespace Vocaluxe.Screens { case Keys.O: CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); break; case Keys.S: if (CProfiles.NumProfiles > 0) CGraphics.FadeTo(EScreen.Song); + _LeaveScreen(); break; case Keys.C: CGraphics.FadeTo(EScreen.Credits); + _LeaveScreen(); break; case Keys.T: CGraphics.FadeTo(EScreen.Test); + _LeaveScreen(); break; case Keys.Enter: @@ -91,16 +107,26 @@ namespace Vocaluxe.Screens { CParty.SetNormalGameMode(); CGraphics.FadeTo(EScreen.Song); + _LeaveScreen(); } if (_Buttons[_ButtonParty].Selected) + { CGraphics.FadeTo(EScreen.Party); + _LeaveScreen(); + } if (_Buttons[_ButtonOptions].Selected) + { CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); + } if (_Buttons[_ButtonProfiles].Selected) + { CGraphics.FadeTo(EScreen.Profiles); + _LeaveScreen(); + } if (_Buttons[_ButtonExit].Selected) return false; @@ -125,16 +151,26 @@ namespace Vocaluxe.Screens { CParty.SetNormalGameMode(); CGraphics.FadeTo(EScreen.Song); + _LeaveScreen(); } if (_Buttons[_ButtonParty].Selected) + { CGraphics.FadeTo(EScreen.Party); + _LeaveScreen(); + } if (_Buttons[_ButtonOptions].Selected) + { CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); + } if (_Buttons[_ButtonProfiles].Selected) + { CGraphics.FadeTo(EScreen.Profiles); + _LeaveScreen(); + } if (_Buttons[_ButtonExit].Selected) return false; @@ -150,7 +186,22 @@ namespace Vocaluxe.Screens _Texts[_TextWarningProfiles].Visible = !profileOK; _Buttons[_ButtonSing].Selectable = profileOK; _Buttons[_ButtonParty].Selectable = profileOK; + + if (_Texts[_TextWarningProfiles].Visible && !_HasPlayedWarningSound) + { + _WarningStream = CScreenMain.PlaySound(ESounds.Warning, CConfig.SoundEffectVolume); + _HasPlayedWarningSound = true; + } return true; } + + private void _LeaveScreen() + { + if (_WarningStream != -1) + { + CSound.Close(_WarningStream); + _WarningStream = -1; + } + } } -} \ No newline at end of file +} diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index 3dd334a9..34746d04 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -24,6 +24,7 @@ using VocaluxeLib.Draw; using VocaluxeLib.Menu; using VocaluxeLib.Songs; using VocaluxeLib.Profile; +using Vocaluxe.Lib.Sound; namespace Vocaluxe.Screens { @@ -70,6 +71,17 @@ namespace Vocaluxe.Screens get { return EMusicType.BackgroundPreview; } } + private int _WarningStream = -1; + private bool _HasPlayedWarningSound = false; + + private static int PlaySound(ESounds sound, int volume) + { + int streamId = CSound.PlaySound(sound, false); + CSound.SetStreamVolume(streamId, volume); + + return streamId; + } + #region public methods public override void Init() { @@ -286,15 +298,21 @@ namespace Vocaluxe.Screens case Keys.Escape: case Keys.Back: CGraphics.FadeTo(EScreen.Song); + _LeaveScreen(); break; case Keys.Enter: if (_Buttons[_ButtonBack].Selected) + { CGraphics.FadeTo(EScreen.Song); + _LeaveScreen(); + } else if (_Buttons[_ButtonStart].Selected) + { _StartSong(); - + _LeaveScreen(); + } break; case Keys.D1: @@ -469,9 +487,15 @@ namespace Vocaluxe.Screens else if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { if (_Buttons[_ButtonBack].Selected) + { CGraphics.FadeTo(EScreen.Song); + _LeaveScreen(); + } else if (_Buttons[_ButtonStart].Selected) + { _StartSong(); + _LeaveScreen(); + } else _UpdatePlayerNumber(); //Update Tiles-List @@ -512,7 +536,10 @@ namespace Vocaluxe.Screens } } if (exit) + { CGraphics.FadeTo(EScreen.Song); + _LeaveScreen(); + } } if (mouseEvent.MB && _SelectingFast) @@ -562,6 +589,13 @@ namespace Vocaluxe.Screens CRecord.AnalyzeBuffer(i - 1); _Equalizers["EqualizerPlayer" + i].Update(CRecord.ToneWeigth(i - 1), CRecord.GetMaxVolume(i - 1)); } + + if ((_Texts[_TextWarningMics].Visible || _Texts[_TextWarningProfiles].Visible) && !_HasPlayedWarningSound) + { + _WarningStream = CScreenNames.PlaySound(ESounds.Warning, CConfig.SoundEffectVolume); + _HasPlayedWarningSound = true; + } + return true; } @@ -803,6 +837,15 @@ namespace Vocaluxe.Screens _Texts[_TextWarningProfiles].Visible = false; } } + + private void _LeaveScreen() + { + if (_WarningStream != -1) + { + CSound.Close(_WarningStream); + _WarningStream = -1; + } + } #endregion private methods } -} \ No newline at end of file +} diff --git a/Vocaluxe/Screens/CScreenOptionsGame.cs b/Vocaluxe/Screens/CScreenOptionsGame.cs index a7b5132c..0fac7e72 100644 --- a/Vocaluxe/Screens/CScreenOptionsGame.cs +++ b/Vocaluxe/Screens/CScreenOptionsGame.cs @@ -21,6 +21,7 @@ using System.Collections.Generic; using Vocaluxe.Base; using VocaluxeLib; using VocaluxeLib.Menu; +using Vocaluxe.Lib.Sound; namespace Vocaluxe.Screens { @@ -48,6 +49,17 @@ namespace Vocaluxe.Screens private const string _TextWarningRestart = "TextWarningRestart"; private const string _StaticWarningRestart = "StaticWarningRestart"; + private int _WarningStream = -1; + private bool _HasPlayedWarningSound = 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() { base.Init(); @@ -89,12 +101,14 @@ namespace Vocaluxe.Screens case Keys.Back: _SaveConfig(); CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); break; case Keys.S: CParty.SetNormalGameMode(); _SaveConfig(); CGraphics.FadeTo(EScreen.Song); + _LeaveScreen(); break; case Keys.Enter: @@ -102,6 +116,7 @@ namespace Vocaluxe.Screens { _SaveConfig(); CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); } else if (_Buttons[_ButtonServer].Selected) { @@ -134,6 +149,7 @@ namespace Vocaluxe.Screens { _SaveConfig(); CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); } if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) @@ -142,6 +158,7 @@ namespace Vocaluxe.Screens { CGraphics.FadeTo(EScreen.Options); _SaveConfig(); + _LeaveScreen(); } else if (_Buttons[_ButtonServer].Selected) { @@ -158,6 +175,12 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { + if (_Texts[_TextWarningRestart].Visible && !_HasPlayedWarningSound) + { + _WarningStream = CScreenOptionsGame.PlaySound(ESounds.Warning, CConfig.SoundEffectVolume); + _HasPlayedWarningSound = true; + } + return true; } @@ -200,5 +223,14 @@ namespace Vocaluxe.Screens CSongs.Sorter.SongSorting = CConfig.Config.Game.SongSorting; CSongs.Categorizer.Tabs = CConfig.Config.Game.Tabs; } + + private void _LeaveScreen() + { + if (_WarningStream != -1) + { + CSound.Close(_WarningStream); + _WarningStream = -1; + } + } } } diff --git a/Vocaluxe/Screens/CScreenOptionsLyrics.cs b/Vocaluxe/Screens/CScreenOptionsLyrics.cs index 0eaac477..27e259b5 100644 --- a/Vocaluxe/Screens/CScreenOptionsLyrics.cs +++ b/Vocaluxe/Screens/CScreenOptionsLyrics.cs @@ -21,6 +21,7 @@ using System.IO; using Vocaluxe.Base; using VocaluxeLib; using VocaluxeLib.Menu; +using Vocaluxe.Lib.Sound; namespace Vocaluxe.Screens { @@ -43,6 +44,17 @@ namespace Vocaluxe.Screens private const string _ButtonExit = "ButtonExit"; private static readonly string[] CoverSizes = { "32", "64", "128", "256", "512", "1024" }; + private int _WarningStream = -1; + private bool _HasPlayedWarningSound = 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() { base.Init(); @@ -89,12 +101,14 @@ namespace Vocaluxe.Screens case Keys.Back: _SaveConfig(); CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); break; case Keys.S: CParty.SetNormalGameMode(); _SaveConfig(); CGraphics.FadeTo(EScreen.Song); + _LeaveScreen(); break; case Keys.Enter: @@ -102,6 +116,7 @@ namespace Vocaluxe.Screens { _SaveConfig(); CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); } break; @@ -125,18 +140,27 @@ namespace Vocaluxe.Screens { _SaveConfig(); CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); } if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { _SaveConfig(); if (_Buttons[_ButtonExit].Selected) + { CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); + } } return true; } public override bool UpdateGame() { + if (_Texts[_TextWarningRestart].Visible && !_HasPlayedWarningSound) + { + _WarningStream = CScreenOptionsLyrics.PlaySound(ESounds.Warning, CConfig.SoundEffectVolume); + _HasPlayedWarningSound = true; + } return true; } @@ -181,5 +205,14 @@ namespace Vocaluxe.Screens CConfig.SaveConfig(); } + + private void _LeaveScreen() + { + if (_WarningStream != -1) + { + CSound.Close(_WarningStream); + _WarningStream = -1; + } + } } } diff --git a/Vocaluxe/Screens/CScreenOptionsRecord.cs b/Vocaluxe/Screens/CScreenOptionsRecord.cs index bac267a9..38748c96 100644 --- a/Vocaluxe/Screens/CScreenOptionsRecord.cs +++ b/Vocaluxe/Screens/CScreenOptionsRecord.cs @@ -20,6 +20,7 @@ using System.Collections.ObjectModel; using System.Windows.Forms; using Vocaluxe.Base; using Vocaluxe.Base.ThemeSystem; +using Vocaluxe.Lib.Sound; using Vocaluxe.Lib.Sound.Record; using VocaluxeLib; using VocaluxeLib.Menu; @@ -65,6 +66,17 @@ namespace Vocaluxe.Screens get { return EMusicType.Game; } } + private int _WarningStream = -1; + private bool _HasPlayedWarningSound = 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() { base.Init(); @@ -108,12 +120,14 @@ namespace Vocaluxe.Screens case Keys.Back: _SaveMicConfig(); CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); break; case Keys.S: CParty.SetNormalGameMode(); _SaveMicConfig(); CGraphics.FadeTo(EScreen.Song); + _LeaveScreen(); break; case Keys.Enter: @@ -121,6 +135,7 @@ namespace Vocaluxe.Screens { _SaveMicConfig(); CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); } if (_Buttons[_ButtonDelayTest].Selected) @@ -152,6 +167,7 @@ namespace Vocaluxe.Screens { _SaveMicConfig(); CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); } if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) @@ -162,6 +178,7 @@ namespace Vocaluxe.Screens { _SaveMicConfig(); CGraphics.FadeTo(EScreen.Options); + _LeaveScreen(); } if (_Buttons[_ButtonDelayTest].Selected) @@ -210,6 +227,12 @@ namespace Vocaluxe.Screens _Statics[_StaticWarning].Visible = showWarning; _Texts[_TextWarning].Visible = showWarning; + if (_Texts[_TextWarning].Visible && !_HasPlayedWarningSound) + { + _WarningStream = CScreenOptionsRecord.PlaySound(ESounds.Warning, CConfig.SoundEffectVolume); + _HasPlayedWarningSound = true; + } + return true; } @@ -435,5 +458,14 @@ namespace Vocaluxe.Screens } } } + + private void _LeaveScreen() + { + if (_WarningStream != -1) + { + CSound.Close(_WarningStream); + _WarningStream = -1; + } + } } -} \ No newline at end of file +}