Skip to content

Commit d9b195b

Browse files
committed
Add speech volume control
1 parent 907baf8 commit d9b195b

14 files changed

+209
-53
lines changed

Source/Game/PerimeterDataChannel.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ int terObjectReflection = 0;
3030

3131
int terAudioEnable = 1;
3232
float terSoundVolume = 1;
33+
float terSpeechVolume = 1;
3334
float terVoiceVolume = 1;
3435
float terMusicVolume = 1;
3536

Source/Game/Runtime.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -763,13 +763,15 @@ void InitSound()
763763
int chunkSizeFactor = 12; //1056 bytes under 2 channel 22khz 16 bits
764764
terAudioEnable = true;
765765
terSoundVolume = 0.75f;
766+
terSpeechVolume = 0.75f;
766767
terVoiceVolume = 0.75f;
767-
terMusicVolume = 0.25f;
768+
terMusicVolume = 0.75f;
768769

769770
IniManager ini_no("Perimeter.ini", false);
770771
ini_no.getInt("Sound","MixChannels", mixChannels);
771772
ini_no.getInt("Sound","ChunkSize", chunkSizeFactor);
772773
ini_no.getFloat("Sound","SoundVolume", terSoundVolume);
774+
ini_no.getFloat("Sound","SpeechVolume", terSpeechVolume);
773775
ini_no.getFloat("Sound","VoiceVolume", terVoiceVolume);
774776
ini_no.getFloat("Sound","MusicVolume", terMusicVolume);
775777

