Struct VVClient

Source
pub struct VVClient {
    pub host: String,
    pub port: i32,
    pub speakers: Vec<Speaker>,
    pub dct: HashMap<String, usize>,
    pub hm: HashMap<i32, (usize, usize)>,
    pub ac_tpl: Option<(AhoCorasick, Vec<String>)>,
    pub words: BTreeMap<i32, (String, String)>,
    pub words_file: String,
    pub cfg_path: String,
    pub stream_tpl: Option<(OutputStream, OutputStreamHandle)>,
    pub sink: Option<Sink>,
}
Expand description

VOICEVOX Client

Fields§

§host: String

host

§port: i32

port

§speakers: Vec<Speaker>

speakers

§dct: HashMap<String, usize>

dct (name, index)

§hm: HashMap<i32, (usize, usize)>

hm (speaker_id, (index of speakers, index of styles))

§ac_tpl: Option<(AhoCorasick, Vec<String>)>

ac_tpl

§words: BTreeMap<i32, (String, String)>

words (String, String)

§words_file: String

words file

§cfg_path: String

cfg path

§stream_tpl: Option<(OutputStream, OutputStreamHandle)>

stream_tpl

§sink: Option<Sink>

sink

Implementations§

Source§

impl VVClient

VOICEVOX Client implementation

Source

pub fn new() -> VVClient

constructor VOICEVOX Client

Source

pub fn words_path(&self) -> Result<String, Box<dyn Error>>

path to words

Source

pub fn load_words(&mut self) -> Result<(), Box<dyn Error>>

load words (called inner constructor)

Source

pub fn save_words(&self) -> Result<(), Box<dyn Error>>

save words

Source

pub fn get_speakers(&mut self) -> Result<(), Box<dyn Error>>

get speakers (called inner constructor)

Source

pub fn display_speakers(&self) -> Result<(), Box<dyn Error>>

display speaker names

Source

pub fn find(&self, name: &str) -> Option<usize>

find speaker idx

Source

pub fn speaker(&self, name: &str, ss: &str) -> Option<i32>

find speaker id

Source

pub fn name(&self, idx: usize) -> &String

get speaker name

Source

pub fn style_name(&self, idx: (usize, usize)) -> &String

get style name

Source

pub fn style_id(&self, idx: (usize, usize)) -> i32

get style id (speaker id)

Source

pub fn detail_speaker(&self, id: i32) -> (bool, String)

detail speaker

Source

pub fn query(&self, txt: &str, id: i32) -> Result<String, Box<dyn Error>>

audio query as string

Source

pub fn phrases(&self, qs: &String) -> Result<Phrases, Box<dyn Error>>

audio query string to json object Phrases

Source

pub fn phrases_to_str(&self, ps: &Phrases) -> Result<String, Box<dyn Error>>

json object Phrases to string

Source

pub fn synth(&self, qs: String, id: i32) -> Result<Vec<u8>, Box<dyn Error>>

synthesis

Source

pub fn speak(&self, dat: Vec<u8>, sec: u64) -> Result<(), Box<dyn Error>>

speak

Source

pub fn speak_flush(&self) -> Result<(), Box<dyn Error>>

speak_flush

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,