From b511280f66a401455685dc56ed399dfbf18f28bd Mon Sep 17 00:00:00 2001 From: philburk Date: Thu, 25 Aug 2011 07:17:48 +0000 Subject: [PATCH] Fix #164 by using if instead if ifdef PA_USE_* for unix builds. --- src/common/pa_hostapi.h | 47 ++++++++++++++++++++++++++++++++++ src/os/unix/pa_unix_hostapis.c | 18 ++++++------- 2 files changed, 56 insertions(+), 9 deletions(-) diff --git a/src/common/pa_hostapi.h b/src/common/pa_hostapi.h index cfbd521..658ad5d 100644 --- a/src/common/pa_hostapi.h +++ b/src/common/pa_hostapi.h @@ -106,6 +106,53 @@ are defaulted to 1. #define PA_USE_WDMKS 1 #endif +/* Set default values for Unix based APIs. */ +#if defined(PA_NO_OSS) || defined(PA_NO_ALSA) || defined(PA_NO_JACK) || defined(PA_NO_COREAUDIO) || defined(PA_NO_SGI) || defined(PA_NO_ASIHPI) +#error "Portaudio: PA_NO_ is no longer supported, please remove definition and use PA_USE_ instead" +#endif + +#ifndef PA_USE_OSS +#define PA_USE_OSS 0 +#elif (PA_USE_OSS != 0) && (PA_USE_OSS != 1) +#undef PA_USE_OSS +#define PA_USE_OSS 1 +#endif + +#ifndef PA_USE_ALSA +#define PA_USE_ALSA 0 +#elif (PA_USE_ALSA != 0) && (PA_USE_ALSA != 1) +#undef PA_USE_ALSA +#define PA_USE_ALSA 1 +#endif + +#ifndef PA_USE_JACK +#define PA_USE_JACK 0 +#elif (PA_USE_JACK != 0) && (PA_USE_JACK != 1) +#undef PA_USE_JACK +#define PA_USE_JACK 1 +#endif + +#ifndef PA_USE_SGI +#define PA_USE_SGI 0 +#elif (PA_USE_SGI != 0) && (PA_USE_SGI != 1) +#undef PA_USE_SGI +#define PA_USE_SGI 1 +#endif + +#ifndef PA_USE_COREAUDIO +#define PA_USE_COREAUDIO 0 +#elif (PA_USE_COREAUDIO != 0) && (PA_USE_COREAUDIO != 1) +#undef PA_USE_COREAUDIO +#define PA_USE_COREAUDIO 1 +#endif + +#ifndef PA_USE_ASIHPI +#define PA_USE_ASIHPI 0 +#elif (PA_USE_ASIHPI != 0) && (PA_USE_ASIHPI != 1) +#undef PA_USE_ASIHPI +#define PA_USE_ASIHPI 1 +#endif + #ifdef __cplusplus extern "C" { diff --git a/src/os/unix/pa_unix_hostapis.c b/src/os/unix/pa_unix_hostapis.c index ef56e81..a9b4a05 100644 --- a/src/os/unix/pa_unix_hostapis.c +++ b/src/os/unix/pa_unix_hostapis.c @@ -59,43 +59,43 @@ PaUtilHostApiInitializer *paHostApiInitializers[] = { #ifdef __linux__ -#ifdef PA_USE_ALSA +#if PA_USE_ALSA PaAlsa_Initialize, #endif -#ifdef PA_USE_OSS +#if PA_USE_OSS PaOSS_Initialize, #endif #else /* __linux__ */ -#ifdef PA_USE_OSS +#if PA_USE_OSS PaOSS_Initialize, #endif -#ifdef PA_USE_ALSA +#if PA_USE_ALSA PaAlsa_Initialize, #endif #endif /* __linux__ */ -#ifdef PA_USE_JACK +#if PA_USE_JACK PaJack_Initialize, #endif /* Added for IRIX, Pieter, oct 2, 2003: */ -#ifdef PA_USE_SGI +#if PA_USE_SGI PaSGI_Initialize, #endif -#ifdef PA_USE_ASIHPI +#if PA_USE_ASIHPI PaAsiHpi_Initialize, #endif -#ifdef PA_USE_COREAUDIO +#if PA_USE_COREAUDIO PaMacCore_Initialize, #endif -#ifdef PA_USE_SKELETON +#if PA_USE_SKELETON PaSkeleton_Initialize, #endif -- 2.43.0