From 296d9e1ce910cdd27bfcb04fbe0e528d272b030a Mon Sep 17 00:00:00 2001 From: mchinen Date: Wed, 1 Jun 2011 18:59:51 +0000 Subject: [PATCH] restore build for when USE_PORTMIXER is not defined. This fixes an issue where audacity could not be built on certain linux boxes without devices --- src/DeviceManager.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/DeviceManager.cpp b/src/DeviceManager.cpp index bd409632d..284b3007f 100644 --- a/src/DeviceManager.cpp +++ b/src/DeviceManager.cpp @@ -7,7 +7,9 @@ ******************************************************************/ #include "portaudio.h" +#ifdef USE_PORTMIXER #include "portmixer.h" +#endif #include "Audacity.h" // For compilers that support precompilation, includes "wx/wx.h". @@ -126,14 +128,15 @@ static void FillHostDeviceInfo(DeviceSourceMap *map, const PaDeviceInfo *info, i static void AddSourcesFromStream(int deviceIndex, const PaDeviceInfo *info, std::vector *maps, PaStream *stream) { int i; - PxMixer *portMixer; DeviceSourceMap map; map.sourceIndex = -1; map.totalSources = 0; // Only inputs have sources, so we call FillHostDeviceInfo with a 1 to indicate this FillHostDeviceInfo(&map, info, deviceIndex, 1); - portMixer = Px_OpenMixer(stream, 0); + +#ifdef USE_PORTMIXER + PxMixer *portMixer = Px_OpenMixer(stream, 0); if (!portMixer) { maps->push_back(map); return; @@ -145,11 +148,14 @@ static void AddSourcesFromStream(int deviceIndex, const PaDeviceInfo *info, std: //note that some devices have no input sources at all but are still valid. //the behavior we do is the same for 0 and 1 source cases. map.totalSources = Px_GetNumInputSources(portMixer); +#endif if (map.totalSources <= 1) { map.sourceIndex = 0; maps->push_back(map); - } else { + } +#ifdef USE_PORTMIXER + else { //open up a stream with the device so portmixer can get the info out of it. for (i = 0; i < map.totalSources; i++) { map.sourceIndex = i; @@ -158,6 +164,7 @@ static void AddSourcesFromStream(int deviceIndex, const PaDeviceInfo *info, std: } } Px_CloseMixer(portMixer); +#endif } static bool IsInputDeviceAMapperDevice(const PaDeviceInfo *info)