use crate::pack::{FetchProgress, Pack, PackFile};
use oa::{Engine, Result};
use std::path::PathBuf;
pub(crate) const LJSPEECH_PACK: Pack = Pack {
name: "ljspeech",
version: "1.1.0",
license: "public domain (librivox)",
files: &[PackFile {
name: "LJSpeech-1.1.tar.bz2",
size: 2_748_572_632,
shake256: "7b8a9d69d9004dec8c9b5f43684944b072b5713e3aa8b9a94ec039f920f9c40a",
urls: &["https://data.keithito.com/data/speech/LJSpeech-1.1.tar.bz2"],
}],
};
pub const SAMPLE_RATE: usize = 22050;
#[derive(Clone, Debug, Default)]
pub struct LjSpeechConfig {
pub cache_dir: Option<PathBuf>,
}
impl LjSpeechConfig {
#[inline]
#[must_use]
pub fn new() -> Self {
Self::default()
}
}
impl super::LjSpeech {
#[inline]
pub fn load(config: &LjSpeechConfig) -> Result<Self> {
Self::load_on(&Engine::current()?, config)
}
#[inline]
pub fn load_on(engine: &Engine, config: &LjSpeechConfig) -> Result<Self> {
Self::load_with_progress_on(engine, config, &mut |_| true)
}
#[inline]
pub fn load_with_progress(
config: &LjSpeechConfig,
progress: &mut impl FnMut(FetchProgress) -> bool,
) -> Result<Self> {
Self::load_with_progress_on(&Engine::current()?, config, progress)
}
}