use std::sync::Arc; use toid::music_state::states::{MusicState, MusicStateEvent}; use toid::music_state::wave_reader::{WaveReader, WaveReaderEvent}; use toid::outputters::portaudio_outputter::PortAudioOutputter; use toid::players::local_player::LocalPlayer; use toid::players::player::Player; fn main() { let player = LocalPlayer::new(); let player = Arc::new(player); player .get_resource_manager() .register(String::from("./toid-sample-resource/sf2/sf2.toml")) .unwrap(); player .get_resource_manager() .register(String::from("./toid-sample-resource/samples/samples.toml")) .unwrap(); let mut portaudio_outputter = PortAudioOutputter::new(Arc::clone(&player) as Arc< dyn Player< MusicState, MusicStateEvent, WaveReader, (Vec, Vec), WaveReaderEvent, >, >) .unwrap(); portaudio_outputter.set_volume(0.3); player.load_state("states.json".to_string()).unwrap(); portaudio_outputter.run().unwrap(); portaudio_outputter.sleep(12000); }