use crate::audio::AudioFeatures;
use crate::mic::MicHandler;
use crate::model::Model;
use log::info;
use std::path::Path;
pub mod audio;
mod tests;
pub mod model;
pub mod mic;
pub const VOICE_SAMPLE_RATE: usize = 16000; pub const BUFFER_SECS: usize = 4;
pub const DETECTIONS_PER_SEC: u32 = 4; const WAV_STORING_DIR: &str = "recordings";
const QUIET_THRESHOLD: f32 = 100.0;
const CHUNK: usize = 1280;
pub fn create_unlock_task(model_path: &Path, detection_threshold: f32) -> Result<(), String> {
info!("Using unlock model {}", &model_path.to_str().unwrap());
let model = Model::new(&model_path, detection_threshold);
let audio = AudioFeatures::new();
let mut mic = MicHandler::new(audio, model, false).unwrap();
mic.loop_now()
}