Spaces:
Runtime error
Runtime error
/* | |
* PortAudio Portable Real-Time Audio Library | |
* Windows WAVEFORMAT* data structure utilities | |
* portaudio.h should be included before this file. | |
* | |
* Copyright (c) 2007 Ross Bencina | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining | |
* a copy of this software and associated documentation files | |
* (the "Software"), to deal in the Software without restriction, | |
* including without limitation the rights to use, copy, modify, merge, | |
* publish, distribute, sublicense, and/or sell copies of the Software, | |
* and to permit persons to whom the Software is furnished to do so, | |
* subject to the following conditions: | |
* | |
* The above copyright notice and this permission notice shall be | |
* included in all copies or substantial portions of the Software. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR | |
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
*/ | |
/* | |
* The text above constitutes the entire PortAudio license; however, | |
* the PortAudio community also makes the following non-binding requests: | |
* | |
* Any person wishing to distribute modifications to the Software is | |
* requested to send the modifications to the original developer so that | |
* they can be incorporated into the canonical version. It is also | |
* requested that these non-binding requests be included along with the | |
* license above. | |
*/ | |
/** @file | |
@ingroup public_header | |
@brief Windows specific PortAudio API extension and utilities header file. | |
*/ | |
extern "C" { | |
/* | |
The following #defines for speaker channel masks are the same | |
as those in ksmedia.h, except with PAWIN_ prepended, KSAUDIO_ removed | |
in some cases, and casts to PaWinWaveFormatChannelMask added. | |
*/ | |
typedef unsigned long PaWinWaveFormatChannelMask; | |
/* Speaker Positions: */ | |
/* Bit mask locations reserved for future use */ | |
/* Used to specify that any possible permutation of speaker configurations */ | |
/* DirectSound Speaker Config */ | |
/* | |
According to the Microsoft documentation: | |
The following are obsolete 5.1 and 7.1 settings (they lack side speakers). Note this means | |
that the default 5.1 and 7.1 settings (KSAUDIO_SPEAKER_5POINT1 and KSAUDIO_SPEAKER_7POINT1 are | |
similarly obsolete but are unchanged for compatibility reasons). | |
*/ | |
/* DVD Speaker Positions */ | |
/* | |
PaWinWaveFormat is defined here to provide compatibility with | |
compilation environments which don't have headers defining | |
WAVEFORMATEXTENSIBLE (e.g. older versions of MSVC, Borland C++ etc. | |
The fields for WAVEFORMATEX and WAVEFORMATEXTENSIBLE are declared as an | |
unsigned char array here to avoid clients who include this file having | |
a dependency on windows.h and mmsystem.h, and also to to avoid having | |
to write separate packing pragmas for each compiler. | |
*/ | |
typedef struct{ | |
unsigned char fields[ PAWIN_SIZEOF_WAVEFORMATEXTENSIBLE ]; | |
unsigned long extraLongForAlignment; /* ensure that compiler aligns struct to DWORD */ | |
} PaWinWaveFormat; | |
/* | |
WAVEFORMATEXTENSIBLE fields: | |
union { | |
WORD wValidBitsPerSample; | |
WORD wSamplesPerBlock; | |
WORD wReserved; | |
} Samples; | |
DWORD dwChannelMask; | |
GUID SubFormat; | |
*/ | |
/* | |
Valid values to pass for the waveFormatTag PaWin_InitializeWaveFormatEx and | |
PaWin_InitializeWaveFormatExtensible functions below. These must match | |
the standard Windows WAVE_FORMAT_* values. | |
*/ | |
/* | |
returns PAWIN_WAVE_FORMAT_PCM or PAWIN_WAVE_FORMAT_IEEE_FLOAT | |
depending on the sampleFormat parameter. | |
*/ | |
int PaWin_SampleFormatToLinearWaveFormatTag( PaSampleFormat sampleFormat ); | |
/* | |
Use the following two functions to initialize the waveformat structure. | |
*/ | |
void PaWin_InitializeWaveFormatEx( PaWinWaveFormat *waveFormat, | |
int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate ); | |
void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat, | |
int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate, | |
PaWinWaveFormatChannelMask channelMask ); | |
/* Map a channel count to a speaker channel mask */ | |
PaWinWaveFormatChannelMask PaWin_DefaultChannelMask( int numChannels ); | |
} | |