aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriamgoofball <iamgoofball@gmail.com>2018-10-16 01:22:07 -0700
committeriamgoofball <iamgoofball@gmail.com>2018-10-16 01:22:07 -0700
commitd1347b2243c1595557d7b89d40eb88a68a94375b (patch)
tree5feea820e2f8fb3675c3ce8fe8e35ba13727a045
parent4858904d11bc9b350cf461d8455cf369b89477da (diff)
Opus on SFX
-rw-r--r--aoapplication.h3
-rw-r--r--courtroom.cpp9
-rw-r--r--text_file_functions.cpp22
3 files changed, 29 insertions, 5 deletions
diff --git a/aoapplication.h b/aoapplication.h
index e3544fe6..b9d3fd10 100644
--- a/aoapplication.h
+++ b/aoapplication.h
@@ -169,6 +169,9 @@ public:
//Returns the sfx with p_identifier from sounds.ini in the current theme path
QString get_sfx(QString p_identifier);
+ //Figure out if we can opus this or if we should fall back to wav
+ QString get_sfx_suffix(QString sound_to_check);
+
//Returns the value of p_search_line within target_tag and terminator_tag
QString read_char_ini(QString p_char, QString p_search_line, QString target_tag, QString terminator_tag);
diff --git a/courtroom.cpp b/courtroom.cpp
index 43e977be..1ccae30b 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -1377,7 +1377,7 @@ void Courtroom::play_sfx()
if (sfx_name == "1")
return;
- sfx_player->play(sfx_name + ".wav");
+ sfx_player->play(ao_app->get_sfx_suffix(sfx_name));
}
void Courtroom::set_scene()
@@ -1488,12 +1488,13 @@ void Courtroom::set_text_color()
ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
"color: yellow");
break;
- default:
- qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR];
+
case WHITE:
ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
"color: white");
-
+ break;
+ default:
+ qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR];
}
}
diff --git a/text_file_functions.cpp b/text_file_functions.cpp
index 1aebc35e..5b057a4b 100644
--- a/text_file_functions.cpp
+++ b/text_file_functions.cpp
@@ -340,6 +340,26 @@ QString AOApplication::get_sfx(QString p_identifier)
return return_sfx;
}
+QString AOApplication::get_sfx_suffix(QString sound_to_check)
+{
+ QString wav_check = get_sounds_path() + sound_to_check + ".wav";
+ QString mp3_check = get_sounds_path() + sound_to_check + ".mp3";
+ QString opus_check = get_sounds_path() + sound_to_check + ".opus";
+ if(file_exists(opus_check))
+ {
+ return sound_to_check + ".opus";
+ }
+ if(file_exists(mp3_check))
+ {
+ return sound_to_check + ".mp3";
+ }
+ if(file_exists(wav_check))
+ {
+ return sound_to_check + ".wav";
+ }
+ return sound_to_check + ".wav";
+}
+
//returns whatever is to the right of "search_line =" within target_tag and terminator_tag, trimmed
//returns the empty string if the search line couldnt be found
QString AOApplication::read_char_ini(QString p_char, QString p_search_line, QString target_tag, QString terminator_tag)
@@ -586,4 +606,4 @@ bool AOApplication::ic_scroll_down_enabled()
{
QString f_result = read_config("ic_scroll_down");
return f_result.startsWith("true");
-} \ No newline at end of file
+}