File tree 2 files changed +27
-6
lines changed 2 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -1483,7 +1483,8 @@ void speech_service::handle_speech_to_file(const tts_partial_result_t &result) {
1483
1483
}
1484
1484
1485
1485
m_current_task->counter .value += result.text .size ();
1486
- m_current_task->files .push_back (result.wav_file_path );
1486
+ if (!result.wav_file_path .isEmpty ())
1487
+ m_current_task->files .push_back (result.wav_file_path );
1487
1488
1488
1489
qDebug () << " partial speech to file progress:"
1489
1490
<< m_current_task->counter .progress ();
@@ -1556,11 +1557,27 @@ void speech_service::handle_tts_queue() {
1556
1557
1557
1558
auto &result = m_tts_queue.front ();
1558
1559
1559
- m_player.setMedia (QMediaContent{QUrl::fromLocalFile (result.wav_file_path )});
1560
+ if (!result.wav_file_path .isEmpty ()) {
1561
+ m_player.setMedia (
1562
+ QMediaContent{QUrl::fromLocalFile (result.wav_file_path )});
1560
1563
1561
- m_player.play ();
1564
+ m_player.play ();
1562
1565
1563
- emit tts_partial_speech_playing (result.text , result.task_id );
1566
+ emit tts_partial_speech_playing (result.text , result.task_id );
1567
+ } else if (result.last ) {
1568
+ auto task = result.task_id ;
1569
+
1570
+ tts_stop_speech (task);
1571
+ if (m_tts_queue.empty ()) {
1572
+ emit tts_partial_speech_playing (" " , task);
1573
+ } else {
1574
+ m_tts_queue.pop ();
1575
+ }
1576
+ emit tts_play_speech_finished (task);
1577
+ } else {
1578
+ if (!m_tts_queue.empty ()) m_tts_queue.pop ();
1579
+ handle_tts_queue ();
1580
+ }
1564
1581
}
1565
1582
1566
1583
void speech_service::handle_tts_engine_error () {
Original file line number Diff line number Diff line change @@ -454,8 +454,12 @@ void tts_engine::process() {
454
454
455
455
if (!encode_speech_impl (new_text, output_file)) {
456
456
unlink (output_file.c_str ());
457
- if (m_call_backs.error ) m_call_backs.error ();
458
- break ;
457
+ LOGE (" speech encoding error" );
458
+ if (m_call_backs.speech_encoded ) {
459
+ m_call_backs.speech_encoded (" " , " " , task.last );
460
+ }
461
+
462
+ continue ;
459
463
}
460
464
461
465
if (!model_supports_speed ()) apply_speed (output_file);
You can’t perform that action at this time.
0 commit comments