MCPcopy Create free account
hub / github.com/PerroEngine/Perro / mic_worker

Function mic_worker

perro_source/audio_stack/perro_pawdio/src/mic.rs:626–656  ·  view source on GitHub ↗
(
    rx: std::sync::mpsc::Receiver<MicCommand>,
    samples: Arc<Mutex<Vec<i16>>>,
    stream_cursor: Arc<Mutex<usize>>,
    meta: Arc<Mutex<Option<(u32, u16)>>>,
    listening: Arc<std::sync::atomic

Source from the content-addressed store, hash-verified

624 default_taken |= is_default;
625 MicDevice {
626 name: input.name,
627 label,
628 is_default,
629 sample_rate: input.sample_rate,
630 channels: input.channels,
631 }
632 })
633 .collect();
634 Ok(devices)
635}
636
637/// One input device found on some cpal host, under its selection name.
638#[cfg(not(target_arch = "wasm32"))]
639struct EnumeratedInput {
640 device: cpal::Device,
641 name: String,
642 is_default: bool,
643 sample_rate: u32,
644 channels: u16,
645}
646
647/// The default host plus every optional backend compiled in (ASIO via the
648/// `mic-asio` feature, JACK via `mic-jack`). Without those features this is
649/// exactly one host, so scan behavior matches the plain build.
650#[cfg(not(target_arch = "wasm32"))]
651fn input_hosts() -> Vec<(cpal::Host, bool)> {
652 let default = cpal::default_host();
653 let default_id = default.id();
654 let mut hosts = vec![(default, true)];
655 for id in cpal::available_hosts() {
656 if id == default_id {
657 continue;
658 }
659 if let Ok(host) = cpal::host_from_id(id) {

Callers 1

newMethod · 0.85

Calls 2

start_streamFunction · 0.85
sendMethod · 0.80

Tested by

no test coverage detected