Browse Source

Misc

tags/1.9.4
falkTX 11 years ago
parent
commit
5835b82e97
8 changed files with 123 additions and 97 deletions
  1. +3
    -1
      source/backend/carla_engine.hpp
  2. +6
    -4
      source/backend/engine/carla_engine.cpp
  3. +9
    -9
      source/backend/engine/jack.cpp
  4. +11
    -7
      source/backend/plugin/carla_plugin.cpp
  5. +41
    -29
      source/bridges/carla_bridge_plugin.cpp
  6. +45
    -43
      source/bridges/qtcreator/carla-bridge-plugin.pro
  7. +4
    -0
      source/utils/carla_backend_utils.hpp
  8. +4
    -4
      source/utils/rt_list.hpp

+ 3
- 1
source/backend/carla_engine.hpp View File

@@ -21,7 +21,9 @@
#include "carla_backend.hpp"
#include "carla_utils.hpp"

#ifndef BUILD_BRIDGE
#ifdef BUILD_BRIDGE
struct CarlaOscData;
#else
class QProcessEnvironment;
#endif



+ 6
- 4
source/backend/engine/carla_engine.cpp View File

@@ -1168,13 +1168,13 @@ void CarlaEngine::setOscBridgeData(const CarlaOscData* const oscData)
// -----------------------------------------------------------------------
// protected calls

#ifndef BUILD_BRIDGE
EngineEvent* CarlaEngine::getRackEventBuffer(const bool isInput)
{
// TODO
return nullptr;
}

#ifndef BUILD_BRIDGE
void CarlaEngine::processRack(float* inBuf[2], float* outBuf[2], const uint32_t frames)
{
// initialize outputs (zero)
@@ -1952,14 +1952,14 @@ void CarlaEngine::osc_send_bridge_set_midi_program(const int32_t index)
void CarlaEngine::osc_send_bridge_set_custom_data(const char* const type, const char* const key, const char* const value)
{
qDebug("CarlaEngine::osc_send_bridge_set_custom_data(\"%s\", \"%s\", \"%s\")", type, key, value);
CARLA_ASSERT(m_oscData);
CARLA_ASSERT(fData->oscData);

if (fData->oscData != nullptr && fData->oscData->target != nullptr)
{
char target_path[strlen(fData->oscData->path)+24];
strcpy(target_path, fData->oscData->path);
strcat(target_path, "/bridge_set_custom_data");
lo_send(m_oscData->target, target_path, "sss", type, key, value);
lo_send(fData->oscData->target, target_path, "sss", type, key, value);
}
}

@@ -1977,6 +1977,7 @@ void CarlaEngine::osc_send_bridge_set_chunk_data(const char* const chunkFile)
}
}

#if 0
void CarlaEngine::osc_send_bridge_set_inpeak(const int32_t portId)
{
CARLA_ASSERT(fData->oscData != nullptr);
@@ -1987,7 +1988,7 @@ void CarlaEngine::osc_send_bridge_set_inpeak(const int32_t portId)
char target_path[strlen(fData->oscData->path)+28];
strcpy(target_path, fData->oscData->path);
strcat(target_path, "/bridge_set_inpeak");
lo_send(m_oscData->target, target_path, "id", portId, data->insPeak[portId-1]);
lo_send(fData->oscData->target, target_path, "id", portId, data->insPeak[portId-1]);
}
}

@@ -2005,5 +2006,6 @@ void CarlaEngine::osc_send_bridge_set_outpeak(const int32_t portId)
}
}
#endif
#endif

CARLA_BACKEND_END_NAMESPACE

+ 9
- 9
source/backend/engine/jack.cpp View File

@@ -569,24 +569,24 @@ public:
return false;
#else
// open temp client to get initial buffer-size and sample-rate values
if (bufferSize == 0 || sampleRate == 0.0)
if (fBufferSize == 0 || fSampleRate == 0.0)
{
m_client = jackbridge_client_open(clientName, JackNullOption, nullptr);

if (m_client)
{
bufferSize = jackbridge_get_buffer_size(m_client);
sampleRate = jackbridge_get_sample_rate(m_client);
fBufferSize = jackbridge_get_buffer_size(m_client);
fSampleRate = jackbridge_get_sample_rate(m_client);

jackbridge_client_close(m_client);
m_client = nullptr;
}
}

