gnu: Add kafs-client
[jackhill/guix/guix.git] / gnu / packages / patches / portaudio-audacity-compat.patch
1 Description: Add features needed to make portmixer work with audacity.
2 Author: Audacity Team
3 Last-Update: 2011-12-07
4
5 See <http://music.columbia.edu/pipermail/portaudio/2015-March/016611.html>.
6
7 --- a/include/pa_win_ds.h
8 +++ b/include/pa_win_ds.h
9 @@ -89,6 +89,21 @@
10
11 }PaWinDirectSoundStreamInfo;
12
13 +/** Retrieve the GUID of the input device.
14 +
15 + @param stream The stream to query.
16 +
17 + @return A pointer to the GUID, or NULL if none.
18 +*/
19 +LPGUID PaWinDS_GetStreamInputGUID( PaStream* s );
20 +
21 +/** Retrieve the GUID of the output device.
22 +
23 + @param stream The stream to query.
24 +
25 + @return A pointer to the GUID, or NULL if none.
26 +*/
27 +LPGUID PaWinDS_GetStreamOutputGUID( PaStream* s );
28
29
30 #ifdef __cplusplus
31 --- a/include/portaudio.h
32 +++ b/include/portaudio.h
33 @@ -1146,6 +1146,15 @@
34 signed long Pa_GetStreamWriteAvailable( PaStream* stream );
35
36
37 +/** Retrieve the host type handling an open stream.
38 +
39 + @return Returns a non-negative value representing the host API type
40 + handling an open stream or, a PaErrorCode (which are always negative)
41 + if PortAudio is not initialized or an error is encountered.
42 +*/
43 +PaHostApiTypeId Pa_GetStreamHostApiType( PaStream* stream );
44 +
45 +
46 /* Miscellaneous utilities */
47
48
49 --- /dev/null
50 +++ b/include/pa_unix_oss.h
51 @@ -0,0 +1,104 @@
52 +#ifndef PA_UNIX_OSS_H
53 +#define PA_UNIX_OSS_H
54 +
55 +/*
56 + * $Id: portaudio.patch,v 1.10 2009-06-30 04:52:59 llucius Exp $
57 + * PortAudio Portable Real-Time Audio Library
58 + * OSS-specific extensions
59 + *
60 + * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
61 + *
62 + * Permission is hereby granted, free of charge, to any person obtaining
63 + * a copy of this software and associated documentation files
64 + * (the "Software"), to deal in the Software without restriction,
65 + * including without limitation the rights to use, copy, modify, merge,
66 + * publish, distribute, sublicense, and/or sell copies of the Software,
67 + * and to permit persons to whom the Software is furnished to do so,
68 + * subject to the following conditions:
69 + *
70 + * The above copyright notice and this permission notice shall be
71 + * included in all copies or substantial portions of the Software.
72 + *
73 + * Any person wishing to distribute modifications to the Software is
74 + * requested to send the modifications to the original developer so that
75 + * they can be incorporated into the canonical version.
76 + *
77 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
78 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
79 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
80 + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
81 + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
82 + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
83 + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
84 + *
85 + */
86 +
87 +/** @file
88 + * OSS-specific PortAudio API extension header file.
89 + */
90 +
91 +#ifdef __cplusplus
92 +extern "C" {
93 +#endif
94 +
95 +const char *PaOSS_GetStreamInputDevice( PaStream *s );
96 +
97 +const char *PaOSS_GetStreamOutputDevice( PaStream *s );
98 +
99 +#ifdef __cplusplus
100 +}
101 +#endif
102 +
103 +#endif
104 +#ifndef PA_UNIX_OSS_H
105 +#define PA_UNIX_OSS_H
106 +
107 +/*
108 + * $Id: portaudio.patch,v 1.10 2009-06-30 04:52:59 llucius Exp $
109 + * PortAudio Portable Real-Time Audio Library
110 + * OSS-specific extensions
111 + *
112 + * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
113 + *
114 + * Permission is hereby granted, free of charge, to any person obtaining
115 + * a copy of this software and associated documentation files
116 + * (the "Software"), to deal in the Software without restriction,
117 + * including without limitation the rights to use, copy, modify, merge,
118 + * publish, distribute, sublicense, and/or sell copies of the Software,
119 + * and to permit persons to whom the Software is furnished to do so,
120 + * subject to the following conditions:
121 + *
122 + * The above copyright notice and this permission notice shall be
123 + * included in all copies or substantial portions of the Software.
124 + *
125 + * Any person wishing to distribute modifications to the Software is
126 + * requested to send the modifications to the original developer so that
127 + * they can be incorporated into the canonical version.
128 + *
129 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
130 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
131 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
132 + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
133 + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
134 + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
135 + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
136 + *
137 + */
138 +
139 +/** @file
140 + * OSS-specific PortAudio API extension header file.
141 + */
142 +
143 +#ifdef __cplusplus
144 +extern "C" {
145 +#endif
146 +
147 +const char *PaOSS_GetStreamInputDevice( PaStream *s );
148 +
149 +const char *PaOSS_GetStreamOutputDevice( PaStream *s );
150 +
151 +#ifdef __cplusplus
152 +}
153 +#endif
154 +
155 +#endif
156 --- a/src/common/pa_front.c
157 +++ b/src/common/pa_front.c
158 @@ -1216,8 +1216,10 @@
159 hostApiInputParametersPtr, hostApiOutputParametersPtr,
160 sampleRate, framesPerBuffer, streamFlags, streamCallback, userData );
161
162 - if( result == paNoError )
163 + if( result == paNoError ) {
164 AddOpenStream( *stream );
165 + PA_STREAM_REP(*stream)->hostApiType = hostApi->info.type;
166 + }
167
168
169 PA_LOGAPI(("Pa_OpenStream returned:\n" ));
170 @@ -1729,6 +1731,32 @@
171 return result;
172 }
173
174 +PaHostApiTypeId Pa_GetStreamHostApiType( PaStream* stream )
175 +{
176 + PaError error = PaUtil_ValidateStreamPointer( stream );
177 + PaHostApiTypeId result;
178 +
179 +#ifdef PA_LOG_API_CALLS
180 + PaUtil_DebugPrint("Pa_GetStreamHostApiType called:\n" );
181 + PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
182 +#endif
183 +
184 + if( error == paNoError )
185 + {
186 + result = PA_STREAM_REP(stream)->hostApiType;
187 + }
188 + else
189 + {
190 + result = (PaHostApiTypeId) error;
191 + }
192 +
193 +#ifdef PA_LOG_API_CALLS
194 + PaUtil_DebugPrint("Pa_GetStreamHostApiType returned:\n" );
195 + PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
196 +#endif
197 +
198 + return result;
199 +}
200
201 PaError Pa_GetSampleSize( PaSampleFormat format )
202 {
203 --- a/src/common/pa_stream.c
204 +++ b/src/common/pa_stream.c
205 @@ -93,6 +93,8 @@
206 streamRepresentation->streamInfo.inputLatency = 0.;
207 streamRepresentation->streamInfo.outputLatency = 0.;
208 streamRepresentation->streamInfo.sampleRate = 0.;
209 +
210 + streamRepresentation->hostApiType = 0;
211 }
212
213
214 --- a/src/common/pa_stream.h
215 +++ b/src/common/pa_stream.h
216 @@ -152,6 +152,7 @@
217 PaStreamFinishedCallback *streamFinishedCallback;
218 void *userData;
219 PaStreamInfo streamInfo;
220 + PaHostApiTypeId hostApiType;
221 } PaUtilStreamRepresentation;
222
223
224 --- a/src/hostapi/coreaudio/pa_mac_core_blocking.c
225 +++ b/src/hostapi/coreaudio/pa_mac_core_blocking.c
226 @@ -66,6 +66,9 @@
227 #ifdef MOSX_USE_NON_ATOMIC_FLAG_BITS
228 # define OSAtomicOr32( a, b ) ( (*(b)) |= (a) )
229 # define OSAtomicAnd32( a, b ) ( (*(b)) &= (a) )
230 +#elif MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3
231 +# define OSAtomicOr32( a, b ) BitOrAtomic( a, (UInt32 *) b )
232 +# define OSAtomicAnd32( a, b ) BitAndAtomic( a, (UInt32 *) b )
233 #else
234 # include <libkern/OSAtomic.h>
235 #endif
236 --- a/src/hostapi/alsa/pa_linux_alsa.c
237 +++ b/src/hostapi/alsa/pa_linux_alsa.c
238 @@ -611,6 +611,7 @@
239 StreamDirection streamDir;
240
241 snd_pcm_channel_area_t *channelAreas; /* Needed for channel adaption */
242 + int card;
243 } PaAlsaStreamComponent;
244
245 /* Implementation specific stream structure */
246 @@ -1806,6 +1807,7 @@
247 {
248 PaError result = paNoError;
249 PaSampleFormat userSampleFormat = params->sampleFormat, hostSampleFormat = paNoError;
250 + snd_pcm_info_t* pcmInfo;
251 assert( params->channelCount > 0 );
252
253 /* Make sure things have an initial value */
254 @@ -1826,6 +1828,9 @@
255 self->device = params->device;
256
257 PA_ENSURE( AlsaOpen( &alsaApi->baseHostApiRep, params, streamDir, &self->pcm ) );
258 +
259 + snd_pcm_info_alloca( &pcmInfo );
260 + self->card = snd_pcm_info_get_card( pcmInfo );
261 self->nfds = alsa_snd_pcm_poll_descriptors_count( self->pcm );
262
263 PA_ENSURE( hostSampleFormat = PaUtil_SelectClosestAvailableFormat( GetAvailableFormats( self->pcm ), userSampleFormat ) );
264 @@ -4519,9 +4524,7 @@
265 /* XXX: More descriptive error? */
266 PA_UNLESS( stream->capture.pcm, paDeviceUnavailable );
267
268 - alsa_snd_pcm_info_alloca( &pcmInfo );
269 - PA_ENSURE( alsa_snd_pcm_info( stream->capture.pcm, pcmInfo ) );
270 - *card = alsa_snd_pcm_info_get_card( pcmInfo );
271 + *card = stream->capture.card;
272
273 error:
274 return result;
275 @@ -4537,9 +4540,7 @@
276 /* XXX: More descriptive error? */
277 PA_UNLESS( stream->playback.pcm, paDeviceUnavailable );
278
279 - alsa_snd_pcm_info_alloca( &pcmInfo );
280 - PA_ENSURE( alsa_snd_pcm_info( stream->playback.pcm, pcmInfo ) );
281 - *card = alsa_snd_pcm_info_get_card( pcmInfo );
282 + *card = stream->playback.card;
283
284 error:
285 return result;
286 --- a/src/hostapi/oss/pa_unix_oss.c
287 +++ b/src/hostapi/oss/pa_unix_oss.c
288 @@ -2028,3 +2028,26 @@
289 #endif
290 }
291
292 +const char *PaOSS_GetStreamInputDevice( PaStream* s )
293 +{
294 + PaOssStream *stream = (PaOssStream*)s;
295 +
296 + if( stream->capture )
297 + {
298 + return stream->capture->devName;
299 + }
300 +
301 + return NULL;
302 +}
303 +
304 +const char *PaOSS_GetStreamOutputDevice( PaStream* s )
305 +{
306 + PaOssStream *stream = (PaOssStream*)s;
307 +
308 + if( stream->playback )
309 + {
310 + return stream->playback->devName;
311 + }
312 +
313 + return NULL;
314 +}
315 --- a/configure.in
316 +++ b/configure.in
317 @@ -365,6 +365,7 @@
318 DLL_LIBS="$DLL_LIBS -lossaudio"
319 LIBS="$LIBS -lossaudio"
320 fi
321 + INCLUDES="$INCLUDES pa_unix_oss.h"
322 AC_DEFINE(PA_USE_OSS,1)
323 fi
324