Volume control for sound effects (#773)

* Add SoundEffectVolume

* Add SoundEffectVolume

* Add SoundEffectVolume

* Add SoundEffectVolume

* Add SoundEffectVolume

* Add SoundEffectVolume

* Add SoundEffectVolume

* Add SoundEffectVolume

* Add SoundEffectVolume

* Add SoundEffectVolume

* Add SoundEffectVolume

* Add SoundEffectVolume

* Add SoundEffectVolume
This commit is contained in:
Edi316 authored and GitHub committed 2025-04-22 16:55:39 +02:00
1 parent f6e56f70b9
commit e9564b3cba
7 files changed
+99 -12

No files matched your search

+15 -1
View File
@@ -1,4 +1,4 @@
#region license
#region license
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
@@ -151,6 +151,8 @@ namespace Vocaluxe.Base
public int PreviewMusicVolume;
[XmlRanged(0, 100), DefaultValue(80)]
public int GameMusicVolume;
[XmlRanged(0, 100), DefaultValue(80)]
public int SoundEffectVolume;
[DefaultValue(EOffOn.TR_CONFIG_OFF)]
public EOffOn KaraokeEffect;
[XmlRanged(0, 1), DefaultValue(1.0f)]
@@ -326,6 +328,16 @@ namespace Vocaluxe.Base
}
}
public static int SoundEffectVolume
{
get { return Config.Sound.SoundEffectVolume; }
set
{
Config.Sound.SoundEffectVolume = value.Clamp(0, 100);
SaveConfig();
}
}
public static int PreviewMusicVolume
{
get { return Config.Sound.PreviewMusicVolume; }
@@ -497,6 +509,8 @@ namespace Vocaluxe.Base
return "Preview Volume from 0 to 100";
case "GameMusicVolume":
return "Game Volume from 0 to 100";
case "SoundEffectVolume":
return "Sound Effect Volume from 0 to 100";
case "KaraokeEffect":
return "Apply a karaoke effect to song playback (EPlaybackLib.GstreamerSharp only)";
case "KaraokeEffectLevel":
+1 -1
View File
@@ -199,7 +199,7 @@ namespace Vocaluxe.Screens
if (_ParticleEffects[_ParticleEffectNew[p]].Visible && !_HasPlayedSound)
{
_HighscoreStream = CScreenHighscore.PlaySound(ESounds.Highscore, CConfig.GameMusicVolume);
_HighscoreStream = CScreenHighscore.PlaySound(ESounds.Highscore, CConfig.SoundEffectVolume);
_HasPlayedSound = true;
}
}
+9 -3
View File
@@ -27,7 +27,7 @@ namespace Vocaluxe.Screens
// Version number for theme files. Increment it, if you've changed something on the theme files!
protected override int _ScreenVersion
{
get { return 4; }
get { return 5; }
}
private const string _SelectSlideBackgroundMusic = "SelectSlideBackgroundMusic";
@@ -35,6 +35,7 @@ namespace Vocaluxe.Screens
private const string _SelectSlideBackgroundMusicSource = "SelectSlideBackgroundMusicSource";
private const string _SelectSlidePreviewMusicVolume = "SelectSlidePreviewMusicVolume";
private const string _SelectSlideGameMusicVolume = "SelectSlideGameMusicVolume";
private const string _SelectSlideSoundEffectVolume = "SelectSlideSoundEffectVolume";
private const string _SelectSlideKaraokeEffect = "SelectSlideKaraokeEffect";
private const string _ButtonExit = "ButtonExit";
@@ -47,7 +48,7 @@ namespace Vocaluxe.Screens
_ThemeButtons = new string[] {_ButtonExit};
_ThemeSelectSlides = new string[]
{_SelectSlideBackgroundMusic, _SelectSlideBackgroundMusicVolume, _SelectSlideBackgroundMusicSource, _SelectSlidePreviewMusicVolume, _SelectSlideGameMusicVolume, _SelectSlideKaraokeEffect};
{_SelectSlideBackgroundMusic, _SelectSlideBackgroundMusicVolume, _SelectSlideBackgroundMusicSource, _SelectSlidePreviewMusicVolume, _SelectSlideGameMusicVolume, _SelectSlideSoundEffectVolume, _SelectSlideKaraokeEffect};
}
public override void LoadTheme(string xmlPath)
@@ -65,6 +66,9 @@ namespace Vocaluxe.Screens
_SelectSlides[_SelectSlideGameMusicVolume].AddValues(new string[]
{"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"});
_SelectSlides[_SelectSlideGameMusicVolume].Selection = CConfig.GameMusicVolume / 5;
_SelectSlides[_SelectSlideSoundEffectVolume].AddValues(new string[]
{"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"});
_SelectSlides[_SelectSlideSoundEffectVolume].Selection = CConfig.SoundEffectVolume / 5;
if (CConfig.Config.Sound.PlayBackLib == EPlaybackLib.GstreamerSharp)
{
_SelectSlides[_SelectSlideKaraokeEffect].SetValues<EOffOn>((int)CConfig.Config.Sound.KaraokeEffect);
@@ -144,12 +148,14 @@ namespace Vocaluxe.Screens
_BackgroundMusicVolume = CConfig.BackgroundMusicVolume;
_SelectSlides[_SelectSlideGameMusicVolume].Selection = CConfig.GameMusicVolume / 5;
_SelectSlides[_SelectSlideSoundEffectVolume].Selection = CConfig.SoundEffectVolume / 5;
_SelectSlides[_SelectSlidePreviewMusicVolume].Selection = CConfig.PreviewMusicVolume / 5;
}
private void _SaveConfig()
{
CConfig.GameMusicVolume = _SelectSlides[_SelectSlideGameMusicVolume].Selection * 5;
CConfig.SoundEffectVolume = _SelectSlides[_SelectSlideSoundEffectVolume].Selection * 5;
CConfig.PreviewMusicVolume = _SelectSlides[_SelectSlidePreviewMusicVolume].Selection * 5;
CConfig.Config.Sound.BackgroundMusic = (EBackgroundMusicOffOn)_SelectSlides[_SelectSlideBackgroundMusic].Selection;
CConfig.Config.Sound.BackgroundMusicSource = (EBackgroundMusicSource)_SelectSlides[_SelectSlideBackgroundMusicSource].Selection;
@@ -168,4 +174,4 @@ namespace Vocaluxe.Screens
CBackgroundMusic.Stop();
}
}
}
}
+4 -4
View File
@@ -274,7 +274,7 @@ namespace Vocaluxe.Screens
double duration = Math.Min(maxPoints / 10000.0, 1.0) * 5;
// Play the sound
_ProgressBarSoundStream = PlaySound(ESounds.ProgressBar, CConfig.GameMusicVolume);
_ProgressBarSoundStream = PlaySound(ESounds.ProgressBar, CConfig.SoundEffectVolume);
// Schedule stop after duration and start Applause sound
Task.Run(async () =>
@@ -302,15 +302,15 @@ namespace Vocaluxe.Screens
// Play the appropriate applause sound based on maxPoints
if (maxPoints >= 8000)
{
_ApplauseStream = PlaySound(ESounds.ApplauseHigh, CConfig.GameMusicVolume);
_ApplauseStream = PlaySound(ESounds.ApplauseHigh, CConfig.SoundEffectVolume);
}
else if (maxPoints >= 5000)
{
_ApplauseStream = PlaySound(ESounds.ApplauseMid, CConfig.GameMusicVolume);
_ApplauseStream = PlaySound(ESounds.ApplauseMid, CConfig.SoundEffectVolume);
}
else if (maxPoints >= 2000)
{
_ApplauseStream = PlaySound(ESounds.ApplauseLow, CConfig.GameMusicVolume);
_ApplauseStream = PlaySound(ESounds.ApplauseLow, CConfig.SoundEffectVolume);
}
}