| 1 |
#ifndef PA_WIN_WMME_H |
| 2 |
#define PA_WIN_WMME_H |
| 3 |
/* |
| 4 |
* $Id$ |
| 5 |
* PortAudio Portable Real-Time Audio Library |
| 6 |
* MME specific extensions |
| 7 |
* |
| 8 |
* Copyright (c) 1999-2000 Ross Bencina and Phil Burk |
| 9 |
* |
| 10 |
* Permission is hereby granted, free of charge, to any person obtaining |
| 11 |
* a copy of this software and associated documentation files |
| 12 |
* (the "Software"), to deal in the Software without restriction, |
| 13 |
* including without limitation the rights to use, copy, modify, merge, |
| 14 |
* publish, distribute, sublicense, and/or sell copies of the Software, |
| 15 |
* and to permit persons to whom the Software is furnished to do so, |
| 16 |
* subject to the following conditions: |
| 17 |
* |
| 18 |
* The above copyright notice and this permission notice shall be |
| 19 |
* included in all copies or substantial portions of the Software. |
| 20 |
* |
| 21 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 22 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 23 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 24 |
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR |
| 25 |
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
| 26 |
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 27 |
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 28 |
*/ |
| 29 |
|
| 30 |
/* |
| 31 |
* The text above constitutes the entire PortAudio license; however, |
| 32 |
* the PortAudio community also makes the following non-binding requests: |
| 33 |
* |
| 34 |
* Any person wishing to distribute modifications to the Software is |
| 35 |
* requested to send the modifications to the original developer so that |
| 36 |
* they can be incorporated into the canonical version. It is also |
| 37 |
* requested that these non-binding requests be included along with the |
| 38 |
* license above. |
| 39 |
*/ |
| 40 |
|
| 41 |
/** @file |
| 42 |
@ingroup public_header |
| 43 |
@brief WMME-specific PortAudio API extension header file. |
| 44 |
*/ |
| 45 |
|
| 46 |
#include "portaudio.h" |
| 47 |
#include "pa_win_waveformat.h" |
| 48 |
|
| 49 |
#ifdef __cplusplus |
| 50 |
extern "C" |
| 51 |
{ |
| 52 |
#endif /* __cplusplus */ |
| 53 |
|
| 54 |
|
| 55 |
/* The following are flags which can be set in |
| 56 |
PaWinMmeStreamInfo's flags field. |
| 57 |
*/ |
| 58 |
|
| 59 |
#define paWinMmeUseLowLevelLatencyParameters (0x01) |
| 60 |
#define paWinMmeUseMultipleDevices (0x02) /* use mme specific multiple device feature */ |
| 61 |
#define paWinMmeUseChannelMask (0x04) |
| 62 |
|
| 63 |
/* By default, the mme implementation drops the processing thread's priority |
| 64 |
to THREAD_PRIORITY_NORMAL and sleeps the thread if the CPU load exceeds 100% |
| 65 |
This flag disables any priority throttling. The processing thread will always |
| 66 |
run at THREAD_PRIORITY_TIME_CRITICAL. |
| 67 |
*/ |
| 68 |
#define paWinMmeDontThrottleOverloadedProcessingThread (0x08) |
| 69 |
|
| 70 |
/* Flags for non-PCM spdif passthrough. |
| 71 |
*/ |
| 72 |
#define paWinMmeWaveFormatDolbyAc3Spdif (0x10) |
| 73 |
#define paWinMmeWaveFormatWmaSpdif (0x20) |
| 74 |
|
| 75 |
|
| 76 |
typedef struct PaWinMmeDeviceAndChannelCount{ |
| 77 |
PaDeviceIndex device; |
| 78 |
int channelCount; |
| 79 |
}PaWinMmeDeviceAndChannelCount; |
| 80 |
|
| 81 |
|
| 82 |
typedef struct PaWinMmeStreamInfo{ |
| 83 |
unsigned long size; /**< sizeof(PaWinMmeStreamInfo) */ |
| 84 |
PaHostApiTypeId hostApiType; /**< paMME */ |
| 85 |
unsigned long version; /**< 1 */ |
| 86 |
|
| 87 |
unsigned long flags; |
| 88 |
|
| 89 |
/* low-level latency setting support |
| 90 |
These settings control the number and size of host buffers in order |
| 91 |
to set latency. They will be used instead of the generic parameters |
| 92 |
to Pa_OpenStream() if flags contains the PaWinMmeUseLowLevelLatencyParameters |
| 93 |
flag. |
| 94 |
|
| 95 |
If PaWinMmeStreamInfo structures with PaWinMmeUseLowLevelLatencyParameters |
| 96 |
are supplied for both input and output in a full duplex stream, then the |
| 97 |
input and output framesPerBuffer must be the same, or the larger of the |
| 98 |
two must be a multiple of the smaller, otherwise a |
| 99 |
paIncompatibleHostApiSpecificStreamInfo error will be returned from |
| 100 |
Pa_OpenStream(). |
| 101 |
*/ |
| 102 |
unsigned long framesPerBuffer; |
| 103 |
unsigned long bufferCount; /* formerly numBuffers */ |
| 104 |
|
| 105 |
/* multiple devices per direction support |
| 106 |
If flags contains the PaWinMmeUseMultipleDevices flag, |
| 107 |
this functionality will be used, otherwise the device parameter to |
| 108 |
Pa_OpenStream() will be used instead. |
| 109 |
If devices are specified here, the corresponding device parameter |
| 110 |
to Pa_OpenStream() should be set to paUseHostApiSpecificDeviceSpecification, |
| 111 |
otherwise an paInvalidDevice error will result. |
| 112 |
The total number of channels across all specified devices |
| 113 |
must agree with the corresponding channelCount parameter to |
| 114 |
Pa_OpenStream() otherwise a paInvalidChannelCount error will result. |
| 115 |
*/ |
| 116 |
PaWinMmeDeviceAndChannelCount *devices; |
| 117 |
unsigned long deviceCount; |
| 118 |
|
| 119 |
/* |
| 120 |
support for WAVEFORMATEXTENSIBLE channel masks. If flags contains |
| 121 |
paWinMmeUseChannelMask this allows you to specify which speakers |
| 122 |
to address in a multichannel stream. Constants for channelMask |
| 123 |
are specified in pa_win_waveformat.h |
| 124 |
|
| 125 |
*/ |
| 126 |
PaWinWaveFormatChannelMask channelMask; |
| 127 |
|
| 128 |
}PaWinMmeStreamInfo; |
| 129 |
|
| 130 |
|
| 131 |
/** Retrieve the number of wave in handles used by a PortAudio WinMME stream. |
| 132 |
Returns zero if the stream is output only. |
| 133 |
|
| 134 |
@return A non-negative value indicating the number of wave in handles |
| 135 |
or, a PaErrorCode (which are always negative) if PortAudio is not initialized |
| 136 |
or an error is encountered. |
| 137 |
|
| 138 |
@see PaWinMME_GetStreamInputHandle |
| 139 |
*/ |
| 140 |
int PaWinMME_GetStreamInputHandleCount( PaStream* stream ); |
| 141 |
|
| 142 |
|
| 143 |
/** Retrieve a wave in handle used by a PortAudio WinMME stream. |
| 144 |
|
| 145 |
@param stream The stream to query. |
| 146 |
@param handleIndex The zero based index of the wave in handle to retrieve. This |
| 147 |
should be in the range [0, PaWinMME_GetStreamInputHandleCount(stream)-1]. |
| 148 |
|
| 149 |
@return A valid wave in handle, or NULL if an error occurred. |
| 150 |
|
| 151 |
@see PaWinMME_GetStreamInputHandle |
| 152 |
*/ |
| 153 |
HWAVEIN PaWinMME_GetStreamInputHandle( PaStream* stream, int handleIndex ); |
| 154 |
|
| 155 |
|
| 156 |
/** Retrieve the number of wave out handles used by a PortAudio WinMME stream. |
| 157 |
Returns zero if the stream is input only. |
| 158 |
|
| 159 |
@return A non-negative value indicating the number of wave out handles |
| 160 |
or, a PaErrorCode (which are always negative) if PortAudio is not initialized |
| 161 |
or an error is encountered. |
| 162 |
|
| 163 |
@see PaWinMME_GetStreamOutputHandle |
| 164 |
*/ |
| 165 |
int PaWinMME_GetStreamOutputHandleCount( PaStream* stream ); |
| 166 |
|
| 167 |
|
| 168 |
/** Retrieve a wave out handle used by a PortAudio WinMME stream. |
| 169 |
|
| 170 |
@param stream The stream to query. |
| 171 |
@param handleIndex The zero based index of the wave out handle to retrieve. |
| 172 |
This should be in the range [0, PaWinMME_GetStreamOutputHandleCount(stream)-1]. |
| 173 |
|
| 174 |
@return A valid wave out handle, or NULL if an error occurred. |
| 175 |
|
| 176 |
@see PaWinMME_GetStreamOutputHandleCount |
| 177 |
*/ |
| 178 |
HWAVEOUT PaWinMME_GetStreamOutputHandle( PaStream* stream, int handleIndex ); |
| 179 |
|
| 180 |
|
| 181 |
#ifdef __cplusplus |
| 182 |
} |
| 183 |
#endif /* __cplusplus */ |
| 184 |
|
| 185 |
#endif /* PA_WIN_WMME_H */ |