#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AudioContent {
#[prost(message, optional, tag = "2")]
pub audio_spec: ::core::option::Option<AudioFormatOptions>,
#[prost(oneof = "audio_content::AudioSource", tags = "1")]
pub audio_source: ::core::option::Option<audio_content::AudioSource>,
}
pub mod audio_content {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum AudioSource {
#[prost(bytes, tag = "1")]
Content(::prost::alloc::vec::Vec<u8>),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AudioFormatOptions {
#[prost(oneof = "audio_format_options::AudioFormat", tags = "1, 2")]
pub audio_format: ::core::option::Option<audio_format_options::AudioFormat>,
}
pub mod audio_format_options {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum AudioFormat {
#[prost(message, tag = "1")]
RawAudio(super::RawAudio),
#[prost(message, tag = "2")]
ContainerAudio(super::ContainerAudio),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawAudio {
#[prost(enumeration = "raw_audio::AudioEncoding", tag = "1")]
pub audio_encoding: i32,
#[prost(int64, tag = "2")]
pub sample_rate_hertz: i64,
}
pub mod raw_audio {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum AudioEncoding {
Unspecified = 0,
Linear16Pcm = 1,
}
impl AudioEncoding {
pub fn as_str_name(&self) -> &'static str {
match self {
AudioEncoding::Unspecified => "AUDIO_ENCODING_UNSPECIFIED",
AudioEncoding::Linear16Pcm => "LINEAR16_PCM",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"AUDIO_ENCODING_UNSPECIFIED" => Some(Self::Unspecified),
"LINEAR16_PCM" => Some(Self::Linear16Pcm),
_ => None,
}
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ContainerAudio {
#[prost(enumeration = "container_audio::ContainerAudioType", tag = "1")]
pub container_audio_type: i32,
}
pub mod container_audio {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ContainerAudioType {
Unspecified = 0,
Wav = 1,
OggOpus = 2,
Mp3 = 3,
}
impl ContainerAudioType {
pub fn as_str_name(&self) -> &'static str {
match self {
ContainerAudioType::Unspecified => "CONTAINER_AUDIO_TYPE_UNSPECIFIED",
ContainerAudioType::Wav => "WAV",
ContainerAudioType::OggOpus => "OGG_OPUS",
ContainerAudioType::Mp3 => "MP3",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CONTAINER_AUDIO_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"WAV" => Some(Self::Wav),
"OGG_OPUS" => Some(Self::OggOpus),
"MP3" => Some(Self::Mp3),
_ => None,
}
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextVariable {
#[prost(string, tag = "1")]
pub variable_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub variable_value: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AudioVariable {
#[prost(string, tag = "1")]
pub variable_name: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub variable_start_ms: i64,
#[prost(int64, tag = "3")]
pub variable_length_ms: i64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UtteranceSynthesisResponse {
#[prost(message, optional, tag = "1")]
pub audio_chunk: ::core::option::Option<AudioChunk>,
#[prost(message, optional, tag = "2")]
pub text_chunk: ::core::option::Option<TextChunk>,
#[prost(int64, tag = "3")]
pub start_ms: i64,
#[prost(int64, tag = "4")]
pub length_ms: i64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AudioTemplate {
#[prost(message, optional, tag = "1")]
pub audio: ::core::option::Option<AudioContent>,
#[prost(message, optional, tag = "2")]
pub text_template: ::core::option::Option<TextTemplate>,
#[prost(message, repeated, tag = "3")]
pub variables: ::prost::alloc::vec::Vec<AudioVariable>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AudioChunk {
#[prost(bytes = "vec", tag = "1")]
pub data: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextChunk {
#[prost(string, tag = "1")]
pub text: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextTemplate {
#[prost(string, tag = "1")]
pub text_template: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub variables: ::prost::alloc::vec::Vec<TextVariable>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DurationHint {
#[prost(enumeration = "duration_hint::DurationHintPolicy", tag = "1")]
pub policy: i32,
#[prost(int64, tag = "2")]
pub duration_ms: i64,
}
pub mod duration_hint {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum DurationHintPolicy {
Unspecified = 0,
ExactDuration = 1,
MinDuration = 2,
MaxDuration = 3,
}
impl DurationHintPolicy {
pub fn as_str_name(&self) -> &'static str {
match self {
DurationHintPolicy::Unspecified => "DURATION_HINT_POLICY_UNSPECIFIED",
DurationHintPolicy::ExactDuration => "EXACT_DURATION",
DurationHintPolicy::MinDuration => "MIN_DURATION",
DurationHintPolicy::MaxDuration => "MAX_DURATION",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"DURATION_HINT_POLICY_UNSPECIFIED" => Some(Self::Unspecified),
"EXACT_DURATION" => Some(Self::ExactDuration),
"MIN_DURATION" => Some(Self::MinDuration),
"MAX_DURATION" => Some(Self::MaxDuration),
_ => None,
}
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Hints {
#[prost(oneof = "hints::Hint", tags = "1, 2, 3, 4, 5, 6, 7")]
pub hint: ::core::option::Option<hints::Hint>,
}
pub mod hints {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Hint {
#[prost(string, tag = "1")]
Voice(::prost::alloc::string::String),
#[prost(message, tag = "2")]
AudioTemplate(super::AudioTemplate),
#[prost(double, tag = "3")]
Speed(f64),
#[prost(double, tag = "4")]
Volume(f64),
#[prost(string, tag = "5")]
Role(::prost::alloc::string::String),
#[prost(double, tag = "6")]
PitchShift(f64),
#[prost(message, tag = "7")]
Duration(super::DurationHint),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UtteranceSynthesisRequest {
#[prost(string, tag = "1")]
pub model: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "4")]
pub hints: ::prost::alloc::vec::Vec<Hints>,
#[prost(message, optional, tag = "5")]
pub output_audio_spec: ::core::option::Option<AudioFormatOptions>,
#[prost(
enumeration = "utterance_synthesis_request::LoudnessNormalizationType",
tag = "6"
)]
pub loudness_normalization_type: i32,
#[prost(bool, tag = "7")]
pub unsafe_mode: bool,
#[prost(oneof = "utterance_synthesis_request::Utterance", tags = "2, 3")]
pub utterance: ::core::option::Option<utterance_synthesis_request::Utterance>,
}
pub mod utterance_synthesis_request {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum LoudnessNormalizationType {
Unspecified = 0,
MaxPeak = 1,
Lufs = 2,
}
impl LoudnessNormalizationType {
pub fn as_str_name(&self) -> &'static str {
match self {
LoudnessNormalizationType::Unspecified => {
"LOUDNESS_NORMALIZATION_TYPE_UNSPECIFIED"
}
LoudnessNormalizationType::MaxPeak => "MAX_PEAK",
LoudnessNormalizationType::Lufs => "LUFS",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"LOUDNESS_NORMALIZATION_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"MAX_PEAK" => Some(Self::MaxPeak),
"LUFS" => Some(Self::Lufs),
_ => None,
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Utterance {
#[prost(string, tag = "2")]
Text(::prost::alloc::string::String),
#[prost(message, tag = "3")]
TextTemplate(super::TextTemplate),
}
}
pub mod synthesizer_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct SynthesizerClient<T> {
inner: tonic::client::Grpc<T>,
}
impl SynthesizerClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> SynthesizerClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> SynthesizerClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
SynthesizerClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn utterance_synthesis(
&mut self,
request: impl tonic::IntoRequest<super::UtteranceSynthesisRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::UtteranceSynthesisResponse>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/speechkit.tts.v3.Synthesizer/UtteranceSynthesis",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("speechkit.tts.v3.Synthesizer", "UtteranceSynthesis"),
);
self.inner.server_streaming(req, path, codec).await
}
}
}