Julius 4.2
msvc/portaudio/pa_win_waveformat.h
説明を見る。
00001 #ifndef PA_WIN_WAVEFORMAT_H
00002 #define PA_WIN_WAVEFORMAT_H
00003 
00004 /*
00005  * PortAudio Portable Real-Time Audio Library
00006  * Windows WAVEFORMAT* data structure utilities
00007  * portaudio.h should be included before this file.
00008  *
00009  * Copyright (c) 2007 Ross Bencina
00010  *
00011  * Permission is hereby granted, free of charge, to any person obtaining
00012  * a copy of this software and associated documentation files
00013  * (the "Software"), to deal in the Software without restriction,
00014  * including without limitation the rights to use, copy, modify, merge,
00015  * publish, distribute, sublicense, and/or sell copies of the Software,
00016  * and to permit persons to whom the Software is furnished to do so,
00017  * subject to the following conditions:
00018  *
00019  * The above copyright notice and this permission notice shall be
00020  * included in all copies or substantial portions of the Software.
00021  *
00022  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00023  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00024  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00025  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
00026  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
00027  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00028  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00029  */
00030 
00031 /*
00032  * The text above constitutes the entire PortAudio license; however, 
00033  * the PortAudio community also makes the following non-binding requests:
00034  *
00035  * Any person wishing to distribute modifications to the Software is
00036  * requested to send the modifications to the original developer so that
00037  * they can be incorporated into the canonical version. It is also 
00038  * requested that these non-binding requests be included along with the 
00039  * license above.
00040  */
00041 
00046 #ifdef __cplusplus
00047 extern "C" {
00048 #endif
00049 
00050 /*
00051         The following #defines for speaker channel masks are the same
00052         as those in ksmedia.h, except with PAWIN_ prepended, KSAUDIO_ removed
00053         in some cases, and casts to PaWinWaveFormatChannelMask added.
00054 */
00055 
00056 typedef unsigned long PaWinWaveFormatChannelMask;
00057 
00058 /* Speaker Positions: */
00059 #define PAWIN_SPEAKER_FRONT_LEFT                                ((PaWinWaveFormatChannelMask)0x1)
00060 #define PAWIN_SPEAKER_FRONT_RIGHT                               ((PaWinWaveFormatChannelMask)0x2)
00061 #define PAWIN_SPEAKER_FRONT_CENTER                              ((PaWinWaveFormatChannelMask)0x4)
00062 #define PAWIN_SPEAKER_LOW_FREQUENCY                             ((PaWinWaveFormatChannelMask)0x8)
00063 #define PAWIN_SPEAKER_BACK_LEFT                                 ((PaWinWaveFormatChannelMask)0x10)
00064 #define PAWIN_SPEAKER_BACK_RIGHT                                ((PaWinWaveFormatChannelMask)0x20)
00065 #define PAWIN_SPEAKER_FRONT_LEFT_OF_CENTER              ((PaWinWaveFormatChannelMask)0x40)
00066 #define PAWIN_SPEAKER_FRONT_RIGHT_OF_CENTER             ((PaWinWaveFormatChannelMask)0x80)
00067 #define PAWIN_SPEAKER_BACK_CENTER                               ((PaWinWaveFormatChannelMask)0x100)
00068 #define PAWIN_SPEAKER_SIDE_LEFT                                 ((PaWinWaveFormatChannelMask)0x200)
00069 #define PAWIN_SPEAKER_SIDE_RIGHT                                ((PaWinWaveFormatChannelMask)0x400)
00070 #define PAWIN_SPEAKER_TOP_CENTER                                ((PaWinWaveFormatChannelMask)0x800)
00071 #define PAWIN_SPEAKER_TOP_FRONT_LEFT                    ((PaWinWaveFormatChannelMask)0x1000)
00072 #define PAWIN_SPEAKER_TOP_FRONT_CENTER                  ((PaWinWaveFormatChannelMask)0x2000)
00073 #define PAWIN_SPEAKER_TOP_FRONT_RIGHT                   ((PaWinWaveFormatChannelMask)0x4000)
00074 #define PAWIN_SPEAKER_TOP_BACK_LEFT                             ((PaWinWaveFormatChannelMask)0x8000)
00075 #define PAWIN_SPEAKER_TOP_BACK_CENTER                   ((PaWinWaveFormatChannelMask)0x10000)
00076 #define PAWIN_SPEAKER_TOP_BACK_RIGHT                    ((PaWinWaveFormatChannelMask)0x20000)
00077 
00078 /* Bit mask locations reserved for future use */
00079 #define PAWIN_SPEAKER_RESERVED                                  ((PaWinWaveFormatChannelMask)0x7FFC0000)
00080 
00081 /* Used to specify that any possible permutation of speaker configurations */
00082 #define PAWIN_SPEAKER_ALL                                               ((PaWinWaveFormatChannelMask)0x80000000)
00083 
00084 /* DirectSound Speaker Config */
00085 #define PAWIN_SPEAKER_DIRECTOUT                                 0
00086 #define PAWIN_SPEAKER_MONO                                              (PAWIN_SPEAKER_FRONT_CENTER)
00087 #define PAWIN_SPEAKER_STEREO                                    (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT)
00088 #define PAWIN_SPEAKER_QUAD                                              (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
00089                                                                                                 PAWIN_SPEAKER_BACK_LEFT  | PAWIN_SPEAKER_BACK_RIGHT)
00090 #define PAWIN_SPEAKER_SURROUND                                  (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
00091                                                                                                 PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_BACK_CENTER)
00092 #define PAWIN_SPEAKER_5POINT1                                   (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
00093                                                                                                 PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_LOW_FREQUENCY | \
00094                                                                                                 PAWIN_SPEAKER_BACK_LEFT  | PAWIN_SPEAKER_BACK_RIGHT)
00095 #define PAWIN_SPEAKER_7POINT1                                   (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
00096                                                                                                 PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_LOW_FREQUENCY | \
00097                                                                                                 PAWIN_SPEAKER_BACK_LEFT | PAWIN_SPEAKER_BACK_RIGHT | \
00098                                                                                                 PAWIN_SPEAKER_FRONT_LEFT_OF_CENTER | PAWIN_SPEAKER_FRONT_RIGHT_OF_CENTER)
00099 #define PAWIN_SPEAKER_5POINT1_SURROUND                  (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
00100                                                                                                 PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_LOW_FREQUENCY | \
00101                                                                                                 PAWIN_SPEAKER_SIDE_LEFT  | PAWIN_SPEAKER_SIDE_RIGHT)
00102 #define PAWIN_SPEAKER_7POINT1_SURROUND                  (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
00103                                                                                                 PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_LOW_FREQUENCY | \
00104                                                                                                 PAWIN_SPEAKER_BACK_LEFT | PAWIN_SPEAKER_BACK_RIGHT | \
00105                                                                                                 PAWIN_SPEAKER_SIDE_LEFT | PAWIN_SPEAKER_SIDE_RIGHT)
00106 /*
00107  According to the Microsoft documentation:
00108  The following are obsolete 5.1 and 7.1 settings (they lack side speakers).  Note this means
00109  that the default 5.1 and 7.1 settings (KSAUDIO_SPEAKER_5POINT1 and KSAUDIO_SPEAKER_7POINT1 are
00110  similarly obsolete but are unchanged for compatibility reasons).
00111 */
00112 #define PAWIN_SPEAKER_5POINT1_BACK                              PAWIN_SPEAKER_5POINT1
00113 #define PAWIN_SPEAKER_7POINT1_WIDE                              PAWIN_SPEAKER_7POINT1
00114 
00115 /* DVD Speaker Positions */
00116 #define PAWIN_SPEAKER_GROUND_FRONT_LEFT                 PAWIN_SPEAKER_FRONT_LEFT
00117 #define PAWIN_SPEAKER_GROUND_FRONT_CENTER               PAWIN_SPEAKER_FRONT_CENTER
00118 #define PAWIN_SPEAKER_GROUND_FRONT_RIGHT                PAWIN_SPEAKER_FRONT_RIGHT
00119 #define PAWIN_SPEAKER_GROUND_REAR_LEFT                  PAWIN_SPEAKER_BACK_LEFT
00120 #define PAWIN_SPEAKER_GROUND_REAR_RIGHT                 PAWIN_SPEAKER_BACK_RIGHT
00121 #define PAWIN_SPEAKER_TOP_MIDDLE                                PAWIN_SPEAKER_TOP_CENTER
00122 #define PAWIN_SPEAKER_SUPER_WOOFER                              PAWIN_SPEAKER_LOW_FREQUENCY
00123 
00124 
00125 /*
00126         PaWinWaveFormat is defined here to provide compatibility with
00127         compilation environments which don't have headers defining 
00128         WAVEFORMATEXTENSIBLE (e.g. older versions of MSVC, Borland C++ etc.
00129 
00130         The fields for WAVEFORMATEX and WAVEFORMATEXTENSIBLE are declared as an
00131     unsigned char array here to avoid clients who include this file having 
00132     a dependency on windows.h and mmsystem.h, and also to to avoid having
00133     to write separate packing pragmas for each compiler.
00134 */
00135 #define PAWIN_SIZEOF_WAVEFORMATEX   18
00136 #define PAWIN_SIZEOF_WAVEFORMATEXTENSIBLE (PAWIN_SIZEOF_WAVEFORMATEX + 22)
00137 
00138 typedef struct{
00139     unsigned char fields[ PAWIN_SIZEOF_WAVEFORMATEXTENSIBLE ];
00140     unsigned long extraLongForAlignment; /* ensure that compiler aligns struct to DWORD */ 
00141 } PaWinWaveFormat;
00142 
00143 /*
00144     WAVEFORMATEXTENSIBLE fields:
00145     
00146     union  {
00147             WORD  wValidBitsPerSample;    
00148             WORD  wSamplesPerBlock;    
00149             WORD  wReserved;  
00150     } Samples;
00151     DWORD  dwChannelMask;  
00152     GUID  SubFormat;
00153 */
00154 
00155 #define PAWIN_INDEXOF_WVALIDBITSPERSAMPLE       (PAWIN_SIZEOF_WAVEFORMATEX+0)
00156 #define PAWIN_INDEXOF_DWCHANNELMASK                     (PAWIN_SIZEOF_WAVEFORMATEX+2)
00157 #define PAWIN_INDEXOF_SUBFORMAT                         (PAWIN_SIZEOF_WAVEFORMATEX+6)
00158 
00159 /*
00160         Use the following two functions to initialize the waveformat structure.
00161 */
00162 
00163 void PaWin_InitializeWaveFormatEx( PaWinWaveFormat *waveFormat, 
00164                 int numChannels, PaSampleFormat sampleFormat, double sampleRate );
00165 
00166 
00167 void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat, 
00168                 int numChannels, PaSampleFormat sampleFormat, double sampleRate,
00169             PaWinWaveFormatChannelMask channelMask );
00170 
00171 
00172 /* Map a channel count to a speaker channel mask */
00173 PaWinWaveFormatChannelMask PaWin_DefaultChannelMask( int numChannels );
00174 
00175 
00176 #ifdef __cplusplus
00177 }
00178 #endif /* __cplusplus */
00179 
00180 #endif /* PA_WIN_WAVEFORMAT_H */