macro_rules! assert_audio_unit_snapshot {
($unit:expr) => { ... };
($name:expr, $unit:expr) => { ... };
($name:expr, $unit:expr, $input:expr) => { ... };
($name:expr, $unit:expr, $input:expr, $config:expr) => { ... };
}Expand description
Macro for audio unit snapshot testing
This macro processes an audio unit with the given configuration, generates an SVG visualization, and asserts it against a stored snapshot.
ยงExamples
use fundsp::prelude::*;
use insta_fun::prelude::*;
// With a custom name
let unit = saw_hz(220.0);
assert_audio_unit_snapshot!("doc_sawtooth", unit);
// With input source
let unit = lowpass_hz(1000.0, 1.0);
assert_audio_unit_snapshot!("doc_lowpass", unit, InputSource::impulse());
// With input source and custom config
let config = SnapshotConfigBuilder::default().num_samples(512).build().unwrap();
let unit = highpass_hz(2000.0, 0.7);
assert_audio_unit_snapshot!("doc_highpass", unit, InputSource::sine(100.0, 44100.0), config);