Browse Source

Carla: More cleanup; fix engine thread issue

tags/v0.9.0
falkTX 12 years ago
parent
commit
345e5f0e8c
15 changed files with 98 additions and 74 deletions
  1. +10
    -5
      c++/carla-backend/carla_backend.hpp
  2. +1
    -1
      c++/carla-engine/DistrhoPluginInfo.h
  3. +25
    -0
      c++/carla-engine/carla_engine.cpp
  4. +2
    -0
      c++/carla-engine/carla_engine.hpp
  5. +16
    -5
      c++/carla-engine/carla_engine.pro
  6. +1
    -1
      c++/carla-engine/carla_engine_osc.cpp
  7. +3
    -2
      c++/carla-engine/carla_engine_osc.hpp
  8. +27
    -49
      c++/carla-engine/carla_engine_thread.cpp
  9. +3
    -1
      c++/carla-engine/carla_engine_thread.hpp
  10. +1
    -1
      c++/carla-engine/jack.cpp
  11. +2
    -2
      c++/carla-engine/plugin.cpp
  12. +1
    -1
      c++/carla-engine/rtaudio.cpp
  13. +1
    -2
      c++/distrho-plugin-toolkit/src/DistrhoPluginLADSPA+DSSI.cpp
  14. +3
    -3
      src/claudia.py
  15. +2
    -1
      src/shared_carla.py

+ 10
- 5
c++/carla-backend/carla_backend.hpp View File

@@ -83,13 +83,14 @@ const unsigned int PARAMETER_USES_CUSTOM_TEXT = 0x80; //!< Parameter uses custom
/*! /*!
* @defgroup CustomDataTypes Custom Data types * @defgroup CustomDataTypes Custom Data types
* *
* The type defines how the value in CustomData is stored.
* The type defines how the \param value in CustomData is stored.
* *
* Types are valid URIs.\n * Types are valid URIs.\n
* Any non-string type is saved in a base64 format.
* Any non-string type is saved in a base64 encoded format.
*/ */
const char* const CUSTOM_DATA_INVALID = nullptr; //!< Null/Invalid data.
const char* const CUSTOM_DATA_STRING = "urn:carla:string"; //!< Internal String (s)
const char* const CUSTOM_DATA_INVALID = nullptr; //!< Null/Invalid data.
const char* const CUSTOM_DATA_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk"; //!< Carla Chunk
const char* const CUSTOM_DATA_STRING = "http://kxstudio.sf.net/ns/carla/string"; //!< Carla String
/**@}*/ /**@}*/


/*! /*!
@@ -562,13 +563,17 @@ struct CustomData {
const char* value; const char* value;


CustomData() CustomData()
: type(CUSTOM_DATA_INVALID),
: type(nullptr),
key(nullptr), key(nullptr),
value(nullptr) {} value(nullptr) {}
}; };


/**@}*/ /**@}*/


// forward declarations of commonly used Carla classes
class CarlaEngine;
class CarlaPlugin;

CARLA_BACKEND_END_NAMESPACE CARLA_BACKEND_END_NAMESPACE


#endif // CARLA_BACKEND_HPP #endif // CARLA_BACKEND_HPP

+ 1
- 1
c++/carla-engine/DistrhoPluginInfo.h View File

