Skip to content

armgit / Handy

Public Imported from GitHub
0

A free, open source, and extensible speech-to-text application that works completely offline.

fix: add input channel selection for multi-channel audio interfaces (#1254)

Paul Hinze12f02e2a9645
diff --git a/src-tauri/src/audio_toolkit/audio/recorder.rs b/src-tauri/src/audio_toolkit/audio/recorder.rs
index 9077bf1c..9bc77d05 100644
--- a/src-tauri/src/audio_toolkit/audio/recorder.rs
+++ b/src-tauri/src/audio_toolkit/audio/recorder.rs
@@ -77,6 +77,8 @@ pub struct AudioRecorder {
vad: Option<VadConfig>,
level_cb: Option<Arc<dyn Fn(Vec<f32>) + Send + Sync + 'static>>,
audio_cb: Option<AudioFrameCallback>,
+ /// Which input channel to use. None = average all (original behavior).
+ selected_channel: Option<usize>,
/// Preferred stream config cached per device name. The two HAL property
/// queries in `get_preferred_config` cost ~40-85ms per open (worse on
/// USB/Bluetooth), which lands on the keypress->capture path in on-demand
@@ -95,6 +97,7 @@ impl AudioRecorder {
vad: None,
level_cb: None,
audio_cb: None,
+ selected_channel: None,
config_cache: Arc::new(Mutex::new(None)),
})
}
@@ -136,6 +139,15 @@ impl AudioRecorder {
self
}
+ pub fn with_selected_channel(mut self, channel: Option<u16>) -> Self {
+ self.set_selected_channel(channel);
+ self
+ }
+
+ pub fn set_selected_channel(&mut self, channel: Option<u16>) {
+ self.selected_channel = channel.map(usize::from);
+ }
+
pub fn open(&mut self, device: Option<Device>) -> Result<(), Box<dyn std::error::Error>> {
if self.worker_handle.is_some() {
if !self.is_capture_worker_dead() {
@@ -166,6 +178,7 @@ impl AudioRecorder {
let level_cb = self.level_cb.clone();
// Move the optional real-time audio frame callback into the worker thread
let audio_cb = self.audio_cb.clone();
+ let selected_channel = self.selected_channel;
let config_cache = Arc::clone(&self.config_cache);
let worker = std::thread::spawn(move || {
@@ -199,6 +212,20 @@ impl AudioRecorder {
config.sample_format()
);
+ if let Some(channel) = selected_channel {
+ if channel < channels {
+ log::info!("Using selected input channel: {}", channel + 1);
+ } else {
+ log::warn!(
+ "Selected input channel {} is out of range for a {}-channel device; averaging all channels instead",
+ channel + 1,
+ channels
+ );
+ }
+ } else {
+ log::info!("Averaging all {} input channels", channels);
+ }
+
let build_started = Instant::now();
let stream = match config.sample_format() {
cpal::SampleFormat::U8 => AudioRecorder::build_stream::<u8>(
@@ -206,6 +233,7 @@ impl AudioRecorder {
&config,
sample_tx,
channels,
+ selected_channel,
stop_flag_for_stream,
)
.map_err(|e| format!("Failed to build input stream: {e}"))?,
@@ -214,6 +242,7 @@ impl AudioRecorder {
&config,
sample_tx,
channels,
+ selected_channel,
stop_flag_for_stream,
)
.map_err(|e| format!("Failed to build input stream: {e}"))?,
@@ -222,6 +251,7 @@ impl AudioRecorder {
&config,
sample_tx,
channels,
+ selected_channel,
stop_flag_for_stream,
)
.map_err(|e| format!("Failed to build input stream: {e}"))?,
@@ -230,6 +260,7 @@ impl AudioRecorder {
&config,
sample_tx,
channels,
+ selected_channel,
stop_flag_for_stream,
)
.map_err(|e| format!("Failed to build input stream: {e}"))?,
@@ -238,6 +269,7 @@ impl AudioRecorder {
&config,
sample_tx,
channels,
+ selected_channel,
stop_flag_for_stream,
)
.map_err(|e| format!("Failed to build input stream: {e}"))?,
@@ -368,6 +400,7 @@ impl AudioRecorder {
config: &cpal::SupportedStreamConfig,
sample_tx: mpsc::Sender<AudioChunk>,
channels: usize,
+ selected_channel: Option<usize>,
stop_flag: Arc<AtomicBool>,
) -> Result<cpal::Stream, cpal::BuildStreamError>
where
@@ -376,6 +409,13 @@ impl AudioRecorder {
{
let mut output_buffer = Vec::new();
let mut eos_sent = false;
+ // Resolve the effective channel to use. If the selected channel is
+ // out of range for this device, fall back to averaging all channels.
+ let use_channel: Option<usize> = match selected_channel {
+ Some(ch) if ch < channels => Some(ch),
+ Some(_) => None, // out of range, fall back to average
+ None => None, // user chose "average all"
+ };
let stream_cb = move |data: &[T], _: &cpal::InputCallbackInfo| {
if stop_flag.load(Ordering::Relaxed) {
@@ -395,13 +435,20 @@ impl AudioRecorder {
let frame_count = data.len() / channels;
output_buffer.reserve(frame_count);
- for frame in data.chunks_exact(channels) {
- let mono_sample = frame
- .iter()
- .map(|&sample| sample.to_sample::<f32>())
- .sum::<f32>()
- / channels as f32;
- output_buffer.push(mono_sample);
+ if let Some(ch) = use_channel {
+ for frame in data.chunks_exact(channels) {
+ let mono_sample = frame[ch].to_sample::<f32>();
+ output_buffer.push(mono_sample);
+ }
+ } else {
+ for frame in data.chunks_exact(channels) {
+ let mono_sample = frame
+ .iter()
+ .map(|&sample| sample.to_sample::<f32>())
+ .sum::<f32>()
+ / channels as f32;
+ output_buffer.push(mono_sample);
+ }
}
}
@@ -421,6 +468,12 @@ impl AudioRecorder {
)
}
+ pub fn preferred_input_channel_count(
+ device: &cpal::Device,
+ ) -> Result<u16, Box<dyn std::error::Error>> {
+ Ok(Self::get_preferred_config(device)?.channels())
+ }
+
fn get_preferred_config(
device: &cpal::Device,
) -> Result<cpal::SupportedStreamConfig, Box<dyn std::error::Error>> {
diff --git a/src-tauri/src/commands/audio.rs b/src-tauri/src/commands/audio.rs
index 97cb52f1..07920e25 100644
--- a/src-tauri/src/commands/audio.rs
+++ b/src-tauri/src/commands/audio.rs
@@ -1,5 +1,5 @@
use crate::audio_feedback;
-use crate::audio_toolkit::audio::{list_input_devices, list_output_devices};
+use crate::audio_toolkit::audio::{list_input_devices, list_output_devices, AudioRecorder};
use crate::managers::audio::{AudioRecordingManager, MicrophoneMode};
use crate::settings::{get_settings, write_settings};
use log::warn;
@@ -332,3 +332,49 @@ pub fn is_recording(app: AppHandle) -> bool {
let audio_manager = app.state::<Arc<AudioRecordingManager>>();
audio_manager.is_recording()
}
+
+#[tauri::command]
+#[specta::specta]
+pub async fn get_microphone_channels(device_name: String) -> Result<u16, String> {
+ // cpal device enumeration and config queries can stall, so keep them off
+ // the webview/main run loop.
+ tokio::task::spawn_blocking(move || {
+ use cpal::traits::HostTrait;
+
+ let device = if device_name.eq_ignore_ascii_case("default") {
+ crate::audio_toolkit::get_cpal_host().default_input_device()
+ } else {
+ list_input_devices()
+ .map_err(|e| format!("Failed to list audio devices: {e}"))?
+ .into_iter()
+ .find(|device| device.name == device_name)
+ .map(|device| device.device)
+ };
+
+ match device {
+ Some(device) => AudioRecorder::preferred_input_channel_count(&device)
+ .map_err(|e| format!("Failed to get microphone config: {e}")),
+ None => Ok(1),
+ }
+ })
+ .await
+ .map_err(|e| format!("audio task join failed: {e}"))?
+}
+
+#[tauri::command]
+#[specta::specta]
+pub async fn set_selected_channel(app: AppHandle, channel: Option<u16>) -> Result<(), String> {
+ // Restarting cpal can block, so keep it off the webview/main run loop. Apply
+ // the runtime change before persisting it so a rejected active-recording
+ // change does not become effective on the next launch.
+ let manager = app.state::<Arc<AudioRecordingManager>>().inner().clone();
+ tokio::task::spawn_blocking(move || manager.update_selected_channel(channel))
+ .await
+ .map_err(|e| format!("audio task join failed: {e}"))?
+ .map_err(|e| format!("Failed to update channel selection: {e}"))?;
+
+ let mut settings = get_settings(&app);
+ settings.selected_channel = channel;
+ write_settings(&app, settings);
+ Ok(())
+}
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 9ccc1f62..6b3e2fa0 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -701,6 +701,8 @@ pub fn run(cli_args: CliArgs) {
commands::audio::set_clamshell_microphone,
commands::audio::get_clamshell_microphone,
commands::audio::is_recording,
+ commands::audio::get_microphone_channels,
+ commands::audio::set_selected_channel,
commands::transcription::set_model_unload_timeout,
commands::transcription::get_model_load_status,
commands::transcription::unload_model_manually,
diff --git a/src-tauri/src/managers/audio.rs b/src-tauri/src/managers/audio.rs
index 5543c6b0..8cf50a2e 100644
--- a/src-tauri/src/managers/audio.rs
+++ b/src-tauri/src/managers/audio.rs
@@ -262,6 +262,7 @@ struct MuteState {
fn create_audio_recorder(
vad_path: &Path,
app_handle: &tauri::AppHandle,
+ selected_channel: Option<u16>,
stream_router: Arc<StreamRouter>,
) -> Result<AudioRecorder, anyhow::Error> {
// A single Silero engine covers both the offline and streaming policies (never
@@ -286,6 +287,7 @@ fn create_audio_recorder(
VAD_OFFLINE_HANGOVER_FRAMES,
VAD_STREAMING_HANGOVER_FRAMES,
)
+ .with_selected_channel(selected_channel)
.with_level_callback({
let app_handle = app_handle.clone();
move |levels| {
@@ -515,9 +517,11 @@ impl AudioRecordingManager {
tauri::path::BaseDirectory::Resource,
)
.map_err(|e| anyhow::anyhow!("Failed to resolve VAD path: {}", e))?;
+ let settings = get_settings(&self.app_handle);
*recorder_opt = Some(create_audio_recorder(
&vad_path,
&self.app_handle,
+ settings.selected_channel,
Arc::clone(&self.stream_router),
)?);
}
@@ -741,12 +745,10 @@ impl AudioRecordingManager {
}
pub fn update_selected_device(&self) -> Result<(), anyhow::Error> {
- // Device settings changed; drop the cached resolution so the next
- // open re-enumerates. (The name-keyed cache would miss anyway; this
- // just avoids holding a stale cpal::Device alive.)
+ // Device settings changed; re-enumerate the device and restart capture.
self.invalidate_device_cache();
- // If currently open, restart the microphone stream to use the new device
- if *self.is_open.lock().unwrap() {
+ let was_open = *self.is_open.lock().unwrap();
+ if was_open {
self.close_generation.fetch_add(1, Ordering::SeqCst);
self.stop_microphone_stream();
self.start_microphone_stream()?;
@@ -754,6 +756,41 @@ impl AudioRecordingManager {
Ok(())
}
+ pub fn update_selected_channel(
+ &self,
+ selected_channel: Option<u16>,
+ ) -> Result<(), anyhow::Error> {
+ // Serialize against recording start/stop. Restarting an active capture
+ // would discard its samples and leave the manager's recording state out
+ // of sync with the new recorder.
+ let state = self.state.lock().unwrap();
+ if !matches!(*state, RecordingState::Idle) {
+ return Err(anyhow::anyhow!(
+ "Cannot change the input channel while recording"
+ ));
+ }
+
+ let previous_channel = get_settings(&self.app_handle).selected_channel;
+ let was_open = *self.is_open.lock().unwrap();
+ if was_open {
+ self.close_generation.fetch_add(1, Ordering::SeqCst);
+ self.stop_microphone_stream();
+ }
+ if let Some(recorder) = self.recorder.lock().unwrap().as_mut() {
+ recorder.set_selected_channel(selected_channel);
+ }
+ if was_open {
+ if let Err(error) = self.start_microphone_stream() {
+ if let Some(recorder) = self.recorder.lock().unwrap().as_mut() {
+ recorder.set_selected_channel(previous_channel);
+ }
+ return Err(error);
+ }
+ }
+ drop(state);
+ Ok(())
+ }
+
pub fn cancel_generation(&self) -> u64 {
self.cancel_generation.load(Ordering::Acquire)
}
diff --git a/src-tauri/src/settings.rs b/src-tauri/src/settings.rs
index 7cf32fec..7b73ba0e 100644
--- a/src-tauri/src/settings.rs
+++ b/src-tauri/src/settings.rs
@@ -377,6 +377,10 @@ pub struct AppSettings {
pub always_on_microphone: bool,
#[serde(default)]
pub selected_microphone: Option<String>,
+ /// Which input channel to use on the selected microphone device.
+ /// None means "average all channels" (original behavior).
+ #[serde(default)]
+ pub selected_channel: Option<u16>,
#[serde(default)]
pub clamshell_microphone: Option<String>,
#[serde(default)]
@@ -857,6 +861,7 @@ pub fn get_default_settings() -> AppSettings {
onboarding_completed: false,
always_on_microphone: false,
selected_microphone: None,
+ selected_channel: None,
clamshell_microphone: None,
selected_output_device: None,
translate_to_english: false,
diff --git a/src/bindings.ts b/src/bindings.ts
index e850f733..98127f97 100644
--- a/src/bindings.ts
+++ b/src/bindings.ts
@@ -789,6 +789,22 @@ async getClamshellMicrophone() : Promise<Result<string, string>> {
async isRecording() : Promise<boolean> {
return await TAURI_INVOKE("is_recording");
},
+async getMicrophoneChannels(deviceName: string) : Promise<Result<number, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("get_microphone_channels", { deviceName }) };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
+async setSelectedChannel(channel: number | null) : Promise<Result<null, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("set_selected_channel", { channel }) };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
async setModelUnloadTimeout(timeout: ModelUnloadTimeout) : Promise<void> {
await TAURI_INVOKE("set_model_unload_timeout", { timeout });
},
@@ -924,7 +940,12 @@ bindings?: Partial<{ [key in string]: ShortcutBinding }>; push_to_talk?: boolean
* upgrading from before this key existed are blanked by the migration so they
* see the current release's notes — see `apply_settings_migrations`.
*/
-whats_new_last_seen_version?: string; selected_model?: string; onboarding_completed?: boolean; always_on_microphone?: boolean; selected_microphone?: string | null; clamshell_microphone?: string | null; selected_output_device?: string | null; translate_to_english?: boolean; selected_language?: string; overlay_position?: OverlayPosition; debug_mode?: boolean; log_level?: LogLevel; custom_words?: string[]; model_unload_timeout?: ModelUnloadTimeout; word_correction_threshold?: number; history_limit?: number; recording_retention_period?: RecordingRetentionPeriod; paste_method?: PasteMethod; clipboard_handling?: ClipboardHandling; auto_submit?: boolean; auto_submit_key?: AutoSubmitKey; post_process_enabled?: boolean; post_process_provider_id?: string; post_process_providers?: PostProcessProvider[]; post_process_api_keys?: SecretMap; post_process_models?: Partial<{ [key in string]: string }>; post_process_prompts?: LLMPrompt[]; post_process_selected_prompt_id?: string | null; mute_while_recording?: boolean; append_trailing_space?: boolean; app_language?: string; theme?: Theme; experimental_enabled?: boolean; lazy_stream_close?: boolean; keyboard_implementation?: KeyboardImplementation; show_tray_icon?: boolean; paste_delay_ms?: number; paste_delay_after_ms?: number;
+whats_new_last_seen_version?: string; selected_model?: string; onboarding_completed?: boolean; always_on_microphone?: boolean; selected_microphone?: string | null;
+/**
+ * Which input channel to use on the selected microphone device.
+ * None means "average all channels" (original behavior).
+ */
+selected_channel?: number | null; clamshell_microphone?: string | null; selected_output_device?: string | null; translate_to_english?: boolean; selected_language?: string; overlay_position?: OverlayPosition; debug_mode?: boolean; log_level?: LogLevel; custom_words?: string[]; model_unload_timeout?: ModelUnloadTimeout; word_correction_threshold?: number; history_limit?: number; recording_retention_period?: RecordingRetentionPeriod; paste_method?: PasteMethod; clipboard_handling?: ClipboardHandling; auto_submit?: boolean; auto_submit_key?: AutoSubmitKey; post_process_enabled?: boolean; post_process_provider_id?: string; post_process_providers?: PostProcessProvider[]; post_process_api_keys?: SecretMap; post_process_models?: Partial<{ [key in string]: string }>; post_process_prompts?: LLMPrompt[]; post_process_selected_prompt_id?: string | null; mute_while_recording?: boolean; append_trailing_space?: boolean; app_language?: string; theme?: Theme; experimental_enabled?: boolean; lazy_stream_close?: boolean; keyboard_implementation?: KeyboardImplementation; show_tray_icon?: boolean; paste_delay_ms?: number; paste_delay_after_ms?: number;
/**
* Debug-gated ("beta") receipt-sequenced paste: restore the clipboard only
* after the target app actually reads the transcript, instead of after a
diff --git a/src/components/settings/ChannelSelector.tsx b/src/components/settings/ChannelSelector.tsx
new file mode 100644
index 00000000..2f64afed
--- /dev/null
+++ b/src/components/settings/ChannelSelector.tsx
@@ -0,0 +1,88 @@
+import React, { useEffect, useState } from "react";
+import { useTranslation } from "react-i18next";
+import { Dropdown } from "../ui/Dropdown";
+import { SettingContainer } from "../ui/SettingContainer";
+import { commands } from "@/bindings";
+import { useSettings } from "../../hooks/useSettings";
+
+interface ChannelSelectorProps {
+ descriptionMode?: "inline" | "tooltip";
+ grouped?: boolean;
+}
+
+export const ChannelSelector: React.FC<ChannelSelectorProps> = React.memo(
+ ({ descriptionMode = "tooltip", grouped = false }) => {
+ const { t } = useTranslation();
+ const { getSetting, updateSetting, isUpdating, isLoading } = useSettings();
+ const [channelCount, setChannelCount] = useState(1);
+
+ const selectedMicrophone = getSetting("selected_microphone") || "default";
+ const selectedChannel = getSetting("selected_channel");
+
+ useEffect(() => {
+ let cancelled = false;
+ setChannelCount(1);
+
+ const fetchChannels = async () => {
+ try {
+ const deviceName =
+ selectedMicrophone === "Default" ? "default" : selectedMicrophone;
+ const result = await commands.getMicrophoneChannels(deviceName);
+ if (!cancelled && result.status === "ok") {
+ setChannelCount(result.data);
+ }
+ } catch (error) {
+ console.error("Failed to get microphone channel count:", error);
+ }
+ };
+
+ void fetchChannels();
+ return () => {
+ cancelled = true;
+ };
+ }, [selectedMicrophone]);
+
+ // Don't render if the device only has one channel.
+ if (channelCount <= 1) {
+ return null;
+ }
+
+ const handleChannelSelect = async (value: string) => {
+ const channel = value === "average" ? null : parseInt(value, 10);
+ await updateSetting("selected_channel", channel);
+ };
+
+ const options = [
+ { value: "average", label: t("settings.sound.channel.average") },
+ ...Array.from({ length: channelCount }, (_, index) => ({
+ value: index.toString(),
+ label: t("settings.sound.channel.channel", { n: index + 1 }),
+ })),
+ ];
+
+ // An old selection may not exist on a newly selected device. The recorder
+ // also falls back to averaging in that case, so reflect that effective value.
+ const currentValue =
+ selectedChannel == null || selectedChannel >= channelCount
+ ? "average"
+ : selectedChannel.toString();
+
+ return (
+ <SettingContainer
+ title={t("settings.sound.channel.title")}
+ description={t("settings.sound.channel.description")}
+ descriptionMode={descriptionMode}
+ grouped={grouped}
+ >
+ <Dropdown
+ options={options}
+ selectedValue={currentValue}
+ onSelect={handleChannelSelect}
+ disabled={isUpdating("selected_channel") || isLoading}
+ />
+ </SettingContainer>
+ );
+ },
+);
+
+ChannelSelector.displayName = "ChannelSelector";
diff --git a/src/components/settings/general/GeneralSettings.tsx b/src/components/settings/general/GeneralSettings.tsx
index adbb6787..314c00fa 100644
--- a/src/components/settings/general/GeneralSettings.tsx
+++ b/src/components/settings/general/GeneralSettings.tsx
@@ -2,6 +2,7 @@ import React from "react";
import { useTranslation } from "react-i18next";
import { type } from "@tauri-apps/plugin-os";
import { MicrophoneSelector } from "../MicrophoneSelector";
+import { ChannelSelector } from "../ChannelSelector";
import { ShortcutInput } from "../ShortcutInput";
import { SettingsGroup } from "../../ui/SettingsGroup";
import { OutputDeviceSelector } from "../OutputDeviceSelector";
@@ -30,6 +31,7 @@ export const GeneralSettings: React.FC = () => {
<ModelSettingsCard />
<SettingsGroup title={t("settings.sound.title")}>
<MicrophoneSelector descriptionMode="tooltip" grouped={true} />
+ <ChannelSelector descriptionMode="tooltip" grouped={true} />
<MuteWhileRecording descriptionMode="tooltip" grouped={true} />
<AudioFeedback descriptionMode="tooltip" grouped={true} />
<OutputDeviceSelector
diff --git a/src/components/settings/index.ts b/src/components/settings/index.ts
index c50132ae..5397d108 100644
--- a/src/components/settings/index.ts
+++ b/src/components/settings/index.ts
@@ -9,6 +9,7 @@ export { ModelsSettings } from "./models/ModelsSettings";
// Individual setting components
export { MicrophoneSelector } from "./MicrophoneSelector";
+export { ChannelSelector } from "./ChannelSelector";
export { ClamshellMicrophoneSelector } from "./ClamshellMicrophoneSelector";
export { OutputDeviceSelector } from "./OutputDeviceSelector";
export { AlwaysOnMicrophone } from "./AlwaysOnMicrophone";
diff --git a/src/i18n/locales/ar/translation.json b/src/i18n/locales/ar/translation.json
index 9c7a8c0e..12598ead 100644
--- a/src/i18n/locales/ar/translation.json
+++ b/src/i18n/locales/ar/translation.json
@@ -204,6 +204,12 @@
"placeholder": "...اختر الميكروفون",
"loading": "...جاري التحميل"
},
+ "channel": {
+ "title": "قناة الإدخال",
+ "description": "اختر قناة الإدخال التي تريد التسجيل منها. استخدم هذا الخيار إذا كانت واجهة الصوت لديك تحتوي على عدة مداخل.",
+ "average": "متوسط جميع القنوات",
+ "channel": "القناة {{n}}"
+ },
"audioFeedback": {
"label": "تنبيهات صوتية",
"description": "تشغيل صوت عند بدء التسجيل وتوقفه"
diff --git a/src/i18n/locales/bg/translation.json b/src/i18n/locales/bg/translation.json
index 80db4a26..a09af10d 100644
--- a/src/i18n/locales/bg/translation.json
+++ b/src/i18n/locales/bg/translation.json
@@ -225,6 +225,12 @@
"placeholder": "Изберете микрофон...",
"loading": "Зареждане..."
},
+ "channel": {
+ "title": "Входен канал",
+ "description": "Изберете входния канал, от който да записвате. Използвайте тази опция, ако аудио интерфейсът ви има няколко входа.",
+ "average": "Осредняване на всички канали",
+ "channel": "Канал {{n}}"
+ },
"audioFeedback": {
"label": "Звукова обратна връзка",
"description": "Възпроизвеждане на звук при старт и край на записа"
diff --git a/src/i18n/locales/cs/translation.json b/src/i18n/locales/cs/translation.json
index 6e42e63a..783d7067 100644
--- a/src/i18n/locales/cs/translation.json
+++ b/src/i18n/locales/cs/translation.json
@@ -225,6 +225,12 @@
"placeholder": "Vyberte mikrofon...",
"loading": "Načítání..."
},
+ "channel": {
+ "title": "Vstupní kanál",
+ "description": "Vyberte vstupní kanál, ze kterého se má nahrávat. Tuto možnost použijte, pokud má vaše zvukové rozhraní více vstupů.",
+ "average": "Průměr všech kanálů",
+ "channel": "Kanál {{n}}"
+ },
"audioFeedback": {
"label": "Zvuková odezva",
"description": "Přehrát zvuk při zahájení a ukončení nahrávání"
diff --git a/src/i18n/locales/da/translation.json b/src/i18n/locales/da/translation.json
index 6121d536..051d6ae3 100644
--- a/src/i18n/locales/da/translation.json
+++ b/src/i18n/locales/da/translation.json
@@ -225,6 +225,12 @@
"placeholder": "Vælg mikrofon...",
"loading": "Indlæser..."
},
+ "channel": {
+ "title": "Inputkanal",
+ "description": "Vælg, hvilken inputkanal der skal optages fra. Brug dette, hvis din lydgrænseflade har flere indgange.",
+ "average": "Gennemsnit af alle kanaler",
+ "channel": "Kanal {{n}}"
+ },
"audioFeedback": {
"label": "Lydfeedback",
"description": "Afspil lyd, når optagelse starter og stopper"
diff --git a/src/i18n/locales/de/translation.json b/src/i18n/locales/de/translation.json
index 204e171b..550aa87d 100644
--- a/src/i18n/locales/de/translation.json
+++ b/src/i18n/locales/de/translation.json
@@ -225,6 +225,12 @@
"placeholder": "Mikrofon auswählen...",
"loading": "Wird geladen..."
},
+ "channel": {
+ "title": "Eingangskanal",
+ "description": "Wähle den Eingangskanal aus, von dem aufgenommen werden soll. Verwende diese Option, wenn dein Audio-Interface mehrere Eingänge hat.",
+ "average": "Alle Kanäle mitteln",
+ "channel": "Kanal {{n}}"
+ },
"audioFeedback": {
"label": "Audio-Feedback",
"description": "Ton bei Start und Ende der Aufnahme abspielen"
diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json
index 20488920..9b42f7b6 100644
--- a/src/i18n/locales/en/translation.json
+++ b/src/i18n/locales/en/translation.json
@@ -225,6 +225,12 @@
"placeholder": "Select microphone...",
"loading": "Loading..."
},
+ "channel": {
+ "title": "Input Channel",
+ "description": "Select which input channel to record from. Use this if your audio interface has multiple inputs.",
+ "average": "Average all channels",
+ "channel": "Channel {{n}}"
+ },
"audioFeedback": {
"label": "Audio Feedback",
"description": "Play sound when recording starts and stops"
diff --git a/src/i18n/locales/es/translation.json b/src/i18n/locales/es/translation.json
index 70438241..cdf9e183 100644
--- a/src/i18n/locales/es/translation.json
+++ b/src/i18n/locales/es/translation.json
@@ -225,6 +225,12 @@
"placeholder": "Seleccionar micrófono...",
"loading": "Cargando..."
},
+ "channel": {
+ "title": "Canal de entrada",
+ "description": "Selecciona el canal de entrada desde el que se grabará. Usa esta opción si tu interfaz de audio tiene varias entradas.",
+ "average": "Promediar todos los canales",
+ "channel": "Canal {{n}}"
+ },
"audioFeedback": {
"label": "Retroalimentación de audio",
"description": "Reproducir sonido cuando la grabación inicia y se detiene"
diff --git a/src/i18n/locales/fr/translation.json b/src/i18n/locales/fr/translation.json
index 17fc4a13..0805981b 100644
--- a/src/i18n/locales/fr/translation.json
+++ b/src/i18n/locales/fr/translation.json
@@ -225,6 +225,12 @@
"placeholder": "Sélectionner un microphone...",
"loading": "Chargement..."
},
+ "channel": {
+ "title": "Canal d’entrée",
+ "description": "Sélectionnez le canal d’entrée à enregistrer. Utilisez cette option si votre interface audio possède plusieurs entrées.",
+ "average": "Moyenne de tous les canaux",
+ "channel": "Canal {{n}}"
+ },
"audioFeedback": {
"label": "Signal sonore",
"description": "Jouer un son au début et à la fin de l'enregistrement"
diff --git a/src/i18n/locales/he/translation.json b/src/i18n/locales/he/translation.json
index 70cbd689..025f06d7 100644
--- a/src/i18n/locales/he/translation.json
+++ b/src/i18n/locales/he/translation.json
@@ -225,6 +225,12 @@
"placeholder": "בחר מיקרופון...",
"loading": "טוען..."
},
+ "channel": {
+ "title": "ערוץ קלט",
+ "description": "בחרו את ערוץ הקלט שממנו תתבצע ההקלטה. השתמשו באפשרות זו אם לממשק השמע שלכם יש מספר כניסות.",
+ "average": "ממוצע של כל הערוצים",
+ "channel": "ערוץ {{n}}"
+ },
"audioFeedback": {
"label": "משוב קולי",
"description": "נגן צליל כשההקלטה מתחילה ומסתיימת"
diff --git a/src/i18n/locales/hi/translation.json b/src/i18n/locales/hi/translation.json
index 4fb9a20a..2089103a 100644
--- a/src/i18n/locales/hi/translation.json
+++ b/src/i18n/locales/hi/translation.json
@@ -225,6 +225,12 @@
"placeholder": "माइक्रोफ़ोन चुनें...",
"loading": "लोड हो रहा है..."
},
+ "channel": {
+ "title": "इनपुट चैनल",
+ "description": "रिकॉर्ड करने के लिए इनपुट चैनल चुनें। यदि आपके ऑडियो इंटरफ़ेस में कई इनपुट हैं, तो इसका उपयोग करें।",
+ "average": "सभी चैनलों का औसत",
+ "channel": "चैनल {{n}}"
+ },
"audioFeedback": {
"label": "ऑडियो फ़ीडबैक",
"description": "रिकॉर्डिंग शुरू और बंद होने पर साउंड चलाएं"
diff --git a/src/i18n/locales/it/translation.json b/src/i18n/locales/it/translation.json
index c66c0001..7206f018 100644
--- a/src/i18n/locales/it/translation.json
+++ b/src/i18n/locales/it/translation.json
@@ -225,6 +225,12 @@
"placeholder": "Scegli microfono...",
"loading": "Caricamento..."
},
+ "channel": {
+ "title": "Canale di ingresso",
+ "description": "Seleziona il canale di ingresso da cui registrare. Usa questa opzione se l'interfaccia audio dispone di più ingressi.",
+ "average": "Media di tutti i canali",
+ "channel": "Canale {{n}}"
+ },
"audioFeedback": {
"label": "Feedback Audio",
"description": "Riproduci un suono quando la registrazione inizia e finisce"
diff --git a/src/i18n/locales/ja/translation.json b/src/i18n/locales/ja/translation.json
index 5c25fba9..41d0e4ad 100644
--- a/src/i18n/locales/ja/translation.json
+++ b/src/i18n/locales/ja/translation.json
@@ -225,6 +225,12 @@
"placeholder": "マイクを選択…",
"loading": "読み込み中…"
},
+ "channel": {
+ "title": "入力チャンネル",
+ "description": "録音に使用する入力チャンネルを選択します。オーディオインターフェースに複数の入力がある場合に使用してください。",
+ "average": "すべてのチャンネルの平均",
+ "channel": "チャンネル{{n}}"
+ },
"audioFeedback": {
"label": "オーディオフィードバック",
"description": "録音の開始と停止時にサウンドを再生"
diff --git a/src/i18n/locales/ko/translation.json b/src/i18n/locales/ko/translation.json
index 8a2fe59c..74b2ea94 100644
--- a/src/i18n/locales/ko/translation.json
+++ b/src/i18n/locales/ko/translation.json
@@ -207,6 +207,12 @@
"placeholder": "마이크 선택...",
"loading": "로딩 중..."
},
+ "channel": {
+ "title": "입력 채널",
+ "description": "녹음할 입력 채널을 선택하세요. 오디오 인터페이스에 입력이 여러 개 있는 경우 사용하세요.",
+ "average": "모든 채널 평균",
+ "channel": "채널 {{n}}"
+ },
"audioFeedback": {
"label": "오디오 피드백",
"description": "녹음 시작 및 정지 시 소리 재생"
diff --git a/src/i18n/locales/ne/translation.json b/src/i18n/locales/ne/translation.json
index 7df5264e..43dc81f0 100644
--- a/src/i18n/locales/ne/translation.json
+++ b/src/i18n/locales/ne/translation.json
@@ -225,6 +225,12 @@
"placeholder": "माइक्रोफोन चयन गर्नुहोस्...",
"loading": "लोड गरिँदैछ..."
},
+ "channel": {
+ "title": "इनपुट च्यानल",
+ "description": "रेकर्ड गर्ने इनपुट च्यानल चयन गर्नुहोस्। तपाईंको अडियो इन्टरफेसमा धेरै इनपुटहरू छन् भने यो प्रयोग गर्नुहोस्।",
+ "average": "सबै च्यानलको औसत",
+ "channel": "च्यानल {{n}}"
+ },
"audioFeedback": {
"label": "अडियो फिडब्याक",
"description": "रेकर्डिङ सुरु र बन्द हुँदा आवाज बजाउनुहोस्"
diff --git a/src/i18n/locales/nl/translation.json b/src/i18n/locales/nl/translation.json
index 67b71934..13ed451f 100644
--- a/src/i18n/locales/nl/translation.json
+++ b/src/i18n/locales/nl/translation.json
@@ -225,6 +225,12 @@
"placeholder": "Microfoon selecteren...",
"loading": "Laden..."
},
+ "channel": {
+ "title": "Ingangskanaal",
+ "description": "Selecteer het ingangskanaal waarvan moet worden opgenomen. Gebruik dit als je audio-interface meerdere ingangen heeft.",
+ "average": "Gemiddelde van alle kanalen",
+ "channel": "Kanaal {{n}}"
+ },
"audioFeedback": {
"label": "Geluidsfeedback",
"description": "Geluid afspelen wanneer de opname start en stopt"
diff --git a/src/i18n/locales/pl/translation.json b/src/i18n/locales/pl/translation.json
index a80b915a..09440847 100644
--- a/src/i18n/locales/pl/translation.json
+++ b/src/i18n/locales/pl/translation.json
@@ -225,6 +225,12 @@
"placeholder": "Wybierz mikrofon...",
"loading": "Wczytywanie..."
},
+ "channel": {
+ "title": "Kanał wejściowy",
+ "description": "Wybierz kanał wejściowy, z którego chcesz nagrywać. Użyj tej opcji, jeśli interfejs audio ma wiele wejść.",
+ "average": "Uśrednij wszystkie kanały",
+ "channel": "Kanał {{n}}"
+ },
"audioFeedback": {
"label": "Informacja dźwiękowa",
"description": "Odtwarzaj dźwięk przy rozpoczęciu i zakończeniu nagrywania"
diff --git a/src/i18n/locales/pt/translation.json b/src/i18n/locales/pt/translation.json
index 0d356204..52cd84b3 100644
--- a/src/i18n/locales/pt/translation.json
+++ b/src/i18n/locales/pt/translation.json
@@ -225,6 +225,12 @@
"placeholder": "Selecionar microfone...",
"loading": "Carregando..."
},
+ "channel": {
+ "title": "Canal de entrada",
+ "description": "Selecione o canal de entrada que será gravado. Use esta opção se a sua interface de áudio tiver várias entradas.",
+ "average": "Média de todos os canais",
+ "channel": "Canal {{n}}"
+ },
"audioFeedback": {
"label": "Feedback de Áudio",
"description": "Reproduzir som quando a gravação iniciar e parar"
diff --git a/src/i18n/locales/ru/translation.json b/src/i18n/locales/ru/translation.json
index 743b9c3c..5d1eaf75 100644
--- a/src/i18n/locales/ru/translation.json
+++ b/src/i18n/locales/ru/translation.json
@@ -225,6 +225,12 @@
"placeholder": "Выбрать микрофон...",
"loading": "Загрузка..."
},
+ "channel": {
+ "title": "Входной канал",
+ "description": "Выберите входной канал для записи. Используйте эту настройку, если у вашего аудиоинтерфейса несколько входов.",
+ "average": "Усреднять все каналы",
+ "channel": "Канал {{n}}"
+ },
"audioFeedback": {
"label": "Обратная звуковая связь",
"description": "Воспроизведение звука при запуске и остановке записи"
diff --git a/src/i18n/locales/sv/translation.json b/src/i18n/locales/sv/translation.json
index d26c2410..ee627c73 100644
--- a/src/i18n/locales/sv/translation.json
+++ b/src/i18n/locales/sv/translation.json
@@ -225,6 +225,12 @@
"placeholder": "Välj mikrofon...",
"loading": "Laddar..."
},
+ "channel": {
+ "title": "Ingångskanal",
+ "description": "Välj vilken ingångskanal du vill spela in från. Använd detta om ditt ljudgränssnitt har flera ingångar.",
+ "average": "Medelvärde av alla kanaler",
+ "channel": "Kanal {{n}}"
+ },
"audioFeedback": {
"label": "Ljudåterkoppling",
"description": "Spela upp ljud när inspelningen startar och stoppar"
diff --git a/src/i18n/locales/tr/translation.json b/src/i18n/locales/tr/translation.json
index 7031ddd4..9b32dc0f 100644
--- a/src/i18n/locales/tr/translation.json
+++ b/src/i18n/locales/tr/translation.json
@@ -225,6 +225,12 @@
"placeholder": "Mikrofon seçin...",
"loading": "Yükleniyor..."
},
+ "channel": {
+ "title": "Giriş Kanalı",
+ "description": "Kayıt yapılacak giriş kanalını seçin. Ses arabiriminizde birden fazla giriş varsa bu seçeneği kullanın.",
+ "average": "Tüm kanalların ortalaması",
+ "channel": "Kanal {{n}}"
+ },
"audioFeedback": {
"label": "Sesli Geri Bildirim",
"description": "Kayıt başladığında ve bittiğinde ses çalar"
diff --git a/src/i18n/locales/uk/translation.json b/src/i18n/locales/uk/translation.json
index ed88557d..eb7d757e 100644
--- a/src/i18n/locales/uk/translation.json
+++ b/src/i18n/locales/uk/translation.json
@@ -225,6 +225,12 @@
"placeholder": "Оберіть мікрофон...",
"loading": "Завантаження..."
},
+ "channel": {
+ "title": "Вхідний канал",
+ "description": "Виберіть вхідний канал для запису. Використовуйте цю опцію, якщо ваш аудіоінтерфейс має кілька входів.",
+ "average": "Усереднювати всі канали",
+ "channel": "Канал {{n}}"
+ },
"audioFeedback": {
"label": "Звукове сповіщення",
"description": "Відтворювати звук при початку та зупинці запису"
diff --git a/src/i18n/locales/vi/translation.json b/src/i18n/locales/vi/translation.json
index b350704c..5497fd9a 100644
--- a/src/i18n/locales/vi/translation.json
+++ b/src/i18n/locales/vi/translation.json
@@ -225,6 +225,12 @@
"placeholder": "Chọn micrô...",
"loading": "Đang tải..."
},
+ "channel": {
+ "title": "Kênh đầu vào",
+ "description": "Chọn kênh đầu vào để ghi âm. Sử dụng tùy chọn này nếu giao diện âm thanh của bạn có nhiều đầu vào.",
+ "average": "Trung bình tất cả các kênh",
+ "channel": "Kênh {{n}}"
+ },
"audioFeedback": {
"label": "Phản hồi âm thanh",
"description": "Phát âm thanh khi bắt đầu và kết thúc ghi âm"
diff --git a/src/i18n/locales/zh-TW/translation.json b/src/i18n/locales/zh-TW/translation.json
index 771afaa2..bc985b80 100644
--- a/src/i18n/locales/zh-TW/translation.json
+++ b/src/i18n/locales/zh-TW/translation.json
@@ -225,6 +225,12 @@
"placeholder": "選擇麥克風...",
"loading": "載入中..."
},
+ "channel": {
+ "title": "輸入聲道",
+ "description": "選擇要錄音的輸入聲道。如果您的音訊介面有多個輸入,請使用此選項。",
+ "average": "所有聲道的平均值",
+ "channel": "聲道 {{n}}"
+ },
"audioFeedback": {
"label": "聲音回饋",
"description": "錄製開始和停止時播放聲音"
diff --git a/src/i18n/locales/zh/translation.json b/src/i18n/locales/zh/translation.json
index 7392cbef..b57e1fa6 100644
--- a/src/i18n/locales/zh/translation.json
+++ b/src/i18n/locales/zh/translation.json
@@ -225,6 +225,12 @@
"placeholder": "选择麦克风...",
"loading": "加载中..."
},
+ "channel": {
+ "title": "输入通道",
+ "description": "选择要录制的输入通道。如果您的音频接口有多个输入,请使用此选项。",
+ "average": "所有通道的平均值",
+ "channel": "通道 {{n}}"
+ },
"audioFeedback": {
"label": "音频反馈",
"description": "录制开始和停止时播放声音"
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index 50f9b2c5..5538908a 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -99,6 +99,14 @@ const settingUpdaters: {
? "default"
: (value as string),
),
+ selected_channel: async (value) => {
+ const result = await commands.setSelectedChannel(
+ (value as number | null | undefined) ?? null,
+ );
+ if (result.status === "error") {
+ throw new Error(result.error);
+ }
+ },
clamshell_microphone: (value) =>
commands.setClamshellMicrophone(
(value as string) === "Default" ? "default" : (value as string),