Skip to content

Commit

Permalink
Add speech volume control
Browse files Browse the repository at this point in the history
  • Loading branch information
IonAgorria committed Jun 10, 2024
1 parent 907baf8 commit d9b195b
Show file tree
Hide file tree
Showing 14 changed files with 209 additions and 53 deletions.
1 change: 1 addition & 0 deletions Source/Game/PerimeterDataChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ int terObjectReflection = 0;

int terAudioEnable = 1;
float terSoundVolume = 1;
float terSpeechVolume = 1;
float terVoiceVolume = 1;
float terMusicVolume = 1;

Expand Down
6 changes: 5 additions & 1 deletion Source/Game/Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,13 +763,15 @@ void InitSound()
int chunkSizeFactor = 12; //1056 bytes under 2 channel 22khz 16 bits
terAudioEnable = true;
terSoundVolume = 0.75f;
terSpeechVolume = 0.75f;
terVoiceVolume = 0.75f;
terMusicVolume = 0.25f;
terMusicVolume = 0.75f;

IniManager ini_no("Perimeter.ini", false);
ini_no.getInt("Sound","MixChannels", mixChannels);
ini_no.getInt("Sound","ChunkSize", chunkSizeFactor);
ini_no.getFloat("Sound","SoundVolume", terSoundVolume);
ini_no.getFloat("Sound","SpeechVolume", terSpeechVolume);
ini_no.getFloat("Sound","VoiceVolume", terVoiceVolume);
ini_no.getFloat("Sound","MusicVolume", terMusicVolume);

