feat: integrate Opus codec into lib/libopus + voice messages in chatgui

- Add lib/libopus/ (opus v1.6.1 embedded source: CELT 18 .c, SILK 77 .c, SILK float 28 .c, OPUS core 14 .c)
- Add lib/opus_codec.h/.c (wrapper: encoder, decoder, raw PCM int16)
- Add tests/test_opus_codec.c (7 tests: silence, sine, compression, PLC, null, defaults, multi-frame)
- chatgui: AudioRecorder (miniaudio capture, 48kHz mono)
- chatgui: VoiceEncoder (PCM→Opus file with custom container)
- chatgui: VoicePlayer (Opus→PCM playback via SoundManager)
- chatgui: PTT button in InputBar, voice message send/receive in MessageList
- chatgui: AudioDeviceSettingsPage (device selection, persisted in ui_state)
- chatgui: MessageDelegate voice message rendering (play button + duration)
- Update autotools: configure.ac, Makefile.am, src/Makefile.am, tests/Makefile.am
- Update CMake: chatgui CMakeLists.txt, libutun CMakeLists.txt (link libopus_internal.a)
This commit is contained in:
Evgeny committed 2026-07-26 20:34:38 +03:00
1 parent 4a23593020
commit 4fde0b0325
260 files changed
+72665 -16

No files matched your search

+13 -1
View File
@@ -8,6 +8,7 @@
#include "creategroupdialog.h"
#include "invite_link.h"
#include "sound_manager.h"
#include "audiorecorder.h"
#include "animtimer.h"
#include "../db/db_manager.h"
#include "../transport/utun_node.h"
@@ -70,6 +71,7 @@ MainWindow::MainWindow(QWidget *parent, DbManager* db, const QString& cfgPath,
, m_db(db), m_cfgPath(cfgPath), m_cfgDbPath(dbPath)
, m_cfgDebugFile(debugFile), m_cfgDebugLevel(debugLevel)
, m_cfgDebugCategories(debugCategories)
, m_recorder(nullptr)
{
setWindowTitle("Chat");
resize(900, 600);
@@ -85,6 +87,7 @@ MainWindow::MainWindow(QWidget *parent, DbManager* db, const QString& cfgPath,
}
MainWindow::~MainWindow() {
if (m_recorder) { m_recorder->shutdown(); m_recorder = nullptr; }
SoundManager::instance()->shutdown();
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "MainWindow: ~MainWindow — saving channel state");
if (m_messageList) m_messageList->saveChannelState();
@@ -101,7 +104,8 @@ void MainWindow::setupUi() {
auto *splitter = new QSplitter(Qt::Horizontal, this);
m_channelList = new ChannelList(m_db, splitter);
m_messageList = new MessageList(m_db, splitter);
m_recorder = new AudioRecorder(this);
m_messageList = new MessageList(m_db, m_recorder, splitter);
m_accountList = new AccountList(m_db, splitter);
splitter->addWidget(m_channelList);
@@ -195,6 +199,14 @@ void MainWindow::setupSoundFromConfig() {
m_db->getUiStateInt(QStringLiteral("sound_%1_vol").arg(ek), 80) / 100.0f);
}
}
if (m_recorder) {
m_recorder->init();
if (m_db && m_db->isOpen())
m_recorder->setCaptureDeviceIndex(m_db->getUiStateInt("audio_input_device", -1));
qDebug("MainWindow: AudioRecorder initialized (captureDevice=%d)",
m_recorder->captureDeviceIndex());
}
}
void MainWindow::setupBridgeCallbacks() {