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:
1 parent
f6e56f70b9
commit
e9564b3cba
7 files changed
+99
-12
No files matched your search
@@ -238,6 +238,7 @@
|
||||
<string name="TR_SCREENOSOUND_BACKGROUNDMUSICSOURCE">Background-music source</string>
|
||||
<string name="TR_SCREENOSOUND_PREVIEWMUSICVOLUME">Preview-music volume</string>
|
||||
<string name="TR_SCREENOSOUND_GAMEMUSICVOLUME">Game-music volume</string>
|
||||
<string name="TR_SCREENOSOUND_SOUNDEFFECTVOLUME">Sound effect volume</string>
|
||||
<string name="TR_SCREENOSOUND_KARAOKEEFFECT">Karaoke effect</string>
|
||||
<string name="TR_SCREENOTHEME_OPTIONS">Theme Options</string>
|
||||
<string name="TR_SCREENOTHEME_THEME">Theme</string>
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
ScreenOptionsSound
|
||||
|
||||
++++++++++
|
||||
Version 5:
|
||||
|
||||
Add:
|
||||
|
||||
<SelectSlideSoundEffectVolume>
|
||||
|
||||
and text for the description
|
||||
"TR_SCREENOSOUND_SOUNDEFFECTVOLUME"
|
||||
|
||||
++++++++++
|
||||
Version 4:
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Screen xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Informations>
|
||||
<ScreenName>ScreenOptionsSound</ScreenName>
|
||||
<ScreenVersion>4</ScreenVersion>
|
||||
<ScreenVersion>5</ScreenVersion>
|
||||
</Informations>
|
||||
<Backgrounds>
|
||||
<Background Name="Background1">
|
||||
@@ -111,7 +111,7 @@
|
||||
<Font>Outline</Font>
|
||||
<Text>TR_SCREENOSOUND_GAMEMUSICVOLUME</Text>
|
||||
</Text>
|
||||
<Text Name="TextKaraokeEffect">
|
||||
<Text Name="TextSoundEffectVolume">
|
||||
<X>112.5</X>
|
||||
<Y>610.5</Y>
|
||||
<Z>0</Z>
|
||||
@@ -123,6 +123,20 @@
|
||||
<ResizeAlign>Center</ResizeAlign>
|
||||
<Style>Bold</Style>
|
||||
<Font>Outline</Font>
|
||||
<Text>TR_SCREENOSOUND_SOUNDEFFECTVOLUME</Text>
|
||||
</Text>
|
||||
<Text Name="TextKaraokeEffect">
|
||||
<X>112.5</X>
|
||||
<Y>700.5</Y>
|
||||
<Z>0</Z>
|
||||
<H>40.5</H>
|
||||
<MaxW>0</MaxW>
|
||||
<Color Name="TextColor" />
|
||||
<SelColor Name="TextSelColor" />
|
||||
<Align>Left</Align>
|
||||
<ResizeAlign>Center</ResizeAlign>
|
||||
<Style>Bold</Style>
|
||||
<Font>Outline</Font>
|
||||
<Text>TR_SCREENOSOUND_KARAOKEEFFECT</Text>
|
||||
</Text>
|
||||
</Texts>
|
||||
@@ -376,7 +390,7 @@
|
||||
<TextStyle>Bold</TextStyle>
|
||||
<NumVisible>3</NumVisible>
|
||||
</SelectSlide>
|
||||
<SelectSlide Name="SelectSlideKaraokeEffect">
|
||||
<SelectSlide Name="SelectSlideSoundEffectVolume">
|
||||
<Skin />
|
||||
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
|
||||
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
|
||||
@@ -418,6 +432,48 @@
|
||||
<TextStyle>Bold</TextStyle>
|
||||
<NumVisible>3</NumVisible>
|
||||
</SelectSlide>
|
||||
<SelectSlide Name="SelectSlideKaraokeEffect">
|
||||
<Skin />
|
||||
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
|
||||
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
|
||||
<SkinSelected>SelectSlide</SkinSelected>
|
||||
<SkinArrowLeftSelected>SelectSlideArrowLeft</SkinArrowLeftSelected>
|
||||
<SkinArrowRightSelected>SelectSlideArrowRight</SkinArrowRightSelected>
|
||||
<Rect>
|
||||
<X>750</X>
|
||||
<Y>690</Y>
|
||||
<W>1072.5</W>
|
||||
<H>75</H>
|
||||
<Z>0</Z>
|
||||
</Rect>
|
||||
<RectArrowLeft>
|
||||
<X>757.5</X>
|
||||
<Y>697.5</Y>
|
||||
<W>60</W>
|
||||
<H>60</H>
|
||||
<Z>0</Z>
|
||||
</RectArrowLeft>
|
||||
<RectArrowRight>
|
||||
<X>1755</X>
|
||||
<Y>697.5</Y>
|
||||
<W>60</W>
|
||||
<H>60</H>
|
||||
<Z>0</Z>
|
||||
</RectArrowRight>
|
||||
<Color Name="SelectSlideColor" />
|
||||
<SelColor Name="SelectSlideSelColor" />
|
||||
<ArrowColor Name="ArrowColor" />
|
||||
<ArrowSelColor Name="ArrowSelColor" />
|
||||
<TextColor Name="TextColorAlpha" />
|
||||
<TextSelColor Name="TextSelColor" />
|
||||
<TextH>40.5</TextH>
|
||||
<TextRelativeX>75</TextRelativeX>
|
||||
<TextRelativeY>0</TextRelativeY>
|
||||
<TextMaxW>750</TextMaxW>
|
||||
<TextFont>Outline</TextFont>
|
||||
<TextStyle>Bold</TextStyle>
|
||||
<NumVisible>3</NumVisible>
|
||||
</SelectSlide>
|
||||
</SelectSlides>
|
||||
<SingNotes />
|
||||
<NameSelections />
|
||||
|
||||
@@ -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":
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user