diff --git a/src/audiobank.rs b/src/audiobank.rs index a6647bda23..655982fe9f 100644 --- a/src/audiobank.rs +++ b/src/audiobank.rs @@ -264,36 +264,6 @@ impl Audiobank { Some(all_samples) } - /** Get a diphone in the form "{first}_{second}.wav". */ - pub fn get_diphone(&self, speaker: &str, first: &str, second: &str) - -> Option> { - - if check_path(speaker).is_err() - || check_path(first).is_err() - || check_path(second).is_err() { - return None; - } - - let path = self.audio_path.join(format!("{}/", speaker)) - .join("2-phones/") - .join(format!("{}_{}.wav", first, second)); - - let mut reader = match WavReader::open(path) { - Err(_) => { return None; }, - Ok(reader) => reader, - }; - - // TODO: Inefficient. - let mut all_samples = Vec::new(); - let samples = reader.samples::(); - for sample in samples { - all_samples.push(sample.unwrap()); - } - - Some(all_samples) - } - - /** * Get the miscellaneous sound effect file. */ diff --git a/src/handlers/audio_synth_handler.rs b/src/handlers/audio_synth_handler.rs index 9393d910ac..f66798017b 100644 --- a/src/handlers/audio_synth_handler.rs +++ b/src/handlers/audio_synth_handler.rs @@ -1,5 +1,4 @@ // Copyright (c) 2015 Brandon Thomas -// TODO: This looks really bad now. Needs cleanup. use config::Config; use crypto::digest::Digest; @@ -119,7 +118,6 @@ impl SpeakRequest { }, }; - let sen = match get_str(params, SENTENCE_PARAM) { Some(s) => s.to_string(), None => { @@ -294,7 +292,6 @@ impl AudioSynthHandler { synth.generate(&request.sentence, &request.speaker, params) } - } fn get_str<'a>(params: &'a QueryParams, param_name: &str) diff --git a/src/main.rs b/src/main.rs index 8316ee0ea8..aa31607105 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,7 +20,6 @@ extern crate urlencoded; pub mod audiobank; pub mod config; -pub mod effects; pub mod error; pub mod handlers; pub mod lang; diff --git a/src/effects/mod.rs b/src/synthesis/effects/mod.rs similarity index 100% rename from src/effects/mod.rs rename to src/synthesis/effects/mod.rs diff --git a/src/effects/pause.rs b/src/synthesis/effects/pause.rs similarity index 100% rename from src/effects/pause.rs rename to src/synthesis/effects/pause.rs diff --git a/src/effects/speed.rs b/src/synthesis/effects/speed.rs similarity index 100% rename from src/effects/speed.rs rename to src/synthesis/effects/speed.rs diff --git a/src/effects/volume.rs b/src/synthesis/effects/volume.rs similarity index 100% rename from src/effects/volume.rs rename to src/synthesis/effects/volume.rs diff --git a/src/synthesis/mod.rs b/src/synthesis/mod.rs index 310896c522..0531f70717 100644 --- a/src/synthesis/mod.rs +++ b/src/synthesis/mod.rs @@ -1,4 +1,5 @@ // Copyright (c) 2016 Brandon Thomas +pub mod effects; pub mod synthesizer; pub mod tokens; diff --git a/src/synthesis/synthesizer.rs b/src/synthesis/synthesizer.rs index 7be30d6e7b..3c284b1a68 100644 --- a/src/synthesis/synthesizer.rs +++ b/src/synthesis/synthesizer.rs @@ -3,9 +3,6 @@ use audiobank::Audiobank; use audiobank::SampleBytes; use audiobank::SamplePreference; -use effects::pause::generate_pause; -use effects::speed::change_speed; -use effects::volume::change_volume; use error::SynthError; use hound::WavSpec; use hound::WavWriter; @@ -14,6 +11,9 @@ use lang::parser::Parser; use speaker::Speaker; use std::io::BufWriter; use std::io::Cursor; +use synthesis::effects::pause::generate_pause; +use synthesis::effects::speed::change_speed; +use synthesis::effects::volume::change_volume; use synthesis::tokens::*; pub type WavBytes = Vec; @@ -38,11 +38,6 @@ pub struct SynthesisParams { * Generates wave files from text input. */ pub struct Synthesizer { - // TODO: For now we rely on word files existing on the filesystem - // at runtime. This is pretty lame. - ///// Word dictionary - //word_dictionary: Vocabulary, - /// Arpabet, (Word) -> (PhonemeList) arpabet_dictionary: Arpabet, @@ -72,7 +67,7 @@ impl Synthesizer { sentence: &str, speaker: &Speaker, params: SynthesisParams) - -> Result { + -> Result { let tokens = self.parser.parse(sentence); @@ -594,4 +589,3 @@ impl Synthesizer { } } } -