Browse Source

Juce related fixing

tags/1.9.4
falkTX 10 years ago
parent
commit
8732657bc7
4 changed files with 40 additions and 80 deletions
  1. +14
    -12
      source/backend/engine/CarlaEngineJuce.cpp
  2. +4
    -0
      source/backend/plugin/Lv2Plugin.cpp
  3. +20
    -68
      source/backend/standalone/CarlaStandalone.cpp
  4. +2
    -0
      source/discovery/carla-discovery.cpp

+ 14
- 12
source/backend/engine/CarlaEngineJuce.cpp View File

@@ -140,11 +140,11 @@ public:
return false; return false;
} }


pData->bufferSize = fDevice->getCurrentBufferSizeSamples();
pData->bufferSize = static_cast<uint32_t>(fDevice->getCurrentBufferSizeSamples());
pData->sampleRate = fDevice->getCurrentSampleRate(); pData->sampleRate = fDevice->getCurrentSampleRate();


pData->bufAudio.inCount = inputChannels.countNumberOfSetBits();
pData->bufAudio.outCount = outputChannels.countNumberOfSetBits();
pData->bufAudio.inCount = static_cast<uint32_t>(inputChannels.countNumberOfSetBits());
pData->bufAudio.outCount = static_cast<uint32_t>(outputChannels.countNumberOfSetBits());


CARLA_ASSERT(pData->bufAudio.outCount > 0); CARLA_ASSERT(pData->bufAudio.outCount > 0);


@@ -250,14 +250,14 @@ public:


for (uint i=0; i < pData->bufAudio.inCount; ++i) for (uint i=0; i < pData->bufAudio.inCount; ++i)
{ {
String inputName(inputNames[i]);
String inputName(inputNames[static_cast<int>(i)]);


if (inputName.trim().isNotEmpty()) if (inputName.trim().isNotEmpty())
std::snprintf(strBuf, STR_MAX, "%s", inputName.toRawUTF8()); std::snprintf(strBuf, STR_MAX, "%s", inputName.toRawUTF8());
else else
std::snprintf(strBuf, STR_MAX, "capture_%i", i+1); std::snprintf(strBuf, STR_MAX, "capture_%i", i+1);


callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_PATCHBAY_GROUP_AUDIO_IN, RACK_PATCHBAY_GROUP_AUDIO_IN*1000 + i, PATCHBAY_PORT_TYPE_AUDIO, 0.0f, strBuf);
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_PATCHBAY_GROUP_AUDIO_IN, static_cast<int>(RACK_PATCHBAY_GROUP_AUDIO_IN*1000 + i), PATCHBAY_PORT_TYPE_AUDIO, 0.0f, strBuf);
} }
} }


@@ -275,14 +275,14 @@ public:


for (uint i=0; i < pData->bufAudio.outCount; ++i) for (uint i=0; i < pData->bufAudio.outCount; ++i)
{ {
String outputName(outputNames[i]);
String outputName(outputNames[static_cast<int>(i)]);


if (outputName.trim().isNotEmpty()) if (outputName.trim().isNotEmpty())
std::snprintf(strBuf, STR_MAX, "%s", outputName.toRawUTF8()); std::snprintf(strBuf, STR_MAX, "%s", outputName.toRawUTF8());
else else
std::snprintf(strBuf, STR_MAX, "playback_%i", i+1); std::snprintf(strBuf, STR_MAX, "playback_%i", i+1);


callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_PATCHBAY_GROUP_AUDIO_OUT, RACK_PATCHBAY_GROUP_AUDIO_OUT*1000 + i, PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, 0.0f, strBuf);
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_PATCHBAY_GROUP_AUDIO_OUT, static_cast<int>(RACK_PATCHBAY_GROUP_AUDIO_OUT*1000 + i), PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, 0.0f, strBuf);
} }
} }


@@ -448,7 +448,9 @@ protected:
} }
else else
{ {
pData->processRackFull(const_cast<float**>(inputChannelData), numInputChannels, outputChannelData, numOutputChannels, numSamples, false);
pData->processRackFull(const_cast<float**>(inputChannelData), static_cast<uint32_t>(numInputChannels),
outputChannelData, static_cast<uint32_t>(numOutputChannels),
static_cast<uint32_t>(numSamples), false);
} }


// output events // output events
@@ -575,7 +577,7 @@ const char* CarlaEngine::getJuceApiName(const unsigned int index)
if (static_cast<int>(index) >= gJuceDeviceTypes.size()) if (static_cast<int>(index) >= gJuceDeviceTypes.size())
return nullptr; return nullptr;


AudioIODeviceType* const deviceType(gJuceDeviceTypes[index]);
AudioIODeviceType* const deviceType(gJuceDeviceTypes[static_cast<int>(index)]);


if (deviceType == nullptr) if (deviceType == nullptr)
return nullptr; return nullptr;
@@ -590,7 +592,7 @@ const char* const* CarlaEngine::getJuceApiDeviceNames(const unsigned int index)
if (static_cast<int>(index) >= gJuceDeviceTypes.size()) if (static_cast<int>(index) >= gJuceDeviceTypes.size())
return nullptr; return nullptr;


AudioIODeviceType* const deviceType(gJuceDeviceTypes[index]);
AudioIODeviceType* const deviceType(gJuceDeviceTypes[static_cast<int>(index)]);


