Files
utun2/tools/chatgui/src/voiceplayback.h
T
evgeny a97e8bcc1f docs: update file inventory and module header contracts
Refresh both AGENTS guides and clarify module purpose, usage, ownership, threading, return values and wire formats in headers. Remove the unused timeout_heap freed_count field and unimplemented getter.
2026-10-04 13:10:01 +02:00

25 lines
1.2 KiB
C++

/* Воспроизведение собственного Opus-файла voice_file: worker декодирует PCM, SoundManager проигрывает.
* Управление — в GUI-потоке; ready(duration,id) вызывается там же, 0 означает ошибку/busy.
* cancelPending подавляет результат, не останавливая worker; уничтожение context также подавляет callback.
* decodeOpusFile синхронно возвращает число кадров или -1; это отдельный API для worker. */
#pragma once
#include <QString>
#include <vector>
#include <cstdint>
#include <functional>
class QObject;
class VoicePlayer {
public:
static void playOpusFile(const QString& filePath, QObject* context, std::function<void(float, uint64_t)> ready);
static void cancelPending();
static void stop();
static bool isPlaying();
static uint64_t playbackId();
static bool isPreparing();
static int decodeOpusFile(const QString& filePath, std::vector<int16_t>& outPcm,
int& outSampleRate, int& outChannels, float& outDurationSec);
};