static int first=1;
#if PORTAUDIO_V19
+PaHostApiTypeId HostApiTypeId;
+const PaHostApiInfo *HostApiInfo;
PaDeviceIndex DeviceIndex;
const PaDeviceInfo *DeviceInfo;
PaStreamParameters StreamParameters;
PaSampleFormat SampleFormat, nativeSampleFormats;
#ifdef AU_PORTAUDIO_DLL
+#if PORTAUDIO_V19
+ {
+ if(&dpm == &portaudio_asio_play_mode){
+ HostApiTypeId = paASIO;
+ } else if(&dpm == &portaudio_win_ds_play_mode){
+ HostApiTypeId = paDirectSound;
+ } else if(&dpm == &portaudio_win_wmme_play_mode){
+ HostApiTypeId = paMME;
+ } else {
+ return -1;
+ }
+ if(load_portaudio_dll(0))
+ return -1;
+ }
+#else
{
if(&dpm == &portaudio_asio_play_mode){
if(load_portaudio_dll(PA_DLL_ASIO))
}
}
#endif
+#endif
/* if call twice Pa_OpenStream causes paDeviceUnavailable error */
if(pa_active == 1) return 0;
if(pa_active == 0){
}
#ifdef PORTAUDIO_V19
- DeviceIndex = Pa_GetDefaultOutputDevice();
+ {
+ PaHostApiIndex i, ApiCount;
+ i = 0;
+ ApiCount = Pa_GetHostApiCount();
+ do{
+ HostApiInfo=Pa_GetHostApiInfo(i);
+ if( HostApiInfo->type == HostApiTypeId ) break;
+ i++;
+ }while ( i < ApiCount );
+ if ( i == ApiCount ) goto error;
+ }
+ DeviceIndex = HostApiInfo->defaultOutputDevice;
if(DeviceIndex==paNoDevice) goto error;
DeviceInfo = Pa_GetDeviceInfo( DeviceIndex);
if(DeviceInfo==NULL) goto error;
#include "w32_portaudio.h"
-extern int load_portaudio_dll(int type);
-extern void free_portaudio_dll(void);
#ifdef PORTAUDIO_V19
+
+extern int load_portaudio_dll(int);
+extern void free_portaudio_dll(void);
+
/***************************************************************
name: portaudio_dll dll: portaudio.dll
***************************************************************/
-// (PaError)0 -> paDeviceUnavailable
-// (PaDeviceID)0 -> paNoDevice
-
-// #define PA_DLL_ASIO 1
-// #define PA_DLL_WIN_DS 2
-// #define PA_DLL_WIN_WMME 3
-#define PA_DLL_ASIO_FILE "pa_asio.dll"
-#define PA_DLL_WIN_DS_FILE "pa_win_ds.dll"
-#define PA_DLL_WIN_WMME_FILE "pa_win_wmme.dll"
-
-
typedef int(*type_Pa_GetVersion)( void );
typedef const char*(*type_Pa_GetVersionText)( void );
typedef const char*(*type_Pa_GetErrorText)( PaError errorCode );
}
}
-int load_portaudio_dll(int type)
+int load_portaudio_dll(int a)
{
- char* dll_file = NULL;
- switch(type){
- case PA_DLL_ASIO:
- dll_file = PA_DLL_ASIO_FILE;
- break;
- case PA_DLL_WIN_DS:
- dll_file = PA_DLL_WIN_DS_FILE;
- break;
- case PA_DLL_WIN_WMME:
- dll_file = PA_DLL_WIN_WMME_FILE;
- break;
- default:
- return -1;
- }
if(!h_portaudio_dll){
- h_portaudio_dll = LoadLibrary(dll_file);
+ h_portaudio_dll = LoadLibrary("portaudio.dll");
if(!h_portaudio_dll) return -1;
}
portaudio_dll.Pa_GetVersion = (type_Pa_GetVersion)GetProcAddress(h_portaudio_dll,"Pa_GetVersion");
}
/***************************************************************/
+
+
+
#else
+
+
+
+extern int load_portaudio_dll(int type);
+extern void free_portaudio_dll(void);
+
/***************************************************************
name: portaudio_dll dll: portaudio.dll
***************************************************************/