fix: pause support + old message skip + stopCurrentPcm

- SoundManager: added stopCurrentPcm() for pause/stop of PCM playback
- messagedelegate: call stopCurrentPcm on pause, new play, and timer complete
- messagelist: skip old double-nested JSON messages (raw starts with '{')
- sound_manager.h: void* for ma_audio_buffer to avoid header dependency
This commit is contained in:
Evgeny committed 2026-07-27 00:38:15 +03:00
1 parent 2687c3ed82
commit 830f729f52
5 files changed
+38 -16

No files matched your search

+4 -2
View File
@@ -5,6 +5,7 @@
#include "animtimer.h"
#include "lottieicon.h"
#include "voiceplayback.h"
#include "sound_manager.h"
#include <cmath>
#include <QPainter>
#include <QPainterPath>
@@ -42,6 +43,7 @@ static void ensureVoiceTimer() {
float elapsed = (now - it->startMs) / 1000.0f;
if (elapsed >= it->durationSec && it->durationSec > 0) {
it->playing = false;
SoundManager::instance()->stopCurrentPcm();
++it;
} else {
anyPlaying = true;
@@ -76,13 +78,13 @@ bool MessageDelegate::editorEvent(QEvent *event, QAbstractItemModel *model,
if (st.playing) {
st.playing = false;
SoundManager::instance()->stopCurrentPcm();
model->setData(index, 0, MsgVoicePlayStateRole);
} else {
// Stop any other playing voice
for (auto it = s_voiceStates.begin(); it != s_voiceStates.end(); ++it)
it->playing = false;
SoundManager::instance()->stopCurrentPcm();
// Parse duration
QString durStr = index.data(MsgVoiceDurationRole).toString();
durStr.remove('s');
float dur = durStr.toFloat();