00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <windows.h>
00026 #include <mmsystem.h>
00027
00028
00029
00030
00031
00032
00033
00034 #define INITGUID
00035 #include <initguid.h>
00036
00037 #ifndef WAVE_FORMAT_IEEE_FLOAT
00038 # define WAVE_FORMAT_IEEE_FLOAT 0x0003
00039 #endif
00040
00041 #ifndef WAVE_FORMAT_DOLBY_AC3_SPDIF
00042 # define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092
00043 #endif
00044
00045 #ifndef WAVE_FORMAT_EXTENSIBLE
00046 #define WAVE_FORMAT_EXTENSIBLE 0xFFFE
00047 #endif
00048
00049 DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, WAVE_FORMAT_IEEE_FLOAT, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
00050 DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_PCM, WAVE_FORMAT_PCM, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
00051 DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF, WAVE_FORMAT_DOLBY_AC3_SPDIF, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
00052
00053 static const GUID __KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = {WAVE_FORMAT_IEEE_FLOAT, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
00054 static const GUID __KSDATAFORMAT_SUBTYPE_PCM = {WAVE_FORMAT_PCM, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
00055 static const GUID __KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF = {WAVE_FORMAT_DOLBY_AC3_SPDIF, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
00056
00057
00058 #define FRAMES_NUM 8
00059
00060 #ifndef _WAVEFORMATEXTENSIBLE_
00061 typedef struct {
00062 WAVEFORMATEX Format;
00063 union {
00064 WORD wValidBitsPerSample;
00065 WORD wSamplesPerBlock;
00066 WORD wReserved;
00067 } Samples;
00068 DWORD dwChannelMask;
00069
00070 GUID SubFormat;
00071 } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
00072 #endif
00073
00074
00075 #ifndef SPEAKER_FRONT_LEFT
00076 # define SPEAKER_FRONT_LEFT 0x1
00077 # define SPEAKER_FRONT_RIGHT 0x2
00078 # define SPEAKER_FRONT_CENTER 0x4
00079 # define SPEAKER_LOW_FREQUENCY 0x8
00080 # define SPEAKER_BACK_LEFT 0x10
00081 # define SPEAKER_BACK_RIGHT 0x20
00082 # define SPEAKER_FRONT_LEFT_OF_CENTER 0x40
00083 # define SPEAKER_FRONT_RIGHT_OF_CENTER 0x80
00084 # define SPEAKER_BACK_CENTER 0x100
00085 # define SPEAKER_SIDE_LEFT 0x200
00086 # define SPEAKER_SIDE_RIGHT 0x400
00087 # define SPEAKER_TOP_CENTER 0x800
00088 # define SPEAKER_TOP_FRONT_LEFT 0x1000
00089 # define SPEAKER_TOP_FRONT_CENTER 0x2000
00090 # define SPEAKER_TOP_FRONT_RIGHT 0x4000
00091 # define SPEAKER_TOP_BACK_LEFT 0x8000
00092 # define SPEAKER_TOP_BACK_CENTER 0x10000
00093 # define SPEAKER_TOP_BACK_RIGHT 0x20000
00094 # define SPEAKER_RESERVED 0x80000000
00095 #endif
00096
00097 #ifndef DSSPEAKER_DSSPEAKER_DIRECTOUT
00098 # define DSSPEAKER_DSSPEAKER_DIRECTOUT 0x00000000
00099 #endif
00100 #ifndef DSSPEAKER_HEADPHONE
00101 # define DSSPEAKER_HEADPHONE 0x00000001
00102 #endif
00103 #ifndef DSSPEAKER_MONO
00104 # define DSSPEAKER_MONO 0x00000002
00105 #endif
00106 #ifndef DSSPEAKER_QUAD
00107 # define DSSPEAKER_QUAD 0x00000003
00108 #endif
00109 #ifndef DSSPEAKER_STEREO
00110 # define DSSPEAKER_STEREO 0x00000004
00111 #endif
00112 #ifndef DSSPEAKER_SURROUND
00113 # define DSSPEAKER_SURROUND 0x00000005
00114 #endif
00115 #ifndef DSSPEAKER_5POINT1
00116 # define DSSPEAKER_5POINT1 0x00000006
00117 #endif
00118 #ifndef DSSPEAKER_7POINT1
00119 # define DSSPEAKER_7POINT1 0x00000007
00120 #endif
00121 #ifndef DSSPEAKER_7POINT1_SURROUND
00122 # define DSSPEAKER_7POINT1_SURROUND 0x00000008
00123 #endif
00124 #ifndef DSSPEAKER_7POINT1_WIDE
00125 # define DSSPEAKER_7POINT1_WIDE DSSPEAKER_7POINT1
00126 #endif
00127
00128 static const uint32_t pi_channels_src[] =
00129 { AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT,
00130 AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT,
00131 AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, AOUT_CHAN_REARCENTER,
00132 AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0 };
00133 static const uint32_t pi_channels_in[] =
00134 { SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
00135 SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT,
00136 SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT, SPEAKER_BACK_CENTER,
00137 SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY, 0 };
00138 static const uint32_t pi_channels_out[] =
00139 { SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
00140 SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY,
00141 SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT,
00142 SPEAKER_BACK_CENTER,
00143 SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT, 0 };
00144
00145 #define FLOAT_TEXT N_("Use float32 output")
00146 #define FLOAT_LONGTEXT N_( \
00147 "The option allows you to enable or disable the high-quality float32 " \
00148 "audio output mode (which is not well supported by some soundcards)." )
00149