From 5dfe6b46cd188f0934ef8be087ad4030e9f3cc9f Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 8 Jul 2014 17:00:55 +0100 Subject: [PATCH] Fix #105 --- source/backend/engine/CarlaEngineInternal.cpp | 4 ++ source/backend/engine/CarlaEngineInternal.hpp | 2 + source/backend/engine/CarlaEngineRtAudio.cpp | 39 +++++++++---------- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/source/backend/engine/CarlaEngineInternal.cpp b/source/backend/engine/CarlaEngineInternal.cpp index 351966f9e..adefd7d3a 100644 --- a/source/backend/engine/CarlaEngineInternal.cpp +++ b/source/backend/engine/CarlaEngineInternal.cpp @@ -581,6 +581,7 @@ void CarlaEngine::ProtectedData::close() // ----------------------------------------------------------------------- +#ifndef BUILD_BRIDGE void CarlaEngine::ProtectedData::doPluginRemove() noexcept { CARLA_SAFE_ASSERT_RETURN(curPluginCount > 0,); @@ -634,6 +635,7 @@ void CarlaEngine::ProtectedData::doPluginsSwitch() noexcept plugins[idB].plugin = tmp; #endif } +#endif void CarlaEngine::ProtectedData::doNextPluginAction(const bool unlock) noexcept { @@ -644,12 +646,14 @@ void CarlaEngine::ProtectedData::doNextPluginAction(const bool unlock) noexcept case kEnginePostActionZeroCount: curPluginCount = 0; break; +#ifndef BUILD_BRIDGE case kEnginePostActionRemovePlugin: doPluginRemove(); break; case kEnginePostActionSwitchPlugins: doPluginsSwitch(); break; +#endif } nextAction.opcode = kEnginePostActionNull; diff --git a/source/backend/engine/CarlaEngineInternal.hpp b/source/backend/engine/CarlaEngineInternal.hpp index c48456e4f..be4d2ff11 100644 --- a/source/backend/engine/CarlaEngineInternal.hpp +++ b/source/backend/engine/CarlaEngineInternal.hpp @@ -378,8 +378,10 @@ struct EngineInternalTime { enum EnginePostAction { kEnginePostActionNull, kEnginePostActionZeroCount, +#ifndef BUILD_BRIDGE kEnginePostActionRemovePlugin, kEnginePostActionSwitchPlugins +#endif }; struct EngineNextAction { diff --git a/source/backend/engine/CarlaEngineRtAudio.cpp b/source/backend/engine/CarlaEngineRtAudio.cpp index c25bb590c..d1f47ae18 100644 --- a/source/backend/engine/CarlaEngineRtAudio.cpp +++ b/source/backend/engine/CarlaEngineRtAudio.cpp @@ -50,31 +50,28 @@ static void initRtAudioAPIsIfNeeded() needsInit = false; - RtAudio::getCompiledApi(gRtAudioApis); + // get APIs in a local var, and pass wanted ones into gRtAudioApis - std::vector::iterator it; + std::vector apis; + RtAudio::getCompiledApi(apis); - // remove JACK if not available - if (! jackbridge_is_ok()) + for (std::vector::iterator it = apis.begin(), end = apis.end(); it != end; ++it) { - it = std::find(gRtAudioApis.begin(), gRtAudioApis.end(), RtAudio::UNIX_JACK); - if (it != gRtAudioApis.end()) gRtAudioApis.erase(it); + const RtAudio::Api& api(*it); + + if (api == RtAudio::LINUX_ALSA) + continue; + if (api == RtAudio::MACOSX_CORE) + continue; + if (api == RtAudio::WINDOWS_ASIO) + continue; + if (api == RtAudio::WINDOWS_DS) + continue; + if (api == RtAudio::UNIX_JACK && ! jackbridge_is_ok()) + continue; + + gRtAudioApis.push_back(api); } - -#ifdef HAVE_JUCE - // prefer juce to handle some APIs - it = std::find(gRtAudioApis.begin(), gRtAudioApis.end(), RtAudio::LINUX_ALSA); - if (it != gRtAudioApis.end()) gRtAudioApis.erase(it); - - it = std::find(gRtAudioApis.begin(), gRtAudioApis.end(), RtAudio::MACOSX_CORE); - if (it != gRtAudioApis.end()) gRtAudioApis.erase(it); - - it = std::find(gRtAudioApis.begin(), gRtAudioApis.end(), RtAudio::WINDOWS_ASIO); - if (it != gRtAudioApis.end()) gRtAudioApis.erase(it); - - it = std::find(gRtAudioApis.begin(), gRtAudioApis.end(), RtAudio::WINDOWS_DS); - if (it != gRtAudioApis.end()) gRtAudioApis.erase(it); -#endif } static const char* getRtAudioApiName(const RtAudio::Api api) noexcept