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

Method intern_source

perro_source/audio_stack/perro_pawdio/src/controller.rs:215–228  ·  view source on GitHub ↗
(&self, source: &str)

Source from the content-addressed store, hash-verified

213 pub fn new(static_audio_lookup: Option<fn(u64) -> &'static [u8]>) -> Result<Self, String> {
214 if audio_disabled_by_env() {
215 return Err(format!("audio disabled by {AUDIO_DISABLED_ENV}"));
216 }
217
218 Self::new_with_player_factory(static_audio_lookup, BarkPlayer::new)
219 }
220
221 fn new_with_player_factory<F>(
222 static_audio_lookup: Option<fn(u64) -> &'static [u8]>,
223 player_factory: F,
224 ) -> Result<Self, String>
225 where
226 F: FnOnce(Option<fn(u64) -> &'static [u8]>) -> Result<BarkPlayer, String> + Send + 'static,
227 {
228 let (tx, rx) = crossbeam_channel::bounded::<AudioCommand>(Self::COMMAND_QUEUE_CAPACITY);
229 let (startup_tx, startup_rx) = crossbeam_channel::bounded::<Result<(), String>>(1);
230 let next_playback_id = Arc::new(AtomicU64::new(1));
231 let loaded = Arc::new(Mutex::new(AudioLoadedState::default()));

Callers 15

source_handleMethod · 0.80
play_sourceMethod · 0.80
play_clipMethod · 0.80
play_spatial_sourceMethod · 0.80
load_sourceMethod · 0.80
load_source_bytesMethod · 0.80
is_source_loadedMethod · 0.80
reserve_sourceMethod · 0.80
reserve_source_bytesMethod · 0.80
drop_sourceMethod · 0.80
source_length_secondsMethod · 0.80
stop_sourceMethod · 0.80

Calls 5

string_to_u64Function · 0.85
cloneMethod · 0.80
getMethod · 0.45
as_refMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected