feat: waveform display + 3px progress bar in bubble + sliding window RMS
- AudioRecorder: sliding window RMS (avg 5 frames), waveformLevels() getter - InputBar: downsample RMS to 100 samples, encode as wf0,wf1,... in textData - MessageList: parse 3rd pipe-separated field as waveform, store in MsgVoiceWaveformRole - MessageDelegate: new voice layout (16px play btn + 25px waveform + 3px progress bar) - MessageDelegate: waveform bars colored by progress (blue before, gray after) - Progress bar integrated at bottom of waveform area as colored fill
This commit is contained in:
1 parent
70a0a70b88
commit
05c7b4d47e
7 files changed
+133
-75
No files matched your search
@@ -26,7 +26,17 @@ void audioCaptureCallback(ma_device* pDevice, void* pOutput, const void* pInput,
|
||||
float v = (float)src[i] / 32768.0f;
|
||||
sumSq += v * v;
|
||||
}
|
||||
self->m_peakLevel = sqrtf(sumSq / (float)(frameCount * self->m_channels));
|
||||
float rms = sqrtf(sumSq / (float)(frameCount * self->m_channels));
|
||||
self->m_peakLevel = rms;
|
||||
|
||||
self->m_recentRms[self->m_rmsIdx % 5] = rms;
|
||||
self->m_rmsIdx++;
|
||||
if (self->m_rmsIdx >= 5) {
|
||||
float avg = 0.0f;
|
||||
for (int i = 0; i < 5; i++) avg += self->m_recentRms[i];
|
||||
avg /= 5.0f;
|
||||
self->m_waveformLevels.push_back(avg);
|
||||
}
|
||||
}
|
||||
|
||||
AudioRecorder::AudioRecorder(QObject* parent)
|
||||
@@ -72,6 +82,8 @@ void AudioRecorder::startRecording() {
|
||||
if (!m_initialized) { qWarning("AudioRecorder: not initialized"); return; }
|
||||
|
||||
m_pcmBuffer.clear();
|
||||
m_waveformLevels.clear();
|
||||
m_rmsIdx = 0;
|
||||
m_elapsedMs = 0;
|
||||
|
||||
ma_context* ctx = SoundManager::instance()->context();
|
||||
|
||||
Reference in new issue
Block a user