name = clientName;
name.toBasic();
fName = clientName;
fName.toBasic();

CarlaEngine::init(name);
CarlaEngine::init(fName);
return true;
#endif
}
@@ -632,7 +632,7 @@ public:
bool isRunning() const
{
#ifdef BUILD_BRIDGE
return bool(m_client || ! hasQuit);
return bool(m_client || ! m_hasQuit);
#else
return bool(m_client);
#endif
@@ -655,8 +655,8 @@ public:
#ifdef BUILD_BRIDGE
client = m_client = jackbridge_client_open(plugin->name(), JackNullOption, nullptr);

bufferSize = jackbridge_get_buffer_size(client);
sampleRate = jackbridge_get_sample_rate(client);
fBufferSize = jackbridge_get_buffer_size(client);
fSampleRate = jackbridge_get_sample_rate(client);

jackbridge_set_buffer_size_callback(client, carla_jack_bufsize_callback, this);
jackbridge_set_sample_rate_callback(client, carla_jack_srate_callback, this);


+ 11
- 7
source/backend/plugin/carla_plugin.cpp View File

@@ -785,8 +785,12 @@ void CarlaPlugin::setMidiProgram(int32_t index, const bool sendGui, const bool s
if (sendGui && index >= 0)
uiMidiProgramChange(index);

#ifndef BUILD_BRIDGE
// Change default parameter values (sound banks never change defaults)
if (index >= 0 && type() != PLUGIN_GIG && type() != PLUGIN_SF2 && type() != PLUGIN_SFZ)
#else
if (index >= 0)
#endif
{
for (uint32_t i=0; i < fData->param.count; i++)
{
@@ -839,7 +843,7 @@ void CarlaPlugin::idleGui()
if (fData->hints & PLUGIN_USES_SINGLE_THREAD)
{
// Process postponed events
postEventsRun();
//postEventsRun();

// Update parameter outputs
for (uint32_t i=0; i < fData->param.count; i++)
@@ -962,8 +966,8 @@ void CarlaPlugin::registerToOscClient()

#ifdef BUILD_BRIDGE
fData->engine->osc_send_bridge_parameter_info(i, bufName, bufUnit);
fData->engine->osc_send_bridge_parameter_data(i, param.data[i].type, param.data[i].rindex, param.data[i].hints, param.data[i].midiChannel, param.data[i].midiCC);
fData->engine->osc_send_bridge_parameter_ranges(i, param.ranges[i].def, param.ranges[i].min, param.ranges[i].max, param.ranges[i].step, param.ranges[i].stepSmall, param.ranges[i].stepLarge);
//fData->engine->osc_send_bridge_parameter_data(i, fData->param.data[i].type, fData->param.data[i].rindex, param.data[i].hints, param.data[i].midiChannel, param.data[i].midiCC);
//fData->engine->osc_send_bridge_parameter_ranges(i, fData->param.ranges[i].def, fData->param.ranges[i].min, param.ranges[i].max, param.ranges[i].step, param.ranges[i].stepSmall, param.ranges[i].stepLarge);
fData->engine->osc_send_bridge_set_parameter_value(i, getParameterValue(i));
#else
fData->engine->osc_send_control_set_parameter_data(fData->id, i, fData->param.data[i].type, fData->param.data[i].hints, bufName, bufUnit, getParameterValue(i));
@@ -999,12 +1003,12 @@ void CarlaPlugin::registerToOscClient()
if (fData->midiprog.count > 0)
{
#ifdef BUILD_BRIDGE
x_engine->osc_send_bridge_midi_program_count(midiprog.count);
fData->engine->osc_send_bridge_midi_program_count(fData->midiprog.count);

for (uint32_t i=0; i < midiprog.count; i++)
x_engine->osc_send_bridge_midi_program_info(i, midiprog.data[i].bank, midiprog.data[i].program, midiprog.data[i].name);
for (uint32_t i=0; i < fData->midiprog.count; i++)
fData->engine->osc_send_bridge_midi_program_info(i, fData->midiprog.data[i].bank, fData->midiprog.data[i].program, fData->midiprog.data[i].name);

x_engine->osc_send_bridge_set_midi_program(prog.current);
fData->engine->osc_send_bridge_set_midi_program(fData->midiprog.current);
#else
fData->engine->osc_send_control_set_midi_program_count(fData->id, fData->midiprog.count);



+ 41
- 29
source/bridges/carla_bridge_plugin.cpp View File

@@ -19,8 +19,10 @@

#include "carla_bridge_client.hpp"
#include "carla_bridge_toolkit.hpp"
#include "carla_backend_utils.hpp"
#include "carla_engine.hpp"
#include "carla_plugin.hpp"
#include "../carla/Shared.hpp"
#include "Shared.hpp"

#include <set>
#include <QtCore/QDir>
@@ -101,8 +103,8 @@ CARLA_BRIDGE_START_NAMESPACE

// -------------------------------------------------------------------------

class CarlaBridgeToolkitPlugin : public CarlaBridgeToolkit,
public CarlaBackend::CarlaPluginGUI::Callback
class CarlaBridgeToolkitPlugin : public CarlaBridgeToolkit //,
//public CarlaBackend::CarlaPluginGUI::Callback
{
public:
CarlaBridgeToolkitPlugin(CarlaBridgeClient* const client, const char* const uiTitle)
@@ -111,7 +113,7 @@ public:
qDebug("CarlaBridgeToolkitPlugin::CarlaBridgeToolkitPlugin(%p, \"%s\")", client, uiTitle);

app = nullptr;
gui = nullptr;
//gui = nullptr;

m_hasUI = false;
m_uiQuit = false;
@@ -124,6 +126,7 @@ public:
{
qDebug("CarlaBridgeToolkitPlugin::~CarlaBridgeToolkitPlugin()");

#if 0
if (gui)
{
gui->close();
@@ -131,6 +134,7 @@ public:
delete gui;
gui = nullptr;
}
#endif

if (app)
{
@@ -146,18 +150,18 @@ public:
{
qDebug("CarlaBridgeToolkitPlugin::init()");
CARLA_ASSERT(! app);
CARLA_ASSERT(! gui);
//CARLA_ASSERT(! gui);

app = new QApplication(qargc, qargv);

gui = new CarlaBackend::CarlaPluginGUI(nullptr, this);
//gui = new CarlaBackend::CarlaPluginGUI(nullptr, this);
}

void exec(const bool showGui)
{
qDebug("CarlaBridgeToolkitPlugin::exec(%s)", bool2str(showGui));
CARLA_ASSERT(app);
CARLA_ASSERT(gui);
//CARLA_ASSERT(gui);
CARLA_ASSERT(client);

if (showGui)
@@ -193,12 +197,15 @@ public:
void resize(const int width, const int height)
{
qDebug("CarlaBridgeToolkitPlugin::resize(%i, %i)", width, height);
#if 0
CARLA_ASSERT(gui);

if (gui)
gui->setNewSize(width, height);
#endif
}

#if 0
GuiContainer* getContainer() const
{
CARLA_ASSERT(gui);
@@ -218,6 +225,7 @@ public:

return nullptr;
}
#endif

void setHasUI(const bool hasUI, const bool showUI)
{
@@ -229,7 +237,7 @@ public:

protected:
QApplication* app;
CarlaBackend::CarlaPluginGUI* gui;
//CarlaBackend::CarlaPluginGUI* gui;

private:
bool m_hasUI;
@@ -284,6 +292,7 @@ public:
if (! plugin)
return;

#if 0
bool guiResizable;
CarlaBackend::GuiType guiType;
plugin->getGuiInfo(&guiType, &guiResizable);
@@ -299,6 +308,7 @@ public:
{
plugToolkit->setHasUI(guiType != CarlaBackend::GUI_NONE, false);
}
#endif
}

void quit()
@@ -383,6 +393,7 @@ public:

qDebug("Loading plugin state now...");

#if 0
// ---------------------------------------------------------------------
// Part 1 - set custom data (except chunks)

@@ -397,6 +408,7 @@ public:
plugin->setCustomData(type, key, value, true);
}
}
#endif

// ---------------------------------------------------------------------
// Part 2 - set program
@@ -455,9 +467,9 @@ public:

for (uint32_t i=0; i < midiProgramCount; i++)
{
const MidiProgramData* const midiProgramData = plugin->midiProgramData(i);
const MidiProgramData& midiProgramData = plugin->midiProgramData(i);

if ((int32_t)midiProgramData->bank == content->currentMidiBank && (int32_t)midiProgramData->program == content->currentMidiProgram)
if ((int32_t)midiProgramData.bank == content->currentMidiBank && (int32_t)midiProgramData.program == content->currentMidiProgram)
{
plugin->setMidiProgram(i, true, true, false, true);
break;
@@ -560,10 +572,10 @@ public:
// Now set parameter
if (index >= 0)
{
const ParameterData* const paramData = plugin->parameterData(index);
const ParameterData& paramData = plugin->parameterData(index);
double value = parameter.value;

if (paramData->hints & PARAMETER_USES_SAMPLERATE)
if (paramData.hints & PARAMETER_USES_SAMPLERATE)
value *= sampleRate;

plugin->setParameterValue(index, value, true, true, false);
@@ -574,6 +586,7 @@ public:
qWarning("Could not set parameter data for '%s')", parameter.name.toUtf8().constData());
}

#if 0
// ---------------------------------------------------------------------
// Part 5 - set chunk data

@@ -588,6 +601,7 @@ public:
plugin->setCustomData(type, key, value, true);
}
}
#endif

if (! content->chunk.isEmpty())
plugin->setChunkData(content->chunk.toUtf8().constData());
@@ -599,8 +613,8 @@ public:
{
CARLA_ASSERT(engine);

if (engine)
engine->osc_send_bridge_configure(CarlaBackend::CARLA_BRIDGE_MSG_HIDE_GUI, "");
//if (engine)
// engine->osc_send_bridge_configure(CarlaBackend::CARLA_BRIDGE_MSG_HIDE_GUI, "");
}

void showPluginGui(const bool yesNo)
@@ -675,7 +689,7 @@ public:
if (! plugin)
return;

plugin->sendMidiSingleNote(channel, note, velo, true, true, false);
//plugin->sendMidiSingleNote(channel, note, velo, true, true, false);
}

void noteOff(const uint8_t channel, const uint8_t note)
@@ -686,7 +700,7 @@ public:
if (! plugin)
return;

plugin->sendMidiSingleNote(channel, note, 0, true, true, false);
//plugin->sendMidiSingleNote(channel, note, 0, true, true, false);
}

// ---------------------------------------------------------------------
@@ -705,8 +719,8 @@ public:

for (uint32_t i=0; i < plugin->customDataCount(); i++)
{
const CarlaBackend::CustomData* const cdata = plugin->customData(i);
engine->osc_send_bridge_set_custom_data(cdata->type, cdata->key, cdata->value);
const CarlaBackend::CustomData& cdata = plugin->customData(i);
engine->osc_send_bridge_set_custom_data(cdata.type, cdata.key, cdata.value);
}

if (plugin->hints() & CarlaBackend::PLUGIN_USES_CHUNKS)
@@ -737,7 +751,7 @@ public:
}
}

engine->osc_send_bridge_configure(CarlaBackend::CARLA_BRIDGE_MSG_SAVED, "");
//engine->osc_send_bridge_configure(CarlaBackend::CARLA_BRIDGE_MSG_SAVED, "");
}

void setCustomData(const char* const type, const char* const key, const char* const value)
@@ -785,7 +799,7 @@ public:
// ---------------------------------------------------------------------
// callback

static void callback(void* const ptr, CarlaBackend::CallbackType const action, const unsigned short, const int value1, const int value2, const double value3, const char* const valueStr)
static void callback(void* const ptr, CarlaBackend::CallbackType const action, const int, const int value1, const int value2, const double value3, const char* const valueStr)
{
CARLA_ASSERT(ptr);

@@ -857,12 +871,6 @@ protected:
}
break;

case CALLBACK_RESIZE_GUI:
nextWidth = value1;
nextHeight = value2;
needsResize = true;
break;

case CALLBACK_UPDATE:
// todo
break;
@@ -929,6 +937,7 @@ protected:
void CarlaBridgeToolkitPlugin::show()
{
qDebug("CarlaBridgeToolkitPlugin::show()");
#if 0
CARLA_ASSERT(gui);

CarlaPluginClient* const plugClient = (CarlaPluginClient*)client;
@@ -937,11 +946,13 @@ void CarlaBridgeToolkitPlugin::show()

if (gui && m_uiShow)
gui->setVisible(true);
#endif
}

void CarlaBridgeToolkitPlugin::hide()
{
qDebug("CarlaBridgeToolkitPlugin::hide()");
#if 0
CARLA_ASSERT(gui);

CarlaPluginClient* const plugClient = (CarlaPluginClient*)client;
@@ -950,6 +961,7 @@ void CarlaBridgeToolkitPlugin::hide()
gui->setVisible(false);

plugClient->showPluginGui(false);
#endif
}

void CarlaBridgeToolkitPlugin::guiClosedCallback()
@@ -1102,10 +1114,10 @@ int main(int argc, char* argv[])
extraStuff = findDSSIGUI(filename, name, label);

// Init plugin
short id = engine->addPlugin(itype, filename, name, label, extraStuff);
int id = engine->addPlugin(itype, filename, name, label, extraStuff);
int ret;

if (id >= 0 && id < CarlaBackend::MAX_PLUGINS)
if (id >= 0 && id < CarlaBackend::MAX_DEFAULT_PLUGINS)
{
CarlaBackend::CarlaPlugin* const plugin = engine->getPlugin(id);
client.setPlugin(plugin);
@@ -1133,7 +1145,7 @@ int main(int argc, char* argv[])
if (extraStuff && itype == CarlaBackend::PLUGIN_DSSI)
free((char*)extraStuff);

engine->aboutToClose();
engine->setAboutToClose();
engine->removeAllPlugins();
engine->close();
delete engine;


+ 45
- 43
source/bridges/qtcreator/carla-bridge-plugin.pro View File

@@ -25,76 +25,78 @@ HEADERS = \
../carla_bridge_osc.hpp \
../carla_bridge_toolkit.hpp \

# carla
SOURCES += \
../../carla/Shared.cpp

# common
HEADERS += \
../../carla/Shared.hpp
../../backend/carla_backend.hpp \
../../backend/carla_engine.hpp \
../../backend/carla_plugin.hpp

# carla-engine
SOURCES += \
../../carla-engine/carla_engine.cpp \
../../carla-engine/carla_engine_osc.cpp \
../../carla-engine/carla_engine_thread.cpp \
../../carla-engine/jack.cpp
../../backend/engine/carla_engine.cpp \
../../backend/engine/carla_engine_osc.cpp \
../../backend/engine/carla_engine_thread.cpp \
../../backend/engine/jack.cpp

HEADERS += \
../../carla-engine/carla_engine.hpp \
../../carla-engine/carla_engine_osc.hpp \
../../carla-engine/carla_engine_thread.hpp \
../../backend/engine/carla_engine.hpp \
../../backend/engine/carla_engine_osc.hpp \
../../backend/engine/carla_engine_thread.hpp \

# carla-plugin
SOURCES += \
../../carla-plugin/carla_plugin.cpp \
../../carla-plugin/carla_plugin_thread.cpp \
../../carla-plugin/ladspa.cpp \
../../carla-plugin/dssi.cpp \
../../carla-plugin/lv2.cpp \
../../carla-plugin/vst.cpp
../../backend/plugin/carla_plugin.cpp
# ../../backend/plugin/carla_plugin_thread.cpp \
# ../../backend/plugin/ladspa.cpp \
# ../../backend/plugin/dssi.cpp \
# ../../backend/plugin/lv2.cpp \
# ../../backend/plugin/vst.cpp

HEADERS += \
../../carla-plugin/carla_plugin.hpp \
../../carla-plugin/carla_plugin_thread.hpp
../../backend/plugin/carla_plugin_thread.hpp

# carla-utils
SOURCES += \
../../backend/utils/Shared.cpp

# carla-backend
HEADERS += \
../../carla-backend/carla_backend.hpp \
../../carla-backend/carla_backend_utils.hpp
../../backend/utils/Shared.hpp

# carla-includes
# includes
HEADERS += \
../../carla-includes/carla_defines.hpp \
../../carla-includes/carla_midi.h \
../../carla-includes/ladspa_rdf.hpp \
../../carla-includes/lv2_rdf.hpp
../../includes/carla_defines.hpp \
../../includes/carla_midi.h \
../../includes/ladspa_rdf.hpp \
../../includes/lv2_rdf.hpp

# carla-utils
# utils
HEADERS += \
../../carla-utils/carla_lib_utils.hpp \
../../carla-utils/carla_osc_utils.hpp \
../../carla-utils/carla_ladspa_utils.hpp \
../../carla-utils/carla_lv2_utils.hpp \
../../carla-utils/carla_vst_utils.hpp
../../utils/carla_lib_utils.hpp \
../../utils/carla_osc_utils.hpp \
../../utils/carla_ladspa_utils.hpp \
../../utils/carla_lv2_utils.hpp \
../../utils/carla_vst_utils.hpp \
../../utils/carla_backend_utils.hpp

INCLUDEPATH = .. \
../../carla-backend \
../../carla-engine \
../../carla-includes \
../../carla-jackbridge \
../../carla-plugin \
../../carla-utils
../../backend \
../../backend/engine \
../../backend/plugin \
../../backend/utils \
../../includes \
../../libs \
../../utils

DEFINES = QTCREATOR_TEST
DEFINES += DEBUG
#DEFINES += VESTIGE_HEADER
DEFINES += BUILD_BRIDGE BUILD_BRIDGE_PLUGIN BRIDGE_PLUGIN

DEFINES += CARLA_ENGINE_JACK
DEFINES += WANT_JACK
DEFINES += WANT_LADSPA WANT_DSSI WANT_LV2 WANT_VST

LIBS = -ldl \
../../carla-lilv/carla_lilv.a \
../../carla-rtmempool/carla_rtmempool.a
../../libs/lilv.a \
../../libs/rtmempool.a

QMAKE_CXXFLAGS *= -std=c++0x

+ 4
- 0
source/utils/carla_backend_utils.hpp View File

@@ -55,8 +55,10 @@ const char* PluginType2Str(const PluginType& type)
{
case PLUGIN_NONE:
return "PLUGIN_NONE";
#ifndef BUILD_BRIDGE
case PLUGIN_INTERNAL:
return "PLUGIN_INTERNAL";
#endif
case PLUGIN_LADSPA:
return "PLUGIN_LADSPA";
case PLUGIN_DSSI:
@@ -65,12 +67,14 @@ const char* PluginType2Str(const PluginType& type)
return "PLUGIN_LV2";
case PLUGIN_VST:
return "PLUGIN_VST";
#ifndef BUILD_BRIDGE
case PLUGIN_GIG:
return "PLUGIN_GIG";
case PLUGIN_SF2:
return "PLUGIN_SF2";
case PLUGIN_SFZ:
return "PLUGIN_SFZ";
#endif
}

qWarning("CarlaBackend::PluginType2Str(%i) - invalid type", type);


+ 4
- 4
source/utils/rt_list.hpp View File

@@ -231,7 +231,7 @@ private:
return value;
}

LIST_DECLARATIONS(List)
//LIST_DECLARATIONS(List)
};

template<typename T>
@@ -292,7 +292,7 @@ private:
rtsafe_memory_pool_deallocate(fMemPool, dataPtr);
}

LIST_DECLARATIONS(RtList)
//LIST_DECLARATIONS(RtList)
};

template<typename T>
@@ -318,7 +318,7 @@ private:
free(dataPtr);
}

LIST_DECLARATIONS(NonRtList)
//LIST_DECLARATIONS(NonRtList)
};

template<typename T>
@@ -344,7 +344,7 @@ private:
delete dataPtr;
}

LIST_DECLARATIONS(NonRtListNew)
//LIST_DECLARATIONS(NonRtListNew)
};

// -----------------------------------------------------------------------


Loading…
Cancel
Save