JNVXXPEIDBTMUTQT5T5WWJXPZCDBEEBG5QXA3JKXYP5SORBVUMMQC EK273J7XN5BRDC6T24XLZ2LZP2SLDT2Y4AVPIGCQTY2IMEKHDZBAC CHX7R6AMVYVLZJ7DSE6E3B4TCJPRWS2V7ZEJIU2UQ3SSLRKYMJWQC MKB2A5XCWBZO2E6QFE6PD36LF3IGMJCGJB5TGMRAPSKCKHS75ISAC FIO72ZSANLC3OS5IKSZ4PUAIBFAAHZA6EFGHMHP6YVFGTOJ7PPKQC X6Q2DCTTZVQ2HCA4BFLKONTXJ2AYHTBBZCARASBEKEDCDZ2YSPUQC JV22QZEHUOIQD6B3P5F3CT5H3FFR4VH5Q64XG2TQKSTSXEVBH6MAC Machine::new(pink() * sfxr.amp.unwrap_or(1.0) * envelope(move |t| exp(-sfxr.f * t)))
match sfxr {Sfxr::PinkExp { amp, f } => {Machine::new(pink() * amp.unwrap_or(1.0) * envelope(move |t| exp(-f * t)))}}}}// Also let's us load in the Sfxr itself, for debugging purposes#[derive(Default)]struct DebugSfxrLoader;impl AssetLoader for DebugSfxrLoader {type Asset = Sfxr;type Settings = ();type Error = SfxrLoaderError;fn load<'a>(&'a self,reader: &'a mut Reader,_settings: &'a Self::Settings,_load_context: &'a mut LoadContext,) -> BoxedFuture<'a, Result<Self::Asset, Self::Error>> {Box::pin(async move {let mut bytes = Vec::new();reader.read_to_end(&mut bytes).await?;let sfxr = ron::de::from_bytes::<Sfxr>(&bytes)?;Ok(sfxr)})
app.add_systems(Update, debug_view_window.run_if(in_state(GameState::InRun))).add_systems(Startup, setup_debug_collection);
app.add_systems(Update, debug_view_window.run_if(in_state(GameState::InRun)));}fn finish(&self, app: &mut App) {app.configure_loading_state(LoadingStateConfig::new(GameState::Booting).load_collection::<DebugAssets>(),);
fn setup_debug_collection(// mut machines: ResMut<Assets<fundsp_kira::Machine>>,asset_server: Res<AssetServer>,mut commands: Commands,) {// use fundsp::hacker32::*;// let noisy_handle = machines.add(fundsp_kira::Machine::new(// pink() * envelope(|t| exp(-5.0 * t)),// // pink() * 0.2,// ));let noisy_handle = asset_server.load("debug.sfxr.ron");commands.insert_resource(DebugAssets { noisy_handle })}
if let Some(assets) = assets {track.play(assets.noisy_handle.clone());} else {warn!("Debug asset noisy_handle not loaded...");
track.play(assets.noisy_handle.clone());}ui.collapsing("Debug Sfxr", |ui| {// Show our homeworkif let Some(sfxr) = sfxrs.get(assets.noisy_handle_sfxr.clone()) {ui.label(format!("{sfxr:#?}"));