Ticket #18 (assigned enhancement)

Opened 2 years ago

Last modified 7 months ago

Patch to expose device "handle" to applications

Reported by: leland_lucius Owned by: rossb
Priority: blocker Milestone: V19-RC1
Component: common Version: 2.0
Keywords: Cc:

Description

Refer to mailing list discussion on PortMixer? and exposing devices for a full understanding of the changes:

diff -wruN orig/audacity/lib-src/portaudio-v19/include/portaudio.h audacity/lib-src/portaudio-v19/include/portaudio.h
--- orig/audacity/lib-src/portaudio-v19/include/portaudio.h	2006-09-04 14:05:58.000000000 -0500
+++ audacity/lib-src/portaudio-v19/include/portaudio.h	2006-09-04 05:30:19.000000000 -0500
@@ -1105,6 +1105,15 @@
 signed long Pa_GetStreamWriteAvailable( PaStream* stream );
 
 
+/** Retrieve the host type handling an open stream.
+
+ @return Returns a non-negative value representing the host API type
+ handling an open stream or, a PaErrorCode (which are always negative)
+ if PortAudio is not initialized or an error is encountered.
+*/
+PaHostApiTypeId Pa_GetStreamHostApiType( PaStream* stream );
+
+
 /* Miscellaneous utilities */
 
 
diff -wruN orig/audacity/lib-src/portaudio-v19/src/common/pa_front.c audacity/lib-src/portaudio-v19/src/common/pa_front.c
--- orig/audacity/lib-src/portaudio-v19/src/common/pa_front.c	2006-09-04 14:05:59.000000000 -0500
+++ audacity/lib-src/portaudio-v19/src/common/pa_front.c	2006-09-04 05:30:19.000000000 -0500
@@ -1327,8 +1327,10 @@
                                   hostApiInputParametersPtr, hostApiOutputParametersPtr,
                                   sampleRate, framesPerBuffer, streamFlags, streamCallback, userData );
 
-    if( result == paNoError )
+    if( result == paNoError ) {
         AddOpenStream( *stream );
+        PA_STREAM_REP(*stream)->hostApiType = hostApi->info.type;
+    }
 
 
 #ifdef PA_LOG_API_CALLS
@@ -1915,6 +1917,33 @@
 }
 
 
+PaHostApiTypeId Pa_GetStreamHostApiType( PaStream* stream )
+{
+    PaError error = PaUtil_ValidateStreamPointer( stream );
+    PaHostApiTypeId result;
+
+#ifdef PA_LOG_API_CALLS
+    PaUtil_DebugPrint("Pa_GetStreamHostApiType called:\n" );
+    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
+#endif
+
+    if( error == paNoError )
+    {
+        result = PA_STREAM_REP(stream)->hostApiType;
+    }
+    else
+    {
+        result = (PaHostApiTypeId) error;
+    }
+
+#ifdef PA_LOG_API_CALLS
+    PaUtil_DebugPrint("Pa_GetStreamHostApiType returned:\n" );
+    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
+#endif
+
+    return result;
+}
+
 PaError Pa_GetSampleSize( PaSampleFormat format )
 {
     int result;
diff -wruN orig/audacity/lib-src/portaudio-v19/src/common/pa_stream.c audacity/lib-src/portaudio-v19/src/common/pa_stream.c
--- orig/audacity/lib-src/portaudio-v19/src/common/pa_stream.c	2006-09-04 14:05:59.000000000 -0500
+++ audacity/lib-src/portaudio-v19/src/common/pa_stream.c	2006-09-04 05:30:19.000000000 -0500
@@ -93,6 +93,8 @@
     streamRepresentation->streamInfo.inputLatency = 0.;
     streamRepresentation->streamInfo.outputLatency = 0.;
     streamRepresentation->streamInfo.sampleRate = 0.;
+
+    streamRepresentation->hostApiType = 0;
 }
 
 
diff -wruN orig/audacity/lib-src/portaudio-v19/src/common/pa_stream.h audacity/lib-src/portaudio-v19/src/common/pa_stream.h
--- orig/audacity/lib-src/portaudio-v19/src/common/pa_stream.h	2006-09-04 14:05:59.000000000 -0500
+++ audacity/lib-src/portaudio-v19/src/common/pa_stream.h	2006-09-04 05:30:19.000000000 -0500
@@ -152,6 +152,7 @@
     PaStreamFinishedCallback *streamFinishedCallback;
     void *userData;
     PaStreamInfo streamInfo;
+    PaHostApiTypeId hostApiType;
 } PaUtilStreamRepresentation;
 
 

Attachments

common.diff (3.3 kB) - added by leland_lucius 2 years ago.

Change History

Changed 2 years ago by leland_lucius

Changed 22 months ago by rossb

  • status changed from new to assigned

Changed 7 months ago by rossb

  • milestone set to V19-RC1

Changed 7 months ago by rossb

  • priority changed from minor to critical

Changed 7 months ago by rossb

  • priority changed from critical to blocker
Note: See TracTickets for help on using tickets.