fix(voice): keep both mic-test takes playable

Record the original take from a pre-denoise AudioContext tap instead of
the already-captured getUserMedia track, and wait for every MediaRecorder
onstop before publishing URLs so a late dry dataavailable is not dropped.
Show an explicit missing-take message when a tab has no playable URL,
and flush recorders before releasing standalone capture.
This commit is contained in:
OddTurtleHead committed 2026-12-03 23:57:06 +08:00
1 parent 47abe356f5
commit 5d3af8dfbb
8 files changed
+492 -44

No files matched your search

@@ -155,6 +155,11 @@
controls
:aria-label="t('microphoneTest')"
></audio>
<p
v-else
class="settings-hint mic-test-missing"
role="status"
>{{ t(testAudioMissingKey) }}</p>
<p class="settings-hint">{{ t("micTestCompareHint") }}</p>
</div></div
></section>
@@ -257,6 +262,7 @@
<script setup lang="ts">
import { computed, ref, type CSSProperties } from "vue";
import { micTestPlaybackSource } from "../../voice/microphone-test.js";
import Icon from "../Icon.vue";
import AudioDeviceSelect from "./AudioDeviceSelect.vue";
import { useDialogFocus } from "../../composables/useDialogFocus.js";
@@ -361,9 +367,12 @@ const outputDeviceOptions = computed(() => [
]);
const testVariant = ref<"processed" | "dry">("processed");
const testAudioSrc = computed(() => testVariant.value === "dry"
? testAudioDryUrl.value
: (testAudioUrl.value || testAudioDryUrl.value));
const testPlayback = computed(() => micTestPlaybackSource(testVariant.value, {
processed: testAudioUrl.value,
dry: testAudioDryUrl.value,
}));
const testAudioSrc = computed(() => testPlayback.value.src);
const testAudioMissingKey = computed(() => testPlayback.value.missingKey);
const processingFallback = computed(() => microphoneProcessing.fallback);
const processingWarning = computed(() => microphoneProcessing.warning);
// Reflect the engine that really ran, not the stored preference.