Expand Down Expand Up @@ -800,6 +802,7 @@ void InitSound()
snd_listener.SetZMultiple(fSoundZMultiple);
} else {
terMusicVolume = 0.0f;
terSpeechVolume = 0.0f;
terVoiceVolume = 0.0f;
terSoundVolume = 0.0f;
SNDEnableSound(false);
Expand Down Expand Up @@ -829,6 +832,7 @@ void FinitSound()
IniManager ini("Perimeter.ini");
ini.putFloat("Sound","SoundVolume", terSoundVolume);
ini.putFloat("Sound","MusicVolume", terMusicVolume);
ini.putFloat("Sound","SpeechVolume", terVoiceVolume);
ini.putFloat("Sound","VoiceVolume", terVoiceVolume);

SNDReleaseSound();
Expand Down
1 change: 1 addition & 0 deletions Source/Game/Runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ extern int terObjectReflection;

extern int terAudioEnable; // 0,1
extern float terSoundVolume; // 0..1
extern float terSpeechVolume; // 0..1
extern float terVoiceVolume; // 0..1
extern float terMusicVolume; // 0..1

Expand Down
118 changes: 101 additions & 17 deletions Source/Game/Scripts/InterfaceScriptExport.cppi

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Source/Game/Texts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ void qdTextDB::load_supplementary_texts(const std::string& locale) {
"Interface.Menu.ButtonLabels.GUIDE=РУКОВОДСТВО",
"Interface.Menu.ButtonLabels.VSYNC=ВЕРТИКАЛЬНАЯ СИНХРОНИЗАЦИЯ",
"Interface.Menu.ButtonLabels.VOICE VOLUME=ГРОМКОСТЬ ГОЛОСА",
"Interface.Menu.ButtonLabels.SPEECH VOLUME=ГРОМКОСТЬ ГОЛОСА БРИФИНГОВ И ЗАДАНИЙ",
"Interface.Menu.ComboItems.Centered=По центру",
"Interface.Menu.ComboItems.Left side=Левая сторона",
"Interface.Menu.ComboItems.Right side=Правая сторона",
Expand Down Expand Up @@ -890,6 +891,7 @@ void qdTextDB::load_supplementary_texts(const std::string& locale) {
"Interface.Menu.ButtonLabels.GUIDE=GUIDE",
"Interface.Menu.ButtonLabels.VSYNC=VERTICAL SYNC",
"Interface.Menu.ButtonLabels.VOICE VOLUME=VOICE VOLUME",
"Interface.Menu.ButtonLabels.SPEECH VOLUME=VOICE VOLUME OF BRIEFINGS AND TASKS",
"Interface.Menu.ComboItems.Centered=Centered",
"Interface.Menu.ComboItems.Left side=Left side",
"Interface.Menu.ComboItems.Right side=Right side",
Expand Down
43 changes: 31 additions & 12 deletions Source/Scripts/InterfaceScriptExport.prm
Original file line number Diff line number Diff line change
Expand Up @@ -5334,7 +5334,7 @@ sqshControlContainer _sqsh_controls[int _sqsh_control_count] = {
controls = new sqshControl[] {
{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; },
{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; },
// {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; },
{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; },


{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; },
Expand All @@ -5358,8 +5358,18 @@ sqshControlContainer _sqsh_controls[int _sqsh_control_count] = {
target = SQSH_MM_SOUND_VOICEVOLUME; },

{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; },
{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;};},
{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;
{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;};},
{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;
image2={texture="resource\\icons\\MainMenu\\tv.avi";_ix = 0; _iy = 0; ix = 8; iy = 8;hasResolutionVersion=0;};
image={texture="resource\\icons\\MainMenu\\Main_menu.tga";_ix = 328;_iy = 489;ix = 150;iy = 27;};
image_disabled={texture="";_ix = 447;_iy = 456; ix = 16; iy = 27;};
image_h={texture="";_ix = 303;_iy = 493; ix = 25; iy = 23;};
image_check={texture="";_ix = 478;_iy = 493; ix = 25; iy = 23;};
target = SQSH_MM_SOUND_SPEECHVOLUME; },

{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; },
{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;};},
{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;
image2={texture="resource\\icons\\MainMenu\\tv.avi";_ix = 0; _iy = 0; ix = 8; iy = 8;hasResolutionVersion=0;};
image={texture="resource\\icons\\MainMenu\\Main_menu.tga";_ix = 328;_iy = 489;ix = 150;iy = 27;};
image_disabled={texture="";_ix = 447;_iy = 456; ix = 16; iy = 27;};
Expand Down Expand Up @@ -5801,27 +5811,36 @@ sqshControlContainer _sqsh_controls[int _sqsh_control_count] = {
{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; },


{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; },
{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";},
{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;
{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; },
{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";},
{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;
image={texture="resource\\icons\\MainMenu\\Main_menu.tga";_ix = 328;_iy = 489;ix = 150;iy = 27;};
image_disabled={texture="";_ix = 447;_iy = 456; ix = 16; iy = 27;};
image_h={texture="";_ix = 303;_iy = 493; ix = 25; iy = 23;};
image_check={texture="";_ix = 478;_iy = 493; ix = 25; iy = 23;};
target = SQSH_MM_SOUND_SOUNDVOLUME; },

{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; },
{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";},
{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;
{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; },
{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";},
{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;
image={texture="resource\\icons\\MainMenu\\Main_menu.tga";_ix = 328;_iy = 489;ix = 150;iy = 27;};
image_disabled={texture="";_ix = 447;_iy = 456; ix = 16; iy = 27;};
image_h={texture="";_ix = 303;_iy = 493; ix = 25; iy = 23;};
image_check={texture="";_ix = 478;_iy = 493; ix = 25; iy = 23;};
target = SQSH_MM_SOUND_VOICEVOLUME; },

{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; },
{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";},
{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;
{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; },
{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";},
{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;
image={texture="resource\\icons\\MainMenu\\Main_menu.tga";_ix = 328;_iy = 489;ix = 150;iy = 27;};
image_disabled={texture="";_ix = 447;_iy = 456; ix = 16; iy = 27;};
image_h={texture="";_ix = 303;_iy = 493; ix = 25; iy = 23;};
image_check={texture="";_ix = 478;_iy = 493; ix = 25; iy = 23;};
target = SQSH_MM_SOUND_SPEECHVOLUME; },

{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; },
{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";},
{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;
image={texture="resource\\icons\\MainMenu\\Main_menu.tga";_ix = 328;_iy = 489;ix = 150;iy = 27;};
image_disabled={texture="";_ix = 447;_iy = 456; ix = 16; iy = 27;};
image_h={texture="";_ix = 303;_iy = 493; ix = 25; iy = 23;};
Expand Down
2 changes: 2 additions & 0 deletions Source/Scripts/SquadShellEnums.inl
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,8 @@ enum ShellControlID
SQSH_MM_SOUND_MUSICVOLUME_SLIDER,
SQSH_MM_SOUND_VOICEVOLUME,
SQSH_MM_SOUND_VOICEVOLUME_SLIDER,
SQSH_MM_SOUND_SPEECHVOLUME,
SQSH_MM_SOUND_SPEECHVOLUME_SLIDER,

SQSH_EMPTY_WND,

Expand Down
2 changes: 1 addition & 1 deletion Source/Sound/Sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ bool SND_Sample::updateEffects(int channel) {
case GLOBAL_VOLUME_IGNORE:
break;
case GLOBAL_VOLUME_CHANNEL:
global_vol = channel_group == SND_GROUP_SPEECH ? SND::voice_volume : SND::sound_volume;
global_vol = channel_group == SND_GROUP_SPEECH ? 1.0f : SND::sound_volume;
break;
case GLOBAL_VOLUME_VOICE:
global_vol = SND::voice_volume;
Expand Down
5 changes: 3 additions & 2 deletions Source/UserInterface/HistoryScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ void HistoryScene::postDraw() {
}

void HistoryScene::setupAudio() {
if (terVoiceVolume == 0) {
if (terSpeechVolume == 0) {
stopAudio();
}
}
Expand All @@ -551,8 +551,9 @@ void HistoryScene::startAudio(const string& name) {
if (!name.empty()) {
stopAudio();
interpreter->eventOccured(Controller::END_OF_AUDIO_EVENT);
if (0 < terVoiceVolume) {
if (0 < terSpeechVolume) {
playingVoice = true;
voice->SetVolume(terSpeechVolume);
int ret = voice->OpenToPlay((getLocDataPath() + name).c_str(), 0);
if (!ret) {
fprintf(stderr, "startAudio %s error\n", name.c_str());
Expand Down
65 changes: 50 additions & 15 deletions Source/UserInterface/OptionsMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,20 +466,23 @@ void OnComboGraphicsMode(CShellWindow* pWnd, InterfaceEventCode code, int param)
// sound
static SpeechPlayer* OptionSamplePlayer = new SpeechPlayer();

void OptionPlaySample(GLOBAL_VOLUME global_volume, const char* path) {
bool OptionPlaySample(GLOBAL_VOLUME global_volume, float volume, const char* path) {
bool started = false;
if (OptionSamplePlayer->GetVolumeSelection() != global_volume) {
OptionSamplePlayer->Stop();
}
if (OptionSamplePlayer->IsPlay()) {
OptionSamplePlayer->SetVolume(1.0f); //update the effect
} else {
OptionSamplePlayer->SetVolume(volume); //Calls updateEffects() if playing
if (!OptionSamplePlayer->IsPlay()) {
OptionSamplePlayer->SetVolumeSelection(global_volume);
bool ret = OptionSamplePlayer->OpenToPlay(path, false);
if (!ret) {
if (ret) {
started = true;
} else {
fprintf(stderr, "OptionPlaySample sample '%s' error\n", path);
xassert(0);
}
}
return started;
}

void OnSliderSoundVolume(CShellWindow* pWnd, InterfaceEventCode code, int param)
Expand All @@ -490,33 +493,62 @@ void OnSliderSoundVolume(CShellWindow* pWnd, InterfaceEventCode code, int param)
} else if((code == EVENT_SLIDERUPDATE && pSlider->pos != terSoundVolume) || code == EVENT_UNPRESSED) {
terSoundVolume = pSlider->pos;
SNDSetSoundVolume(terSoundVolume);
OptionPlaySample(GLOBAL_VOLUME_EFFECTS, "Resource/Sounds/EFF/Units/Unit_Shot_Wargon.wav");
OptionPlaySample(GLOBAL_VOLUME_EFFECTS, 1.0f, "Resource/Sounds/EFF/Units/Unit_Shot_Wargon.wav");
}
}
void OnSliderVoiceVolume(CShellWindow* pWnd, InterfaceEventCode code, int param)

void OnSliderSpeechVolume(CShellWindow* pWnd, InterfaceEventCode code, int param)
{
CSliderWindow *pSlider = (CSliderWindow*) pWnd;
if ( code == EVENT_CREATEWND ) {
pSlider->pos = terVoiceVolume;
pSlider->pos = terSpeechVolume;
historyScene.setupAudio();
_shellIconManager.setupAudio();
} else if((code == EVENT_SLIDERUPDATE && pSlider->pos != terVoiceVolume) || code == EVENT_UNPRESSED) {
terVoiceVolume = pSlider->pos;
SNDSetVoiceVolume(terVoiceVolume);
} else if((code == EVENT_SLIDERUPDATE && pSlider->pos != terSpeechVolume) || code == EVENT_UNPRESSED) {
terSpeechVolume = pSlider->pos;
if (code == EVENT_UNPRESSED) {
historyScene.setupAudio();
_shellIconManager.setupAudio();
}
std::string path = getLocDataPath();
static int i = 0;
//Select ET audio if only ET is selected
bool et = terGameContentSelect == PERIMETER_ET;
if (1 < i) i = 0;
switch (i) {
default:
case 0:
path += et ? "Voice/Briefings/Briefing_mission5_3.ogg"
: "Voice/Tips/Mission1_5.ogg";
break;
case 1:
path += et ? "Voice/Tips/Mission26_1.ogg"
: "Voice/Tips/Mission9_1.ogg";
break;

}
bool started = OptionPlaySample(GLOBAL_VOLUME_IGNORE, terSpeechVolume, path.c_str());
if (started) i++;
}
}

void OnSliderVoiceVolume(CShellWindow* pWnd, InterfaceEventCode code, int param)
{
CSliderWindow *pSlider = (CSliderWindow*) pWnd;
if ( code == EVENT_CREATEWND ) {
pSlider->pos = terVoiceVolume;
} else if((code == EVENT_SLIDERUPDATE && pSlider->pos != terVoiceVolume) || code == EVENT_UNPRESSED) {
terVoiceVolume = pSlider->pos;
SNDSetVoiceVolume(terVoiceVolume);
std::string path = getLocDataPath();
static int i = 0;
//Skip some audios if PERIMETER_ET
if (terGameContentSelect == PERIMETER_ET && (i == 2 || i == 5)) {
i++;
}
switch (i++) {
if (5 < i) i = 0;
switch (i) {
default:
i = 1;
[[fallthrough]];
case 0:
path += "Voice/Exodus_Voice_Labor_Under_Attack.wav";
break;
Expand All @@ -537,7 +569,8 @@ void OnSliderVoiceVolume(CShellWindow* pWnd, InterfaceEventCode code, int param)
break;

}
OptionPlaySample(GLOBAL_VOLUME_VOICE, path.c_str());
bool started = OptionPlaySample(GLOBAL_VOLUME_VOICE, 1.0f, path.c_str());
if (started) i++;
}
}
void OnSliderMusicVolume(CShellWindow* pWnd, InterfaceEventCode code, int param)
Expand Down Expand Up @@ -671,6 +704,8 @@ void OnButtonOptionSound(CShellWindow* pWnd, InterfaceEventCode code, int param)
pCombo->pos = terMusicVolume;
pCombo = safe_cast<CSliderWindow*>(_shellIconManager.GetWnd(SQSH_MM_SOUND_VOICEVOLUME_SLIDER));
pCombo->pos = terVoiceVolume;
pCombo = safe_cast<CSliderWindow*>(_shellIconManager.GetWnd(SQSH_MM_SOUND_SPEECHVOLUME_SLIDER));
pCombo->pos = terSpeechVolume;

_shellIconManager.SwitchMenuScreens(pWnd->m_pParent->ID, SQSH_MM_SCREEN_SOUND);
}
Expand Down
Loading

0 comments on commit d9b195b

Please sign in to comment.