Commits
Gregorio Litenstein authored and Mojca Miklavec committed 7da86ccc71c
1 1 | Description: Add features needed to make portmixer work with audacity. |
2 2 | Author: Audacity Team |
3 3 | Last-Update: 2011-12-07 |
4 4 | |
5 5 | --- include/pa_win_ds.h |
6 6 | +++ include/pa_win_ds.h |
7 7 | |
8 - | |
9 - | }PaWinDirectSoundStreamInfo; |
10 - | |
11 - | +/** Retrieve the GUID of the input device. |
12 - | + |
13 - | + @param stream The stream to query. |
14 - | + |
15 - | + @return A pointer to the GUID, or NULL if none. |
16 - | +*/ |
17 - | +LPGUID PaWinDS_GetStreamInputGUID( PaStream* s ); |
18 - | + |
19 - | +/** Retrieve the GUID of the output device. |
20 - | + |
21 - | + @param stream The stream to query. |
22 - | + |
23 - | + @return A pointer to the GUID, or NULL if none. |
24 - | +*/ |
25 - | +LPGUID PaWinDS_GetStreamOutputGUID( PaStream* s ); |
26 - | |
27 - | |
28 - | #ifdef __cplusplus |
8 + | |
9 + | }PaWinDirectSoundStreamInfo; |
10 + | |
11 + | +/** Retrieve the GUID of the input device. |
12 + | + |
13 + | + @param stream The stream to query. |
14 + | + |
15 + | + @return A pointer to the GUID, or NULL if none. |
16 + | +*/ |
17 + | +LPGUID PaWinDS_GetStreamInputGUID( PaStream* s ); |
18 + | + |
19 + | +/** Retrieve the GUID of the output device. |
20 + | + |
21 + | + @param stream The stream to query. |
22 + | + |
23 + | + @return A pointer to the GUID, or NULL if none. |
24 + | +*/ |
25 + | +LPGUID PaWinDS_GetStreamOutputGUID( PaStream* s ); |
26 + | |
27 + | |
28 + | #ifdef __cplusplus |
29 29 | --- include/portaudio.h |
30 30 | +++ include/portaudio.h |
31 - | |
31 + | |
32 32 | signed long Pa_GetStreamWriteAvailable( PaStream* stream ); |
33 33 | |
34 34 | |
35 35 | +/** Retrieve the host type handling an open stream. |
36 36 | + |
37 37 | + @return Returns a non-negative value representing the host API type |
38 38 | + handling an open stream or, a PaErrorCode (which are always negative) |
39 39 | + if PortAudio is not initialized or an error is encountered. |
40 40 | +*/ |
41 41 | +PaHostApiTypeId Pa_GetStreamHostApiType( PaStream* stream ); |
146 146 | + |
147 147 | +const char *PaOSS_GetStreamOutputDevice( PaStream *s ); |
148 148 | + |
149 149 | +#ifdef __cplusplus |
150 150 | +} |
151 151 | +#endif |
152 152 | + |
153 153 | +#endif |
154 154 | --- src/common/pa_front.c |
155 155 | +++ src/common/pa_front.c |
156 - | |
156 + | |
157 157 | hostApiInputParametersPtr, hostApiOutputParametersPtr, |
158 158 | sampleRate, framesPerBuffer, streamFlags, streamCallback, userData ); |
159 159 | |
160 160 | - if( result == paNoError ) |
161 161 | + if( result == paNoError ) { |
162 162 | AddOpenStream( *stream ); |
163 163 | + PA_STREAM_REP(*stream)->hostApiType = hostApi->info.type; |
164 164 | + } |
165 165 | |
166 166 | |
167 167 | PA_LOGAPI(("Pa_OpenStream returned:\n" )); |
168 - | |
168 + | |
169 169 | return result; |
170 170 | } |
171 171 | |
172 172 | +PaHostApiTypeId Pa_GetStreamHostApiType( PaStream* stream ) |
173 173 | +{ |
174 174 | + PaError error = PaUtil_ValidateStreamPointer( stream ); |
175 175 | + PaHostApiTypeId result; |
176 176 | + |
177 177 | +#ifdef PA_LOG_API_CALLS |
178 178 | + PaUtil_DebugPrint("Pa_GetStreamHostApiType called:\n" ); |
215 215 | PaStreamFinishedCallback *streamFinishedCallback; |
216 216 | void *userData; |
217 217 | PaStreamInfo streamInfo; |
218 218 | + PaHostApiTypeId hostApiType; |
219 219 | } PaUtilStreamRepresentation; |
220 220 | |
221 221 | |
222 222 | --- src/hostapi/coreaudio/pa_mac_core_blocking.c |
223 223 | +++ src/hostapi/coreaudio/pa_mac_core_blocking.c |
224 224 | |
225 - | #ifdef MOSX_USE_NON_ATOMIC_FLAG_BITS |
226 - | # define OSAtomicOr32( a, b ) ( (*(b)) |= (a) ) |
227 - | # define OSAtomicAnd32( a, b ) ( (*(b)) &= (a) ) |
228 - | +#elif MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3 |
229 - | +# define OSAtomicOr32( a, b ) BitOrAtomic( a, (UInt32 *) b ) |
230 - | +# define OSAtomicAnd32( a, b ) BitAndAtomic( a, (UInt32 *) b ) |
231 - | #else |
232 - | # include <libkern/OSAtomic.h> |
233 - | #endif |
225 + | #ifdef MOSX_USE_NON_ATOMIC_FLAG_BITS |
226 + | # define OSAtomicOr32( a, b ) ( (*(b)) |= (a) ) |
227 + | # define OSAtomicAnd32( a, b ) ( (*(b)) &= (a) ) |
228 + | +#elif MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3 |
229 + | +# define OSAtomicOr32( a, b ) BitOrAtomic( a, (UInt32 *) b ) |
230 + | +# define OSAtomicAnd32( a, b ) BitAndAtomic( a, (UInt32 *) b ) |
231 + | #else |
232 + | # include <libkern/OSAtomic.h> |
233 + | #endif |
234 234 | --- src/hostapi/alsa/pa_linux_alsa.c |
235 235 | +++ src/hostapi/alsa/pa_linux_alsa.c |
236 236 | |
237 237 | StreamDirection streamDir; |
238 238 | |
239 239 | snd_pcm_channel_area_t *channelAreas; /* Needed for channel adaption */ |
240 240 | + int card; |
241 241 | } PaAlsaStreamComponent; |
242 242 | |
243 243 | /* Implementation specific stream structure */ |
252 252 | |
253 253 | self->device = params->device; |
254 254 | |
255 255 | PA_ENSURE( AlsaOpen( &alsaApi->baseHostApiRep, params, streamDir, &self->pcm ) ); |
256 256 | + |
257 257 | + snd_pcm_info_alloca( &pcmInfo ); |
258 258 | + self->card = snd_pcm_info_get_card( pcmInfo ); |
259 259 | self->nfds = alsa_snd_pcm_poll_descriptors_count( self->pcm ); |
260 260 | |
261 261 | PA_ENSURE( hostSampleFormat = PaUtil_SelectClosestAvailableFormat( GetAvailableFormats( self->pcm ), userSampleFormat ) ); |
262 - | |
262 + | |
263 263 | /* XXX: More descriptive error? */ |
264 264 | PA_UNLESS( stream->capture.pcm, paDeviceUnavailable ); |
265 265 | |
266 266 | - alsa_snd_pcm_info_alloca( &pcmInfo ); |
267 267 | - PA_ENSURE( alsa_snd_pcm_info( stream->capture.pcm, pcmInfo ) ); |
268 268 | - *card = alsa_snd_pcm_info_get_card( pcmInfo ); |
269 269 | + *card = stream->capture.card; |
270 270 | |
271 271 | error: |
272 272 | return result; |
273 - | |
273 + | |
274 274 | /* XXX: More descriptive error? */ |
275 275 | PA_UNLESS( stream->playback.pcm, paDeviceUnavailable ); |
276 276 | |
277 277 | - alsa_snd_pcm_info_alloca( &pcmInfo ); |
278 278 | - PA_ENSURE( alsa_snd_pcm_info( stream->playback.pcm, pcmInfo ) ); |
279 279 | - *card = alsa_snd_pcm_info_get_card( pcmInfo ); |
280 280 | + *card = stream->playback.card; |
281 281 | |
282 282 | error: |
283 283 | return result; |
305 305 | + |
306 306 | + if( stream->playback ) |
307 307 | + { |
308 308 | + return stream->playback->devName; |
309 309 | + } |
310 310 | + |
311 311 | + return NULL; |
312 312 | +} |
313 313 | --- configure.in |
314 314 | +++ configure.in |
315 - | |
315 + | |
316 316 | DLL_LIBS="$DLL_LIBS -lossaudio" |
317 317 | LIBS="$LIBS -lossaudio" |
318 318 | fi |
319 319 | + INCLUDES="$INCLUDES pa_unix_oss.h" |
320 320 | AC_DEFINE(PA_USE_OSS,1) |
321 321 | fi |
322 322 |