use crate::pack::{FetchProgress, Pack, PackFile};
use oa::{Engine, Result};
use std::path::PathBuf;
pub(crate) const VCTK_PACK: Pack = Pack {
name: "vctk",
version: "0.92.0",
license: "CC-BY-4.0",
files: &[PackFile {
name: "DS_10283_3443.zip",
size: 11_749_118_645,
shake256: "c19bf0fe7668604ce2b590e63fc52f54b63645f59b2f83600cce812da0a7c0a9",
urls: &["https://datashare.ed.ac.uk/download/DS_10283_3443.zip"],
}],
};
pub const SAMPLE_RATE: usize = 48000;
#[derive(Clone, Debug)]
pub struct VctkConfig {
pub mic: super::VctkMic,
pub cache_dir: Option<PathBuf>,
}
impl Default for VctkConfig {
fn default() -> Self {
Self {
mic: super::VctkMic::Mic1,
cache_dir: None,
}
}
}
impl VctkConfig {
#[inline]
#[must_use]
pub fn new() -> Self {
Self::default()
}
}
impl super::Vctk {
#[inline]
pub fn load(config: &VctkConfig) -> Result<Self> {
Self::load_on(&Engine::current()?, config)
}
#[inline]
pub fn load_on(engine: &Engine, config: &VctkConfig) -> Result<Self> {
Self::load_with_progress_on(engine, config, &mut |_| true)
}
#[inline]
pub fn load_with_progress(
config: &VctkConfig,
progress: &mut impl FnMut(FetchProgress) -> bool,
) -> Result<Self> {
Self::load_with_progress_on(&Engine::current()?, config, progress)
}
}