1 |
#ifndef PA_WIN_WMME_H |
2 |
#define PA_WIN_WMME_H |
3 |
/* |
4 |
* $Id: pa_win_wmme.h 1405 2009-03-08 08:10:55Z rossb $ |
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 |
|
47 |
#include "portaudio.h" |
48 |
#include "pa_win_waveformat.h" |
49 |
|
50 |
#ifdef __cplusplus |
51 |
extern "C" |
52 |
{ |
53 |
#endif /* __cplusplus */ |
54 |
|
55 |
|
56 |
/* The following are flags which can be set in |
57 |
PaWinMmeStreamInfo's flags field. |
58 |
*/ |
59 |
|
60 |
#define paWinMmeUseLowLevelLatencyParameters (0x01) |
61 |
#define paWinMmeUseMultipleDevices (0x02) /* use mme specific multiple device feature */ |
62 |
#define paWinMmeUseChannelMask (0x04) |
63 |
|
64 |
/* By default, the mme implementation drops the processing thread's priority |
65 |
to THREAD_PRIORITY_NORMAL and sleeps the thread if the CPU load exceeds 100% |
66 |
This flag disables any priority throttling. The processing thread will always |
67 |
run at THREAD_PRIORITY_TIME_CRITICAL. |
68 |
*/ |
69 |
#define paWinMmeDontThrottleOverloadedProcessingThread (0x08) |
70 |
|
71 |
/* Flags for non-PCM spdif passthrough. |
72 |
*/ |
73 |
#define paWinMmeWaveFormatDolbyAc3Spdif (0x10) |
74 |
#define paWinMmeWaveFormatWmaSpdif (0x20) |
75 |
|
76 |
|
77 |
typedef struct PaWinMmeDeviceAndChannelCount{ |
78 |
PaDeviceIndex device; |
79 |
int channelCount; |
80 |
}PaWinMmeDeviceAndChannelCount; |
81 |
|
82 |
|
83 |
typedef struct PaWinMmeStreamInfo{ |
84 |
unsigned long size; /**< sizeof(PaWinMmeStreamInfo) */ |
85 |
PaHostApiTypeId hostApiType; /**< paMME */ |
86 |
unsigned long version; /**< 1 */ |
87 |
|
88 |
unsigned long flags; |
89 |
|
90 |
/* low-level latency setting support |
91 |
These settings control the number and size of host buffers in order |
92 |
to set latency. They will be used instead of the generic parameters |
93 |
to Pa_OpenStream() if flags contains the PaWinMmeUseLowLevelLatencyParameters |
94 |
flag. |
95 |
|
96 |
If PaWinMmeStreamInfo structures with PaWinMmeUseLowLevelLatencyParameters |
97 |
are supplied for both input and output in a full duplex stream, then the |
98 |
input and output framesPerBuffer must be the same, or the larger of the |
99 |
two must be a multiple of the smaller, otherwise a |
100 |
paIncompatibleHostApiSpecificStreamInfo error will be returned from |
101 |
Pa_OpenStream(). |
102 |
*/ |
103 |
unsigned long framesPerBuffer; |
104 |
unsigned long bufferCount; /* formerly numBuffers */ |
105 |
|
106 |
/* multiple devices per direction support |
107 |
If flags contains the PaWinMmeUseMultipleDevices flag, |
108 |
this functionality will be used, otherwise the device parameter to |
109 |
Pa_OpenStream() will be used instead. |
110 |
If devices are specified here, the corresponding device parameter |
111 |
to Pa_OpenStream() should be set to paUseHostApiSpecificDeviceSpecification, |
112 |
otherwise an paInvalidDevice error will result. |
113 |
The total number of channels accross all specified devices |
114 |
must agree with the corresponding channelCount parameter to |
115 |
Pa_OpenStream() otherwise a paInvalidChannelCount error will result. |
116 |
*/ |
117 |
PaWinMmeDeviceAndChannelCount *devices; |
118 |
unsigned long deviceCount; |
119 |
|
120 |
/* |
121 |
support for WAVEFORMATEXTENSIBLE channel masks. If flags contains |
122 |
paWinMmeUseChannelMask this allows you to specify which speakers |
123 |
to address in a multichannel stream. Constants for channelMask |
124 |
are specified in pa_win_waveformat.h |
125 |
|
126 |
*/ |
127 |
PaWinWaveFormatChannelMask channelMask; |
128 |
|
129 |
}PaWinMmeStreamInfo; |
130 |
|
131 |
|
132 |
/** Retrieve the number of wave in handles used by a PortAudio WinMME stream. |
133 |
Returns zero if the stream is output only. |
134 |
|
135 |
@return A non-negative value indicating the number of wave in handles |
136 |
or, a PaErrorCode (which are always negative) if PortAudio is not initialized |
137 |
or an error is encountered. |
138 |
|
139 |
@see PaWinMME_GetStreamInputHandle |
140 |
*/ |
141 |
int PaWinMME_GetStreamInputHandleCount( PaStream* stream ); |
142 |
|
143 |
|
144 |
/** Retrieve a wave in handle used by a PortAudio WinMME stream. |
145 |
|
146 |
@param stream The stream to query. |
147 |
@param handleIndex The zero based index of the wave in handle to retrieve. This |
148 |
should be in the range [0, PaWinMME_GetStreamInputHandleCount(stream)-1]. |
149 |
|
150 |
@return A valid wave in handle, or NULL if an error occurred. |
151 |
|
152 |
@see PaWinMME_GetStreamInputHandle |
153 |
*/ |
154 |
HWAVEIN PaWinMME_GetStreamInputHandle( PaStream* stream, int handleIndex ); |
155 |
|
156 |
|
157 |
/** Retrieve the number of wave out handles used by a PortAudio WinMME stream. |
158 |
Returns zero if the stream is input only. |
159 |
|
160 |
@return A non-negative value indicating the number of wave out handles |
161 |
or, a PaErrorCode (which are always negative) if PortAudio is not initialized |
162 |
or an error is encountered. |
163 |
|
164 |
@see PaWinMME_GetStreamOutputHandle |
165 |
*/ |
166 |
int PaWinMME_GetStreamOutputHandleCount( PaStream* stream ); |
167 |
|
168 |
|
169 |
/** Retrieve a wave out handle used by a PortAudio WinMME stream. |
170 |
|
171 |
@param stream The stream to query. |
172 |
@param handleIndex The zero based index of the wave out handle to retrieve. |
173 |
This should be in the range [0, PaWinMME_GetStreamOutputHandleCount(stream)-1]. |
174 |
|
175 |
@return A valid wave out handle, or NULL if an error occurred. |
176 |
|
177 |
@see PaWinMME_GetStreamOutputHandleCount |
178 |
*/ |
179 |
HWAVEOUT PaWinMME_GetStreamOutputHandle( PaStream* stream, int handleIndex ); |
180 |
|
181 |
|
182 |
#ifdef __cplusplus |
183 |
} |
184 |
#endif /* __cplusplus */ |
185 |
|
186 |
#endif /* PA_WIN_WMME_H */ |