use alloc::{format, string::ToString};
use core::fmt::{self, Display};
use crate::{Meta, voice::Voice};
pub mod express;
pub use self::express::{Express, express};
crate::element::el! {
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Element<'s> {
Express(Express<'s>)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MicrosoftViseme {
ById,
FacialExpression
}
impl Display for MicrosoftViseme {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
MicrosoftViseme::ById => "redlips_front",
MicrosoftViseme::FacialExpression => "FacialExpression"
})
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MicrosoftVoiceEffect {
Automobile,
Telecom
}
impl Display for MicrosoftVoiceEffect {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
MicrosoftVoiceEffect::Automobile => "eq_car",
MicrosoftVoiceEffect::Telecom => "eq_telecomhp8k"
})
}
}
pub trait MicrosoftVoiceExt {
fn with_mstts_viseme(self, config: MicrosoftViseme) -> Self;
fn with_mstts_effect(self, effect: MicrosoftVoiceEffect) -> Self;
}
impl<'s> MicrosoftVoiceExt for Voice<'s> {
fn with_mstts_viseme(mut self, config: MicrosoftViseme) -> Self {
self.children.insert(
0,
Meta::new(format!("<mstts:viseme type=\"{config}\" />"))
.with_name("MicrosoftViseme")
.into()
);
self
}
fn with_mstts_effect(mut self, effect: MicrosoftVoiceEffect) -> Self {
self.attrs.push(("effect".into(), effect.to_string().into()));
self
}
}