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

Method play_clip

perro_source/audio_stack/perro_pawdio/src/controller.rs:241–259  ·  view source on GitHub ↗
(
        &self,
        source: &str,
        clip: MicClip,
        bus_id: Option<AudioBusID>,
        volume: f32,
        pan: crate::types::AudioPan,
    )

Source from the content-addressed store, hash-verified

239 &rx,
240 &startup_tx,
241 &loaded_for_thread,
242 );
243 })
244 .map_err(|err| format!("failed to spawn audio thread: {err}"))?;
245 startup_rx
246 .recv()
247 .map_err(|_| "audio worker stopped during startup".to_string())??;
248 Ok(Self {
249 tx,
250 next_playback_id,
251 source_pool: Mutex::new(HashMap::new()),
252 loaded,
253 })
254 }
255
256 #[cfg(test)]
257 fn from_test_sender(tx: Sender<AudioCommand>) -> Self {
258 Self {
259 tx,
260 next_playback_id: Arc::new(AtomicU64::new(1)),
261 source_pool: Mutex::new(HashMap::new()),
262 loaded: Arc::new(Mutex::new(AudioLoadedState::default())),

Callers 1

newMethod · 0.45

Calls 1

intern_sourceMethod · 0.80

Tested by

no test coverage detected