Skip to content

Commit 957e53a

Browse files
committed
remove opt in volume option and cleanup
1 parent 499acef commit 957e53a

2 files changed

Lines changed: 2 additions & 11 deletions

File tree

code/sound/fsspeech.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ static bool ttstechroom_change(bool new_val, bool initial)
7575
return true;
7676
}
7777

78-
#ifndef __ANDROID__
7978
static bool ttsvolume_change(float new_val, bool initial)
8079
{
8180
if (initial) {
@@ -84,7 +83,6 @@ static bool ttsvolume_change(float new_val, bool initial)
8483
speech_set_volume((unsigned short) new_val);
8584
return true;
8685
}
87-
#endif
8886

8987
static std::pair<int, SCP_string> ttsvoice_deserializer(const json_t* el)
9088
{
@@ -127,7 +125,6 @@ static SCP_string ttsvoice_display(const std::pair<int, SCP_string>& vi)
127125
return vi.second;
128126
}
129127

130-
#ifndef __ANDROID__ //Note: No independient TTS volume control in Android, remove the option.
131128
static auto SpeechVolumeOption = options::OptionBuilder<float>("Speech.Volume",
132129
std::pair<const char*, int>{"TTS Volume", 1920},
133130
std::pair<const char*, int>{"Volume used for playing TTS speech", 1921})
@@ -137,7 +134,6 @@ static auto SpeechVolumeOption = options::OptionBuilder<float>("Speech.Volume",
137134
.change_listener(ttsvolume_change)
138135
.importance(2)
139136
.finish();
140-
#endif
141137

142138
static auto SpeechRateOption = options::OptionBuilder<float>("Speech.Rate",
143139
std::pair<const char*, int>{"TTS Rate", 1922},
@@ -156,9 +152,7 @@ static bool ttsvoice_change(const std::pair<int, SCP_string>& new_voice, bool in
156152
}
157153
speech_set_voice(new_voice.first);
158154
// Re-apply volume and rate, it is needed on Mac and maybe on other OS as well
159-
#ifndef __ANDROID__
160155
speech_set_volume((unsigned short)SpeechVolumeOption->getValue());
161-
#endif
162156
speech_set_rate(SpeechRateOption->getValue());
163157
return true;
164158
}
@@ -257,9 +251,7 @@ bool fsspeech_init()
257251
FSSpeech_play_from[FSSPEECH_FROM_MULTI] = SpeechMultiOption->getValue();
258252
// The apply order must be Voice->Volume/Rate to avoid issues on Mac.
259253
speech_set_voice(SpeechVoiceOption->getValue().first);
260-
#ifndef __ANDROID__
261254
speech_set_volume((unsigned short)SpeechVolumeOption->getValue());
262-
#endif
263255
speech_set_rate(SpeechRateOption->getValue());
264256
}
265257
else
@@ -272,10 +264,10 @@ bool fsspeech_init()
272264

273265
int voice = os_config_read_uint(nullptr, "SpeechVoice", 0);
274266
speech_set_voice(voice);
275-
#ifndef __ANDROID__
267+
276268
int volume = os_config_read_uint(nullptr, "SpeechVolume", 100);
277269
speech_set_volume((unsigned short)volume);
278-
#endif
270+
279271
int rate = os_config_read_uint(nullptr, "SpeechRate", 100);
280272
speech_set_rate(static_cast<float>(rate));
281273
}

code/sound/speech_android.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ SCP_vector<std::pair<int, SCP_string>> speech_enumerate_voices()
275275
return voices;
276276

277277
jsize count = env->GetArrayLength(tags);
278-
voices.reserve((size_t)count);
279278

280279
for (jsize i = 0; i < count; ++i) {
281280
jstring tag = (jstring)env->GetObjectArrayElement(tags, i);

0 commit comments

Comments
 (0)