@ondewo/t2s-client-angular
Version:
ONDEWO Text 2 Speech (T2S) Client library for Angular
1,298 lines (1,297 loc) • 337 kB
JavaScript
import { uint8ArrayToBase64, GrpcMetadata, GrpcCallType } from '@ngx-grpc/common';
import { BinaryReader, BinaryWriter } from 'google-protobuf';
import * as googleProtobuf001 from '@ngx-grpc/well-known-types';
import * as i0 from '@angular/core';
import { InjectionToken, Optional, Inject, Injectable } from '@angular/core';
import * as i1 from '@ngx-grpc/core';
import { throwStatusErrors, takeMessages, GRPC_CLIENT_FACTORY } from '@ngx-grpc/core';
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
//
// THIS IS A GENERATED FILE
// DO NOT MODIFY IT! YOUR CHANGES WILL BE LOST
var Pcm;
(function (Pcm) {
Pcm[Pcm["PCM_16"] = 0] = "PCM_16";
Pcm[Pcm["PCM_24"] = 1] = "PCM_24";
Pcm[Pcm["PCM_32"] = 2] = "PCM_32";
Pcm[Pcm["PCM_S8"] = 3] = "PCM_S8";
Pcm[Pcm["PCM_U8"] = 4] = "PCM_U8";
Pcm[Pcm["FLOAT"] = 5] = "FLOAT";
Pcm[Pcm["DOUBLE"] = 6] = "DOUBLE";
})(Pcm || (Pcm = {}));
var AudioFormat;
(function (AudioFormat) {
AudioFormat[AudioFormat["wav"] = 0] = "wav";
AudioFormat[AudioFormat["flac"] = 1] = "flac";
AudioFormat[AudioFormat["caf"] = 2] = "caf";
AudioFormat[AudioFormat["mp3"] = 3] = "mp3";
AudioFormat[AudioFormat["aac"] = 4] = "aac";
AudioFormat[AudioFormat["ogg"] = 5] = "ogg";
AudioFormat[AudioFormat["wma"] = 6] = "wma";
})(AudioFormat || (AudioFormat = {}));
/**
* Message implementation for ondewo.t2s.SynthesizeRequest
*/
class SynthesizeRequest {
static id = 'ondewo.t2s.SynthesizeRequest';
/**
* Deserialize binary data to message
* @param instance message instance
*/
static deserializeBinary(bytes) {
const instance = new SynthesizeRequest();
SynthesizeRequest.deserializeBinaryFromReader(instance, new BinaryReader(bytes));
return instance;
}
/**
* Check all the properties and set default protobuf values if necessary
* @param _instance message instance
*/
static refineValues(_instance) {
_instance.text = _instance.text || '';
_instance.config = _instance.config || undefined;
}
/**
* Deserializes / reads binary message into message instance using provided binary reader
* @param _instance message instance
* @param _reader binary reader instance
*/
static deserializeBinaryFromReader(_instance, _reader) {
while (_reader.nextField()) {
if (_reader.isEndGroup())
break;
switch (_reader.getFieldNumber()) {
case 1:
_instance.text = _reader.readString();
break;
case 2:
_instance.config = new RequestConfig();
_reader.readMessage(_instance.config, RequestConfig.deserializeBinaryFromReader);
break;
default:
_reader.skipField();
}
}
SynthesizeRequest.refineValues(_instance);
}
/**
* Serializes a message to binary format using provided binary reader
* @param _instance message instance
* @param _writer binary writer instance
*/
static serializeBinaryToWriter(_instance, _writer) {
if (_instance.text) {
_writer.writeString(1, _instance.text);
}
if (_instance.config) {
_writer.writeMessage(2, _instance.config, RequestConfig.serializeBinaryToWriter);
}
}
_text;
_config;
/**
* Message constructor. Initializes the properties and applies default Protobuf values if necessary
* @param _value initial values object or instance of SynthesizeRequest to deeply clone from
*/
constructor(_value) {
_value = _value || {};
this.text = _value.text;
this.config = _value.config ? new RequestConfig(_value.config) : undefined;
SynthesizeRequest.refineValues(this);
}
get text() {
return this._text;
}
set text(value) {
this._text = value;
}
get config() {
return this._config;
}
set config(value) {
this._config = value;
}
/**
* Serialize message to binary data
* @param instance message instance
*/
serializeBinary() {
const writer = new BinaryWriter();
SynthesizeRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
}
/**
* Cast message to standard JavaScript object (all non-primitive values are deeply cloned)
*/
toObject() {
return {
text: this.text,
config: this.config ? this.config.toObject() : undefined
};
}
/**
* Convenience method to support JSON.stringify(message), replicates the structure of toObject()
*/
toJSON() {
return this.toObject();
}
/**
* Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json
* Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc.
* If the message itself or some of descendant messages is google.protobuf.Any, you MUST provide a message pool as options. If not, the messagePool is not required
*/
toProtobufJSON(
// @ts-ignore
options) {
return {
text: this.text,
config: this.config ? this.config.toProtobufJSON(options) : null
};
}
}
/**
* Message implementation for ondewo.t2s.BatchSynthesizeRequest
*/
class BatchSynthesizeRequest {
static id = 'ondewo.t2s.BatchSynthesizeRequest';
/**
* Deserialize binary data to message
* @param instance message instance
*/
static deserializeBinary(bytes) {
const instance = new BatchSynthesizeRequest();
BatchSynthesizeRequest.deserializeBinaryFromReader(instance, new BinaryReader(bytes));
return instance;
}
/**
* Check all the properties and set default protobuf values if necessary
* @param _instance message instance
*/
static refineValues(_instance) {
_instance.batchRequest = _instance.batchRequest || [];
}
/**
* Deserializes / reads binary message into message instance using provided binary reader
* @param _instance message instance
* @param _reader binary reader instance
*/
static deserializeBinaryFromReader(_instance, _reader) {
while (_reader.nextField()) {
if (_reader.isEndGroup())
break;
switch (_reader.getFieldNumber()) {
case 1:
const messageInitializer1 = new SynthesizeRequest();
_reader.readMessage(messageInitializer1, SynthesizeRequest.deserializeBinaryFromReader);
(_instance.batchRequest = _instance.batchRequest || []).push(messageInitializer1);
break;
default:
_reader.skipField();
}
}
BatchSynthesizeRequest.refineValues(_instance);
}
/**
* Serializes a message to binary format using provided binary reader
* @param _instance message instance
* @param _writer binary writer instance
*/
static serializeBinaryToWriter(_instance, _writer) {
if (_instance.batchRequest && _instance.batchRequest.length) {
_writer.writeRepeatedMessage(1, _instance.batchRequest, SynthesizeRequest.serializeBinaryToWriter);
}
}
_batchRequest;
/**
* Message constructor. Initializes the properties and applies default Protobuf values if necessary
* @param _value initial values object or instance of BatchSynthesizeRequest to deeply clone from
*/
constructor(_value) {
_value = _value || {};
this.batchRequest = (_value.batchRequest || []).map(m => new SynthesizeRequest(m));
BatchSynthesizeRequest.refineValues(this);
}
get batchRequest() {
return this._batchRequest;
}
set batchRequest(value) {
this._batchRequest = value;
}
/**
* Serialize message to binary data
* @param instance message instance
*/
serializeBinary() {
const writer = new BinaryWriter();
BatchSynthesizeRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
}
/**
* Cast message to standard JavaScript object (all non-primitive values are deeply cloned)
*/
toObject() {
return {
batchRequest: (this.batchRequest || []).map(m => m.toObject())
};
}
/**
* Convenience method to support JSON.stringify(message), replicates the structure of toObject()
*/
toJSON() {
return this.toObject();
}
/**
* Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json
* Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc.
* If the message itself or some of descendant messages is google.protobuf.Any, you MUST provide a message pool as options. If not, the messagePool is not required
*/
toProtobufJSON(
// @ts-ignore
options) {
return {
batchRequest: (this.batchRequest || []).map(m => m.toProtobufJSON(options))
};
}
}
/**
* Message implementation for ondewo.t2s.StreamingSynthesizeRequest
*/
class StreamingSynthesizeRequest {
static id = 'ondewo.t2s.StreamingSynthesizeRequest';
/**
* Deserialize binary data to message
* @param instance message instance
*/
static deserializeBinary(bytes) {
const instance = new StreamingSynthesizeRequest();
StreamingSynthesizeRequest.deserializeBinaryFromReader(instance, new BinaryReader(bytes));
return instance;
}
/**
* Check all the properties and set default protobuf values if necessary
* @param _instance message instance
*/
static refineValues(_instance) {
_instance.text = _instance.text || '';
_instance.config = _instance.config || undefined;
}
/**
* Deserializes / reads binary message into message instance using provided binary reader
* @param _instance message instance
* @param _reader binary reader instance
*/
static deserializeBinaryFromReader(_instance, _reader) {
while (_reader.nextField()) {
if (_reader.isEndGroup())
break;
switch (_reader.getFieldNumber()) {
case 1:
_instance.text = _reader.readString();
break;
case 2:
_instance.config = new RequestConfig();
_reader.readMessage(_instance.config, RequestConfig.deserializeBinaryFromReader);
break;
default:
_reader.skipField();
}
}
StreamingSynthesizeRequest.refineValues(_instance);
}
/**
* Serializes a message to binary format using provided binary reader
* @param _instance message instance
* @param _writer binary writer instance
*/
static serializeBinaryToWriter(_instance, _writer) {
if (_instance.text) {
_writer.writeString(1, _instance.text);
}
if (_instance.config) {
_writer.writeMessage(2, _instance.config, RequestConfig.serializeBinaryToWriter);
}
}
_text;
_config;
/**
* Message constructor. Initializes the properties and applies default Protobuf values if necessary
* @param _value initial values object or instance of StreamingSynthesizeRequest to deeply clone from
*/
constructor(_value) {
_value = _value || {};
this.text = _value.text;
this.config = _value.config ? new RequestConfig(_value.config) : undefined;
StreamingSynthesizeRequest.refineValues(this);
}
get text() {
return this._text;
}
set text(value) {
this._text = value;
}
get config() {
return this._config;
}
set config(value) {
this._config = value;
}
/**
* Serialize message to binary data
* @param instance message instance
*/
serializeBinary() {
const writer = new BinaryWriter();
StreamingSynthesizeRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
}
/**
* Cast message to standard JavaScript object (all non-primitive values are deeply cloned)
*/
toObject() {
return {
text: this.text,
config: this.config ? this.config.toObject() : undefined
};
}
/**
* Convenience method to support JSON.stringify(message), replicates the structure of toObject()
*/
toJSON() {
return this.toObject();
}
/**
* Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json
* Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc.
* If the message itself or some of descendant messages is google.protobuf.Any, you MUST provide a message pool as options. If not, the messagePool is not required
*/
toProtobufJSON(
// @ts-ignore
options) {
return {
text: this.text,
config: this.config ? this.config.toProtobufJSON(options) : null
};
}
}
/**
* Message implementation for ondewo.t2s.BatchSynthesizeResponse
*/
class BatchSynthesizeResponse {
static id = 'ondewo.t2s.BatchSynthesizeResponse';
/**
* Deserialize binary data to message
* @param instance message instance
*/
static deserializeBinary(bytes) {
const instance = new BatchSynthesizeResponse();
BatchSynthesizeResponse.deserializeBinaryFromReader(instance, new BinaryReader(bytes));
return instance;
}
/**
* Check all the properties and set default protobuf values if necessary
* @param _instance message instance
*/
static refineValues(_instance) {
_instance.batchResponse = _instance.batchResponse || [];
}
/**
* Deserializes / reads binary message into message instance using provided binary reader
* @param _instance message instance
* @param _reader binary reader instance
*/
static deserializeBinaryFromReader(_instance, _reader) {
while (_reader.nextField()) {
if (_reader.isEndGroup())
break;
switch (_reader.getFieldNumber()) {
case 1:
const messageInitializer1 = new SynthesizeResponse();
_reader.readMessage(messageInitializer1, SynthesizeResponse.deserializeBinaryFromReader);
(_instance.batchResponse = _instance.batchResponse || []).push(messageInitializer1);
break;
default:
_reader.skipField();
}
}
BatchSynthesizeResponse.refineValues(_instance);
}
/**
* Serializes a message to binary format using provided binary reader
* @param _instance message instance
* @param _writer binary writer instance
*/
static serializeBinaryToWriter(_instance, _writer) {
if (_instance.batchResponse && _instance.batchResponse.length) {
_writer.writeRepeatedMessage(1, _instance.batchResponse, SynthesizeResponse.serializeBinaryToWriter);
}
}
_batchResponse;
/**
* Message constructor. Initializes the properties and applies default Protobuf values if necessary
* @param _value initial values object or instance of BatchSynthesizeResponse to deeply clone from
*/
constructor(_value) {
_value = _value || {};
this.batchResponse = (_value.batchResponse || []).map(m => new SynthesizeResponse(m));
BatchSynthesizeResponse.refineValues(this);
}
get batchResponse() {
return this._batchResponse;
}
set batchResponse(value) {
this._batchResponse = value;
}
/**
* Serialize message to binary data
* @param instance message instance
*/
serializeBinary() {
const writer = new BinaryWriter();
BatchSynthesizeResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
}
/**
* Cast message to standard JavaScript object (all non-primitive values are deeply cloned)
*/
toObject() {
return {
batchResponse: (this.batchResponse || []).map(m => m.toObject())
};
}
/**
* Convenience method to support JSON.stringify(message), replicates the structure of toObject()
*/
toJSON() {
return this.toObject();
}
/**
* Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json
* Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc.
* If the message itself or some of descendant messages is google.protobuf.Any, you MUST provide a message pool as options. If not, the messagePool is not required
*/
toProtobufJSON(
// @ts-ignore
options) {
return {
batchResponse: (this.batchResponse || []).map(m => m.toProtobufJSON(options))
};
}
}
/**
* Message implementation for ondewo.t2s.RequestConfig
*/
class RequestConfig {
static id = 'ondewo.t2s.RequestConfig';
/**
* Deserialize binary data to message
* @param instance message instance
*/
static deserializeBinary(bytes) {
const instance = new RequestConfig();
RequestConfig.deserializeBinaryFromReader(instance, new BinaryReader(bytes));
return instance;
}
/**
* Check all the properties and set default protobuf values if necessary
* @param _instance message instance
*/
static refineValues(_instance) {
_instance.t2sPipelineId = _instance.t2sPipelineId || '';
_instance.t2sServiceConfig = _instance.t2sServiceConfig || undefined;
_instance.t2sCloudProviderConfig =
_instance.t2sCloudProviderConfig || undefined;
_instance.wordToPhonemeMapping =
_instance.wordToPhonemeMapping || undefined;
}
/**
* Deserializes / reads binary message into message instance using provided binary reader
* @param _instance message instance
* @param _reader binary reader instance
*/
static deserializeBinaryFromReader(_instance, _reader) {
while (_reader.nextField()) {
if (_reader.isEndGroup())
break;
switch (_reader.getFieldNumber()) {
case 1:
_instance.t2sPipelineId = _reader.readString();
break;
case 2:
_instance.lengthScale = _reader.readFloat();
break;
case 3:
_instance.noiseScale = _reader.readFloat();
break;
case 4:
_instance.sampleRate = _reader.readInt32();
break;
case 5:
_instance.pcm = _reader.readEnum();
break;
case 6:
_instance.audioFormat = _reader.readEnum();
break;
case 7:
_instance.useCache = _reader.readBool();
break;
case 9:
_instance.t2sServiceConfig = new googleProtobuf001.Struct();
_reader.readMessage(_instance.t2sServiceConfig, googleProtobuf001.Struct.deserializeBinaryFromReader);
break;
case 10:
_instance.t2sCloudProviderConfig = new T2sCloudProviderConfig();
_reader.readMessage(_instance.t2sCloudProviderConfig, T2sCloudProviderConfig.deserializeBinaryFromReader);
break;
case 11:
_instance.t2sNormalization = new T2SNormalization();
_reader.readMessage(_instance.t2sNormalization, T2SNormalization.deserializeBinaryFromReader);
break;
case 12:
_instance.wordToPhonemeMapping = new googleProtobuf001.Struct();
_reader.readMessage(_instance.wordToPhonemeMapping, googleProtobuf001.Struct.deserializeBinaryFromReader);
break;
default:
_reader.skipField();
}
}
RequestConfig.refineValues(_instance);
}
/**
* Serializes a message to binary format using provided binary reader
* @param _instance message instance
* @param _writer binary writer instance
*/
static serializeBinaryToWriter(_instance, _writer) {
if (_instance.t2sPipelineId) {
_writer.writeString(1, _instance.t2sPipelineId);
}
if (_instance.lengthScale || _instance.lengthScale === 0) {
_writer.writeFloat(2, _instance.lengthScale);
}
if (_instance.noiseScale || _instance.noiseScale === 0) {
_writer.writeFloat(3, _instance.noiseScale);
}
if (_instance.sampleRate || _instance.sampleRate === 0) {
_writer.writeInt32(4, _instance.sampleRate);
}
if (_instance.pcm || _instance.pcm === 0) {
_writer.writeEnum(5, _instance.pcm);
}
if (_instance.audioFormat || _instance.audioFormat === 0) {
_writer.writeEnum(6, _instance.audioFormat);
}
if (_instance.useCache || _instance.useCache === false) {
_writer.writeBool(7, _instance.useCache);
}
if (_instance.t2sServiceConfig) {
_writer.writeMessage(9, _instance.t2sServiceConfig, googleProtobuf001.Struct.serializeBinaryToWriter);
}
if (_instance.t2sCloudProviderConfig) {
_writer.writeMessage(10, _instance.t2sCloudProviderConfig, T2sCloudProviderConfig.serializeBinaryToWriter);
}
if (_instance.t2sNormalization) {
_writer.writeMessage(11, _instance.t2sNormalization, T2SNormalization.serializeBinaryToWriter);
}
if (_instance.wordToPhonemeMapping) {
_writer.writeMessage(12, _instance.wordToPhonemeMapping, googleProtobuf001.Struct.serializeBinaryToWriter);
}
}
_t2sPipelineId;
_lengthScale;
_noiseScale;
_sampleRate;
_pcm;
_audioFormat;
_useCache;
_t2sServiceConfig;
_t2sCloudProviderConfig;
_t2sNormalization;
_wordToPhonemeMapping;
_oneofLengthScale = RequestConfig.OneofLengthScaleCase.none;
_oneofNoiseScale = RequestConfig.OneofNoiseScaleCase.none;
_oneofSampleRate = RequestConfig.OneofSampleRateCase.none;
_oneofPcm = RequestConfig.OneofPcmCase.none;
_oneofAudioFormat = RequestConfig.OneofAudioFormatCase.none;
_oneofUseCache = RequestConfig.OneofUseCacheCase.none;
_oneofT2sNormalization = RequestConfig.OneofT2sNormalizationCase.none;
/**
* Message constructor. Initializes the properties and applies default Protobuf values if necessary
* @param _value initial values object or instance of RequestConfig to deeply clone from
*/
constructor(_value) {
_value = _value || {};
this.t2sPipelineId = _value.t2sPipelineId;
this.lengthScale = _value.lengthScale;
this.noiseScale = _value.noiseScale;
this.sampleRate = _value.sampleRate;
this.pcm = _value.pcm;
this.audioFormat = _value.audioFormat;
this.useCache = _value.useCache;
this.t2sServiceConfig = _value.t2sServiceConfig
? new googleProtobuf001.Struct(_value.t2sServiceConfig)
: undefined;
this.t2sCloudProviderConfig = _value.t2sCloudProviderConfig
? new T2sCloudProviderConfig(_value.t2sCloudProviderConfig)
: undefined;
this.t2sNormalization = _value.t2sNormalization
? new T2SNormalization(_value.t2sNormalization)
: undefined;
this.wordToPhonemeMapping = _value.wordToPhonemeMapping
? new googleProtobuf001.Struct(_value.wordToPhonemeMapping)
: undefined;
RequestConfig.refineValues(this);
}
get t2sPipelineId() {
return this._t2sPipelineId;
}
set t2sPipelineId(value) {
this._t2sPipelineId = value;
}
get lengthScale() {
return this._lengthScale;
}
set lengthScale(value) {
if (value !== undefined && value !== null) {
this._oneofLengthScale = RequestConfig.OneofLengthScaleCase.lengthScale;
}
this._lengthScale = value;
}
get noiseScale() {
return this._noiseScale;
}
set noiseScale(value) {
if (value !== undefined && value !== null) {
this._oneofNoiseScale = RequestConfig.OneofNoiseScaleCase.noiseScale;
}
this._noiseScale = value;
}
get sampleRate() {
return this._sampleRate;
}
set sampleRate(value) {
if (value !== undefined && value !== null) {
this._oneofSampleRate = RequestConfig.OneofSampleRateCase.sampleRate;
}
this._sampleRate = value;
}
get pcm() {
return this._pcm;
}
set pcm(value) {
if (value !== undefined && value !== null) {
this._oneofPcm = RequestConfig.OneofPcmCase.pcm;
}
this._pcm = value;
}
get audioFormat() {
return this._audioFormat;
}
set audioFormat(value) {
if (value !== undefined && value !== null) {
this._oneofAudioFormat = RequestConfig.OneofAudioFormatCase.audioFormat;
}
this._audioFormat = value;
}
get useCache() {
return this._useCache;
}
set useCache(value) {
if (value !== undefined && value !== null) {
this._oneofUseCache = RequestConfig.OneofUseCacheCase.useCache;
}
this._useCache = value;
}
get t2sServiceConfig() {
return this._t2sServiceConfig;
}
set t2sServiceConfig(value) {
this._t2sServiceConfig = value;
}
get t2sCloudProviderConfig() {
return this._t2sCloudProviderConfig;
}
set t2sCloudProviderConfig(value) {
this._t2sCloudProviderConfig = value;
}
get t2sNormalization() {
return this._t2sNormalization;
}
set t2sNormalization(value) {
if (value !== undefined && value !== null) {
this._oneofT2sNormalization =
RequestConfig.OneofT2sNormalizationCase.t2sNormalization;
}
this._t2sNormalization = value;
}
get wordToPhonemeMapping() {
return this._wordToPhonemeMapping;
}
set wordToPhonemeMapping(value) {
this._wordToPhonemeMapping = value;
}
get oneofLengthScale() {
return this._oneofLengthScale;
}
get oneofNoiseScale() {
return this._oneofNoiseScale;
}
get oneofSampleRate() {
return this._oneofSampleRate;
}
get oneofPcm() {
return this._oneofPcm;
}
get oneofAudioFormat() {
return this._oneofAudioFormat;
}
get oneofUseCache() {
return this._oneofUseCache;
}
get oneofT2sNormalization() {
return this._oneofT2sNormalization;
}
/**
* Serialize message to binary data
* @param instance message instance
*/
serializeBinary() {
const writer = new BinaryWriter();
RequestConfig.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
}
/**
* Cast message to standard JavaScript object (all non-primitive values are deeply cloned)
*/
toObject() {
return {
t2sPipelineId: this.t2sPipelineId,
lengthScale: this.lengthScale,
noiseScale: this.noiseScale,
sampleRate: this.sampleRate,
pcm: this.pcm,
audioFormat: this.audioFormat,
useCache: this.useCache,
t2sServiceConfig: this.t2sServiceConfig
? this.t2sServiceConfig.toObject()
: undefined,
t2sCloudProviderConfig: this.t2sCloudProviderConfig
? this.t2sCloudProviderConfig.toObject()
: undefined,
t2sNormalization: this.t2sNormalization
? this.t2sNormalization.toObject()
: undefined,
wordToPhonemeMapping: this.wordToPhonemeMapping
? this.wordToPhonemeMapping.toObject()
: undefined
};
}
/**
* Convenience method to support JSON.stringify(message), replicates the structure of toObject()
*/
toJSON() {
return this.toObject();
}
/**
* Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json
* Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc.
* If the message itself or some of descendant messages is google.protobuf.Any, you MUST provide a message pool as options. If not, the messagePool is not required
*/
toProtobufJSON(
// @ts-ignore
options) {
return {
t2sPipelineId: this.t2sPipelineId,
lengthScale: this.lengthScale === null || this.lengthScale === undefined
? null
: this.lengthScale,
noiseScale: this.noiseScale === null || this.noiseScale === undefined
? null
: this.noiseScale,
sampleRate: this.sampleRate === null || this.sampleRate === undefined
? null
: this.sampleRate,
pcm: this.pcm === undefined
? null
: Pcm[this.pcm === null || this.pcm === undefined ? 0 : this.pcm],
audioFormat: this.audioFormat === undefined
? null
: AudioFormat[this.audioFormat === null || this.audioFormat === undefined
? 0
: this.audioFormat],
useCache: this.useCache,
t2sServiceConfig: this.t2sServiceConfig
? this.t2sServiceConfig.toProtobufJSON(options)
: null,
t2sCloudProviderConfig: this.t2sCloudProviderConfig
? this.t2sCloudProviderConfig.toProtobufJSON(options)
: null,
t2sNormalization: this.t2sNormalization
? this.t2sNormalization.toProtobufJSON(options)
: null,
wordToPhonemeMapping: this.wordToPhonemeMapping
? this.wordToPhonemeMapping.toProtobufJSON(options)
: null
};
}
}
(function (RequestConfig) {
let OneofLengthScaleCase;
(function (OneofLengthScaleCase) {
OneofLengthScaleCase[OneofLengthScaleCase["none"] = 0] = "none";
OneofLengthScaleCase[OneofLengthScaleCase["lengthScale"] = 1] = "lengthScale";
})(OneofLengthScaleCase = RequestConfig.OneofLengthScaleCase || (RequestConfig.OneofLengthScaleCase = {}));
let OneofNoiseScaleCase;
(function (OneofNoiseScaleCase) {
OneofNoiseScaleCase[OneofNoiseScaleCase["none"] = 0] = "none";
OneofNoiseScaleCase[OneofNoiseScaleCase["noiseScale"] = 1] = "noiseScale";
})(OneofNoiseScaleCase = RequestConfig.OneofNoiseScaleCase || (RequestConfig.OneofNoiseScaleCase = {}));
let OneofSampleRateCase;
(function (OneofSampleRateCase) {
OneofSampleRateCase[OneofSampleRateCase["none"] = 0] = "none";
OneofSampleRateCase[OneofSampleRateCase["sampleRate"] = 1] = "sampleRate";
})(OneofSampleRateCase = RequestConfig.OneofSampleRateCase || (RequestConfig.OneofSampleRateCase = {}));
let OneofPcmCase;
(function (OneofPcmCase) {
OneofPcmCase[OneofPcmCase["none"] = 0] = "none";
OneofPcmCase[OneofPcmCase["pcm"] = 1] = "pcm";
})(OneofPcmCase = RequestConfig.OneofPcmCase || (RequestConfig.OneofPcmCase = {}));
let OneofAudioFormatCase;
(function (OneofAudioFormatCase) {
OneofAudioFormatCase[OneofAudioFormatCase["none"] = 0] = "none";
OneofAudioFormatCase[OneofAudioFormatCase["audioFormat"] = 1] = "audioFormat";
})(OneofAudioFormatCase = RequestConfig.OneofAudioFormatCase || (RequestConfig.OneofAudioFormatCase = {}));
let OneofUseCacheCase;
(function (OneofUseCacheCase) {
OneofUseCacheCase[OneofUseCacheCase["none"] = 0] = "none";
OneofUseCacheCase[OneofUseCacheCase["useCache"] = 1] = "useCache";
})(OneofUseCacheCase = RequestConfig.OneofUseCacheCase || (RequestConfig.OneofUseCacheCase = {}));
let OneofT2sNormalizationCase;
(function (OneofT2sNormalizationCase) {
OneofT2sNormalizationCase[OneofT2sNormalizationCase["none"] = 0] = "none";
OneofT2sNormalizationCase[OneofT2sNormalizationCase["t2sNormalization"] = 1] = "t2sNormalization";
})(OneofT2sNormalizationCase = RequestConfig.OneofT2sNormalizationCase || (RequestConfig.OneofT2sNormalizationCase = {}));
})(RequestConfig || (RequestConfig = {}));
/**
* Message implementation for ondewo.t2s.T2sCloudProviderConfig
*/
class T2sCloudProviderConfig {
static id = 'ondewo.t2s.T2sCloudProviderConfig';
/**
* Deserialize binary data to message
* @param instance message instance
*/
static deserializeBinary(bytes) {
const instance = new T2sCloudProviderConfig();
T2sCloudProviderConfig.deserializeBinaryFromReader(instance, new BinaryReader(bytes));
return instance;
}
/**
* Check all the properties and set default protobuf values if necessary
* @param _instance message instance
*/
static refineValues(_instance) {
_instance.t2sCloudProviderConfigElevenlabs =
_instance.t2sCloudProviderConfigElevenlabs || undefined;
_instance.t2sCloudProviderConfigGoogle =
_instance.t2sCloudProviderConfigGoogle || undefined;
_instance.t2sCloudProviderConfigMicrosoft =
_instance.t2sCloudProviderConfigMicrosoft || undefined;
}
/**
* Deserializes / reads binary message into message instance using provided binary reader
* @param _instance message instance
* @param _reader binary reader instance
*/
static deserializeBinaryFromReader(_instance, _reader) {
while (_reader.nextField()) {
if (_reader.isEndGroup())
break;
switch (_reader.getFieldNumber()) {
case 1:
_instance.t2sCloudProviderConfigElevenlabs = new T2sCloudProviderConfigElevenLabs();
_reader.readMessage(_instance.t2sCloudProviderConfigElevenlabs, T2sCloudProviderConfigElevenLabs.deserializeBinaryFromReader);
break;
case 2:
_instance.t2sCloudProviderConfigGoogle = new T2sCloudProviderConfigGoogle();
_reader.readMessage(_instance.t2sCloudProviderConfigGoogle, T2sCloudProviderConfigGoogle.deserializeBinaryFromReader);
break;
case 3:
_instance.t2sCloudProviderConfigMicrosoft = new T2sCloudProviderConfigMicrosoft();
_reader.readMessage(_instance.t2sCloudProviderConfigMicrosoft, T2sCloudProviderConfigMicrosoft.deserializeBinaryFromReader);
break;
default:
_reader.skipField();
}
}
T2sCloudProviderConfig.refineValues(_instance);
}
/**
* Serializes a message to binary format using provided binary reader
* @param _instance message instance
* @param _writer binary writer instance
*/
static serializeBinaryToWriter(_instance, _writer) {
if (_instance.t2sCloudProviderConfigElevenlabs) {
_writer.writeMessage(1, _instance.t2sCloudProviderConfigElevenlabs, T2sCloudProviderConfigElevenLabs.serializeBinaryToWriter);
}
if (_instance.t2sCloudProviderConfigGoogle) {
_writer.writeMessage(2, _instance.t2sCloudProviderConfigGoogle, T2sCloudProviderConfigGoogle.serializeBinaryToWriter);
}
if (_instance.t2sCloudProviderConfigMicrosoft) {
_writer.writeMessage(3, _instance.t2sCloudProviderConfigMicrosoft, T2sCloudProviderConfigMicrosoft.serializeBinaryToWriter);
}
}
_t2sCloudProviderConfigElevenlabs;
_t2sCloudProviderConfigGoogle;
_t2sCloudProviderConfigMicrosoft;
/**
* Message constructor. Initializes the properties and applies default Protobuf values if necessary
* @param _value initial values object or instance of T2sCloudProviderConfig to deeply clone from
*/
constructor(_value) {
_value = _value || {};
this.t2sCloudProviderConfigElevenlabs = _value.t2sCloudProviderConfigElevenlabs
? new T2sCloudProviderConfigElevenLabs(_value.t2sCloudProviderConfigElevenlabs)
: undefined;
this.t2sCloudProviderConfigGoogle = _value.t2sCloudProviderConfigGoogle
? new T2sCloudProviderConfigGoogle(_value.t2sCloudProviderConfigGoogle)
: undefined;
this.t2sCloudProviderConfigMicrosoft = _value.t2sCloudProviderConfigMicrosoft
? new T2sCloudProviderConfigMicrosoft(_value.t2sCloudProviderConfigMicrosoft)
: undefined;
T2sCloudProviderConfig.refineValues(this);
}
get t2sCloudProviderConfigElevenlabs() {
return this._t2sCloudProviderConfigElevenlabs;
}
set t2sCloudProviderConfigElevenlabs(value) {
this._t2sCloudProviderConfigElevenlabs = value;
}
get t2sCloudProviderConfigGoogle() {
return this._t2sCloudProviderConfigGoogle;
}
set t2sCloudProviderConfigGoogle(value) {
this._t2sCloudProviderConfigGoogle = value;
}
get t2sCloudProviderConfigMicrosoft() {
return this._t2sCloudProviderConfigMicrosoft;
}
set t2sCloudProviderConfigMicrosoft(value) {
this._t2sCloudProviderConfigMicrosoft = value;
}
/**
* Serialize message to binary data
* @param instance message instance
*/
serializeBinary() {
const writer = new BinaryWriter();
T2sCloudProviderConfig.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
}
/**
* Cast message to standard JavaScript object (all non-primitive values are deeply cloned)
*/
toObject() {
return {
t2sCloudProviderConfigElevenlabs: this.t2sCloudProviderConfigElevenlabs
? this.t2sCloudProviderConfigElevenlabs.toObject()
: undefined,
t2sCloudProviderConfigGoogle: this.t2sCloudProviderConfigGoogle
? this.t2sCloudProviderConfigGoogle.toObject()
: undefined,
t2sCloudProviderConfigMicrosoft: this.t2sCloudProviderConfigMicrosoft
? this.t2sCloudProviderConfigMicrosoft.toObject()
: undefined
};
}
/**
* Convenience method to support JSON.stringify(message), replicates the structure of toObject()
*/
toJSON() {
return this.toObject();
}
/**
* Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json
* Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc.
* If the message itself or some of descendant messages is google.protobuf.Any, you MUST provide a message pool as options. If not, the messagePool is not required
*/
toProtobufJSON(
// @ts-ignore
options) {
return {
t2sCloudProviderConfigElevenlabs: this.t2sCloudProviderConfigElevenlabs
? this.t2sCloudProviderConfigElevenlabs.toProtobufJSON(options)
: null,
t2sCloudProviderConfigGoogle: this.t2sCloudProviderConfigGoogle
? this.t2sCloudProviderConfigGoogle.toProtobufJSON(options)
: null,
t2sCloudProviderConfigMicrosoft: this.t2sCloudProviderConfigMicrosoft
? this.t2sCloudProviderConfigMicrosoft.toProtobufJSON(options)
: null
};
}
}
/**
* Message implementation for ondewo.t2s.T2sCloudProviderConfigElevenLabs
*/
class T2sCloudProviderConfigElevenLabs {
static id = 'ondewo.t2s.T2sCloudProviderConfigElevenLabs';
/**
* Deserialize binary data to message
* @param instance message instance
*/
static deserializeBinary(bytes) {
const instance = new T2sCloudProviderConfigElevenLabs();
T2sCloudProviderConfigElevenLabs.deserializeBinaryFromReader(instance, new BinaryReader(bytes));
return instance;
}
/**
* Check all the properties and set default protobuf values if necessary
* @param _instance message instance
*/
static refineValues(_instance) {
_instance.stability = _instance.stability || 0;
_instance.similarityBoost = _instance.similarityBoost || 0;
_instance.style = _instance.style || 0;
_instance.useSpeakerBoost = _instance.useSpeakerBoost || false;
_instance.applyTextNormalization = _instance.applyTextNormalization || '';
}
/**
* Deserializes / reads binary message into message instance using provided binary reader
* @param _instance message instance
* @param _reader binary reader instance
*/
static deserializeBinaryFromReader(_instance, _reader) {
while (_reader.nextField()) {
if (_reader.isEndGroup())
break;
switch (_reader.getFieldNumber()) {
case 1:
_instance.stability = _reader.readFloat();
break;
case 2:
_instance.similarityBoost = _reader.readFloat();
break;
case 3:
_instance.style = _reader.readFloat();
break;
case 4:
_instance.useSpeakerBoost = _reader.readBool();
break;
case 5:
_instance.applyTextNormalization = _reader.readString();
break;
default:
_reader.skipField();
}
}
T2sCloudProviderConfigElevenLabs.refineValues(_instance);
}
/**
* Serializes a message to binary format using provided binary reader
* @param _instance message instance
* @param _writer binary writer instance
*/
static serializeBinaryToWriter(_instance, _writer) {
if (_instance.stability) {
_writer.writeFloat(1, _instance.stability);
}
if (_instance.similarityBoost) {
_writer.writeFloat(2, _instance.similarityBoost);
}
if (_instance.style) {
_writer.writeFloat(3, _instance.style);
}
if (_instance.useSpeakerBoost) {
_writer.writeBool(4, _instance.useSpeakerBoost);
}
if (_instance.applyTextNormalization) {
_writer.writeString(5, _instance.applyTextNormalization);
}
}
_stability;
_similarityBoost;
_style;
_useSpeakerBoost;
_applyTextNormalization;
/**
* Message constructor. Initializes the properties and applies default Protobuf values if necessary
* @param _value initial values object or instance of T2sCloudProviderConfigElevenLabs to deeply clone from
*/
constructor(_value) {
_value = _value || {};
this.stability = _value.stability;
this.similarityBoost = _value.similarityBoost;
this.style = _value.style;
this.useSpeakerBoost = _value.useSpeakerBoost;
this.applyTextNormalization = _value.applyTextNormalization;
T2sCloudProviderConfigElevenLabs.refineValues(this);
}
get stability() {
return this._stability;
}
set stability(value) {
this._stability = value;
}
get similarityBoost() {
return this._similarityBoost;
}
set similarityBoost(value) {
this._similarityBoost = value;
}
get style() {
return this._style;
}
set style(value) {
this._style = value;
}
get useSpeakerBoost() {
return this._useSpeakerBoost;
}
set useSpeakerBoost(value) {
this._useSpeakerBoost = value;
}
get applyTextNormalization() {
return this._applyTextNormalization;
}
set applyTextNormalization(value) {
this._applyTextNormalization = value;
}
/**
* Serialize message to binary data
* @param instance message instance
*/
serializeBinary() {
const writer = new BinaryWriter();
T2sCloudProviderConfigElevenLabs.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
}
/**
* Cast message to standard JavaScript object (all non-primitive values are deeply cloned)
*/
toObject() {
return {
stability: this.stability,
similarityBoost: this.similarityBoost,
style: this.style,
useSpeakerBoost: this.useSpeakerBoost,
applyTextNormalization: this.applyTextNormalization
};
}
/**
* Convenience method to support JSON.stringify(message), replicates the structure of toObject()
*/
toJSON() {
return this.toObject();
}
/**
* Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json
* Attention: output differs from toObject() e.g. enums are represented as names and not as numbers, Timestamp is an ISO Date string format etc.
* If the message itself or some of descendant messages is google.protobuf.Any, you MUST provide a message pool as options. If not, the messagePool is not required
*/
toProtobufJSON(
// @ts-ignore
options) {
return {
stability: this.stability,
similarityBoost: this.similarityBoost,
style: this.style,
useSpeakerBoost: this.useSpeakerBoost,
applyTextNormalization: this.applyTextNormalization
};
}
}
/**
* Message implementation for ondewo.t2s.T2sCloudProviderConfigMicrosoft
*/
class T2sCloudProviderConfigMicrosoft {
static id = 'ondewo.t2s.T2sCloudProviderConfigMicrosoft';
/**
* Deserialize binary data to message
* @param instance message instance
*/
static deserializeBinary(bytes) {
const instance = new T2sCloudProviderConfigMicrosoft();
T2sCloudProviderConfigMicrosoft.deserializeBinaryFromReader(instance, new BinaryReader(bytes));
return instance;
}
/**
* Check all the properties and set default protobuf values if necessary
* @param _instance message instance
*/
static refineValues(_instance) {
_instance.useDefaultSpeaker = _instance.useDefaultSpeaker || false;
}
/**
* Deserializes / reads binary message into message instance using provided binary reader
* @param _instance message instance
* @param _reader binary reader instance
*/
static deserializeBinaryFromReader(_instance, _reader) {
while (_reader.nextField()) {
if (_reader.isEndGroup())
break;
switch (_reader.getFieldNumber()) {
case 1:
_instance.useDefaultSpeaker = _reader.readBool();
break;
default:
_reader.skipField();
}
}
T2sCloudProviderConfigMicrosoft.refineValues(_instance);
}
/**
* Serializes a message to binary format using provided binary reader
* @param _instance message instance
* @param _writer binary writer instance
*/
static serializeBinaryToWriter(_instance, _writer) {
if (_instance.useDefaultSpeaker) {
_writer.writeBool(1, _instance.useDefaultSpeaker);
}
}
_useDefaultSpeaker;
/**
* Message constructor. Initializes the properties and applies default Protobuf values if necessary
* @param _value initial values object or instance of T2sCloudProviderConfigMicrosoft to deeply clone from
*/
constructor(_value) {
_value = _value || {};
this.useDefaultSpeaker = _value.useDefaultSpeaker;
T2sCloudProviderConfigMicrosoft.refineValues(this);
}
get useDefaultSpeaker() {
return this._useDefaultSpeaker;
}
set useDefaultSpeaker(value) {
this._useDefaultSpeaker = value;
}
/**
* Serialize message to binary data
* @param instance message instance
*/
serializeBinary() {
const writer = new BinaryWriter();
T2sCloudProviderConfigMicrosoft.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
}
/**
* Cast message to standard JavaScript object (all non-primitive values are deeply cloned)
*/
toObject() {
return {
useDefaultSpeaker: this.useDefaultSpeaker
};
}
/**
* Convenience method to support JSON.stringify(message), replicates the structure of toObject()
*/
toJSON() {
return this.toObject();
}
/**
* Cast message to JSON using protobuf JSON notation: https://developers.google.com/protocol-buffers/docs/proto3#json
* Attention: output differs from toObject() e.g. enums are r