1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-19 01:20:54 +02:00

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

This commit is contained in:
mchinen 2011-06-01 18:59:51 +00:00
parent fec888198a
commit 296d9e1ce9

View File

@ -7,7 +7,9 @@
******************************************************************/ ******************************************************************/
#include "portaudio.h" #include "portaudio.h"
#ifdef USE_PORTMIXER
#include "portmixer.h" #include "portmixer.h"
#endif
#include "Audacity.h" #include "Audacity.h"
// For compilers that support precompilation, includes "wx/wx.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<DeviceSourceMap> *maps, PaStream *stream) static void AddSourcesFromStream(int deviceIndex, const PaDeviceInfo *info, std::vector<DeviceSourceMap> *maps, PaStream *stream)
{ {
int i; int i;
PxMixer *portMixer;
DeviceSourceMap map; DeviceSourceMap map;
map.sourceIndex = -1; map.sourceIndex = -1;
map.totalSources = 0; map.totalSources = 0;
// Only inputs have sources, so we call FillHostDeviceInfo with a 1 to indicate this // Only inputs have sources, so we call FillHostDeviceInfo with a 1 to indicate this
FillHostDeviceInfo(&map, info, deviceIndex, 1); FillHostDeviceInfo(&map, info, deviceIndex, 1);
portMixer = Px_OpenMixer(stream, 0);
#ifdef USE_PORTMIXER
PxMixer *portMixer = Px_OpenMixer(stream, 0);
if (!portMixer) { if (!portMixer) {
maps->push_back(map); maps->push_back(map);
return; 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. //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. //the behavior we do is the same for 0 and 1 source cases.
map.totalSources = Px_GetNumInputSources(portMixer); map.totalSources = Px_GetNumInputSources(portMixer);
#endif
if (map.totalSources <= 1) { if (map.totalSources <= 1) {
map.sourceIndex = 0; map.sourceIndex = 0;
maps->push_back(map); 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. //open up a stream with the device so portmixer can get the info out of it.
for (i = 0; i < map.totalSources; i++) { for (i = 0; i < map.totalSources; i++) {
map.sourceIndex = i; map.sourceIndex = i;
@ -158,6 +164,7 @@ static void AddSourcesFromStream(int deviceIndex, const PaDeviceInfo *info, std:
} }
} }
Px_CloseMixer(portMixer); Px_CloseMixer(portMixer);
#endif
} }
static bool IsInputDeviceAMapperDevice(const PaDeviceInfo *info) static bool IsInputDeviceAMapperDevice(const PaDeviceInfo *info)