Пример #1
0
        internal static AudioEncoding GetWaveFormatTag(this WaveFormat waveFormat)
        {
            if (waveFormat is WaveFormatExtensible)
            {
                return(AudioSubTypes.EncodingFromSubType(((WaveFormatExtensible)waveFormat).SubFormat));
            }

            return(waveFormat.WaveFormatTag);
        }
Пример #2
0
 /// <summary>
 ///     Returns the SubType-Guid of a <paramref name="waveFormat" />. If the specified <paramref name="waveFormat" /> does
 ///     not contain a SubType-Guid, the <see cref="WaveFormat.WaveFormatTag" /> gets converted to the equal SubType-Guid
 ///     using the <see cref="AudioSubTypes.SubTypeFromEncoding" /> method.
 /// </summary>
 /// <param name="waveFormat"><see cref="WaveFormat" /> which gets used to determine the SubType-Guid.</param>
 /// <returns>SubType-Guid of the specified <paramref name="waveFormat" />.</returns>
 public static Guid SubTypeFromWaveFormat(WaveFormat waveFormat)
 {
     if (waveFormat == null)
     {
         throw new ArgumentNullException("waveFormat");
     }
     if (waveFormat is WaveFormatExtensible)
     {
         return(((WaveFormatExtensible)waveFormat).SubFormat);
     }
     return(AudioSubTypes.SubTypeFromEncoding(waveFormat.WaveFormatTag));
 }
Пример #3
0
 internal override void SetWaveFormatTagInternal(AudioEncoding waveFormatTag)
 {
     SubFormat = AudioSubTypes.SubTypeFromEncoding(waveFormatTag);
 }
Пример #4
0
 /// <summary>
 ///     Converts the <see cref="WaveFormatExtensible" /> instance to a raw <see cref="WaveFormat" /> instance by converting
 ///     the <see cref="SubFormat" /> to the equal <see cref="WaveFormat.WaveFormatTag" />.
 /// </summary>
 /// <returns>A simple <see cref="WaveFormat"/> instance.</returns>
 public WaveFormat ToWaveFormat()
 {
     return(new WaveFormat(SampleRate, BitsPerSample, Channels, AudioSubTypes.EncodingFromSubType(SubFormat)));
 }