mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-29 17:55:45 +01:00
audio-dsp: drop the allocation-counter dev-dependency and its tests/it test
The tests/it binary held only the no-allocation test, which replaced the global allocator with allocation-counter. Both are removed, along with the Cargo.lock entries the dev-dependency added.
This commit is contained in:
1 parent
c4bd9e32bc
commit
7582fbeb65
4 files changed
-54
No files matched your search
Generated
-9
@@ -180,12 +180,6 @@ dependencies = [
|
||||
"alloc-no-stdlib 3.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "allocation-counter"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "beb9e990c0a33699f1984d85a6abead615ccc72dd8130bf3e15dcabe2ca149c9"
|
||||
|
||||
[[package]]
|
||||
name = "allocator-api2"
|
||||
version = "0.2.21"
|
||||
@@ -1643,9 +1637,6 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-audio-dsp"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"allocation-counter",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-ber"
|
||||
|
||||
@@ -12,7 +12,3 @@ workspace = true
|
||||
|
||||
# No dependencies: planar `&mut [f32]` slices in, planar slices out.
|
||||
[dependencies]
|
||||
|
||||
[dev-dependencies]
|
||||
# Counts heap allocations in tests/it, the one test binary it replaces the global allocator in.
|
||||
allocation-counter = "0.8"
|
||||
@@ -1,3 +0,0 @@
|
||||
//! Integration tests of craft-audio-dsp.
|
||||
|
||||
mod no_alloc;
|
||||
@@ -1,38 +0,0 @@
|
||||
//! Processing, parameter changes and resets do not allocate.
|
||||
|
||||
use craft_audio_dsp::create_effect;
|
||||
|
||||
/// The voice pitch shifter runs a voiced tone through 10,000 blocks of 480 frames, with its
|
||||
/// pitch, its fine tune and a return to no shift changed between blocks, and a reset, without one
|
||||
/// heap allocation.
|
||||
#[test]
|
||||
fn voice_pitch_does_not_allocate_while_processing() {
|
||||
let Some(mut fx) = create_effect("voice_pitch", 48_000.0, 2) else { panic!("voice_pitch is not registered") };
|
||||
let tone: Vec<f32> = (0..480).map(|i| (0.4 * (std::f64::consts::TAU * 150.0 * i as f64 / 48_000.0).sin()) as f32).collect();
|
||||
let (mut l, mut r) = (tone.clone(), tone.clone());
|
||||
let info = allocation_counter::measure(|| {
|
||||
for block in 0..10_000u32 {
|
||||
match block % 500 {
|
||||
0 => {
|
||||
fx.set_param("semitones", (block / 500 % 7) as f32 * 4.0 - 12.0);
|
||||
}
|
||||
250 => {
|
||||
fx.set_param("cents", -35.0);
|
||||
}
|
||||
499 => {
|
||||
fx.set_param("semitones", 0.0);
|
||||
fx.set_param("cents", 0.0);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if block == 7_777 {
|
||||
fx.reset();
|
||||
}
|
||||
l.copy_from_slice(&tone);
|
||||
r.copy_from_slice(&tone);
|
||||
fx.process(&mut [&mut l, &mut r]);
|
||||
}
|
||||
});
|
||||
assert_eq!(info.count_total, 0, "{info:?}");
|
||||
assert!(l.iter().chain(&r).all(|v| v.is_finite()));
|
||||
}
|
||||
Reference in new issue
Block a user