Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Speech / Src / AudioFormat / AudioFormatConverter.cs / 1 / AudioFormatConverter.cs
//------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------- using System; using System.Globalization; using System.Runtime.InteropServices; using STATSTG = System.Runtime.InteropServices.ComTypes.STATSTG; using System.Speech.AudioFormat; namespace System.Speech.Internal { #pragma warning restore 649 // Helper class which wraps AudioFormat and handles WaveFormatEx variable sized structure static internal class AudioFormatConverter { //******************************************************************* // // Internal Methods // //******************************************************************* #region Internal Methods static internal SpeechAudioFormatInfo ToSpeechAudioFormatInfo (IntPtr waveFormatPtr) { WaveFormatEx waveFormatEx = (WaveFormatEx) Marshal.PtrToStructure (waveFormatPtr, typeof (WaveFormatEx)); byte [] extraData = new byte [waveFormatEx.cbSize]; IntPtr extraDataPtr = new IntPtr (waveFormatPtr.ToInt64 () + Marshal.SizeOf (waveFormatEx)); for (int i = 0; i < waveFormatEx.cbSize; i++) { extraData [i] = Marshal.ReadByte (extraDataPtr, i); } return new SpeechAudioFormatInfo ((EncodingFormat) waveFormatEx.wFormatTag, (int) waveFormatEx.nSamplesPerSec, (short) waveFormatEx.wBitsPerSample, (short) waveFormatEx.nChannels, (int) waveFormatEx.nAvgBytesPerSec, (short) waveFormatEx.nBlockAlign, extraData); } static internal SpeechAudioFormatInfo ToSpeechAudioFormatInfo (string formatString) { // Is it normal format? short streamFormat; if (Int16.TryParse (formatString, NumberStyles.None, CultureInfo.InvariantCulture, out streamFormat)) { // Now convert enum value into real info return ConvertFormat ((StreamFormat) streamFormat); } return null; } #endregion //******************************************************************** // // Private Methods // //******************************************************************* #region Private Methods ////// This method converts the specified stream format into a wave format /// /// ///static private SpeechAudioFormatInfo ConvertFormat (StreamFormat eFormat) { WaveFormatEx waveEx = new WaveFormatEx (); byte [] extra = null; if (eFormat >= StreamFormat.PCM_8kHz8BitMono && eFormat <= StreamFormat.PCM_48kHz16BitStereo) { uint index = (uint) (eFormat - StreamFormat.PCM_8kHz8BitMono); bool isStereo = (index & 0x1) != 0; bool is16 = (index & 0x2) != 0; uint dwKHZ = (index & 0x3c) >> 2; uint [] adwKHZ = new uint [] { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }; waveEx.wFormatTag = (ushort) WaveFormatId.Pcm; waveEx.nChannels = waveEx.nBlockAlign = (ushort) (isStereo ? 2 : 1); waveEx.nSamplesPerSec = adwKHZ [dwKHZ]; waveEx.wBitsPerSample = 8; if (is16) { waveEx.wBitsPerSample *= 2; waveEx.nBlockAlign *= 2; } waveEx.nAvgBytesPerSec = waveEx.nSamplesPerSec * waveEx.nBlockAlign; } else if (eFormat == StreamFormat.TrueSpeech_8kHz1BitMono) { waveEx.wFormatTag = (ushort) WaveFormatId.TrueSpeech; waveEx.nChannels = 1; waveEx.nSamplesPerSec = 8000; waveEx.nAvgBytesPerSec = 1067; waveEx.nBlockAlign = 32; waveEx.wBitsPerSample = 1; waveEx.cbSize = 32; extra = new byte [32]; extra [0] = 1; extra [2] = 0xF0; } else if ((eFormat >= StreamFormat.CCITT_ALaw_8kHzMono) && (eFormat <= StreamFormat.CCITT_ALaw_44kHzStereo)) { uint index = (uint) (eFormat - StreamFormat.CCITT_ALaw_8kHzMono); uint dwKHZ = index / 2; uint [] adwKHZ = { 8000, 11025, 22050, 44100 }; bool isStereo = (index & 0x1) != 0; waveEx.wFormatTag = (ushort) WaveFormatId.Alaw; waveEx.nChannels = waveEx.nBlockAlign = (ushort) (isStereo ? 2 : 1); waveEx.nSamplesPerSec = adwKHZ [dwKHZ]; waveEx.wBitsPerSample = 8; waveEx.nAvgBytesPerSec = waveEx.nSamplesPerSec * waveEx.nBlockAlign; } else if ((eFormat >= StreamFormat.CCITT_uLaw_8kHzMono) && (eFormat <= StreamFormat.CCITT_uLaw_44kHzStereo)) { uint index = (uint) (eFormat - StreamFormat.CCITT_uLaw_8kHzMono); uint dwKHZ = index / 2; uint [] adwKHZ = new uint [] { 8000, 11025, 22050, 44100 }; bool isStereo = (index & 0x1) != 0; waveEx.wFormatTag = (ushort) WaveFormatId.Mulaw; waveEx.nChannels = waveEx.nBlockAlign = (ushort) (isStereo ? 2 : 1); waveEx.nSamplesPerSec = adwKHZ [dwKHZ]; waveEx.wBitsPerSample = 8; waveEx.nAvgBytesPerSec = waveEx.nSamplesPerSec * waveEx.nBlockAlign; } else if ((eFormat >= StreamFormat.ADPCM_8kHzMono) && (eFormat <= StreamFormat.ADPCM_44kHzStereo)) { //--- Some of these values seem odd. We used what the codec told us. uint [] adwKHZ = new uint [] { 8000, 11025, 22050, 44100 }; uint [] BytesPerSec = new uint [] { 4096, 8192, 5644, 11289, 11155, 22311, 22179, 44359 }; uint [] BlockAlign = new uint [] { 256, 256, 512, 1024 }; byte [] Extra811 = new byte [32] { 0xF4, 0x01, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x40, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xCC, 0x01, 0x30, 0xFF, 0x88, 0x01, 0x18, 0xFF }; byte [] Extra22 = new byte [32] { 0xF4, 0x03, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x40, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xCC, 0x01, 0x30, 0xFF, 0x88, 0x01, 0x18, 0xFF }; byte [] Extra44 = new byte [32] { 0xF4, 0x07, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x40, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xCC, 0x01, 0x30, 0xFF, 0x88, 0x01, 0x18, 0xFF }; byte [] [] Extra = new byte [] [] { Extra811, Extra811, Extra22, Extra44 }; uint index = (uint) (eFormat - StreamFormat.ADPCM_8kHzMono); uint dwKHZ = index / 2; bool isStereo = (index & 0x1) != 0; waveEx.wFormatTag = (ushort) WaveFormatId.AdPcm; waveEx.nChannels = (ushort) (isStereo ? 2 : 1); waveEx.nSamplesPerSec = adwKHZ [dwKHZ]; waveEx.nAvgBytesPerSec = BytesPerSec [index]; waveEx.nBlockAlign = (ushort) (BlockAlign [dwKHZ] * waveEx.nChannels); waveEx.wBitsPerSample = 4; waveEx.cbSize = 32; extra = (byte []) Extra [dwKHZ].Clone (); } else if ((eFormat >= StreamFormat.GSM610_8kHzMono) && (eFormat <= StreamFormat.GSM610_44kHzMono)) { //--- Some of these values seem odd. We used what the codec told us. uint [] adwKHZ = new uint [] { 8000, 11025, 22050, 44100 }; uint [] BytesPerSec = new uint [] { 1625, 2239, 4478, 8957 }; uint index = (uint) (eFormat - StreamFormat.GSM610_8kHzMono); waveEx.wFormatTag = (ushort) WaveFormatId.Gsm610; waveEx.nChannels = 1; waveEx.nSamplesPerSec = adwKHZ [index]; waveEx.nAvgBytesPerSec = BytesPerSec [index]; waveEx.nBlockAlign = 65; waveEx.wBitsPerSample = 0; waveEx.cbSize = 2; extra = new byte [2]; extra [0] = 0x40; extra [1] = 0x01; } else { waveEx = null; switch (eFormat) { case StreamFormat.NoAssignedFormat: break; case StreamFormat.Text: break; default: throw new FormatException (); } } return waveEx != null ? new SpeechAudioFormatInfo ((EncodingFormat) waveEx.wFormatTag, (int) waveEx.nSamplesPerSec, waveEx.wBitsPerSample, waveEx.nChannels, (int) waveEx.nAvgBytesPerSec, waveEx.nBlockAlign, extra) : null; } enum StreamFormat { Default = -1, NoAssignedFormat = 0, // Similar to GUID_NULL Text, NonStandardFormat, // Non-SAPI 5.1 standard format with no WAVEFORMATEX description ExtendedAudioFormat, // Non-SAPI 5.1 standard format but has WAVEFORMATEX description // Standard PCM wave formats PCM_8kHz8BitMono, PCM_8kHz8BitStereo, PCM_8kHz16BitMono, PCM_8kHz16BitStereo, PCM_11kHz8BitMono, PCM_11kHz8BitStereo, PCM_11kHz16BitMono, PCM_11kHz16BitStereo, PCM_12kHz8BitMono, PCM_12kHz8BitStereo, PCM_12kHz16BitMono, PCM_12kHz16BitStereo, PCM_16kHz8BitMono, PCM_16kHz8BitStereo, PCM_16kHz16BitMono, PCM_16kHz16BitStereo, PCM_22kHz8BitMono, PCM_22kHz8BitStereo, PCM_22kHz16BitMono, PCM_22kHz16BitStereo, PCM_24kHz8BitMono, PCM_24kHz8BitStereo, PCM_24kHz16BitMono, PCM_24kHz16BitStereo, PCM_32kHz8BitMono, PCM_32kHz8BitStereo, PCM_32kHz16BitMono, PCM_32kHz16BitStereo, PCM_44kHz8BitMono, PCM_44kHz8BitStereo, PCM_44kHz16BitMono, PCM_44kHz16BitStereo, PCM_48kHz8BitMono, PCM_48kHz8BitStereo, PCM_48kHz16BitMono, PCM_48kHz16BitStereo, // TrueSpeech format TrueSpeech_8kHz1BitMono, // A-Law formats CCITT_ALaw_8kHzMono, CCITT_ALaw_8kHzStereo, CCITT_ALaw_11kHzMono, CCITT_ALaw_11kHzStereo, CCITT_ALaw_22kHzMono, CCITT_ALaw_22kHzStereo, CCITT_ALaw_44kHzMono, CCITT_ALaw_44kHzStereo, // u-Law formats CCITT_uLaw_8kHzMono, CCITT_uLaw_8kHzStereo, CCITT_uLaw_11kHzMono, CCITT_uLaw_11kHzStereo, CCITT_uLaw_22kHzMono, CCITT_uLaw_22kHzStereo, CCITT_uLaw_44kHzMono, CCITT_uLaw_44kHzStereo, // ADPCM formats ADPCM_8kHzMono, ADPCM_8kHzStereo, ADPCM_11kHzMono, ADPCM_11kHzStereo, ADPCM_22kHzMono, ADPCM_22kHzStereo, ADPCM_44kHzMono, ADPCM_44kHzStereo, // GSM 6.10 formats GSM610_8kHzMono, GSM610_11kHzMono, GSM610_22kHzMono, GSM610_44kHzMono, NUM_FORMATS } #endregion //******************************************************************** // // Private Type // //******************************************************************** #region Private Type private enum WaveFormatId { Pcm = 1, AdPcm = 0x0002, TrueSpeech = 0x0022, Alaw = 0x0006, Mulaw = 0x0007, Gsm610 = 0x0031 } [StructLayout (LayoutKind.Sequential)] private class WaveFormatEx { public UInt16 wFormatTag; public UInt16 nChannels; public UInt32 nSamplesPerSec; public UInt32 nAvgBytesPerSec; public UInt16 nBlockAlign; public UInt16 wBitsPerSample; public UInt16 cbSize; } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------- using System; using System.Globalization; using System.Runtime.InteropServices; using STATSTG = System.Runtime.InteropServices.ComTypes.STATSTG; using System.Speech.AudioFormat; namespace System.Speech.Internal { #pragma warning restore 649 // Helper class which wraps AudioFormat and handles WaveFormatEx variable sized structure static internal class AudioFormatConverter { //******************************************************************* // // Internal Methods // //******************************************************************* #region Internal Methods static internal SpeechAudioFormatInfo ToSpeechAudioFormatInfo (IntPtr waveFormatPtr) { WaveFormatEx waveFormatEx = (WaveFormatEx) Marshal.PtrToStructure (waveFormatPtr, typeof (WaveFormatEx)); byte [] extraData = new byte [waveFormatEx.cbSize]; IntPtr extraDataPtr = new IntPtr (waveFormatPtr.ToInt64 () + Marshal.SizeOf (waveFormatEx)); for (int i = 0; i < waveFormatEx.cbSize; i++) { extraData [i] = Marshal.ReadByte (extraDataPtr, i); } return new SpeechAudioFormatInfo ((EncodingFormat) waveFormatEx.wFormatTag, (int) waveFormatEx.nSamplesPerSec, (short) waveFormatEx.wBitsPerSample, (short) waveFormatEx.nChannels, (int) waveFormatEx.nAvgBytesPerSec, (short) waveFormatEx.nBlockAlign, extraData); } static internal SpeechAudioFormatInfo ToSpeechAudioFormatInfo (string formatString) { // Is it normal format? short streamFormat; if (Int16.TryParse (formatString, NumberStyles.None, CultureInfo.InvariantCulture, out streamFormat)) { // Now convert enum value into real info return ConvertFormat ((StreamFormat) streamFormat); } return null; } #endregion //******************************************************************** // // Private Methods // //******************************************************************* #region Private Methods ////// This method converts the specified stream format into a wave format /// /// ///static private SpeechAudioFormatInfo ConvertFormat (StreamFormat eFormat) { WaveFormatEx waveEx = new WaveFormatEx (); byte [] extra = null; if (eFormat >= StreamFormat.PCM_8kHz8BitMono && eFormat <= StreamFormat.PCM_48kHz16BitStereo) { uint index = (uint) (eFormat - StreamFormat.PCM_8kHz8BitMono); bool isStereo = (index & 0x1) != 0; bool is16 = (index & 0x2) != 0; uint dwKHZ = (index & 0x3c) >> 2; uint [] adwKHZ = new uint [] { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }; waveEx.wFormatTag = (ushort) WaveFormatId.Pcm; waveEx.nChannels = waveEx.nBlockAlign = (ushort) (isStereo ? 2 : 1); waveEx.nSamplesPerSec = adwKHZ [dwKHZ]; waveEx.wBitsPerSample = 8; if (is16) { waveEx.wBitsPerSample *= 2; waveEx.nBlockAlign *= 2; } waveEx.nAvgBytesPerSec = waveEx.nSamplesPerSec * waveEx.nBlockAlign; } else if (eFormat == StreamFormat.TrueSpeech_8kHz1BitMono) { waveEx.wFormatTag = (ushort) WaveFormatId.TrueSpeech; waveEx.nChannels = 1; waveEx.nSamplesPerSec = 8000; waveEx.nAvgBytesPerSec = 1067; waveEx.nBlockAlign = 32; waveEx.wBitsPerSample = 1; waveEx.cbSize = 32; extra = new byte [32]; extra [0] = 1; extra [2] = 0xF0; } else if ((eFormat >= StreamFormat.CCITT_ALaw_8kHzMono) && (eFormat <= StreamFormat.CCITT_ALaw_44kHzStereo)) { uint index = (uint) (eFormat - StreamFormat.CCITT_ALaw_8kHzMono); uint dwKHZ = index / 2; uint [] adwKHZ = { 8000, 11025, 22050, 44100 }; bool isStereo = (index & 0x1) != 0; waveEx.wFormatTag = (ushort) WaveFormatId.Alaw; waveEx.nChannels = waveEx.nBlockAlign = (ushort) (isStereo ? 2 : 1); waveEx.nSamplesPerSec = adwKHZ [dwKHZ]; waveEx.wBitsPerSample = 8; waveEx.nAvgBytesPerSec = waveEx.nSamplesPerSec * waveEx.nBlockAlign; } else if ((eFormat >= StreamFormat.CCITT_uLaw_8kHzMono) && (eFormat <= StreamFormat.CCITT_uLaw_44kHzStereo)) { uint index = (uint) (eFormat - StreamFormat.CCITT_uLaw_8kHzMono); uint dwKHZ = index / 2; uint [] adwKHZ = new uint [] { 8000, 11025, 22050, 44100 }; bool isStereo = (index & 0x1) != 0; waveEx.wFormatTag = (ushort) WaveFormatId.Mulaw; waveEx.nChannels = waveEx.nBlockAlign = (ushort) (isStereo ? 2 : 1); waveEx.nSamplesPerSec = adwKHZ [dwKHZ]; waveEx.wBitsPerSample = 8; waveEx.nAvgBytesPerSec = waveEx.nSamplesPerSec * waveEx.nBlockAlign; } else if ((eFormat >= StreamFormat.ADPCM_8kHzMono) && (eFormat <= StreamFormat.ADPCM_44kHzStereo)) { //--- Some of these values seem odd. We used what the codec told us. uint [] adwKHZ = new uint [] { 8000, 11025, 22050, 44100 }; uint [] BytesPerSec = new uint [] { 4096, 8192, 5644, 11289, 11155, 22311, 22179, 44359 }; uint [] BlockAlign = new uint [] { 256, 256, 512, 1024 }; byte [] Extra811 = new byte [32] { 0xF4, 0x01, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x40, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xCC, 0x01, 0x30, 0xFF, 0x88, 0x01, 0x18, 0xFF }; byte [] Extra22 = new byte [32] { 0xF4, 0x03, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x40, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xCC, 0x01, 0x30, 0xFF, 0x88, 0x01, 0x18, 0xFF }; byte [] Extra44 = new byte [32] { 0xF4, 0x07, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x40, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xCC, 0x01, 0x30, 0xFF, 0x88, 0x01, 0x18, 0xFF }; byte [] [] Extra = new byte [] [] { Extra811, Extra811, Extra22, Extra44 }; uint index = (uint) (eFormat - StreamFormat.ADPCM_8kHzMono); uint dwKHZ = index / 2; bool isStereo = (index & 0x1) != 0; waveEx.wFormatTag = (ushort) WaveFormatId.AdPcm; waveEx.nChannels = (ushort) (isStereo ? 2 : 1); waveEx.nSamplesPerSec = adwKHZ [dwKHZ]; waveEx.nAvgBytesPerSec = BytesPerSec [index]; waveEx.nBlockAlign = (ushort) (BlockAlign [dwKHZ] * waveEx.nChannels); waveEx.wBitsPerSample = 4; waveEx.cbSize = 32; extra = (byte []) Extra [dwKHZ].Clone (); } else if ((eFormat >= StreamFormat.GSM610_8kHzMono) && (eFormat <= StreamFormat.GSM610_44kHzMono)) { //--- Some of these values seem odd. We used what the codec told us. uint [] adwKHZ = new uint [] { 8000, 11025, 22050, 44100 }; uint [] BytesPerSec = new uint [] { 1625, 2239, 4478, 8957 }; uint index = (uint) (eFormat - StreamFormat.GSM610_8kHzMono); waveEx.wFormatTag = (ushort) WaveFormatId.Gsm610; waveEx.nChannels = 1; waveEx.nSamplesPerSec = adwKHZ [index]; waveEx.nAvgBytesPerSec = BytesPerSec [index]; waveEx.nBlockAlign = 65; waveEx.wBitsPerSample = 0; waveEx.cbSize = 2; extra = new byte [2]; extra [0] = 0x40; extra [1] = 0x01; } else { waveEx = null; switch (eFormat) { case StreamFormat.NoAssignedFormat: break; case StreamFormat.Text: break; default: throw new FormatException (); } } return waveEx != null ? new SpeechAudioFormatInfo ((EncodingFormat) waveEx.wFormatTag, (int) waveEx.nSamplesPerSec, waveEx.wBitsPerSample, waveEx.nChannels, (int) waveEx.nAvgBytesPerSec, waveEx.nBlockAlign, extra) : null; } enum StreamFormat { Default = -1, NoAssignedFormat = 0, // Similar to GUID_NULL Text, NonStandardFormat, // Non-SAPI 5.1 standard format with no WAVEFORMATEX description ExtendedAudioFormat, // Non-SAPI 5.1 standard format but has WAVEFORMATEX description // Standard PCM wave formats PCM_8kHz8BitMono, PCM_8kHz8BitStereo, PCM_8kHz16BitMono, PCM_8kHz16BitStereo, PCM_11kHz8BitMono, PCM_11kHz8BitStereo, PCM_11kHz16BitMono, PCM_11kHz16BitStereo, PCM_12kHz8BitMono, PCM_12kHz8BitStereo, PCM_12kHz16BitMono, PCM_12kHz16BitStereo, PCM_16kHz8BitMono, PCM_16kHz8BitStereo, PCM_16kHz16BitMono, PCM_16kHz16BitStereo, PCM_22kHz8BitMono, PCM_22kHz8BitStereo, PCM_22kHz16BitMono, PCM_22kHz16BitStereo, PCM_24kHz8BitMono, PCM_24kHz8BitStereo, PCM_24kHz16BitMono, PCM_24kHz16BitStereo, PCM_32kHz8BitMono, PCM_32kHz8BitStereo, PCM_32kHz16BitMono, PCM_32kHz16BitStereo, PCM_44kHz8BitMono, PCM_44kHz8BitStereo, PCM_44kHz16BitMono, PCM_44kHz16BitStereo, PCM_48kHz8BitMono, PCM_48kHz8BitStereo, PCM_48kHz16BitMono, PCM_48kHz16BitStereo, // TrueSpeech format TrueSpeech_8kHz1BitMono, // A-Law formats CCITT_ALaw_8kHzMono, CCITT_ALaw_8kHzStereo, CCITT_ALaw_11kHzMono, CCITT_ALaw_11kHzStereo, CCITT_ALaw_22kHzMono, CCITT_ALaw_22kHzStereo, CCITT_ALaw_44kHzMono, CCITT_ALaw_44kHzStereo, // u-Law formats CCITT_uLaw_8kHzMono, CCITT_uLaw_8kHzStereo, CCITT_uLaw_11kHzMono, CCITT_uLaw_11kHzStereo, CCITT_uLaw_22kHzMono, CCITT_uLaw_22kHzStereo, CCITT_uLaw_44kHzMono, CCITT_uLaw_44kHzStereo, // ADPCM formats ADPCM_8kHzMono, ADPCM_8kHzStereo, ADPCM_11kHzMono, ADPCM_11kHzStereo, ADPCM_22kHzMono, ADPCM_22kHzStereo, ADPCM_44kHzMono, ADPCM_44kHzStereo, // GSM 6.10 formats GSM610_8kHzMono, GSM610_11kHzMono, GSM610_22kHzMono, GSM610_44kHzMono, NUM_FORMATS } #endregion //******************************************************************** // // Private Type // //******************************************************************** #region Private Type private enum WaveFormatId { Pcm = 1, AdPcm = 0x0002, TrueSpeech = 0x0022, Alaw = 0x0006, Mulaw = 0x0007, Gsm610 = 0x0031 } [StructLayout (LayoutKind.Sequential)] private class WaveFormatEx { public UInt16 wFormatTag; public UInt16 nChannels; public UInt32 nSamplesPerSec; public UInt32 nAvgBytesPerSec; public UInt16 nBlockAlign; public UInt16 wBitsPerSample; public UInt16 cbSize; } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EventBuilder.cs
- AttributeCollection.cs
- Positioning.cs
- CompilerState.cs
- Trace.cs
- CodeConstructor.cs
- SecurityPermission.cs
- DataSourceSelectArguments.cs
- SimpleType.cs
- WindowsTreeView.cs
- StreamWithDictionary.cs
- ObjectPersistData.cs
- RuntimeEnvironment.cs
- EventSource.cs
- HttpHandlersSection.cs
- SiteMap.cs
- SmuggledIUnknown.cs
- HttpModuleCollection.cs
- documentation.cs
- TranslateTransform3D.cs
- TextEmbeddedObject.cs
- QueryReaderSettings.cs
- SessionState.cs
- CharAnimationBase.cs
- RegionInfo.cs
- __Filters.cs
- DbCommandTree.cs
- RoleBoolean.cs
- XmlCDATASection.cs
- SpellerHighlightLayer.cs
- BindingCompleteEventArgs.cs
- TextPenaltyModule.cs
- ProfileServiceManager.cs
- WpfWebRequestHelper.cs
- PenThread.cs
- X509InitiatorCertificateServiceElement.cs
- TrackingLocation.cs
- ServiceDeploymentInfo.cs
- LambdaCompiler.Address.cs
- DefinitionUpdate.cs
- ProcessHostConfigUtils.cs
- MediaSystem.cs
- ButtonFlatAdapter.cs
- Page.cs
- DynamicPropertyHolder.cs
- ClaimTypeRequirement.cs
- MobileControlsSection.cs
- ChannelTraceRecord.cs
- RSAPKCS1KeyExchangeFormatter.cs
- OdbcConnectionString.cs
- FixedNode.cs
- CursorConverter.cs
- AnimatedTypeHelpers.cs
- XmlnsCompatibleWithAttribute.cs
- HiddenField.cs
- RepeaterItemCollection.cs
- FactoryGenerator.cs
- ToolStripOverflowButton.cs
- DesignerActionList.cs
- WebRequestModuleElementCollection.cs
- StorageInfo.cs
- CollectionContainer.cs
- WebPartDisplayMode.cs
- OrderToken.cs
- CacheMemory.cs
- ObjectAnimationUsingKeyFrames.cs
- ListView.cs
- InstancePersistenceCommandException.cs
- UpdateCommandGenerator.cs
- WebPartHelpVerb.cs
- DesignerActionUIStateChangeEventArgs.cs
- TextTrailingCharacterEllipsis.cs
- SessionEndedEventArgs.cs
- IDictionary.cs
- EncodingNLS.cs
- CqlParser.cs
- SecureUICommand.cs
- WmpBitmapEncoder.cs
- xmlsaver.cs
- DrawingContextDrawingContextWalker.cs
- PowerModeChangedEventArgs.cs
- LockCookie.cs
- ServiceXNameTypeConverter.cs
- WSHttpSecurityElement.cs
- CSharpCodeProvider.cs
- GlyphInfoList.cs
- OperatorExpressions.cs
- Binding.cs
- DashStyle.cs
- RadialGradientBrush.cs
- OutputCacheSettingsSection.cs
- ApplicationBuildProvider.cs
- MetadataItem_Static.cs
- XmlDataCollection.cs
- ElementHostAutomationPeer.cs
- QueryExpression.cs
- MenuEventArgs.cs
- KeyNotFoundException.cs
- OperationInvokerBehavior.cs
- ExtendedTransformFactory.cs