Closed pvitaliy84 closed 3 years ago
@pvitaliy84 Currently, wavy connects to the default
ALSA configuration. If you're running pulseaudio you should be able to select your external audio card in pavucontrol
, and set it as the default card (you do this by setting other audio cards to "fallback"). You can also do it in gnome-settings if you're on gnome (which is a bit easier). Otherwise, you'll have to mess with the ALSA config files.
Eventually (hopefully soon), I plan to add an API which you can use to build an interface to select the audio card you want to use. I actually need this feature for a side-project, so I might try to set aside some time for it in the near future.
You can now do (in wavy 0.6.0):
use wavy::MicrophoneId;
let microphones = MicrophoneId::query();
for (id, microphone) in microphones.iter().enumerate() {
println!("[{}] {}", id, microphone);
}
// Prompt the user to select a microphone by ID, or hardcode it
...
let microphone = microphones[user_chosen_id].connect::<ChosenAudioFormat>().expect("Microphone unplugged");
// Record audio (same API as before)
...
Very cool! I will try it in evening.
And another question: how to stop record/play?
If you want the microphone to stop, you can put it in an Option
and set it to None
. When you want it start again you can reconnect and set the variable to Some
.
How to choose external USB-audio card for record?