@@ -1,5 +1,5 @@
/* /*
* Carla Backend
* Carla Plugin Engine
* Copyright (C) 2012 Filipe Coelho <falktx@falktx.com> * Copyright (C) 2012 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify


+ 25
- 0
c++/carla-engine/carla_engine.cpp View File

@@ -1248,6 +1248,31 @@ void CarlaEngine::bufferSizeChanged(const uint32_t newBufferSize)
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
// Carla Engine OSC stuff // Carla Engine OSC stuff


void CarlaEngine::osc_send_peaks(CarlaPlugin* const plugin, const unsigned short& id)
{
// Peak values
if (plugin->audioInCount() > 0)
{
#ifdef BUILD_BRIDGE
osc_send_bridge_set_inpeak(1);
osc_send_bridge_set_inpeak(2);
#else
osc_send_control_set_input_peak_value(id, 1);
osc_send_control_set_input_peak_value(id, 2);
#endif
}
if (plugin->audioOutCount() > 0)
{
#ifdef BUILD_BRIDGE
osc_send_bridge_set_outpeak(1);
osc_send_bridge_set_outpeak(2);
#else
osc_send_control_set_output_peak_value(id, 1);
osc_send_control_set_output_peak_value(id, 2);
#endif
}
}

#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
void CarlaEngine::osc_send_control_add_plugin_start(const int32_t pluginId, const char* const pluginName) void CarlaEngine::osc_send_control_add_plugin_start(const int32_t pluginId, const char* const pluginName)
{ {


+ 2
- 0
c++/carla-engine/carla_engine.hpp View File

@@ -695,6 +695,8 @@ public:
void setOscBridgeData(const CarlaOscData* const oscData); void setOscBridgeData(const CarlaOscData* const oscData);
#endif #endif


void osc_send_peaks(CarlaPlugin* const plugin, const unsigned short& id);

#ifdef BUILD_BRIDGE #ifdef BUILD_BRIDGE
void osc_send_bridge_audio_count(const int32_t ins, const int32_t outs, const int32_t total); void osc_send_bridge_audio_count(const int32_t ins, const int32_t outs, const int32_t total);
void osc_send_bridge_midi_count(const int32_t ins, const int32_t outs, const int32_t total); void osc_send_bridge_midi_count(const int32_t ins, const int32_t outs, const int32_t total);


+ 16
- 5
c++/carla-engine/carla_engine.pro View File

@@ -9,11 +9,19 @@ CONFIG += link_pkgconfig qt warn_on
DEFINES = DEBUG DEFINES = DEBUG
DEFINES += QTCREATOR_TEST DEFINES += QTCREATOR_TEST


# JACK
DEFINES += CARLA_ENGINE_JACK DEFINES += CARLA_ENGINE_JACK

# RtAudio/RtMidi
DEFINES += CARLA_ENGINE_RTAUDIO HAVE_GETTIMEOFDAY _FORTIFY_SOURCE=2 DEFINES += CARLA_ENGINE_RTAUDIO HAVE_GETTIMEOFDAY _FORTIFY_SOURCE=2
DEFINES += CARLA_ENGINE_PLUGIN DISTRHO_PLUGIN_TARGET_DSSI
DEFINES += __LINUX_ALSA__ __LINUX_ALSASEQ__ __LINUX_PULSE__ __UNIX_JACK__ DEFINES += __LINUX_ALSA__ __LINUX_ALSASEQ__ __LINUX_PULSE__ __UNIX_JACK__
DEFINES += __RTAUDIO_DEBUG__ __RTMIDI_DEBUG__ DEFINES += __RTAUDIO_DEBUG__ __RTMIDI_DEBUG__

# DISTRHO Plugin
DEFINES += CARLA_ENGINE_PLUGIN
DEFINES += DISTRHO_PLUGIN_TARGET_DSSI

# Misc
DEFINES += WANT_LV2 DEFINES += WANT_LV2


PKGCONFIG = liblo jack alsa libpulse-simple PKGCONFIG = liblo jack alsa libpulse-simple
@@ -22,7 +30,7 @@ TARGET = carla_engine
TEMPLATE = lib TEMPLATE = lib
VERSION = 0.5.0 VERSION = 0.5.0


SOURCES = \
SOURCES = \
carla_engine.cpp \ carla_engine.cpp \
carla_engine_osc.cpp \ carla_engine_osc.cpp \
carla_engine_thread.cpp \ carla_engine_thread.cpp \
@@ -30,18 +38,21 @@ SOURCES = \
rtaudio.cpp \ rtaudio.cpp \
plugin.cpp plugin.cpp


HEADERS = \
HEADERS = \
carla_engine.hpp \ carla_engine.hpp \
carla_engine_osc.hpp \ carla_engine_osc.hpp \
carla_engine_thread.hpp carla_engine_thread.hpp


HEADERS += \
DistrhoPluginInfo.h

INCLUDEPATH = . \ INCLUDEPATH = . \
../carla-backend \ ../carla-backend \
../carla-includes \ ../carla-includes \
../carla-plugin \ ../carla-plugin \
../carla-utils ../carla-utils


# Jack
# JACK
INCLUDEPATH += ../carla-jackbridge INCLUDEPATH += ../carla-jackbridge


# RtAudio/RtMidi # RtAudio/RtMidi
@@ -51,6 +62,6 @@ SOURCES += rtaudio-4.0.11/RtAudio.cpp
SOURCES += rtmidi-2.0.1/RtMidi.cpp SOURCES += rtmidi-2.0.1/RtMidi.cpp


# Plugin # Plugin
INCLUDEPATH += distrho-plugin-toolkit
INCLUDEPATH += ../distrho-plugin-toolkit


QMAKE_CXXFLAGS *= -std=c++0x QMAKE_CXXFLAGS *= -std=c++0x

+ 1
- 1
c++/carla-engine/carla_engine_osc.cpp View File

@@ -483,7 +483,7 @@ int CarlaEngineOsc::handleMsgExiting(CARLA_ENGINE_OSC_HANDLE_ARGS1)
qDebug("CarlaEngineOsc::handleMsgExiting()"); qDebug("CarlaEngineOsc::handleMsgExiting()");


// TODO - check for non-UIs (dssi-vst) and set to -1 instead // TODO - check for non-UIs (dssi-vst) and set to -1 instead
engine->callback(CALLBACK_SHOW_GUI, plugin->id(), 0, 0, 0.0);
engine->callback(CALLBACK_SHOW_GUI, plugin->id(), 0, 0, 0.0, nullptr);
plugin->freeOscData(); plugin->freeOscData();


return 0; return 0;


+ 3
- 2
c++/carla-engine/carla_engine_osc.hpp View File

@@ -49,8 +49,9 @@


CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE


class CarlaEngine;
class CarlaPlugin;
#if 0
} // Fix editor indentation
#endif


class CarlaEngineOsc class CarlaEngineOsc
{ {


+ 27
- 49
c++/carla-engine/carla_engine_thread.cpp View File

@@ -84,74 +84,52 @@ void CarlaEngineThread::run()
{ {
CarlaPlugin* const plugin = engine->getPluginUnchecked(i); CarlaPlugin* const plugin = engine->getPluginUnchecked(i);


if (plugin && plugin->enabled())
{
if (! (plugin && plugin->enabled()))
continue;

#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
const unsigned short id = plugin->id();
const unsigned short id = plugin->id();
#endif #endif
usesSingleThread = (plugin->hints() & PLUGIN_USES_SINGLE_THREAD);
usesSingleThread = (plugin->hints() & PLUGIN_USES_SINGLE_THREAD);


// -------------------------------------------------------
// Process postponed events
// -------------------------------------------------------
// Process postponed events


if (! usesSingleThread)
plugin->postEventsRun();
if (! usesSingleThread)
plugin->postEventsRun();


// -------------------------------------------------------
if (oscControlRegisted || ! usesSingleThread)
{
// ---------------------------------------------------
// Update parameter outputs // Update parameter outputs


if (oscControlRegisted || ! usesSingleThread)
for (uint32_t j=0; j < plugin->parameterCount(); j++)
{ {
for (uint32_t i=0; i < plugin->parameterCount(); i++)
{
if (! plugin->parameterIsOutput(i))
continue;
if (! plugin->parameterIsOutput(j))
continue;


value = plugin->getParameterValue(i);
value = plugin->getParameterValue(j);


// Update UI
if (! usesSingleThread)
plugin->uiParameterChange(i, value);
// Update UI
if (! usesSingleThread)
plugin->uiParameterChange(j, value);


// Update OSC control client
if (oscControlRegisted)
{
// Update OSC control client
if (oscControlRegisted)
{
#ifdef BUILD_BRIDGE #ifdef BUILD_BRIDGE
engine->osc_send_bridge_set_parameter_value(i, value);
engine->osc_send_bridge_set_parameter_value(j, value);
#else #else
engine->osc_send_control_set_parameter_value(id, i, value);
engine->osc_send_control_set_parameter_value(id, j, value);
#endif #endif
}
} }
} }


// -------------------------------------------------------
// Update OSC control client (peaks)
// ---------------------------------------------------
// Update OSC control client peaks


if (oscControlRegisted) if (oscControlRegisted)
{
// Peak values
if (plugin->audioInCount() > 0)
{
#ifdef BUILD_BRIDGE
engine->osc_send_bridge_set_inpeak(1);
engine->osc_send_bridge_set_inpeak(2);
#else
engine->osc_send_control_set_input_peak_value(id, 1);
engine->osc_send_control_set_input_peak_value(id, 2);
#endif
}
if (plugin->audioOutCount() > 0)
{
#ifdef BUILD_BRIDGE
engine->osc_send_bridge_set_outpeak(1);
engine->osc_send_bridge_set_outpeak(2);
#else
engine->osc_send_control_set_output_peak_value(id, 1);
engine->osc_send_control_set_output_peak_value(id, 2);
#endif
}
}
engine->osc_send_peaks(plugin, id);
} }
} }




+ 3
- 1
c++/carla-engine/carla_engine_thread.hpp View File

@@ -25,7 +25,9 @@


CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE


class CarlaEngine;
#if 0
} // Fix editor indentation
#endif


class CarlaEngineThread : public QThread class CarlaEngineThread : public QThread
{ {


+ 1
- 1
c++/carla-engine/jack.cpp View File

@@ -1,5 +1,5 @@
/* /*
* Carla Engine
* Carla JACK Engine
* Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com> * Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify


+ 2
- 2
c++/carla-engine/plugin.cpp View File

@@ -1,5 +1,5 @@
/* /*
* Carla Backend
* Carla Plugin Engine
* Copyright (C) 2012 Filipe Coelho <falktx@falktx.com> * Copyright (C) 2012 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -454,7 +454,7 @@ protected:
//#endif //#endif
} }


void d_run(const float** inputs, float** outputs, uint32_t frames, uint32_t midiEventCount, const DISTRHO::MidiEvent* midiEvents)
void d_run(float** inputs, float** outputs, uint32_t frames, uint32_t midiEventCount, const DISTRHO::MidiEvent* midiEvents)
{ {
if (maxPluginNumber() == 0) if (maxPluginNumber() == 0)
return; return;


+ 1
- 1
c++/carla-engine/rtaudio.cpp View File

@@ -1,5 +1,5 @@
/* /*
* Carla Engine
* Carla RtAudio Engine
* Copyright (C) 2012 Filipe Coelho <falktx@falktx.com> * Copyright (C) 2012 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify


+ 1
- 2
c++/distrho-plugin-toolkit/src/DistrhoPluginLADSPA+DSSI.cpp View File

@@ -34,7 +34,6 @@
#include <vector> #include <vector>


typedef LADSPA_Data* LADSPA_DataPtr; typedef LADSPA_Data* LADSPA_DataPtr;
typedef const LADSPA_Data* LADSPA_DataConstPtr;
typedef std::vector<LADSPA_Data> LADSPA_DataVector; typedef std::vector<LADSPA_Data> LADSPA_DataVector;
typedef std::vector<LADSPA_DataPtr> LADSPA_DataPtrVector; typedef std::vector<LADSPA_DataPtr> LADSPA_DataPtrVector;


@@ -296,7 +295,7 @@ private:
PluginInternal plugin; PluginInternal plugin;


// LADSPA ports // LADSPA ports
LADSPA_DataConstPtr portAudioIns[DISTRHO_PLUGIN_NUM_INPUTS];
LADSPA_DataPtr portAudioIns[DISTRHO_PLUGIN_NUM_INPUTS];
LADSPA_DataPtr portAudioOuts[DISTRHO_PLUGIN_NUM_INPUTS]; LADSPA_DataPtr portAudioOuts[DISTRHO_PLUGIN_NUM_INPUTS];
LADSPA_DataPtrVector portControls; LADSPA_DataPtrVector portControls;
#if DISTRHO_PLUGIN_WANT_LATENCY #if DISTRHO_PLUGIN_WANT_LATENCY


+ 3
- 3
src/claudia.py View File

@@ -153,9 +153,9 @@ URI_CANVAS_WIDTH = "http://ladish.org/ns/canvas/width"
URI_CANVAS_HEIGHT = "http://ladish.org/ns/canvas/height" URI_CANVAS_HEIGHT = "http://ladish.org/ns/canvas/height"
URI_CANVAS_X = "http://ladish.org/ns/canvas/x" URI_CANVAS_X = "http://ladish.org/ns/canvas/x"
URI_CANVAS_Y = "http://ladish.org/ns/canvas/y" URI_CANVAS_Y = "http://ladish.org/ns/canvas/y"
URI_CANVAS_SPLIT = "http://kxstudio.sourceforge.net/ns/canvas/split"
URI_CANVAS_X_SPLIT = "http://kxstudio.sourceforge.net/ns/canvas/x_split"
URI_CANVAS_Y_SPLIT = "http://kxstudio.sourceforge.net/ns/canvas/y_split"
URI_CANVAS_SPLIT = "http://kxstudio.sf.net/ns/canvas/split"
URI_CANVAS_X_SPLIT = "http://kxstudio.sf.net/ns/canvas/x_split"
URI_CANVAS_Y_SPLIT = "http://kxstudio.sf.net/ns/canvas/y_split"


DEFAULT_CANVAS_WIDTH = 3100 DEFAULT_CANVAS_WIDTH = 3100
DEFAULT_CANVAS_HEIGHT = 2400 DEFAULT_CANVAS_HEIGHT = 2400


+ 2
- 1
src/shared_carla.py View File

@@ -71,7 +71,8 @@ PARAMETER_USES_CUSTOM_TEXT = 0x80


# group custom data types # group custom data types
CUSTOM_DATA_INVALID = None CUSTOM_DATA_INVALID = None
CUSTOM_DATA_STRING = "urn:carla:string"
CUSTOM_DATA_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk"
CUSTOM_DATA_STRING = "http://kxstudio.sf.net/ns/carla/string"


# enum BinaryType # enum BinaryType
BINARY_NONE = 0 BINARY_NONE = 0


Loading…
Cancel
Save