internal static AudioEncoding GetWaveFormatTag(this WaveFormat waveFormat) { if (waveFormat is WaveFormatExtensible) { return(AudioSubTypes.EncodingFromSubType(((WaveFormatExtensible)waveFormat).SubFormat)); } return(waveFormat.WaveFormatTag); }
/// <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))); }