if (deviceType == nullptr) if (deviceType == nullptr)
return nullptr; return nullptr;
@@ -630,7 +632,7 @@ const EngineDriverDeviceInfo* CarlaEngine::getJuceDeviceInfo(const unsigned int
return nullptr; return nullptr;
} }


AudioIODeviceType* const deviceType(gJuceDeviceTypes[index]);
AudioIODeviceType* const deviceType(gJuceDeviceTypes[static_cast<int>(index)]);


if (deviceType == nullptr) if (deviceType == nullptr)
return nullptr; return nullptr;
@@ -670,7 +672,7 @@ const EngineDriverDeviceInfo* CarlaEngine::getJuceDeviceInfo(const unsigned int
uint32_t* const bufferSizes(new uint32_t[bufferSizesCount+1]); uint32_t* const bufferSizes(new uint32_t[bufferSizesCount+1]);


for (int i=0; i < bufferSizesCount; ++i) for (int i=0; i < bufferSizesCount; ++i)
bufferSizes[i] = device->getBufferSizeSamples(i);
bufferSizes[i] = static_cast<uint32_t>(device->getBufferSizeSamples(i));
bufferSizes[bufferSizesCount] = 0; bufferSizes[bufferSizesCount] = 0;


devInfo.bufferSizes = bufferSizes; devInfo.bufferSizes = bufferSizes;


+ 4
- 0
source/backend/plugin/Lv2Plugin.cpp View File

@@ -20,6 +20,10 @@


#ifdef WANT_LV2 #ifdef WANT_LV2


#ifdef HAVE_JUCE
# include "juce_gui_basics.h"
#endif

#include "CarlaLv2Utils.hpp" #include "CarlaLv2Utils.hpp"
#include "CarlaMathUtils.hpp" #include "CarlaMathUtils.hpp"
#include "Lv2AtomQueue.hpp" #include "Lv2AtomQueue.hpp"


+ 20
- 68
source/backend/standalone/CarlaStandalone.cpp View File

@@ -40,65 +40,6 @@ using juce::MessageManager;
namespace CB = CarlaBackend; namespace CB = CarlaBackend;
using CB::EngineOptions; using CB::EngineOptions;


#ifdef HAVE_JUCE
// -----------------------------------------------------------------------
// Juce Message Thread

class JuceMessageThread : public CarlaThread
{
public:
JuceMessageThread()
: CarlaThread("JuceMessageThread"),
fInitialised(false)
{
}

~JuceMessageThread() override
{
stop();
}

void start()
{
CARLA_SAFE_ASSERT_RETURN(! fInitialised,);

fInitialised = false;

CarlaThread::start();

while (! fInitialised)
carla_msleep(1);
}

void stop()
{
if (! fInitialised)
return;

CarlaThread::stop(-1);
}

protected:
void run() override
{
fInitialised = true;

if (MessageManager* const msgMgr = MessageManager::getInstance())
{
msgMgr->setCurrentThreadAsMessageThread();

while ((! shouldExit()) && msgMgr->runDispatchLoopUntil(250))
{}
}

fInitialised = false;
}

private:
volatile bool fInitialised;
};
#endif

// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
// Single, standalone engine // Single, standalone engine


@@ -113,10 +54,6 @@ struct CarlaBackendStandalone {


CarlaString lastError; CarlaString lastError;


#ifdef HAVE_JUCE
JuceMessageThread juceMsgThread;
#endif

CarlaBackendStandalone() CarlaBackendStandalone()
: engine(nullptr), : engine(nullptr),
engineCallback(nullptr), engineCallback(nullptr),
@@ -145,17 +82,29 @@ struct CarlaBackendStandalone {
void init() void init()
{ {
JUCE_AUTORELEASEPOOL JUCE_AUTORELEASEPOOL
{
initialiseJuce_GUI();
if (MessageManager* const msgMgr = MessageManager::getInstance())
msgMgr->setCurrentThreadAsMessageThread();
}
}


initialiseJuce_GUI();
juceMsgThread.start();
void idle()
{
JUCE_AUTORELEASEPOOL
{
if (MessageManager* const msgMgr = MessageManager::getInstanceWithoutCreating())
msgMgr->runDispatchLoopUntil(5);
}
} }


void close() void close()
{ {
JUCE_AUTORELEASEPOOL JUCE_AUTORELEASEPOOL

juceMsgThread.stop();
shutdownJuce_GUI();
{
MessageManager::deleteInstance();
shutdownJuce_GUI();
}
} }
#endif #endif


@@ -580,6 +529,9 @@ void carla_engine_idle()
{ {
CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,); CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);


#ifdef HAVE_JUCE
gStandalone.idle();
#endif
gStandalone.engine->idle(); gStandalone.engine->idle();
} }




+ 2
- 0
source/discovery/carla-discovery.cpp View File

@@ -15,6 +15,8 @@
* For a full copy of the GNU General Public License see the doc/GPL.txt file. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/ */


#undef HAVE_JUCE // FIXME

#include "CarlaBackendUtils.hpp" #include "CarlaBackendUtils.hpp"
#include "CarlaLibUtils.hpp" #include "CarlaLibUtils.hpp"
#include "CarlaMathUtils.hpp" #include "CarlaMathUtils.hpp"


Loading…
Cancel
Save