forked from Blendman974/faceclaw
First-pass G2 microphone streaming support
This commit is contained in:
1 parent
c28b321705
commit
9996b09e9c
13 files changed
+493
-113
No files matched your search
@@ -100,3 +100,4 @@ export async function ensureBlePermissions(): Promise<void> {
|
||||
export async function ensureVoicePermissions(): Promise<void> {
|
||||
await ensurePermissions([RECORD_AUDIO_PERMISSION], VOICE_PERMISSION_REQUEST_CODE, "Voice control");
|
||||
}
|
||||
|
||||
@@ -487,6 +487,8 @@ class DashboardController {
|
||||
private async setVoiceControlEnabled(enabled: boolean): Promise<void> {
|
||||
if (enabled) {
|
||||
try {
|
||||
// Treat Android mic permission as the consent gate for voice control,
|
||||
// even when the current source is the G2 mic over BLE.
|
||||
await ensureVoicePermissions();
|
||||
} catch (error) {
|
||||
this.appendLog(`voice control permission failed: ${this.formatError(error)}`);
|
||||
@@ -671,7 +673,7 @@ class DashboardController {
|
||||
if (!this.communicator) return;
|
||||
if (!isDashboardVoiceControlEnabled()) return;
|
||||
this.updateConnectedForegroundNotification();
|
||||
voiceControlBridge.start();
|
||||
voiceControlBridge.start(this.communicator.getNativeCommunicator());
|
||||
}
|
||||
|
||||
private setStopwatchRenderActive(active: boolean): void {
|
||||
|
||||
@@ -216,6 +216,10 @@ export class FaceclawCommunicatorBridge {
|
||||
return () => this.frameMetricsListeners.delete(listener);
|
||||
}
|
||||
|
||||
getNativeCommunicator(): any {
|
||||
return this.communicator;
|
||||
}
|
||||
|
||||
waitForNextFrameMetrics(timeoutMs: number): Promise<FrameMetrics | null> {
|
||||
const delayMs = Math.max(1, Math.round(nonNegativeNumber(timeoutMs)));
|
||||
return new Promise((resolve) => {
|
||||
|
||||
@@ -25,9 +25,12 @@ export class FaceclawVoiceControlBridge {
|
||||
return () => this.wakeWordListeners.delete(listener);
|
||||
}
|
||||
|
||||
start(): void {
|
||||
start(communicator?: any): void {
|
||||
if (this.started || !global.isAndroid) return;
|
||||
this.ensureController();
|
||||
if (communicator) {
|
||||
this.controller?.setCommunicator(communicator);
|
||||
}
|
||||
this.started = true;
|
||||
this.controller?.start();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user