示例#1
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));
 }
示例#2
0
 internal override void SetWaveFormatTagInternal(AudioEncoding waveFormatTag)
 {
     _subFormat = AudioSubTypes.SubTypeFromEncoding(waveFormatTag);
 }
示例#3
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, ValidBitsPerSample, Channels, AudioSubTypes.EncodingFromSubType(SubFormat)));
 }