Description: Add features needed to make portmixer work with audacity.
Author: Audacity Team
Last-Update: 2011-12-07
Synced with version 190600_20161030 on 20170507
diff --git configure.in configure.in
index 13816fb7a34eb9aea37050b86e3543aa0adc9282..83c239a12f38fe652948d4293ab161346f377301 100644
|
|
case "${host_os}" in |
420 | 420 | DLL_LIBS="$DLL_LIBS -lossaudio" |
421 | 421 | LIBS="$LIBS -lossaudio" |
422 | 422 | fi |
| 423 | INCLUDES="$INCLUDES pa_unix_oss.h" |
423 | 424 | AC_DEFINE(PA_USE_OSS,1) |
424 | 425 | fi |
425 | 426 | |
diff --git include/pa_win_ds.h include/pa_win_ds.h
index 5d3864168c4508b5ad6559f5ac73b64097637d98..ba1c24546a1c12b8f15706c1b6fd96db2979388e 100644
|
|
typedef struct PaWinDirectSoundStreamInfo{ |
86 | 86 | |
87 | 87 | }PaWinDirectSoundStreamInfo; |
88 | 88 | |
| 89 | /** Retrieve the GUID of the input device. |
| 90 | |
| 91 | @param stream The stream to query. |
| 92 | |
| 93 | @return A pointer to the GUID, or NULL if none. |
| 94 | */ |
| 95 | LPGUID PaWinDS_GetStreamInputGUID( PaStream* s ); |
| 96 | |
| 97 | /** Retrieve the GUID of the output device. |
| 98 | |
| 99 | @param stream The stream to query. |
| 100 | |
| 101 | @return A pointer to the GUID, or NULL if none. |
| 102 | */ |
| 103 | LPGUID PaWinDS_GetStreamOutputGUID( PaStream* s ); |
89 | 104 | |
90 | 105 | |
91 | 106 | #ifdef __cplusplus |
diff --git include/portaudio.h include/portaudio.h
index 8a94aafbbb8104bbda9a5320d1d6fc4b843adf7e..9c8a2959f20c50c392124c6d7f13f326470b0cfe 100644
|
|
signed long Pa_GetStreamReadAvailable( PaStream* stream ); |
1197 | 1197 | signed long Pa_GetStreamWriteAvailable( PaStream* stream ); |
1198 | 1198 | |
1199 | 1199 | |
| 1200 | /** Retrieve the host type handling an open stream. |
| 1201 | |
| 1202 | @return Returns a non-negative value representing the host API type |
| 1203 | handling an open stream or, a PaErrorCode (which are always negative) |
| 1204 | if PortAudio is not initialized or an error is encountered. |
| 1205 | */ |
| 1206 | PaHostApiTypeId Pa_GetStreamHostApiType( PaStream* stream ); |
| 1207 | |
| 1208 | |
1200 | 1209 | /* Miscellaneous utilities */ |
1201 | 1210 | |
1202 | 1211 | |
diff --git src/common/pa_front.c src/common/pa_front.c
index 188cee9e5578f0e050cddbe3c86a9463dc2b22e2..52f44a677dc0f4f3699e019be452337a2ac928d7 100644
|
|
PaError Pa_OpenStream( PaStream** stream, |
1257 | 1257 | hostApiInputParametersPtr, hostApiOutputParametersPtr, |
1258 | 1258 | sampleRate, framesPerBuffer, streamFlags, streamCallback, userData ); |
1259 | 1259 | |
1260 | | if( result == paNoError ) |
| 1260 | if( result == paNoError ) { |
1261 | 1261 | AddOpenStream( *stream ); |
| 1262 | PA_STREAM_REP(*stream)->hostApiType = hostApi->info.type; |
| 1263 | } |
1262 | 1264 | |
1263 | 1265 | |
1264 | 1266 | PA_LOGAPI(("Pa_OpenStream returned:\n" )); |
… |
… |
signed long Pa_GetStreamWriteAvailable( PaStream* stream ) |
1770 | 1772 | return result; |
1771 | 1773 | } |
1772 | 1774 | |
| 1775 | PaHostApiTypeId Pa_GetStreamHostApiType( PaStream* stream ) |
| 1776 | { |
| 1777 | PaError error = PaUtil_ValidateStreamPointer( stream ); |
| 1778 | PaHostApiTypeId result; |
| 1779 | |
| 1780 | #ifdef PA_LOG_API_CALLS |
| 1781 | PaUtil_DebugPrint("Pa_GetStreamHostApiType called:\n" ); |
| 1782 | PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream ); |
| 1783 | #endif |
| 1784 | |
| 1785 | if( error == paNoError ) |
| 1786 | { |
| 1787 | result = PA_STREAM_REP(stream)->hostApiType; |
| 1788 | } |
| 1789 | else |
| 1790 | { |
| 1791 | result = (PaHostApiTypeId) error; |
| 1792 | } |
| 1793 | |
| 1794 | #ifdef PA_LOG_API_CALLS |
| 1795 | PaUtil_DebugPrint("Pa_GetStreamHostApiType returned:\n" ); |
| 1796 | PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) ); |
| 1797 | #endif |
| 1798 | |
| 1799 | return result; |
| 1800 | } |
1773 | 1801 | |
1774 | 1802 | PaError Pa_GetSampleSize( PaSampleFormat format ) |
1775 | 1803 | { |
diff --git src/common/pa_stream.c src/common/pa_stream.c
index 03a0ee6ee32e8752949d75a05d57fa5380329858..c4376f93b969bd02a0f90f1eb07478db8efe1501 100644
|
|
void PaUtil_InitializeStreamRepresentation( PaUtilStreamRepresentation *streamRe |
93 | 93 | streamRepresentation->streamInfo.inputLatency = 0.; |
94 | 94 | streamRepresentation->streamInfo.outputLatency = 0.; |
95 | 95 | streamRepresentation->streamInfo.sampleRate = 0.; |
| 96 | |
| 97 | streamRepresentation->hostApiType = 0; |
96 | 98 | } |
97 | 99 | |
98 | 100 | |
diff --git src/common/pa_stream.h src/common/pa_stream.h
index 678e2ad5ea0897904aaed1fd14c055a74a96f6ba..70572c7523dfce1cc77738979663bb6f98702d06 100644
|
|
typedef struct PaUtilStreamRepresentation { |
152 | 152 | PaStreamFinishedCallback *streamFinishedCallback; |
153 | 153 | void *userData; |
154 | 154 | PaStreamInfo streamInfo; |
| 155 | PaHostApiTypeId hostApiType; |
155 | 156 | } PaUtilStreamRepresentation; |
156 | 157 | |
157 | 158 | |
diff --git src/hostapi/alsa/pa_linux_alsa.c src/hostapi/alsa/pa_linux_alsa.c
index 584cde8901d7f16630ca1e4bc864059da0edd8f3..558fb3d11c5fbdc0deeffe633e62f29b93c06fdf 100644
|
|
typedef struct |
621 | 621 | StreamDirection streamDir; |
622 | 622 | |
623 | 623 | snd_pcm_channel_area_t *channelAreas; /* Needed for channel adaption */ |
| 624 | int card; |
624 | 625 | } PaAlsaStreamComponent; |
625 | 626 | |
626 | 627 | /* Implementation specific stream structure */ |
… |
… |
static PaError PaAlsaStreamComponent_Initialize( PaAlsaStreamComponent *self, Pa |
1873 | 1874 | { |
1874 | 1875 | PaError result = paNoError; |
1875 | 1876 | PaSampleFormat userSampleFormat = params->sampleFormat, hostSampleFormat = paNoError; |
| 1877 | snd_pcm_info_t* pcmInfo; |
1876 | 1878 | assert( params->channelCount > 0 ); |
1877 | 1879 | |
1878 | 1880 | /* Make sure things have an initial value */ |
… |
… |
static PaError PaAlsaStreamComponent_Initialize( PaAlsaStreamComponent *self, Pa |
1900 | 1902 | self->device = params->device; |
1901 | 1903 | |
1902 | 1904 | PA_ENSURE( AlsaOpen( &alsaApi->baseHostApiRep, params, streamDir, &self->pcm ) ); |
| 1905 | |
| 1906 | snd_pcm_info_alloca( &pcmInfo ); |
| 1907 | self->card = snd_pcm_info_get_card( pcmInfo ); |
1903 | 1908 | self->nfds = alsa_snd_pcm_poll_descriptors_count( self->pcm ); |
1904 | 1909 | |
1905 | 1910 | PA_ENSURE( hostSampleFormat = PaUtil_SelectClosestAvailableFormat( GetAvailableFormats( self->pcm ), userSampleFormat ) ); |
… |
… |
PaError PaAlsa_GetStreamInputCard( PaStream* s, int* card ) |
4605 | 4610 | /* XXX: More descriptive error? */ |
4606 | 4611 | PA_UNLESS( stream->capture.pcm, paDeviceUnavailable ); |
4607 | 4612 | |
4608 | | alsa_snd_pcm_info_alloca( &pcmInfo ); |
4609 | | PA_ENSURE( alsa_snd_pcm_info( stream->capture.pcm, pcmInfo ) ); |
4610 | | *card = alsa_snd_pcm_info_get_card( pcmInfo ); |
| 4613 | *card = stream->capture.card; |
4611 | 4614 | |
4612 | 4615 | error: |
4613 | 4616 | return result; |
… |
… |
PaError PaAlsa_GetStreamOutputCard( PaStream* s, int* card ) |
4624 | 4627 | /* XXX: More descriptive error? */ |
4625 | 4628 | PA_UNLESS( stream->playback.pcm, paDeviceUnavailable ); |
4626 | 4629 | |
4627 | | alsa_snd_pcm_info_alloca( &pcmInfo ); |
4628 | | PA_ENSURE( alsa_snd_pcm_info( stream->playback.pcm, pcmInfo ) ); |
4629 | | *card = alsa_snd_pcm_info_get_card( pcmInfo ); |
| 4630 | *card = stream->playback.card; |
4630 | 4631 | |
4631 | 4632 | error: |
4632 | 4633 | return result; |
diff --git src/hostapi/coreaudio/pa_mac_core_blocking.c src/hostapi/coreaudio/pa_mac_core_blocking.c
index 679c6ba0aec3e17a30bf9f6fae0434133852b65a..a69e08589aba8c0cf1d099a1af98a908371fbc0b 100644
|
|
|
66 | 66 | #ifdef MOSX_USE_NON_ATOMIC_FLAG_BITS |
67 | 67 | # define OSAtomicOr32( a, b ) ( (*(b)) |= (a) ) |
68 | 68 | # define OSAtomicAnd32( a, b ) ( (*(b)) &= (a) ) |
| 69 | #elif MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3 |
| 70 | # define OSAtomicOr32( a, b ) BitOrAtomic( a, (UInt32 *) b ) |
| 71 | # define OSAtomicAnd32( a, b ) BitAndAtomic( a, (UInt32 *) b ) |
69 | 72 | #else |
70 | 73 | # include <libkern/OSAtomic.h> |
71 | 74 | #endif |
diff --git src/hostapi/oss/pa_unix_oss.c src/hostapi/oss/pa_unix_oss.c
index 51e963048fa66d1e7748c4e63928fe1dd6d3db66..f257d80398fbbaf5f7886bcd74e14fe3b32c669f 100644
|
|
error: |
2043 | 2043 | #endif |
2044 | 2044 | } |
2045 | 2045 | |
| 2046 | const char *PaOSS_GetStreamInputDevice( PaStream* s ) |
| 2047 | { |
| 2048 | PaOssStream *stream = (PaOssStream*)s; |
| 2049 | |
| 2050 | if( stream->capture ) |
| 2051 | { |
| 2052 | return stream->capture->devName; |
| 2053 | } |
| 2054 | |
| 2055 | return NULL; |
| 2056 | } |
| 2057 | |
| 2058 | const char *PaOSS_GetStreamOutputDevice( PaStream* s ) |
| 2059 | { |
| 2060 | PaOssStream *stream = (PaOssStream*)s; |
| 2061 | |
| 2062 | if( stream->playback ) |
| 2063 | { |
| 2064 | return stream->playback->devName; |
| 2065 | } |
| 2066 | |
| 2067 | return NULL; |
| 2068 | } |