@@ -800,6 +802,7 @@ void InitSound()
800802
snd_listener.SetZMultiple(fSoundZMultiple);
801803
} else {
802804
terMusicVolume = 0.0f;
805+
terSpeechVolume = 0.0f;
803806
terVoiceVolume = 0.0f;
804807
terSoundVolume = 0.0f;
805808
SNDEnableSound(false);
@@ -829,6 +832,7 @@ void FinitSound()
829832
IniManager ini("Perimeter.ini");
830833
ini.putFloat("Sound","SoundVolume", terSoundVolume);
831834
ini.putFloat("Sound","MusicVolume", terMusicVolume);
835+
ini.putFloat("Sound","SpeechVolume", terVoiceVolume);
832836
ini.putFloat("Sound","VoiceVolume", terVoiceVolume);
833837

834838
SNDReleaseSound();

Source/Game/Runtime.h

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ extern int terObjectReflection;
4545

4646
extern int terAudioEnable; // 0,1
4747
extern float terSoundVolume; // 0..1
48+
extern float terSpeechVolume; // 0..1
4849
extern float terVoiceVolume; // 0..1
4950
extern float terMusicVolume; // 0..1
5051

Source/Game/Scripts/InterfaceScriptExport.cppi

+101-17
Large diffs are not rendered by default.

Source/Game/Texts.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,7 @@ void qdTextDB::load_supplementary_texts(const std::string& locale) {
811811
"Interface.Menu.ButtonLabels.GUIDE=РУКОВОДСТВО",
812812
"Interface.Menu.ButtonLabels.VSYNC=ВЕРТИКАЛЬНАЯ СИНХРОНИЗАЦИЯ",
813813
"Interface.Menu.ButtonLabels.VOICE VOLUME=ГРОМКОСТЬ ГОЛОСА",
814+
"Interface.Menu.ButtonLabels.SPEECH VOLUME=ГРОМКОСТЬ ГОЛОСА БРИФИНГОВ И ЗАДАНИЙ",
814815
"Interface.Menu.ComboItems.Centered=По центру",
815816
"Interface.Menu.ComboItems.Left side=Левая сторона",
816817
"Interface.Menu.ComboItems.Right side=Правая сторона",
@@ -890,6 +891,7 @@ void qdTextDB::load_supplementary_texts(const std::string& locale) {
890891
"Interface.Menu.ButtonLabels.GUIDE=GUIDE",
891892
"Interface.Menu.ButtonLabels.VSYNC=VERTICAL SYNC",
892893
"Interface.Menu.ButtonLabels.VOICE VOLUME=VOICE VOLUME",
894+
"Interface.Menu.ButtonLabels.SPEECH VOLUME=VOICE VOLUME OF BRIEFINGS AND TASKS",
893895
"Interface.Menu.ComboItems.Centered=Centered",
894896
"Interface.Menu.ComboItems.Left side=Left side",
895897
"Interface.Menu.ComboItems.Right side=Right side",

Source/Scripts/InterfaceScriptExport.prm

+31-12
Original file line numberDiff line numberDiff line change
@@ -5334,7 +5334,7 @@ sqshControlContainer _sqsh_controls[int _sqsh_control_count] = {
53345334
controls = new sqshControl[] {
53355335
{type = SQSH_GENERAL_WND_TYPE; id = SQSH_MM_RAMKA; x=(500 - 250)/1024; y=(264 + 105 * 0)/768; sx=500/1024; sy=3/768; image={texture="resource\\icons\\MainMenu\\Main_menu.tga";_ix = 2; _iy = 987; ix = 500; iy = 3;}; state = SQSH_ENABLED; txt_dx =0.3f; },
53365336
{type = SQSH_GENERAL_WND_TYPE; id = SQSH_MM_RAMKA; x=(500 - 250)/1024; y=(264 + 105 * 1)/768; sx=500/1024; sy=3/768; image={texture="resource\\icons\\MainMenu\\Main_menu.tga";_ix = 2; _iy = 987; ix = 500; iy = 3;}; state = SQSH_ENABLED; txt_dx =0.3f; },
5337-
// {type = SQSH_GENERAL_WND_TYPE; id = SQSH_MM_RAMKA; x=(500 - 250)/1024; y=(264 + 105 * 2)/768; sx=500/1024; sy=3/768; image={texture="resource\\icons\\MainMenu\\Main_menu.tga";_ix = 2; _iy = 987; ix = 500; iy = 3;}; state = SQSH_ENABLED; txt_dx =0.3f; },
5337+
{type = SQSH_GENERAL_WND_TYPE; id = SQSH_MM_RAMKA; x=(500 - 250)/1024; y=(264 + 105 * 2)/768; sx=500/1024; sy=3/768; image={texture="resource\\icons\\MainMenu\\Main_menu.tga";_ix = 2; _iy = 987; ix = 500; iy = 3;}; state = SQSH_ENABLED; txt_dx =0.3f; },
53385338

53395339

53405340
{type = SQSH_SCALE_BUTTON_TYPE; id = SQSH_MM_RAMKA; x=171/1024; y=(180 + 105*0)/768; sx=680/1024; sy=64/768; ystart=64/768; hitTestMode = HITTEST_NONE; },
@@ -5358,8 +5358,18 @@ sqshControlContainer _sqsh_controls[int _sqsh_control_count] = {
53585358
target = SQSH_MM_SOUND_VOICEVOLUME; },
53595359

53605360
{type = SQSH_SCALE_BUTTON_TYPE; id = SQSH_MM_RAMKA; x=171/1024; y=(180 + 105*2)/768; sx=680/1024; sy=64/768; ystart=64/768; hitTestMode = HITTEST_NONE; },
5361-
{type = SQSH_PUSH_BUTTON_TYPE; id = SQSH_MM_SOUND_MUSICVOLUME; x=188/1024; y=(180 + 105*2)/768; sx=412/1024; sy=64/768; text="MUSIC VOLUME"; font_group=2; txt_dy = 16/768; txt_align = SHELL_ALIGN_LEFT; state = SQSH_ENABLED; sound = "mainmenu_button";image={texture="resource\\icons\\MainMenu\\tv.avi";dx=339/1024;dy=157/768;dsx=128/1024;dsy=128/768;hasResolutionVersion=0;};},
5362-
{type = SQSH_SLIDER_TYPE; id=SQSH_MM_SOUND_MUSICVOLUME_SLIDER; x=645/1024; y=(180 + 105*2 + 18)/768; sx=150/1024; sy=27/768; xstart=25/1024; ystart=16/1024;
5361+
{type = SQSH_PUSH_BUTTON_TYPE; id = SQSH_MM_SOUND_SPEECHVOLUME; x=188/1024; y=(180 + 105*2)/768; sx=412/1024; sy=64/768; text="SPEECH VOLUME"; font_group=2; txt_dy = 16/768; txt_align = SHELL_ALIGN_LEFT; state = SQSH_ENABLED; sound = "mainmenu_button";image={texture="resource\\icons\\MainMenu\\tv.avi";dx=339/1024;dy=157/768;dsx=128/1024;dsy=128/768;hasResolutionVersion=0;};},
5362+
{type = SQSH_SLIDER_TYPE; id=SQSH_MM_SOUND_SPEECHVOLUME_SLIDER; x=645/1024; y=(180 + 105*2 + 18)/768; sx=150/1024; sy=27/768; xstart=25/1024; ystart=16/1024;
5363+
image2={texture="resource\\icons\\MainMenu\\tv.avi";_ix = 0; _iy = 0; ix = 8; iy = 8;hasResolutionVersion=0;};
5364+
image={texture="resource\\icons\\MainMenu\\Main_menu.tga";_ix = 328;_iy = 489;ix = 150;iy = 27;};
5365+
image_disabled={texture="";_ix = 447;_iy = 456; ix = 16; iy = 27;};
5366+
image_h={texture="";_ix = 303;_iy = 493; ix = 25; iy = 23;};
5367+
image_check={texture="";_ix = 478;_iy = 493; ix = 25; iy = 23;};
5368+
target = SQSH_MM_SOUND_SPEECHVOLUME; },
5369+
5370+
{type = SQSH_SCALE_BUTTON_TYPE; id = SQSH_MM_RAMKA; x=171/1024; y=(180 + 105*3)/768; sx=680/1024; sy=64/768; ystart=64/768; hitTestMode = HITTEST_NONE; },
5371+
{type = SQSH_PUSH_BUTTON_TYPE; id = SQSH_MM_SOUND_MUSICVOLUME; x=188/1024; y=(180 + 105*3)/768; sx=412/1024; sy=64/768; text="MUSIC VOLUME"; font_group=2; txt_dy = 16/768; txt_align = SHELL_ALIGN_LEFT; state = SQSH_ENABLED; sound = "mainmenu_button";image={texture="resource\\icons\\MainMenu\\tv.avi";dx=339/1024;dy=157/768;dsx=128/1024;dsy=128/768;hasResolutionVersion=0;};},
5372+
{type = SQSH_SLIDER_TYPE; id=SQSH_MM_SOUND_MUSICVOLUME_SLIDER; x=645/1024; y=(180 + 105*3 + 18)/768; sx=150/1024; sy=27/768; xstart=25/1024; ystart=16/1024;
53635373
image2={texture="resource\\icons\\MainMenu\\tv.avi";_ix = 0; _iy = 0; ix = 8; iy = 8;hasResolutionVersion=0;};
53645374
image={texture="resource\\icons\\MainMenu\\Main_menu.tga";_ix = 328;_iy = 489;ix = 150;iy = 27;};
53655375
image_disabled={texture="";_ix = 447;_iy = 456; ix = 16; iy = 27;};
@@ -5801,27 +5811,36 @@ sqshControlContainer _sqsh_controls[int _sqsh_control_count] = {
58015811
{type = SQSH_MOVE_BUTTON_TYPE; id = SQSH_MM_RAMKA; x=60/1024; y=152/768; sx=511/1024; sy=496/768; image={texture="resource\\icons\\MainMenu\\new_menu.tga";_ix = 88; _iy = 528; ix = 511; iy = 496;}; state = SQSH_ENABLED; xstart=359; ystart=-528; },
58025812

58035813

5804-
{type = SQSH_SCALE_BUTTON_TYPE; id = SQSH_MM_RAMKA; x=191/1024; y=(225 + 70*0)/768; sx=680/1024; sy=64/768; ystart=64/768; hitTestMode = HITTEST_NONE; },
5805-
{type = SQSH_PUSH_BUTTON_TYPE; id = SQSH_MM_SOUND_SOUNDVOLUME; x=208/1024; y=(225 + 70*0)/768; sx=406/1024; sy=64/768; text="SOUND VOLUME"; font_group=2; txt_dy = 16/768; txt_align = SHELL_ALIGN_LEFT; sound = "mainmenu_button";},
5806-
{type = SQSH_SLIDER_TYPE; id = SQSH_MM_SOUND_SOUNDVOLUME_SLIDER;x=665/1024; y=(225 + 70*0 + 18)/768; sx=150/1024; sy=27/768; xstart=25/1024; ystart=16/1024;
5814+
{type = SQSH_SCALE_BUTTON_TYPE; id = SQSH_MM_RAMKA; x=191/1024; y=(225 + 70*0)/768; sx=680/1024; sy=64/768; ystart=64/768; hitTestMode = HITTEST_NONE; },
5815+
{type = SQSH_PUSH_BUTTON_TYPE; id = SQSH_MM_SOUND_SOUNDVOLUME; x=208/1024; y=(225 + 70*0)/768; sx=406/1024; sy=64/768; text="SOUND VOLUME"; font_group=2; txt_dy = 16/768; txt_align = SHELL_ALIGN_LEFT; sound = "mainmenu_button";},
5816+
{type = SQSH_SLIDER_TYPE; id = SQSH_MM_SOUND_SOUNDVOLUME_SLIDER; x=665/1024; y=(225 + 70*0 + 18)/768; sx=150/1024; sy=27/768; xstart=25/1024; ystart=16/1024;
58075817
image={texture="resource\\icons\\MainMenu\\Main_menu.tga";_ix = 328;_iy = 489;ix = 150;iy = 27;};
58085818
image_disabled={texture="";_ix = 447;_iy = 456; ix = 16; iy = 27;};
58095819
image_h={texture="";_ix = 303;_iy = 493; ix = 25; iy = 23;};
58105820
image_check={texture="";_ix = 478;_iy = 493; ix = 25; iy = 23;};
58115821
target = SQSH_MM_SOUND_SOUNDVOLUME; },
58125822

5813-
{type = SQSH_SCALE_BUTTON_TYPE; id = SQSH_MM_RAMKA; x=191/1024; y=(225 + 70*1)/768; sx=680/1024; sy=64/768; ystart=64/768; hitTestMode = HITTEST_NONE; },
5814-
{type = SQSH_PUSH_BUTTON_TYPE; id = SQSH_MM_SOUND_VOICEVOLUME; x=208/1024; y=(225 + 70*1)/768; sx=406/1024; sy=64/768; text="VOICE VOLUME"; font_group=2; txt_dy = 16/768; txt_align = SHELL_ALIGN_LEFT; sound = "mainmenu_button";},
5815-
{type = SQSH_SLIDER_TYPE; id = SQSH_MM_SOUND_VOICEVOLUME_SLIDER;x=665/1024; y=(225 + 70*1 + 18)/768; sx=150/1024; sy=27/768; xstart=25/1024; ystart=16/1024;
5823+
{type = SQSH_SCALE_BUTTON_TYPE; id = SQSH_MM_RAMKA; x=191/1024; y=(225 + 70*1)/768; sx=680/1024; sy=64/768; ystart=64/768; hitTestMode = HITTEST_NONE; },
5824+
{type = SQSH_PUSH_BUTTON_TYPE; id = SQSH_MM_SOUND_VOICEVOLUME; x=208/1024; y=(225 + 70*1)/768; sx=406/1024; sy=64/768; text="VOICE VOLUME"; font_group=2; txt_dy = 16/768; txt_align = SHELL_ALIGN_LEFT; sound = "mainmenu_button";},
5825+
{type = SQSH_SLIDER_TYPE; id = SQSH_MM_SOUND_VOICEVOLUME_SLIDER; x=665/1024; y=(225 + 70*1 + 18)/768; sx=150/1024; sy=27/768; xstart=25/1024; ystart=16/1024;
58165826
image={texture="resource\\icons\\MainMenu\\Main_menu.tga";_ix = 328;_iy = 489;ix = 150;iy = 27;};
58175827
image_disabled={texture="";_ix = 447;_iy = 456; ix = 16; iy = 27;};
58185828
image_h={texture="";_ix = 303;_iy = 493; ix = 25; iy = 23;};
58195829
image_check={texture="";_ix = 478;_iy = 493; ix = 25; iy = 23;};
58205830
target = SQSH_MM_SOUND_VOICEVOLUME; },
58215831

5822-
{type = SQSH_SCALE_BUTTON_TYPE; id = SQSH_MM_RAMKA; x=191/1024; y=(225 + 70*2)/768; sx=680/1024; sy=64/768; ystart=64/768; hitTestMode = HITTEST_NONE; },
5823-
{type = SQSH_PUSH_BUTTON_TYPE; id = SQSH_MM_SOUND_MUSICVOLUME;x=208/1024; y=(225 + 70*2)/768; sx=406/1024; sy=64/768; text="MUSIC VOLUME"; font_group=2; txt_dy = 16/768; txt_align = SHELL_ALIGN_LEFT; state = SQSH_ENABLED; sound = "mainmenu_button";},
5824-
{type = SQSH_SLIDER_TYPE; id=SQSH_MM_SOUND_MUSICVOLUME_SLIDER;x=665/1024; y=(225 + 70*2 + 18)/768; sx=150/1024; sy=27/768; xstart=25/1024; ystart=16/1024;
5832+
{type = SQSH_SCALE_BUTTON_TYPE; id = SQSH_MM_RAMKA; x=191/1024; y=(225 + 70*2)/768; sx=680/1024; sy=64/768; ystart=64/768; hitTestMode = HITTEST_NONE; },
5833+
{type = SQSH_PUSH_BUTTON_TYPE; id = SQSH_MM_SOUND_SPEECHVOLUME; x=208/1024; y=(225 + 70*2)/768; sx=406/1024; sy=64/768; text="SPEECH VOLUME"; font_group=2; txt_dy = 16/768; txt_align = SHELL_ALIGN_LEFT; sound = "mainmenu_button";},
5834+
{type = SQSH_SLIDER_TYPE; id = SQSH_MM_SOUND_SPEECHVOLUME_SLIDER;x=665/1024; y=(225 + 70*2 + 18)/768; sx=150/1024; sy=27/768; xstart=25/1024; ystart=16/1024;
5835+
image={texture="resource\\icons\\MainMenu\\Main_menu.tga";_ix = 328;_iy = 489;ix = 150;iy = 27;};
5836+
image_disabled={texture="";_ix = 447;_iy = 456; ix = 16; iy = 27;};
5837+
image_h={texture="";_ix = 303;_iy = 493; ix = 25; iy = 23;};
5838+
image_check={texture="";_ix = 478;_iy = 493; ix = 25; iy = 23;};
5839+
target = SQSH_MM_SOUND_SPEECHVOLUME; },
5840+
5841+
{type = SQSH_SCALE_BUTTON_TYPE; id = SQSH_MM_RAMKA; x=191/1024; y=(225 + 70*3)/768; sx=680/1024; sy=64/768; ystart=64/768; hitTestMode = HITTEST_NONE; },
5842+
{type = SQSH_PUSH_BUTTON_TYPE; id = SQSH_MM_SOUND_MUSICVOLUME; x=208/1024; y=(225 + 70*3)/768; sx=406/1024; sy=64/768; text="MUSIC VOLUME"; font_group=2; txt_dy = 16/768; txt_align = SHELL_ALIGN_LEFT; state = SQSH_ENABLED; sound = "mainmenu_button";},
5843+
{type = SQSH_SLIDER_TYPE; id=SQSH_MM_SOUND_MUSICVOLUME_SLIDER; x=665/1024; y=(225 + 70*3 + 18)/768; sx=150/1024; sy=27/768; xstart=25/1024; ystart=16/1024;
58255844
image={texture="resource\\icons\\MainMenu\\Main_menu.tga";_ix = 328;_iy = 489;ix = 150;iy = 27;};
58265845
image_disabled={texture="";_ix = 447;_iy = 456; ix = 16; iy = 27;};
58275846
image_h={texture="";_ix = 303;_iy = 493; ix = 25; iy = 23;};

Source/Scripts/SquadShellEnums.inl

+2
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,8 @@ enum ShellControlID
639639
SQSH_MM_SOUND_MUSICVOLUME_SLIDER,
640640
SQSH_MM_SOUND_VOICEVOLUME,
641641
SQSH_MM_SOUND_VOICEVOLUME_SLIDER,
642+
SQSH_MM_SOUND_SPEECHVOLUME,
643+
SQSH_MM_SOUND_SPEECHVOLUME_SLIDER,
642644

643645
SQSH_EMPTY_WND,
644646

Source/Sound/Sample.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ bool SND_Sample::updateEffects(int channel) {
152152
case GLOBAL_VOLUME_IGNORE:
153153
break;
154154
case GLOBAL_VOLUME_CHANNEL:
155-
global_vol = channel_group == SND_GROUP_SPEECH ? SND::voice_volume : SND::sound_volume;
155+
global_vol = channel_group == SND_GROUP_SPEECH ? 1.0f : SND::sound_volume;
156156
break;
157157
case GLOBAL_VOLUME_VOICE:
158158
global_vol = SND::voice_volume;

Source/UserInterface/HistoryScene.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ void HistoryScene::postDraw() {
542542
}
543543

544544
void HistoryScene::setupAudio() {
545-
if (terVoiceVolume == 0) {
545+
if (terSpeechVolume == 0) {
546546
stopAudio();
547547
}
548548
}
@@ -551,8 +551,9 @@ void HistoryScene::startAudio(const string& name) {
551551
if (!name.empty()) {
552552
stopAudio();
553553
interpreter->eventOccured(Controller::END_OF_AUDIO_EVENT);
554-
if (0 < terVoiceVolume) {
554+
if (0 < terSpeechVolume) {
555555
playingVoice = true;
556+
voice->SetVolume(terSpeechVolume);
556557
int ret = voice->OpenToPlay((getLocDataPath() + name).c_str(), 0);
557558
if (!ret) {
558559
fprintf(stderr, "startAudio %s error\n", name.c_str());

Source/UserInterface/OptionsMenu.cpp

+50-15
Original file line numberDiff line numberDiff line change
@@ -466,20 +466,23 @@ void OnComboGraphicsMode(CShellWindow* pWnd, InterfaceEventCode code, int param)
466466
// sound
467467
static SpeechPlayer* OptionSamplePlayer = new SpeechPlayer();
468468

469-
void OptionPlaySample(GLOBAL_VOLUME global_volume, const char* path) {
469+
bool OptionPlaySample(GLOBAL_VOLUME global_volume, float volume, const char* path) {
470+
bool started = false;
470471
if (OptionSamplePlayer->GetVolumeSelection() != global_volume) {
471472
OptionSamplePlayer->Stop();
472473
}
473-
if (OptionSamplePlayer->IsPlay()) {
474-
OptionSamplePlayer->SetVolume(1.0f); //update the effect
475-
} else {
474+
OptionSamplePlayer->SetVolume(volume); //Calls updateEffects() if playing
475+
if (!OptionSamplePlayer->IsPlay()) {
476476
OptionSamplePlayer->SetVolumeSelection(global_volume);
477477
bool ret = OptionSamplePlayer->OpenToPlay(path, false);
478-
if (!ret) {
478+
if (ret) {
479+
started = true;
480+
} else {
479481
fprintf(stderr, "OptionPlaySample sample '%s' error\n", path);
480482
xassert(0);
481483
}
482484
}
485+
return started;
483486
}
484487

485488
void OnSliderSoundVolume(CShellWindow* pWnd, InterfaceEventCode code, int param)
@@ -490,33 +493,62 @@ void OnSliderSoundVolume(CShellWindow* pWnd, InterfaceEventCode code, int param)
490493
} else if((code == EVENT_SLIDERUPDATE && pSlider->pos != terSoundVolume) || code == EVENT_UNPRESSED) {
491494
terSoundVolume = pSlider->pos;
492495
SNDSetSoundVolume(terSoundVolume);
493-
OptionPlaySample(GLOBAL_VOLUME_EFFECTS, "Resource/Sounds/EFF/Units/Unit_Shot_Wargon.wav");
496+
OptionPlaySample(GLOBAL_VOLUME_EFFECTS, 1.0f, "Resource/Sounds/EFF/Units/Unit_Shot_Wargon.wav");
494497
}
495498
}
496-
void OnSliderVoiceVolume(CShellWindow* pWnd, InterfaceEventCode code, int param)
499+
500+
void OnSliderSpeechVolume(CShellWindow* pWnd, InterfaceEventCode code, int param)
497501
{
498502
CSliderWindow *pSlider = (CSliderWindow*) pWnd;
499503
if ( code == EVENT_CREATEWND ) {
500-
pSlider->pos = terVoiceVolume;
504+
pSlider->pos = terSpeechVolume;
501505
historyScene.setupAudio();
502506
_shellIconManager.setupAudio();
503-
} else if((code == EVENT_SLIDERUPDATE && pSlider->pos != terVoiceVolume) || code == EVENT_UNPRESSED) {
504-
terVoiceVolume = pSlider->pos;
505-
SNDSetVoiceVolume(terVoiceVolume);
507+
} else if((code == EVENT_SLIDERUPDATE && pSlider->pos != terSpeechVolume) || code == EVENT_UNPRESSED) {
508+
terSpeechVolume = pSlider->pos;
506509
if (code == EVENT_UNPRESSED) {
507510
historyScene.setupAudio();
508511
_shellIconManager.setupAudio();
509512
}
510513
std::string path = getLocDataPath();
511514
static int i = 0;
515+
//Select ET audio if only ET is selected
516+
bool et = terGameContentSelect == PERIMETER_ET;
517+
if (1 < i) i = 0;
518+
switch (i) {
519+
default:
520+
case 0:
521+
path += et ? "Voice/Briefings/Briefing_mission5_3.ogg"
522+
: "Voice/Tips/Mission1_5.ogg";
523+
break;
524+
case 1:
525+
path += et ? "Voice/Tips/Mission26_1.ogg"
526+
: "Voice/Tips/Mission9_1.ogg";
527+
break;
528+
529+
}
530+
bool started = OptionPlaySample(GLOBAL_VOLUME_IGNORE, terSpeechVolume, path.c_str());
531+
if (started) i++;
532+
}
533+
}
534+
535+
void OnSliderVoiceVolume(CShellWindow* pWnd, InterfaceEventCode code, int param)
536+
{
537+
CSliderWindow *pSlider = (CSliderWindow*) pWnd;
538+
if ( code == EVENT_CREATEWND ) {
539+
pSlider->pos = terVoiceVolume;
540+
} else if((code == EVENT_SLIDERUPDATE && pSlider->pos != terVoiceVolume) || code == EVENT_UNPRESSED) {
541+
terVoiceVolume = pSlider->pos;
542+
SNDSetVoiceVolume(terVoiceVolume);
543+
std::string path = getLocDataPath();
544+
static int i = 0;
512545
//Skip some audios if PERIMETER_ET
513546
if (terGameContentSelect == PERIMETER_ET && (i == 2 || i == 5)) {
514547
i++;
515548
}
516-
switch (i++) {
549+
if (5 < i) i = 0;
550+
switch (i) {
517551
default:
518-
i = 1;
519-
[[fallthrough]];
520552
case 0:
521553
path += "Voice/Exodus_Voice_Labor_Under_Attack.wav";
522554
break;
@@ -537,7 +569,8 @@ void OnSliderVoiceVolume(CShellWindow* pWnd, InterfaceEventCode code, int param)
537569
break;
538570

539571
}
540-
OptionPlaySample(GLOBAL_VOLUME_VOICE, path.c_str());
572+
bool started = OptionPlaySample(GLOBAL_VOLUME_VOICE, 1.0f, path.c_str());
573+
if (started) i++;
541574
}
542575
}
543576
void OnSliderMusicVolume(CShellWindow* pWnd, InterfaceEventCode code, int param)
@@ -671,6 +704,8 @@ void OnButtonOptionSound(CShellWindow* pWnd, InterfaceEventCode code, int param)
671704
pCombo->pos = terMusicVolume;
672705
pCombo = safe_cast<CSliderWindow*>(_shellIconManager.GetWnd(SQSH_MM_SOUND_VOICEVOLUME_SLIDER));
673706
pCombo->pos = terVoiceVolume;
707+
pCombo = safe_cast<CSliderWindow*>(_shellIconManager.GetWnd(SQSH_MM_SOUND_SPEECHVOLUME_SLIDER));
708+
pCombo->pos = terSpeechVolume;
674709

675710
_shellIconManager.SwitchMenuScreens(pWnd->m_pParent->ID, SQSH_MM_SCREEN_SOUND);
676711
}

0 commit comments

Comments
 (0)