fix: voice message display, playback, recording UI, audio settings
- messagelist: parse content_type from JSON when DB column is empty - messagelist: recording indicator (red dot + timer + cancel button) - messagedelegate: editorEvent for play/pause toggle + progress bar - messagedelegate: VoicePlayState tracking with QTimer - InputBar: proper recordingContext (mediaDir + channelId) - DbManager: dbPath() for media directory resolution - AudioRecorder: peakLevel() for mic level meter - VoiceEncoder: codec quality presets (Low/Standard/High) - audiodevicesettingspage: Default device option first - audiodevicesettingspage: mic level meter + test microphone - audiodevicesettingspage: test speaker button - audiodevicesettingspage: codec preset combo (Low/Standard/High) - mainwindow: load opus_codec_preset from ui_state on startup
This commit is contained in:
1 parent
4fde0b0325
commit
850a260aac
14 files changed
+483
-57
No files matched your search
@@ -11,9 +11,21 @@ extern "C" {
|
||||
#include <cstring>
|
||||
|
||||
static const int FRAME_MS = 20;
|
||||
static const uint32_t OPUS_MAGIC = 0x5355504F; /* "OPUS" */
|
||||
static const uint32_t OPUS_MAGIC = 0x5355504F;
|
||||
static const int MAX_PACKET = 4000;
|
||||
|
||||
static int s_preset = 1; /* 0=Low, 1=Standard, 2=High */
|
||||
static const int s_bitrates[] = {16000, 32000, 64000};
|
||||
static const int s_complexities[] = {2, 5, 10};
|
||||
|
||||
void VoiceEncoder::setPreset(int preset) {
|
||||
if (preset < 0) preset = 0;
|
||||
if (preset > 2) preset = 2;
|
||||
s_preset = preset;
|
||||
}
|
||||
|
||||
int VoiceEncoder::preset() { return s_preset; }
|
||||
|
||||
int VoiceEncoder::encodeToFile(const std::vector<int16_t>& pcm, int sampleRate, int channels,
|
||||
const QString& filePath, float& outDurationSec) {
|
||||
if (pcm.empty() || sampleRate <= 0 || channels <= 0) {
|
||||
@@ -30,6 +42,8 @@ int VoiceEncoder::encodeToFile(const std::vector<int16_t>& pcm, int sampleRate,
|
||||
qWarning("VoiceEncoder: encoder create failed");
|
||||
return -1;
|
||||
}
|
||||
opus_codec_encoder_bitrate_set(enc, s_bitrates[s_preset]);
|
||||
opus_codec_encoder_complexity_set(enc, s_complexities[s_preset]);
|
||||
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
|
||||
Reference in new issue
Block a user