// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/texttospeech/v1beta1/cloud_tts.proto

package com.google.cloud.texttospeech.v1beta1;

/**
 *
 *
 * <pre>
 * Description of audio data to be synthesized.
 * </pre>
 *
 * Protobuf type {@code google.cloud.texttospeech.v1beta1.AudioConfig}
 */
public final class AudioConfig extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.texttospeech.v1beta1.AudioConfig)
    AudioConfigOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use AudioConfig.newBuilder() to construct.
  private AudioConfig(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private AudioConfig() {
    audioEncoding_ = 0;
    speakingRate_ = 0D;
    pitch_ = 0D;
    volumeGainDb_ = 0D;
    sampleRateHertz_ = 0;
    effectsProfileId_ = com.google.protobuf.LazyStringArrayList.EMPTY;
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
    return this.unknownFields;
  }

  private AudioConfig(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new java.lang.NullPointerException();
    }
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          case 8:
            {
              int rawValue = input.readEnum();

              audioEncoding_ = rawValue;
              break;
            }
          case 17:
            {
              speakingRate_ = input.readDouble();
              break;
            }
          case 25:
            {
              pitch_ = input.readDouble();
              break;
            }
          case 33:
            {
              volumeGainDb_ = input.readDouble();
              break;
            }
          case 40:
            {
              sampleRateHertz_ = input.readInt32();
              break;
            }
          case 50:
            {
              java.lang.String s = input.readStringRequireUtf8();
              if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
                effectsProfileId_ = new com.google.protobuf.LazyStringArrayList();
                mutable_bitField0_ |= 0x00000020;
              }
              effectsProfileId_.add(s);
              break;
            }
          default:
            {
              if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
    } finally {
      if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
        effectsProfileId_ = effectsProfileId_.getUnmodifiableView();
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.texttospeech.v1beta1.TextToSpeechProto
        .internal_static_google_cloud_texttospeech_v1beta1_AudioConfig_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.texttospeech.v1beta1.TextToSpeechProto
        .internal_static_google_cloud_texttospeech_v1beta1_AudioConfig_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.texttospeech.v1beta1.AudioConfig.class,
            com.google.cloud.texttospeech.v1beta1.AudioConfig.Builder.class);
  }

  private int bitField0_;
  public static final int AUDIO_ENCODING_FIELD_NUMBER = 1;
  private int audioEncoding_;
  /**
   *
   *
   * <pre>
   * Required. The format of the requested audio byte stream.
   * </pre>
   *
   * <code>.google.cloud.texttospeech.v1beta1.AudioEncoding audio_encoding = 1;</code>
   */
  public int getAudioEncodingValue() {
    return audioEncoding_;
  }
  /**
   *
   *
   * <pre>
   * Required. The format of the requested audio byte stream.
   * </pre>
   *
   * <code>.google.cloud.texttospeech.v1beta1.AudioEncoding audio_encoding = 1;</code>
   */
  public com.google.cloud.texttospeech.v1beta1.AudioEncoding getAudioEncoding() {
    @SuppressWarnings("deprecation")
    com.google.cloud.texttospeech.v1beta1.AudioEncoding result =
        com.google.cloud.texttospeech.v1beta1.AudioEncoding.valueOf(audioEncoding_);
    return result == null
        ? com.google.cloud.texttospeech.v1beta1.AudioEncoding.UNRECOGNIZED
        : result;
  }

  public static final int SPEAKING_RATE_FIELD_NUMBER = 2;
  private double speakingRate_;
  /**
   *
   *
   * <pre>
   * Optional speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal
   * native speed supported by the specific voice. 2.0 is twice as fast, and
   * 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any
   * other values &lt; 0.25 or &gt; 4.0 will return an error.
   * </pre>
   *
   * <code>double speaking_rate = 2;</code>
   */
  public double getSpeakingRate() {
    return speakingRate_;
  }

  public static final int PITCH_FIELD_NUMBER = 3;
  private double pitch_;
  /**
   *
   *
   * <pre>
   * Optional speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20
   * semitones from the original pitch. -20 means decrease 20 semitones from the
   * original pitch.
   * </pre>
   *
   * <code>double pitch = 3;</code>
   */
  public double getPitch() {
    return pitch_;
  }

  public static final int VOLUME_GAIN_DB_FIELD_NUMBER = 4;
  private double volumeGainDb_;
  /**
   *
   *
   * <pre>
   * Optional volume gain (in dB) of the normal native volume supported by the
   * specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of
   * 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB)
   * will play at approximately half the amplitude of the normal native signal
   * amplitude. A value of +6.0 (dB) will play at approximately twice the
   * amplitude of the normal native signal amplitude. Strongly recommend not to
   * exceed +10 (dB) as there's usually no effective increase in loudness for
   * any value greater than that.
   * </pre>
   *
   * <code>double volume_gain_db = 4;</code>
   */
  public double getVolumeGainDb() {
    return volumeGainDb_;
  }

  public static final int SAMPLE_RATE_HERTZ_FIELD_NUMBER = 5;
  private int sampleRateHertz_;
  /**
   *
   *
   * <pre>
   * The synthesis sample rate (in hertz) for this audio. Optional.  If this is
   * different from the voice's natural sample rate, then the synthesizer will
   * honor this request by converting to the desired sample rate (which might
   * result in worse audio quality), unless the specified sample rate is not
   * supported for the encoding chosen, in which case it will fail the request
   * and return [google.rpc.Code.INVALID_ARGUMENT][].
   * </pre>
   *
   * <code>int32 sample_rate_hertz = 5;</code>
   */
  public int getSampleRateHertz() {
    return sampleRateHertz_;
  }

  public static final int EFFECTS_PROFILE_ID_FIELD_NUMBER = 6;
  private com.google.protobuf.LazyStringList effectsProfileId_;
  /**
   *
   *
   * <pre>
   * An identifier which selects 'audio effects' profiles that are applied on
   * (post synthesized) text to speech.
   * Effects are applied on top of each other in the order they are given.
   * </pre>
   *
   * <code>repeated string effects_profile_id = 6;</code>
   */
  public com.google.protobuf.ProtocolStringList getEffectsProfileIdList() {
    return effectsProfileId_;
  }
  /**
   *
   *
   * <pre>
   * An identifier which selects 'audio effects' profiles that are applied on
   * (post synthesized) text to speech.
   * Effects are applied on top of each other in the order they are given.
   * </pre>
   *
   * <code>repeated string effects_profile_id = 6;</code>
   */
  public int getEffectsProfileIdCount() {
    return effectsProfileId_.size();
  }
  /**
   *
   *
   * <pre>
   * An identifier which selects 'audio effects' profiles that are applied on
   * (post synthesized) text to speech.
   * Effects are applied on top of each other in the order they are given.
   * </pre>
   *
   * <code>repeated string effects_profile_id = 6;</code>
   */
  public java.lang.String getEffectsProfileId(int index) {
    return effectsProfileId_.get(index);
  }
  /**
   *
   *
   * <pre>
   * An identifier which selects 'audio effects' profiles that are applied on
   * (post synthesized) text to speech.
   * Effects are applied on top of each other in the order they are given.
   * </pre>
   *
   * <code>repeated string effects_profile_id = 6;</code>
   */
  public com.google.protobuf.ByteString getEffectsProfileIdBytes(int index) {
    return effectsProfileId_.getByteString(index);
  }

  private byte memoizedIsInitialized = -1;

  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (audioEncoding_
        != com.google.cloud.texttospeech.v1beta1.AudioEncoding.AUDIO_ENCODING_UNSPECIFIED
            .getNumber()) {
      output.writeEnum(1, audioEncoding_);
    }
    if (speakingRate_ != 0D) {
      output.writeDouble(2, speakingRate_);
    }
    if (pitch_ != 0D) {
      output.writeDouble(3, pitch_);
    }
    if (volumeGainDb_ != 0D) {
      output.writeDouble(4, volumeGainDb_);
    }
    if (sampleRateHertz_ != 0) {
      output.writeInt32(5, sampleRateHertz_);
    }
    for (int i = 0; i < effectsProfileId_.size(); i++) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 6, effectsProfileId_.getRaw(i));
    }
    unknownFields.writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (audioEncoding_
        != com.google.cloud.texttospeech.v1beta1.AudioEncoding.AUDIO_ENCODING_UNSPECIFIED
            .getNumber()) {
      size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, audioEncoding_);
    }
    if (speakingRate_ != 0D) {
      size += com.google.protobuf.CodedOutputStream.computeDoubleSize(2, speakingRate_);
    }
    if (pitch_ != 0D) {
      size += com.google.protobuf.CodedOutputStream.computeDoubleSize(3, pitch_);
    }
    if (volumeGainDb_ != 0D) {
      size += com.google.protobuf.CodedOutputStream.computeDoubleSize(4, volumeGainDb_);
    }
    if (sampleRateHertz_ != 0) {
      size += com.google.protobuf.CodedOutputStream.computeInt32Size(5, sampleRateHertz_);
    }
    {
      int dataSize = 0;
      for (int i = 0; i < effectsProfileId_.size(); i++) {
        dataSize += computeStringSizeNoTag(effectsProfileId_.getRaw(i));
      }
      size += dataSize;
      size += 1 * getEffectsProfileIdList().size();
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.cloud.texttospeech.v1beta1.AudioConfig)) {
      return super.equals(obj);
    }
    com.google.cloud.texttospeech.v1beta1.AudioConfig other =
        (com.google.cloud.texttospeech.v1beta1.AudioConfig) obj;

    boolean result = true;
    result = result && audioEncoding_ == other.audioEncoding_;
    result =
        result
            && (java.lang.Double.doubleToLongBits(getSpeakingRate())
                == java.lang.Double.doubleToLongBits(other.getSpeakingRate()));
    result =
        result
            && (java.lang.Double.doubleToLongBits(getPitch())
                == java.lang.Double.doubleToLongBits(other.getPitch()));
    result =
        result
            && (java.lang.Double.doubleToLongBits(getVolumeGainDb())
                == java.lang.Double.doubleToLongBits(other.getVolumeGainDb()));
    result = result && (getSampleRateHertz() == other.getSampleRateHertz());
    result = result && getEffectsProfileIdList().equals(other.getEffectsProfileIdList());
    result = result && unknownFields.equals(other.unknownFields);
    return result;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + AUDIO_ENCODING_FIELD_NUMBER;
    hash = (53 * hash) + audioEncoding_;
    hash = (37 * hash) + SPEAKING_RATE_FIELD_NUMBER;
    hash =
        (53 * hash)
            + com.google.protobuf.Internal.hashLong(
                java.lang.Double.doubleToLongBits(getSpeakingRate()));
    hash = (37 * hash) + PITCH_FIELD_NUMBER;
    hash =
        (53 * hash)
            + com.google.protobuf.Internal.hashLong(java.lang.Double.doubleToLongBits(getPitch()));
    hash = (37 * hash) + VOLUME_GAIN_DB_FIELD_NUMBER;
    hash =
        (53 * hash)
            + com.google.protobuf.Internal.hashLong(
                java.lang.Double.doubleToLongBits(getVolumeGainDb()));
    hash = (37 * hash) + SAMPLE_RATE_HERTZ_FIELD_NUMBER;
    hash = (53 * hash) + getSampleRateHertz();
    if (getEffectsProfileIdCount() > 0) {
      hash = (37 * hash) + EFFECTS_PROFILE_ID_FIELD_NUMBER;
      hash = (53 * hash) + getEffectsProfileIdList().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.texttospeech.v1beta1.AudioConfig parseFrom(
      java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.texttospeech.v1beta1.AudioConfig parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.texttospeech.v1beta1.AudioConfig parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.texttospeech.v1beta1.AudioConfig parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.texttospeech.v1beta1.AudioConfig parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.texttospeech.v1beta1.AudioConfig parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.texttospeech.v1beta1.AudioConfig parseFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.texttospeech.v1beta1.AudioConfig parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.cloud.texttospeech.v1beta1.AudioConfig parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.texttospeech.v1beta1.AudioConfig parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.cloud.texttospeech.v1beta1.AudioConfig parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.texttospeech.v1beta1.AudioConfig parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(com.google.cloud.texttospeech.v1beta1.AudioConfig prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *
   *
   * <pre>
   * Description of audio data to be synthesized.
   * </pre>
   *
   * Protobuf type {@code google.cloud.texttospeech.v1beta1.AudioConfig}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.texttospeech.v1beta1.AudioConfig)
      com.google.cloud.texttospeech.v1beta1.AudioConfigOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.texttospeech.v1beta1.TextToSpeechProto
          .internal_static_google_cloud_texttospeech_v1beta1_AudioConfig_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.texttospeech.v1beta1.TextToSpeechProto
          .internal_static_google_cloud_texttospeech_v1beta1_AudioConfig_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.texttospeech.v1beta1.AudioConfig.class,
              com.google.cloud.texttospeech.v1beta1.AudioConfig.Builder.class);
    }

    // Construct using com.google.cloud.texttospeech.v1beta1.AudioConfig.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }

    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {}
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      audioEncoding_ = 0;

      speakingRate_ = 0D;

      pitch_ = 0D;

      volumeGainDb_ = 0D;

      sampleRateHertz_ = 0;

      effectsProfileId_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000020);
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.texttospeech.v1beta1.TextToSpeechProto
          .internal_static_google_cloud_texttospeech_v1beta1_AudioConfig_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.texttospeech.v1beta1.AudioConfig getDefaultInstanceForType() {
      return com.google.cloud.texttospeech.v1beta1.AudioConfig.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.cloud.texttospeech.v1beta1.AudioConfig build() {
      com.google.cloud.texttospeech.v1beta1.AudioConfig result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.cloud.texttospeech.v1beta1.AudioConfig buildPartial() {
      com.google.cloud.texttospeech.v1beta1.AudioConfig result =
          new com.google.cloud.texttospeech.v1beta1.AudioConfig(this);
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      result.audioEncoding_ = audioEncoding_;
      result.speakingRate_ = speakingRate_;
      result.pitch_ = pitch_;
      result.volumeGainDb_ = volumeGainDb_;
      result.sampleRateHertz_ = sampleRateHertz_;
      if (((bitField0_ & 0x00000020) == 0x00000020)) {
        effectsProfileId_ = effectsProfileId_.getUnmodifiableView();
        bitField0_ = (bitField0_ & ~0x00000020);
      }
      result.effectsProfileId_ = effectsProfileId_;
      result.bitField0_ = to_bitField0_;
      onBuilt();
      return result;
    }

    @java.lang.Override
    public Builder clone() {
      return (Builder) super.clone();
    }

    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return (Builder) super.setField(field, value);
    }

    @java.lang.Override
    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
      return (Builder) super.clearField(field);
    }

    @java.lang.Override
    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return (Builder) super.clearOneof(oneof);
    }

    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
      return (Builder) super.setRepeatedField(field, index, value);
    }

    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return (Builder) super.addRepeatedField(field, value);
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.cloud.texttospeech.v1beta1.AudioConfig) {
        return mergeFrom((com.google.cloud.texttospeech.v1beta1.AudioConfig) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.texttospeech.v1beta1.AudioConfig other) {
      if (other == com.google.cloud.texttospeech.v1beta1.AudioConfig.getDefaultInstance())
        return this;
      if (other.audioEncoding_ != 0) {
        setAudioEncodingValue(other.getAudioEncodingValue());
      }
      if (other.getSpeakingRate() != 0D) {
        setSpeakingRate(other.getSpeakingRate());
      }
      if (other.getPitch() != 0D) {
        setPitch(other.getPitch());
      }
      if (other.getVolumeGainDb() != 0D) {
        setVolumeGainDb(other.getVolumeGainDb());
      }
      if (other.getSampleRateHertz() != 0) {
        setSampleRateHertz(other.getSampleRateHertz());
      }
      if (!other.effectsProfileId_.isEmpty()) {
        if (effectsProfileId_.isEmpty()) {
          effectsProfileId_ = other.effectsProfileId_;
          bitField0_ = (bitField0_ & ~0x00000020);
        } else {
          ensureEffectsProfileIdIsMutable();
          effectsProfileId_.addAll(other.effectsProfileId_);
        }
        onChanged();
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.google.cloud.texttospeech.v1beta1.AudioConfig parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage =
            (com.google.cloud.texttospeech.v1beta1.AudioConfig) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private int bitField0_;

    private int audioEncoding_ = 0;
    /**
     *
     *
     * <pre>
     * Required. The format of the requested audio byte stream.
     * </pre>
     *
     * <code>.google.cloud.texttospeech.v1beta1.AudioEncoding audio_encoding = 1;</code>
     */
    public int getAudioEncodingValue() {
      return audioEncoding_;
    }
    /**
     *
     *
     * <pre>
     * Required. The format of the requested audio byte stream.
     * </pre>
     *
     * <code>.google.cloud.texttospeech.v1beta1.AudioEncoding audio_encoding = 1;</code>
     */
    public Builder setAudioEncodingValue(int value) {
      audioEncoding_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. The format of the requested audio byte stream.
     * </pre>
     *
     * <code>.google.cloud.texttospeech.v1beta1.AudioEncoding audio_encoding = 1;</code>
     */
    public com.google.cloud.texttospeech.v1beta1.AudioEncoding getAudioEncoding() {
      @SuppressWarnings("deprecation")
      com.google.cloud.texttospeech.v1beta1.AudioEncoding result =
          com.google.cloud.texttospeech.v1beta1.AudioEncoding.valueOf(audioEncoding_);
      return result == null
          ? com.google.cloud.texttospeech.v1beta1.AudioEncoding.UNRECOGNIZED
          : result;
    }
    /**
     *
     *
     * <pre>
     * Required. The format of the requested audio byte stream.
     * </pre>
     *
     * <code>.google.cloud.texttospeech.v1beta1.AudioEncoding audio_encoding = 1;</code>
     */
    public Builder setAudioEncoding(com.google.cloud.texttospeech.v1beta1.AudioEncoding value) {
      if (value == null) {
        throw new NullPointerException();
      }

      audioEncoding_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. The format of the requested audio byte stream.
     * </pre>
     *
     * <code>.google.cloud.texttospeech.v1beta1.AudioEncoding audio_encoding = 1;</code>
     */
    public Builder clearAudioEncoding() {

      audioEncoding_ = 0;
      onChanged();
      return this;
    }

    private double speakingRate_;
    /**
     *
     *
     * <pre>
     * Optional speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal
     * native speed supported by the specific voice. 2.0 is twice as fast, and
     * 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any
     * other values &lt; 0.25 or &gt; 4.0 will return an error.
     * </pre>
     *
     * <code>double speaking_rate = 2;</code>
     */
    public double getSpeakingRate() {
      return speakingRate_;
    }
    /**
     *
     *
     * <pre>
     * Optional speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal
     * native speed supported by the specific voice. 2.0 is twice as fast, and
     * 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any
     * other values &lt; 0.25 or &gt; 4.0 will return an error.
     * </pre>
     *
     * <code>double speaking_rate = 2;</code>
     */
    public Builder setSpeakingRate(double value) {

      speakingRate_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal
     * native speed supported by the specific voice. 2.0 is twice as fast, and
     * 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any
     * other values &lt; 0.25 or &gt; 4.0 will return an error.
     * </pre>
     *
     * <code>double speaking_rate = 2;</code>
     */
    public Builder clearSpeakingRate() {

      speakingRate_ = 0D;
      onChanged();
      return this;
    }

    private double pitch_;
    /**
     *
     *
     * <pre>
     * Optional speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20
     * semitones from the original pitch. -20 means decrease 20 semitones from the
     * original pitch.
     * </pre>
     *
     * <code>double pitch = 3;</code>
     */
    public double getPitch() {
      return pitch_;
    }
    /**
     *
     *
     * <pre>
     * Optional speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20
     * semitones from the original pitch. -20 means decrease 20 semitones from the
     * original pitch.
     * </pre>
     *
     * <code>double pitch = 3;</code>
     */
    public Builder setPitch(double value) {

      pitch_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20
     * semitones from the original pitch. -20 means decrease 20 semitones from the
     * original pitch.
     * </pre>
     *
     * <code>double pitch = 3;</code>
     */
    public Builder clearPitch() {

      pitch_ = 0D;
      onChanged();
      return this;
    }

    private double volumeGainDb_;
    /**
     *
     *
     * <pre>
     * Optional volume gain (in dB) of the normal native volume supported by the
     * specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of
     * 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB)
     * will play at approximately half the amplitude of the normal native signal
     * amplitude. A value of +6.0 (dB) will play at approximately twice the
     * amplitude of the normal native signal amplitude. Strongly recommend not to
     * exceed +10 (dB) as there's usually no effective increase in loudness for
     * any value greater than that.
     * </pre>
     *
     * <code>double volume_gain_db = 4;</code>
     */
    public double getVolumeGainDb() {
      return volumeGainDb_;
    }
    /**
     *
     *
     * <pre>
     * Optional volume gain (in dB) of the normal native volume supported by the
     * specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of
     * 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB)
     * will play at approximately half the amplitude of the normal native signal
     * amplitude. A value of +6.0 (dB) will play at approximately twice the
     * amplitude of the normal native signal amplitude. Strongly recommend not to
     * exceed +10 (dB) as there's usually no effective increase in loudness for
     * any value greater than that.
     * </pre>
     *
     * <code>double volume_gain_db = 4;</code>
     */
    public Builder setVolumeGainDb(double value) {

      volumeGainDb_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional volume gain (in dB) of the normal native volume supported by the
     * specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of
     * 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB)
     * will play at approximately half the amplitude of the normal native signal
     * amplitude. A value of +6.0 (dB) will play at approximately twice the
     * amplitude of the normal native signal amplitude. Strongly recommend not to
     * exceed +10 (dB) as there's usually no effective increase in loudness for
     * any value greater than that.
     * </pre>
     *
     * <code>double volume_gain_db = 4;</code>
     */
    public Builder clearVolumeGainDb() {

      volumeGainDb_ = 0D;
      onChanged();
      return this;
    }

    private int sampleRateHertz_;
    /**
     *
     *
     * <pre>
     * The synthesis sample rate (in hertz) for this audio. Optional.  If this is
     * different from the voice's natural sample rate, then the synthesizer will
     * honor this request by converting to the desired sample rate (which might
     * result in worse audio quality), unless the specified sample rate is not
     * supported for the encoding chosen, in which case it will fail the request
     * and return [google.rpc.Code.INVALID_ARGUMENT][].
     * </pre>
     *
     * <code>int32 sample_rate_hertz = 5;</code>
     */
    public int getSampleRateHertz() {
      return sampleRateHertz_;
    }
    /**
     *
     *
     * <pre>
     * The synthesis sample rate (in hertz) for this audio. Optional.  If this is
     * different from the voice's natural sample rate, then the synthesizer will
     * honor this request by converting to the desired sample rate (which might
     * result in worse audio quality), unless the specified sample rate is not
     * supported for the encoding chosen, in which case it will fail the request
     * and return [google.rpc.Code.INVALID_ARGUMENT][].
     * </pre>
     *
     * <code>int32 sample_rate_hertz = 5;</code>
     */
    public Builder setSampleRateHertz(int value) {

      sampleRateHertz_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The synthesis sample rate (in hertz) for this audio. Optional.  If this is
     * different from the voice's natural sample rate, then the synthesizer will
     * honor this request by converting to the desired sample rate (which might
     * result in worse audio quality), unless the specified sample rate is not
     * supported for the encoding chosen, in which case it will fail the request
     * and return [google.rpc.Code.INVALID_ARGUMENT][].
     * </pre>
     *
     * <code>int32 sample_rate_hertz = 5;</code>
     */
    public Builder clearSampleRateHertz() {

      sampleRateHertz_ = 0;
      onChanged();
      return this;
    }

    private com.google.protobuf.LazyStringList effectsProfileId_ =
        com.google.protobuf.LazyStringArrayList.EMPTY;

    private void ensureEffectsProfileIdIsMutable() {
      if (!((bitField0_ & 0x00000020) == 0x00000020)) {
        effectsProfileId_ = new com.google.protobuf.LazyStringArrayList(effectsProfileId_);
        bitField0_ |= 0x00000020;
      }
    }
    /**
     *
     *
     * <pre>
     * An identifier which selects 'audio effects' profiles that are applied on
     * (post synthesized) text to speech.
     * Effects are applied on top of each other in the order they are given.
     * </pre>
     *
     * <code>repeated string effects_profile_id = 6;</code>
     */
    public com.google.protobuf.ProtocolStringList getEffectsProfileIdList() {
      return effectsProfileId_.getUnmodifiableView();
    }
    /**
     *
     *
     * <pre>
     * An identifier which selects 'audio effects' profiles that are applied on
     * (post synthesized) text to speech.
     * Effects are applied on top of each other in the order they are given.
     * </pre>
     *
     * <code>repeated string effects_profile_id = 6;</code>
     */
    public int getEffectsProfileIdCount() {
      return effectsProfileId_.size();
    }
    /**
     *
     *
     * <pre>
     * An identifier which selects 'audio effects' profiles that are applied on
     * (post synthesized) text to speech.
     * Effects are applied on top of each other in the order they are given.
     * </pre>
     *
     * <code>repeated string effects_profile_id = 6;</code>
     */
    public java.lang.String getEffectsProfileId(int index) {
      return effectsProfileId_.get(index);
    }
    /**
     *
     *
     * <pre>
     * An identifier which selects 'audio effects' profiles that are applied on
     * (post synthesized) text to speech.
     * Effects are applied on top of each other in the order they are given.
     * </pre>
     *
     * <code>repeated string effects_profile_id = 6;</code>
     */
    public com.google.protobuf.ByteString getEffectsProfileIdBytes(int index) {
      return effectsProfileId_.getByteString(index);
    }
    /**
     *
     *
     * <pre>
     * An identifier which selects 'audio effects' profiles that are applied on
     * (post synthesized) text to speech.
     * Effects are applied on top of each other in the order they are given.
     * </pre>
     *
     * <code>repeated string effects_profile_id = 6;</code>
     */
    public Builder setEffectsProfileId(int index, java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureEffectsProfileIdIsMutable();
      effectsProfileId_.set(index, value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * An identifier which selects 'audio effects' profiles that are applied on
     * (post synthesized) text to speech.
     * Effects are applied on top of each other in the order they are given.
     * </pre>
     *
     * <code>repeated string effects_profile_id = 6;</code>
     */
    public Builder addEffectsProfileId(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureEffectsProfileIdIsMutable();
      effectsProfileId_.add(value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * An identifier which selects 'audio effects' profiles that are applied on
     * (post synthesized) text to speech.
     * Effects are applied on top of each other in the order they are given.
     * </pre>
     *
     * <code>repeated string effects_profile_id = 6;</code>
     */
    public Builder addAllEffectsProfileId(java.lang.Iterable<java.lang.String> values) {
      ensureEffectsProfileIdIsMutable();
      com.google.protobuf.AbstractMessageLite.Builder.addAll(values, effectsProfileId_);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * An identifier which selects 'audio effects' profiles that are applied on
     * (post synthesized) text to speech.
     * Effects are applied on top of each other in the order they are given.
     * </pre>
     *
     * <code>repeated string effects_profile_id = 6;</code>
     */
    public Builder clearEffectsProfileId() {
      effectsProfileId_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000020);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * An identifier which selects 'audio effects' profiles that are applied on
     * (post synthesized) text to speech.
     * Effects are applied on top of each other in the order they are given.
     * </pre>
     *
     * <code>repeated string effects_profile_id = 6;</code>
     */
    public Builder addEffectsProfileIdBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      ensureEffectsProfileIdIsMutable();
      effectsProfileId_.add(value);
      onChanged();
      return this;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFieldsProto3(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }

    // @@protoc_insertion_point(builder_scope:google.cloud.texttospeech.v1beta1.AudioConfig)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.texttospeech.v1beta1.AudioConfig)
  private static final com.google.cloud.texttospeech.v1beta1.AudioConfig DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.texttospeech.v1beta1.AudioConfig();
  }

  public static com.google.cloud.texttospeech.v1beta1.AudioConfig getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<AudioConfig> PARSER =
      new com.google.protobuf.AbstractParser<AudioConfig>() {
        @java.lang.Override
        public AudioConfig parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          return new AudioConfig(input, extensionRegistry);
        }
      };

  public static com.google.protobuf.Parser<AudioConfig> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<AudioConfig> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.cloud.texttospeech.v1beta1.AudioConfig getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
