fix: RMS mic level, 25ms timer, speaker test, overlay recording indicator
- AudioRecorder: peak replaced with RMS (sqrt mean of squares) - AudioDeviceSettings: level meter timer 100ms -> 25ms - SoundManager: playRawPcm uses ma_audio_buffer_ref instead of ma_decoder (fixes speaker test) - InputBar: recording overlay positioned over text input, no layout shift - messagelist: removed old recording indicator widget
This commit is contained in:
1 parent
850a260aac
commit
a4ae1c6b41
7 files changed
+85
-58
No files matched your search
@@ -143,21 +143,21 @@ ma_context* SoundManager::context() {
|
||||
void SoundManager::playRawPcm(const int16_t* pcm, int sampleCount, int sampleRate, int channels) {
|
||||
if (!m_engine || !m_initialized) return;
|
||||
|
||||
ma_decoder_config decCfg = ma_decoder_config_init(ma_format_s16, (ma_uint32)channels, (ma_uint32)sampleRate);
|
||||
ma_decoder* decoder = new ma_decoder;
|
||||
ma_result r = ma_decoder_init_memory(pcm, (ma_uint64)sampleCount * channels * sizeof(int16_t), &decCfg, decoder);
|
||||
ma_audio_buffer_ref* ref = new ma_audio_buffer_ref;
|
||||
ma_result r = ma_audio_buffer_ref_init(ma_format_s16, (ma_uint32)channels,
|
||||
pcm, (ma_uint64)sampleCount, ref);
|
||||
if (r != MA_SUCCESS) {
|
||||
qWarning("SoundManager: PCM decoder init failed (%d)", r);
|
||||
delete decoder;
|
||||
qWarning("SoundManager: audio_buffer_ref_init failed (%d)", r);
|
||||
delete ref;
|
||||
return;
|
||||
}
|
||||
|
||||
ma_sound* sound = new ma_sound;
|
||||
r = ma_sound_init_from_data_source(m_engine, (ma_data_source*)decoder, 0, nullptr, sound);
|
||||
r = ma_sound_init_from_data_source(m_engine, (ma_data_source*)ref, 0, nullptr, sound);
|
||||
if (r != MA_SUCCESS) {
|
||||
qWarning("SoundManager: PCM sound init failed (%d)", r);
|
||||
ma_decoder_uninit(decoder);
|
||||
delete decoder;
|
||||
ma_audio_buffer_ref_uninit(ref);
|
||||
delete ref;
|
||||
delete sound;
|
||||
return;
|
||||
}
|
||||
@@ -165,8 +165,6 @@ void SoundManager::playRawPcm(const int16_t* pcm, int sampleCount, int sampleRat
|
||||
ma_sound_set_volume(sound, m_volume);
|
||||
ma_sound_start(sound);
|
||||
qDebug("SoundManager: playing PCM (%d samples, %dHz, %dch)", sampleCount, sampleRate, channels);
|
||||
|
||||
/* auto-cleanup after playback ends. Note: decoder+sound leak on early shutdown, acceptable for voice messages */
|
||||
}
|
||||
|
||||
QVector<SoundManager::DeviceInfo> SoundManager::enumeratePlaybackDevices() {
|
||||
|
||||
Reference in new issue
Block a user