MCPcopy Create free account
hub / github.com/BillyDM/Firewheel / new

Method new

examples/visual_node_graph/src/system.rs:73–143  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

71
72impl AudioSystem {
73 pub fn new() -> Self {
74 let mut cx = FirewheelContext::new(Default::default());
75 let stream = CpalStream::new(
76 &mut cx,
77 CpalConfig {
78 output: Default::default(),
79 input: Some(Default::default()),
80 },
81 )
82 .unwrap();
83
84 let sample_rate = cx.stream_info().unwrap().sample_rate;
85
86 let cache = SymphoniumCache::default();
87
88 // Load all samples
89 let samples = SAMPLE_PATHS
90 .iter()
91 .map(|path| {
92 let probed = symphonium::probe_from_file(
93 path, None, // Custom container probe
94 )
95 .unwrap();
96 firewheel::dyn_symphonium_resource(
97 symphonium::decode(
98 probed,
99 &symphonium::DecodeConfig::default(),
100 Some(sample_rate), // target sample rate
101 Some(&cache), // An optional cache
102 None, // Custom codec registry
103 )
104 .unwrap(),
105 )
106 })
107 .collect();
108
109 let loaded = IR_SAMPLE_PATHS
110 .iter()
111 .map(|path| {
112 let probed = symphonium::probe_from_file(
113 path, None, // Custom container probe
114 )
115 .unwrap();
116 SymphoniumAudioF32(
117 symphonium::decode_f32(
118 probed,
119 &symphonium::DecodeConfig::default(),
120 Some(sample_rate), // target sample rate
121 Some(&cache), // An optional cache
122 None, // Custom codec registry
123 )
124 .unwrap(),
125 )
126 })
127 .collect::<Vec<_>>();
128
129 // Process samples to get multiple channels from few files
130 let ir_samples = vec![

Callers

nothing calls this directly

Calls 4

dyn_symphonium_resourceFunction · 0.85
SymphoniumAudioF32Class · 0.85
collectMethod · 0.80
stream_infoMethod · 0.45

Tested by

no test coverage detected