From 96028d67ed1bcc5a4a25c9d7d889d34d7fc66824 Mon Sep 17 00:00:00 2001 From: fandaymon <36667953+fandaymon@users.noreply.github.com> Date: Fri, 2 Jun 2023 00:10:51 +0300 Subject: [PATCH] Adding a parameter $sound_name to the say function Adding the ability to select an audio file before playing a phrase By default it is the same dingdong --- lib/messages.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/messages.class.php b/lib/messages.class.php index b5cc8743f..261b86d96 100644 --- a/lib/messages.class.php +++ b/lib/messages.class.php @@ -137,7 +137,7 @@ function saySafe($ph, $level = 0, $member_id = 0, $source = '') * @param mixed $member_id Member ID (default 0) * @return void */ -function say($ph, $level = 0, $member_id = 0, $source = '') +function say($ph, $level = 0, $member_id = 0, $source = '', $sound_name = 'dingdong') { //dprint(date('Y-m-d H:i:s')." Say started",false); @@ -184,11 +184,13 @@ function say($ph, $level = 0, $member_id = 0, $source = '') } - if (!defined('SETTINGS_SPEAK_SIGNAL') || SETTINGS_SPEAK_SIGNAL == '1') { + if (!defined('SETTINGS_SPEAK_SIGNAL') || SETTINGS_SPEAK_SIGNAL == '1' ) { if ($level >= (int)getGlobal('minMsgLevel') && !$member_id) { // && !$ignoreVoice $passed = time() - $last_say_time; if ($passed > 20) { - playSound('dingdong', 1, $level); + if ($sound_name != 'none') { + playSound($sound_name, 1, $level); + } } } }