unify voice waveform format: base64 wf={100chars};dur={ms}; for both desktop and Android
- inputbar.cpp: CSV waveform → base64 log-scale (same as voice_recorder.c)
- messagelist.cpp: sendVoiceMessage removes displayName|dur_sec| prefix, uses wfStr directly
setVoiceMessageRoles: decodes new format wf={base64};dur={ms};|... from data field
- messagedelegate.cpp: waveform values now pre-normalized 0..1, no log recalculation needed
- VoiceEncoder: no changes needed (was already compatible)
Both platforms now store identical format in chat_msg_submit.data:
wf=ABCDef...100chars;dur=NNNN;|file_size|block_size|num_blocks|sigs_hex
This commit is contained in:
1 parent
b65a091b00
commit
4ffa59d968
3 files changed
+50
-39
No files matched your search
@@ -710,10 +710,7 @@ void MessageDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
|
||||
float barW = (float)wfR.width() / wfN;
|
||||
int ph = wfR.height() - 3;
|
||||
for (int i = 0; i < wfN; i++) {
|
||||
float v = wf[i].toFloat();
|
||||
float db = v > 0.00001f ? 20.0f * log10f(v) : -100.0f;
|
||||
float logV = (db + 60.0f) / 60.0f;
|
||||
if (logV < 0) logV = 0; if (logV > 1) logV = 1;
|
||||
float logV = wf[i].toFloat(); /* already 0..1 normalized */
|
||||
int barH = 2 + (int)(logV * (ph - 2));
|
||||
int x = wfR.left() + (int)(i * barW);
|
||||
int y = wfR.top() + ph - barH;
|
||||
@@ -724,8 +721,8 @@ void MessageDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
|
||||
QColor idle(0x70, 0x70, 0x78, 130);
|
||||
painter->setBrush((isPlaying || isPaused) ? (before ? played : unplayed) : idle);
|
||||
painter->drawRect(QRect(x, y, bw, barH));
|
||||
if (i == 0) GUI_DEBUG("voice paint: wfN=%d wfW=%d v=%.3f dB=%.1f logV=%.2f barH=%d",
|
||||
wfN, wfR.width(), v, db, logV, barH);
|
||||
if (i == 0) GUI_DEBUG("voice paint: wfN=%d wfW=%d logV=%.2f barH=%d",
|
||||
wfN, wfR.width(), logV, barH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user