use audio_samples::operations::AudioVoiceActivityDetection;
use audio_samples::operations::types::VadConfig;
use audio_samples::sine_wave;
use criterion::{Criterion, black_box, criterion_group, criterion_main};
use std::time::Duration;

fn bench_vad_methods(c: &mut Criterion) {
    let audio = sine_wave::<f32, f32>(150.0, Duration::from_secs_f32(0.7), 44100, 0.5);
    let mut cfg = VadConfig::<f32>::energy_only();
    cfg.frame_size = 1024;
    cfg.hop_size = 512;
    cfg.validate().unwrap();

    c.bench_function("vad::voice_activity_mask", |b| {
        b.iter(|| black_box(audio.voice_activity_mask(&cfg).unwrap()))
    });

    c.bench_function("vad::speech_regions", |b| {
        b.iter(|| black_box(audio.speech_regions(&cfg).unwrap()))
    });
}

criterion_group!(benches, bench_vad_methods);
criterion_main!(benches);
