Invoke onSpeedChange() callback function manually in setSpeed() 93/250093/2
authorArtur Świgoń <a.swigon@samsung.com>
Fri, 18 Dec 2020 18:02:12 +0000 (19:02 +0100)
committerArtur Świgoń <a.swigon@samsung.com>
Fri, 18 Dec 2020 18:12:42 +0000 (18:12 +0000)
This is a (temporary) workaround because notifications registered with
tts_setting_set_speed_changed_cb() are not delivered to the process.

Change-Id: I76ad2512653650220f2bf85d43d7bbb16829fa92

src/service/TextToSpeech.cpp

index 15a3775447fa435eaf41cdda7a23b0463fec39ec..c2d454615c6affd38c7d791886badd187ce41a92 100644 (file)
@@ -37,8 +37,8 @@ TextToSpeech::TextToSpeech()
        if (auto ret = tts_setting_initialize())
                ERROR("tts_setting_initialize: %s", ttsSettingErrorToString(ret).c_str());
 
-       if (auto ret = tts_setting_set_speed_changed_cb(onSpeedChange, this))
-               ERROR("tts_setting_set_speed_changed_cb: %s", ttsSettingErrorToString(ret).c_str());
+       //if (auto ret = tts_setting_set_speed_changed_cb(onSpeedChange, this))
+       //      ERROR("tts_setting_set_speed_changed_cb: %s", ttsSettingErrorToString(ret).c_str());
 }
 
 TextToSpeech::~TextToSpeech()
@@ -82,6 +82,8 @@ void TextToSpeech::setSpeed(size_t speed)
        auto ret = tts_setting_set_speed(speed);
        if (ret)
                ERROR("tts_setting_set_speed: %s", ttsSettingErrorToString(ret).c_str());
+
+       onSpeedChange(static_cast<int>(speed), this);
 }
 
 auto TextToSpeech::getSpeedRange() -> SpeedRange