diff --git a/src/renderer/src/lib/audio.ts b/src/renderer/src/lib/audio.ts
index da82302..67b4094 100644
--- a/src/renderer/src/lib/audio.ts
+++ b/src/renderer/src/lib/audio.ts
@@ -1,21 +1,29 @@
export class _Audio {
src: string
audio: HTMLAudioElement
+ secondaryAudio: HTMLAudioElement
constructor(src: string) {
this.src = src
this.audio = new Audio(src)
+ this.secondaryAudio = new Audio(src)
}
play() {
this.audio.play()
+ this.secondaryAudio.play()
}
stop() {
this.audio.pause()
+ this.secondaryAudio.pause()
this.audio.remove()
+ this.secondaryAudio.remove()
}
- setOuputDevice(id: string) {
+ setMainOuputDevice(id: string) {
this.audio.setSinkId(id)
}
+ setSecondaryOuputDevice(id: string) {
+ this.secondaryAudio.setSinkId(id)
+ }
}
diff --git a/src/renderer/src/lib/components/DevicesSelector.svelte b/src/renderer/src/lib/components/DevicesSelector.svelte
new file mode 100644
index 0000000..238dd97
--- /dev/null
+++ b/src/renderer/src/lib/components/DevicesSelector.svelte
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+ Select main audio device
+ Usually you should select "CABLE Input"
+
+
+ {#each kinds as kind (kind)}
+
+
+
+
+ {/each}
+
+
+
+ {mainTriggerContent}
+
+
+
+ Devices
+ {#each devices as device (`${device.deviceId}`)}
+
+ {device.label}
+
+ {/each}
+
+
+
+
+
+ Select secondary audio device
+ Usually you should your headset
+
+
+ {#each kinds as secondaryKind (secondaryKind)}
+
+
+
+
+ {/each}
+
+
+
+ {secondaryTriggerContent}
+
+
+
+ Devices
+ {#each devices as device (`${device.deviceId}`)}
+
+ {device.label}
+
+ {/each}
+
+
+
+
+
+
+
+
diff --git a/src/renderer/src/lib/components/Footer.svelte b/src/renderer/src/lib/components/Footer.svelte
index c1b52ca..0b81305 100644
--- a/src/renderer/src/lib/components/Footer.svelte
+++ b/src/renderer/src/lib/components/Footer.svelte
@@ -1,95 +1,7 @@
-
diff --git a/src/renderer/src/lib/components/Results.svelte b/src/renderer/src/lib/components/Results.svelte
index 8807bc0..4dcf106 100644
--- a/src/renderer/src/lib/components/Results.svelte
+++ b/src/renderer/src/lib/components/Results.svelte
@@ -7,17 +7,19 @@
let sound: _Audio
function play(src: string): void {
- if (!localStorage.getItem('output_device_id')) {
+ if (!localStorage.getItem('output_main_device_id')) {
return alert('Please select an audio device to ouput sounds.')
}
if (sound) {
sound.stop()
}
sound = new _Audio(src)
- sound.setOuputDevice(localStorage.getItem('output_device_id'))
+ sound.setMainOuputDevice(localStorage.getItem('output_main_device_id'))
+ if (localStorage.getItem('output_secondary_device_id')) {
+ sound.setSecondaryOuputDevice(localStorage.getItem('output_secondary_device_id'))
+ }
sound.play()
}
-
onMount(async () => {
states.sounds = await window.api.search()
})