<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/speech/v2/cloud_speech.proto

namespace Google\Cloud\Speech\V2\ExplicitDecodingConfig;

use UnexpectedValueException;

/**
 * Supported audio data encodings.
 *
 * Protobuf type <code>google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding</code>
 */
class AudioEncoding
{
    /**
     * Default value. This value is unused.
     *
     * Generated from protobuf enum <code>AUDIO_ENCODING_UNSPECIFIED = 0;</code>
     */
    const AUDIO_ENCODING_UNSPECIFIED = 0;
    /**
     * Headerless 16-bit signed little-endian PCM samples.
     *
     * Generated from protobuf enum <code>LINEAR16 = 1;</code>
     */
    const LINEAR16 = 1;
    /**
     * Headerless 8-bit companded mulaw samples.
     *
     * Generated from protobuf enum <code>MULAW = 2;</code>
     */
    const MULAW = 2;
    /**
     * Headerless 8-bit companded alaw samples.
     *
     * Generated from protobuf enum <code>ALAW = 3;</code>
     */
    const ALAW = 3;

    private static $valueToName = [
        self::AUDIO_ENCODING_UNSPECIFIED => 'AUDIO_ENCODING_UNSPECIFIED',
        self::LINEAR16 => 'LINEAR16',
        self::MULAW => 'MULAW',
        self::ALAW => 'ALAW',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(AudioEncoding::class, \Google\Cloud\Speech\V2\ExplicitDecodingConfig_AudioEncoding::class);

