feat(ui): track microphone level separately in the recording store

This commit is contained in:
iamdoubz committed 2026-07-11 00:27:03 -05:00
1 parent 59c2d70643
commit 235129d0d6
1 file changed
+19 -4
+19 -4
View File
@@ -12,9 +12,13 @@ class RecordingStore {
segments = $state<TranscriptSegment[]>([]);
/** Whether audio is being retained as .wav for the in-flight meeting (ADR-0009). */
retention = $state(false);
/** Live input level for the waveform/meter (FR-CAP-5); 0 when not recording. */
/** Live system/loopback level for the waveform/meter (FR-CAP-5); 0 when not recording. */
levelRms = $state(0);
levelPeak = $state(0);
/** Live microphone level, overlaid on the meter in a different colour
* (FR-CAP-7); stays 0 when the mic is disabled or not recording. */
levelRmsMic = $state(0);
levelPeakMic = $state(0);
/** Set while a capture-device reconnect is in progress; cleared on recovery (FR-CAP-6). */
deviceNotice = $state<string | null>(null);
/** Live notes redesign: freeform text typed in the Notes pane while recording. */
@@ -35,6 +39,8 @@ class RecordingStore {
if (ended) {
this.levelRms = 0;
this.levelPeak = 0;
this.levelRmsMic = 0;
this.levelPeakMic = 0;
}
});
await events.onRetention((p) => {
@@ -46,9 +52,14 @@ class RecordingStore {
if (i >= 0) this.segments[i] = segment;
else this.segments.push(segment);
});
await events.onLevel(({ rms, peak }) => {
this.levelRms = rms;
this.levelPeak = peak;
await events.onLevel(({ rms, peak, mic }) => {
if (mic) {
this.levelRmsMic = rms;
this.levelPeakMic = peak;
} else {
this.levelRms = rms;
this.levelPeak = peak;
}
});
await events.onDeviceChanged(({ recovered, message }) => {
this.deviceNotice = recovered ? null : message;
@@ -76,6 +87,8 @@ class RecordingStore {
this.state = "idle";
this.levelRms = 0;
this.levelPeak = 0;
this.levelRmsMic = 0;
this.levelPeakMic = 0;
this.deviceNotice = null;
}
@@ -91,6 +104,8 @@ class RecordingStore {
this.state = "idle";
this.levelRms = 0;
this.levelPeak = 0;
this.levelRmsMic = 0;
this.levelPeakMic = 0;
this.deviceNotice = null;
this.notesText = "";
this.segmentNotes.clear();