Browse Source

More cleanup; make distrho plugins work without UI for now

tags/1.9.4
falkTX 12 years ago
parent
commit
04518c5670
18 changed files with 175 additions and 221 deletions
  1. +18
    -23
      source/backend/CarlaBackend.hpp
  2. +1
    -1
      source/backend/native/3bandeq/DistrhoPlugin3BandEQ.hpp
  3. +1
    -11
      source/backend/native/3bandeq/DistrhoPluginInfo.h
  4. +1
    -1
      source/backend/native/3bandsplitter/DistrhoPlugin3BandSplitter.hpp
  5. +1
    -1
      source/backend/native/3bandsplitter/DistrhoPluginInfo.h
  6. +6
    -6
      source/backend/native/Makefile
  7. +3
    -3
      source/backend/native/distrho-3bandeq.cpp
  8. +3
    -3
      source/backend/native/distrho-3bandsplitter.cpp
  9. +3
    -3
      source/backend/native/distrho-pingpongpan.cpp
  10. +81
    -104
      source/backend/native/distrho/DistrhoPluginCarla.cpp
  11. +1
    -1
      source/backend/native/pingpongpan/DistrhoPluginInfo.h
  12. +1
    -1
      source/backend/native/pingpongpan/DistrhoPluginPingPongPan.hpp
  13. +1
    -1
      source/backend/plugin/CarlaPlugin.cpp
  14. +2
    -3
      source/backend/plugin/CarlaPluginInternal.hpp
  15. +9
    -12
      source/backend/plugin/FluidSynthPlugin.cpp
  16. +32
    -34
      source/carla_shared.py
  17. +8
    -10
      source/utils/CarlaBackendUtils.hpp
  18. +3
    -3
      source/utils/CarlaString.hpp

+ 18
- 23
source/backend/CarlaBackend.hpp View File

@@ -50,17 +50,15 @@ const unsigned int MAX_DEFAULT_PARAMETERS = 200; //!< Maximum default number of
* \see CarlaPlugin::hints()
* @{
*/
const unsigned int PLUGIN_IS_BRIDGE = 0x0001; //!< Plugin is a bridge (ie, BridgePlugin). This hint is required because "bridge" itself is not a plugin type.
const unsigned int PLUGIN_IS_RTSAFE = 0x0002; //!< Plugin is hard real-time safe.
const unsigned int PLUGIN_IS_SYNTH = 0x0004; //!< Plugin is a synthesizer (produces sound).
const unsigned int PLUGIN_HAS_GUI = 0x0010; //!< Plugin has its own custom GUI.
const unsigned int PLUGIN_USES_CHUNKS = 0x0020; //!< Plugin uses chunks to save internal data.\see CarlaPlugin::chunkData()
const unsigned int PLUGIN_USES_SINGLE_THREAD = 0x0040; //!< Plugin needs a single thread for both DSP and UI events.
const unsigned int PLUGIN_CAN_DRYWET = 0x0100; //!< Plugin can make use of Dry/Wet controls.
const unsigned int PLUGIN_CAN_VOLUME = 0x0200; //!< Plugin can make use of Volume controls.
const unsigned int PLUGIN_CAN_BALANCE = 0x0400; //!< Plugin can make use of Left & Right Balance controls.
const unsigned int PLUGIN_CAN_PANNING = 0x0800; //!< Plugin can make use of Panning controls.
const unsigned int PLUGIN_CAN_FORCE_STEREO = 0x1000; //!< Plugin can be used in forced-stereo mode.
const unsigned int PLUGIN_IS_BRIDGE = 0x001; //!< Plugin is a bridge (ie, BridgePlugin). This hint is required because "bridge" itself is not a plugin type.
const unsigned int PLUGIN_IS_RTSAFE = 0x002; //!< Plugin is hard real-time safe.
const unsigned int PLUGIN_IS_SYNTH = 0x004; //!< Plugin is a synthesizer (produces sound).
const unsigned int PLUGIN_HAS_GUI = 0x010; //!< Plugin has its own custom GUI.
const unsigned int PLUGIN_HAS_SINGLE_THREAD = 0x020; //!< Plugin needs a single thread for both DSP and UI events.
const unsigned int PLUGIN_CAN_DRYWET = 0x100; //!< Plugin can make use of Dry/Wet controls.
const unsigned int PLUGIN_CAN_VOLUME = 0x200; //!< Plugin can make use of Volume controls.
const unsigned int PLUGIN_CAN_BALANCE = 0x400; //!< Plugin can make use of Left & Right Balance controls.
const unsigned int PLUGIN_CAN_PANNING = 0x800; //!< Plugin can make use of Panning controls.
/**@}*/

/*!
@@ -69,20 +67,17 @@ const unsigned int PLUGIN_CAN_FORCE_STEREO = 0x1000; //!< Plugin can be used i
* Various plugin options.\n
* ON or OFF defines the default plugin value.
* \see CarlaPlugin::options()
* \note PitchBend is disabled by default on VST plugins
* @{
*/
const unsigned int PLUGIN_OPTION_FIXED_BUFFER = 0x001; //!< OFF: Use a constant, fixed size audio buffer (128 or lower is used)
const unsigned int PLUGIN_OPTION_FORCE_STEREO = 0x002; //!< OFF: Force mono plugin as stereo
const unsigned int PLUGIN_OPTION_SELF_AUTOMATION = 0x004; //!< OFF: Let the plugin handle MIDI-CC automation, not the host
const unsigned int PLUGIN_OPTION_USE_CHUNKS = 0x008; //!< ON: Use chunks to save data
const unsigned int PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x010; //!< ON: Send MIDI ALL_SOUND_OFF / ALL_NOTES_OFF events
const unsigned int PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x020; //!< ON: Send MIDI Note aftertouch events
const unsigned int PLUGIN_OPTION_SEND_PITCHBEND = 0x040; //!< ON: Send MIDI Pitchbend events
#ifdef WANT_VST
const unsigned int PLUGIN_OPTION_VST_SUPPLY_IDLE = 0x100; //!< ON: Idle Plugin's custom GUI (VST only)
const unsigned int PLUGIN_OPTION_VST_UPDATE_DISPLAY = 0x200; //!< ON: Recheck plugin properties on updateDisplay message (VST Only)
#endif
const unsigned int PLUGIN_OPTION_FIXED_BUFFER = 0x001; //!< Use a constant, fixed-size audio buffer
const unsigned int PLUGIN_OPTION_FORCE_STEREO = 0x002; //!< Force mono plugin as stereo
const unsigned int PLUGIN_OPTION_MAP_PROGRAM_CHANGES = 0x004; //!< Map MIDI-Programs to plugin programs
const unsigned int PLUGIN_OPTION_USE_CHUNKS = 0x008; //!< Use chunks to save data
const unsigned int PLUGIN_OPTION_SEND_CONTROL_CHANGES = 0x010; //!< Send MIDI CC events
const unsigned int PLUGIN_OPTION_SEND_CHANNEL_PRESSURE = 0x020; //!< Send MIDI channel pressure events
const unsigned int PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x040; //!< Send MIDI note aftertouch events
const unsigned int PLUGIN_OPTION_SEND_PITCHBEND = 0x080; //!< Send MIDI pitchbend events
const unsigned int PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100; //!< Send MIDI ALL_SOUND_OFF / ALL_NOTES_OFF events
/**@}*/

/*!


+ 1
- 1
source/backend/native/3bandeq/DistrhoPlugin3BandEQ.hpp View File

@@ -18,7 +18,7 @@
#ifndef __DISTRHO_PLUGIN_3BANDEQ_HPP__
#define __DISTRHO_PLUGIN_3BANDEQ_HPP__
#include "DistrhoPlugin.h"
#include "DistrhoPlugin.hpp"
START_NAMESPACE_DISTRHO


+ 1
- 11
source/backend/native/3bandeq/DistrhoPluginInfo.h View File

@@ -19,7 +19,7 @@

#define DISTRHO_PLUGIN_NAME "3 Band EQ"

#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_HAS_UI 0
#define DISTRHO_PLUGIN_IS_SYNTH 0

#define DISTRHO_PLUGIN_NUM_INPUTS 2
@@ -31,14 +31,4 @@

#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/3BandEQ"

#ifdef QTCREATOR_TEST
// TESTING
# undef DISTRHO_PLUGIN_IS_SYNTH
# undef DISTRHO_PLUGIN_WANT_LATENCY
# undef DISTRHO_PLUGIN_WANT_STATE
# define DISTRHO_PLUGIN_IS_SYNTH 1
# define DISTRHO_PLUGIN_WANT_LATENCY 1
# define DISTRHO_PLUGIN_WANT_STATE 1
#endif

#endif // __DISTRHO_PLUGIN_INFO_H__

+ 1
- 1
source/backend/native/3bandsplitter/DistrhoPlugin3BandSplitter.hpp View File

@@ -18,7 +18,7 @@
#ifndef __DISTRHO_PLUGIN_3BANDSPLITTER_HPP__
#define __DISTRHO_PLUGIN_3BANDSPLITTER_HPP__
#include "DistrhoPlugin.h"
#include "DistrhoPlugin.hpp"
START_NAMESPACE_DISTRHO


+ 1
- 1
source/backend/native/3bandsplitter/DistrhoPluginInfo.h View File

@@ -19,7 +19,7 @@

#define DISTRHO_PLUGIN_NAME "3 Band Splitter"

#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_HAS_UI 0
#define DISTRHO_PLUGIN_IS_SYNTH 0

#define DISTRHO_PLUGIN_NUM_INPUTS 2


+ 6
- 6
source/backend/native/Makefile View File

@@ -8,8 +8,8 @@ include ../Makefile.mk

# --------------------------------------------------------------

BUILD_CXX_FLAGS += -I../../libs/distrho-plugin-toolkit
BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtGui)
BUILD_CXX_FLAGS += -I../../libs/distrho
BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtGui gl)
LINK_FLAGS += $(shell pkg-config --libs QtGui gl)

ifeq ($(HAVE_AF_DEPS),true)
@@ -33,10 +33,10 @@ OBJS = \
midi-through.c.o

# DISTRHO plugins
# OBJS += \
# distrho-3bandeq.cpp.o \
# distrho-3bandsplitter.cpp.o \
# distrho-pingpongpan.cpp.o
OBJS += \
distrho-3bandeq.cpp.o \
distrho-3bandsplitter.cpp.o \
distrho-pingpongpan.cpp.o

ifeq ($(HAVE_AF_DEPS),true)
OBJS += \


+ 3
- 3
source/backend/native/distrho-3bandeq.cpp View File

@@ -18,9 +18,9 @@
#include "CarlaNative.hpp"

// Plugin Code
#include "3bandeq/DistrhoArtwork3BandEQ.cpp"
//#include "3bandeq/DistrhoArtwork3BandEQ.cpp"
#include "3bandeq/DistrhoPlugin3BandEQ.cpp"
#include "3bandeq/DistrhoUI3BandEQ.cpp"
//#include "3bandeq/DistrhoUI3BandEQ.cpp"

// Carla DISTRHO Plugin
#include "distrho/DistrhoPluginCarla.cpp"
@@ -31,7 +31,7 @@ START_NAMESPACE_DISTRHO

static const PluginDescriptor tBandEqDesc = {
/* category */ ::PLUGIN_CATEGORY_EQ,
/* hints */ static_cast<PluginHints>(::PLUGIN_IS_RTSAFE | ::PLUGIN_HAS_GUI),
/* hints */ static_cast<PluginHints>(::PLUGIN_IS_RTSAFE /*| ::PLUGIN_HAS_GUI*/),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,


+ 3
- 3
source/backend/native/distrho-3bandsplitter.cpp View File

@@ -18,9 +18,9 @@
#include "CarlaNative.hpp"

// Plugin Code
#include "3bandsplitter/DistrhoArtwork3BandSplitter.cpp"
//#include "3bandsplitter/DistrhoArtwork3BandSplitter.cpp"
#include "3bandsplitter/DistrhoPlugin3BandSplitter.cpp"
#include "3bandsplitter/DistrhoUI3BandSplitter.cpp"
//#include "3bandsplitter/DistrhoUI3BandSplitter.cpp"

// Carla DISTRHO Plugin
#include "distrho/DistrhoPluginCarla.cpp"
@@ -31,7 +31,7 @@ START_NAMESPACE_DISTRHO

static const PluginDescriptor tBandSplitterDesc = {
/* category */ ::PLUGIN_CATEGORY_EQ,
/* hints */ static_cast<PluginHints>(::PLUGIN_IS_RTSAFE | ::PLUGIN_HAS_GUI),
/* hints */ static_cast<PluginHints>(::PLUGIN_IS_RTSAFE /*| ::PLUGIN_HAS_GUI*/),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,


+ 3
- 3
source/backend/native/distrho-pingpongpan.cpp View File

@@ -18,9 +18,9 @@
#include "CarlaNative.hpp"

// Plugin Code
#include "pingpongpan/DistrhoArtworkPingPongPan.cpp"
//#include "pingpongpan/DistrhoArtworkPingPongPan.cpp"
#include "pingpongpan/DistrhoPluginPingPongPan.cpp"
#include "pingpongpan/DistrhoUIPingPongPan.cpp"
//#include "pingpongpan/DistrhoUIPingPongPan.cpp"

// Carla DISTRHO Plugin
#include "distrho/DistrhoPluginCarla.cpp"
@@ -31,7 +31,7 @@ START_NAMESPACE_DISTRHO

static PluginDescriptor tBandEqDesc = {
/* category */ ::PLUGIN_CATEGORY_UTILITY,
/* hints */ static_cast<PluginHints>(::PLUGIN_IS_RTSAFE | ::PLUGIN_HAS_GUI),
/* hints */ static_cast<PluginHints>(::PLUGIN_IS_RTSAFE /*| ::PLUGIN_HAS_GUI*/),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,


+ 81
- 104
source/backend/native/distrho/DistrhoPluginCarla.cpp View File

@@ -14,15 +14,17 @@
* For a full copy of the license see the LGPL.txt file
*/

#include "carla_native.hpp"
#include "carla_utils.hpp"

#include <QtGui/QMainWindow>
#include "CarlaNative.hpp"
#include "CarlaUtils.hpp"

#include "DistrhoPluginMain.cpp"

// TODO
#undef DISTRHO_PLUGIN_HAS_UI

#if DISTRHO_PLUGIN_HAS_UI
# include "DistrhoUIMain.cpp"
#include <QtGui/QMainWindow>
#include "DistrhoUIMain.cpp"
#endif

// -------------------------------------------------
@@ -36,16 +38,16 @@ START_NAMESPACE_DISTRHO
class UICarla : public QMainWindow
{
public:
UICarla(const HostDescriptor* const host_, PluginInternal* const plugin_)
UICarla(const HostDescriptor* const host, PluginInternal* const plugin)
: QMainWindow(nullptr),
host(host_),
plugin(plugin_),
widget(this),
ui(this, (intptr_t)widget.winId(), setParameterCallback, setStateCallback, uiEditParameterCallback, uiSendNoteCallback, uiResizeCallback)
kHost(host),
kPlugin(plugin),
fWidget(this),
fUi(this, (intptr_t)fWidget.winId(), setParameterCallback, setStateCallback, uiEditParameterCallback, uiSendNoteCallback, uiResizeCallback)
{
setCentralWidget(&widget);
setFixedSize(ui.getWidth(), ui.getHeight());
setWindowTitle(DISTRHO_PLUGIN_NAME);
setCentralWidget(&fWidget);
setFixedSize(fUi.getWidth(), fUi.getHeight());
setWindowTitle(fUi.getName());
}

~UICarla()
@@ -61,135 +63,110 @@ public:

void carla_idle()
{
ui.idle();
fUi.idle();
}

void carla_setParameterValue(const uint32_t index, const float value)
{
ui.parameterChanged(index, value);
fUi.parameterChanged(index, value);
}

# if DISTRHO_PLUGIN_WANT_PROGRAMS
void carla_setMidiProgram(const uint32_t realProgram)
{
ui.programChanged(realProgram);
fUi.programChanged(realProgram);
}
# endif

# if DISTRHO_PLUGIN_WANT_STATE
void carla_setCustomData(const char* const key, const char* const value)
{
ui.stateChanged(key, value);
fUi.stateChanged(key, value);
}
# endif

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

protected:
void setParameterValue(uint32_t rindex, float value)
{
host->ui_parameter_changed(host->handle, rindex, value);
kHost->ui_parameter_changed(kHost->handle, rindex, value);
}

# if DISTRHO_PLUGIN_WANT_STATE
void setState(const char* key, const char* value)
{
host->ui_custom_data_changed(host->handle, key, value);
kHost->ui_custom_data_changed(kHost->handle, key, value);
}
# endif

void uiEditParameter(uint32_t, bool)
{
// TODO
}

# if DISTRHO_PLUGIN_IS_SYNTH
void uiSendNote(bool, uint8_t, uint8_t, uint8_t)
{
// TODO
}
# endif

void uiResize(int width, int height)
{
setFixedSize(width, height);
}

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

void closeEvent(QCloseEvent* event)
{
host->ui_closed(host->handle);
kHost->ui_closed(kHost->handle);

// FIXME - ignore event?
QMainWindow::closeEvent(event);
}

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

private:
// Plugin stuff
const HostDescriptor* const host;
PluginInternal* const plugin;
const HostDescriptor* const kHost;
PluginInternal* const kPlugin;

// Qt4 stuff
QWidget widget;
QWidget fWidget;

// UI
UIInternal ui;
UIInternal fUi;

// ---------------------------------------------
// Callbacks

#define handlePtr ((UICarla*)ptr)

static void setParameterCallback(void* ptr, uint32_t rindex, float value)
{
if (UICarla* _this_ = (UICarla*)ptr)
_this_->setParameterValue(rindex, value);
handlePtr->setParameterValue(rindex, value);
}

static void setStateCallback(void* ptr, const char* key, const char* value)
{
# if DISTRHO_PLUGIN_WANT_STATE
if (UICarla* _this_ = (UICarla*)ptr)
_this_->setState(key, value);
# else
return;

// unused
Q_UNUSED(ptr);
Q_UNUSED(key);
Q_UNUSED(value);
# endif
handlePtr->setState(key, value);
}

static void uiEditParameterCallback(void* ptr, uint32_t index, bool started)
{
if (UICarla* _this_ = (UICarla*)ptr)
_this_->uiEditParameter(index, started);
handlePtr->uiEditParameter(index, started);
}

static void uiSendNoteCallback(void* ptr, bool onOff, uint8_t channel, uint8_t note, uint8_t velocity)
{
# if DISTRHO_PLUGIN_IS_SYNTH
if (UICarla* _this_ = (UICarla*)ptr)
_this_->uiSendNote(onOff, channel, note, velocity);
# else
return;

// unused
Q_UNUSED(ptr);
Q_UNUSED(onOff);
Q_UNUSED(channel);
Q_UNUSED(note);
Q_UNUSED(velocity);
# endif
handlePtr->uiSendNote(onOff, channel, note, velocity);
}

static void uiResizeCallback(void* ptr, int width, int height)
{
if (UICarla* _this_ = (UICarla*)ptr)
_this_->uiResize(width, height);
handlePtr->uiResize(width, height);
}

#undef handlePtr

CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(UICarla)
};
#endif
#endif // DISTRHO_PLUGIN_HAS_UI

// -----------------------------------------------------------------------
// Carla Plugin
@@ -201,14 +178,14 @@ public:
: PluginDescriptorClass(host)
{
#if DISTRHO_PLUGIN_HAS_UI
uiPtr = nullptr;
fUi = nullptr;
#endif
}

~PluginCarla()
{
#if DISTRHO_PLUGIN_HAS_UI
uiPtr = nullptr;
fUi = nullptr;
#endif
}

@@ -218,7 +195,7 @@ protected:

uint32_t getParameterCount()
{
return plugin.parameterCount();
return fPlugin.parameterCount();
}

const ::Parameter* getParameterInfo(const uint32_t index)
@@ -233,28 +210,28 @@ protected:
param.scalePoints = nullptr;

{
int nativeparamHints = 0;
const uint32_t paramHints = plugin.parameterHints(index);
int nativeParamHints = 0;
const uint32_t paramHints = fPlugin.parameterHints(index);

if (paramHints & PARAMETER_IS_AUTOMABLE)
nativeparamHints |= ::PARAMETER_IS_AUTOMABLE;
nativeParamHints |= ::PARAMETER_IS_AUTOMABLE;
if (paramHints & PARAMETER_IS_BOOLEAN)
nativeparamHints |= ::PARAMETER_IS_BOOLEAN;
nativeParamHints |= ::PARAMETER_IS_BOOLEAN;
if (paramHints & PARAMETER_IS_INTEGER)
nativeparamHints |= ::PARAMETER_IS_INTEGER;
nativeParamHints |= ::PARAMETER_IS_INTEGER;
if (paramHints & PARAMETER_IS_LOGARITHMIC)
nativeparamHints |= ::PARAMETER_IS_LOGARITHMIC;
nativeParamHints |= ::PARAMETER_IS_LOGARITHMIC;
if (paramHints & PARAMETER_IS_OUTPUT)
nativeparamHints |= ::PARAMETER_IS_OUTPUT;
nativeParamHints |= ::PARAMETER_IS_OUTPUT;

param.hints = static_cast<ParameterHints>(nativeparamHints);
param.hints = static_cast<ParameterHints>(nativeParamHints);
}

param.name = plugin.parameterName(index);
param.unit = plugin.parameterUnit(index);
param.name = fPlugin.parameterName(index);
param.unit = fPlugin.parameterUnit(index);

{
const ParameterRanges& ranges(plugin.parameterRanges(index));
const ParameterRanges& ranges(fPlugin.parameterRanges(index));

param.ranges.def = ranges.def;
param.ranges.min = ranges.min;
@@ -271,7 +248,7 @@ protected:
{
CARLA_ASSERT(index < getParameterCount());

return plugin.parameterValue(index);
return fPlugin.parameterValue(index);
}

// getParameterText unused
@@ -280,23 +257,23 @@ protected:
// Plugin midi-program calls

#if DISTRHO_PLUGIN_WANT_PROGRAMS
virtual uint32_t getMidiProgramCount()
uint32_t getMidiProgramCount()
{
return plugin.programCount();
return fPlugin.programCount();
}

virtual const ::MidiProgram* getMidiProgramInfo(const uint32_t index)
const ::MidiProgram* getMidiProgramInfo(const uint32_t index)
{
CARLA_ASSERT(index < getMidiProgramCount());

if (index >= plugin.programCount())
if (index >= fPlugin.programCount())
return nullptr;

static ::MidiProgram midiProgram;

midiProgram.bank = index / 128;
midiProgram.program = index % 128;
midiProgram.name = plugin.programName(index);
midiProgram.name = fPlugin.programName(index);

return &midiProgram;
}
@@ -309,7 +286,7 @@ protected:
{
CARLA_ASSERT(index < getParameterCount());

plugin.setParameterValue(index, value);
fPlugin.setParameterValue(index, value);
}

#if DISTRHO_PLUGIN_WANT_PROGRAMS
@@ -317,20 +294,20 @@ protected:
{
const uint32_t realProgram = bank * 128 + program;

if (realProgram >= plugin.programCount())
if (realProgram >= fPlugin.programCount())
return;

plugin.setProgram(realProgram);
fPlugin.setProgram(realProgram);
}
#endif

#if DISTRHO_PLUGIN_WANT_STATE
void setCustomData(const char* const key, const char* const value)
{
CARLA_ASSERT(key);
CARLA_ASSERT(value);
CARLA_ASSERT(key != nullptr);
CARLA_ASSERT(value != nullptr);

plugin.setState(key, value);
fPlugin.setState(key, value);
}
#endif

@@ -339,12 +316,12 @@ protected:

void activate()
{
plugin.activate();
fPlugin.activate();
}

void deactivate()
{
plugin.deactivate();
fPlugin.deactivate();
}

#if DISTRHO_PLUGIN_IS_SYNTH
@@ -355,7 +332,7 @@ protected:
for (i=0; i < midiEventCount && i < MAX_MIDI_EVENTS; i++)
{
const ::MidiEvent* const midiEvent = &midiEvents[i];
MidiEvent* const realMidiEvent = &realMidiEvents[i];
MidiEvent* const realMidiEvent = &fRealMidiEvents[i];

realMidiEvent->buffer[0] = midiEvent->data[0];
realMidiEvent->buffer[1] = midiEvent->data[1];
@@ -363,12 +340,12 @@ protected:
realMidiEvent->frame = midiEvent->time;
}

plugin.run(inBuffer, outBuffer, frames, i, realMidiEvents);
fPlugin.run(inBuffer, outBuffer, frames, i, fRealMidiEvents);
}
#else
void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t, const ::MidiEvent* const)
{
plugin.run(inBuffer, outBuffer, frames, 0, nullptr);
fPlugin.run(inBuffer, outBuffer, frames, 0, nullptr);
}
#endif

@@ -387,7 +364,7 @@ protected:

void uiIdle()
{
CARLA_ASSERT(uiPtr);
CARLA_ASSERT(uiPtr != nullptr);

if (uiPtr != nullptr)
uiPtr->carla_idle();
@@ -395,7 +372,7 @@ protected:

void uiSetParameterValue(const uint32_t index, const float value)
{
CARLA_ASSERT(uiPtr);
CARLA_ASSERT(uiPtr != nullptr);
CARLA_ASSERT(index < getParameterCount());

if (uiPtr != nullptr)
@@ -420,9 +397,9 @@ protected:
# if DISTRHO_PLUGIN_WANT_STATE
void uiSetCustomData(const char* const key, const char* const value)
{
CARLA_ASSERT(uiPtr);
CARLA_ASSERT(key);
CARLA_ASSERT(value);
CARLA_ASSERT(uiPtr != nullptr);
CARLA_ASSERT(key != nullptr);
CARLA_ASSERT(value != nullptr);

if (uiPtr != nullptr)
uiPtr->carla_setCustomData(key, value);
@@ -433,22 +410,22 @@ protected:
// -------------------------------------------------------------------

private:
PluginInternal plugin;
PluginInternal fPlugin;

#if DISTRHO_PLUGIN_IS_SYNTH
MidiEvent realMidiEvents[MAX_MIDI_EVENTS];
MidiEvent fRealMidiEvents[MAX_MIDI_EVENTS];
#endif

#if DISTRHO_PLUGIN_HAS_UI
// UI
ScopedPointer<UICarla> uiPtr;
ScopedPointer<UICarla> fUi;

void createUiIfNeeded()
{
if (uiPtr == nullptr)
if (fUi == nullptr)
{
d_lastUiSampleRate = getSampleRate();
uiPtr = new UICarla(getHostHandle(), &plugin);
fUi = new UICarla(getHostHandle(), &fPlugin);
}
}
#endif


+ 1
- 1
source/backend/native/pingpongpan/DistrhoPluginInfo.h View File

@@ -19,7 +19,7 @@

#define DISTRHO_PLUGIN_NAME "Ping Pong Pan"

#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_HAS_UI 0
#define DISTRHO_PLUGIN_IS_SYNTH 0

#define DISTRHO_PLUGIN_NUM_INPUTS 2


+ 1
- 1
source/backend/native/pingpongpan/DistrhoPluginPingPongPan.hpp View File

@@ -18,7 +18,7 @@
#ifndef __DISTRHO_PLUGIN_PINGPONGPAN_HPP__
#define __DISTRHO_PLUGIN_PINGPONGPAN_HPP__
#include "DistrhoPlugin.h"
#include "DistrhoPlugin.hpp"
START_NAMESPACE_DISTRHO


+ 1
- 1
source/backend/plugin/CarlaPlugin.cpp View File

@@ -245,7 +245,7 @@ int32_t CarlaPlugin::chunkData(void** const dataPtr)

unsigned int CarlaPlugin::availableOptions()
{
return kData->availOptions;
return 0x0;
}

float CarlaPlugin::getParameterValue(const uint32_t parameterId)


+ 2
- 3
source/backend/plugin/CarlaPluginInternal.hpp View File

@@ -32,10 +32,11 @@
#include <QtGui/QMainWindow>

#define CARLA_DECLARE_NON_COPY_STRUCT(structName) \
structName(structName&) = delete; \
structName(const structName&) = delete;

#define CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(structName) \
CARLA_DECLARE_NON_COPY_STRUCT(structName) \
CARLA_DECLARE_NON_COPY_STRUCT(structName) \
CARLA_LEAK_DETECTOR(structName)

#define CARLA_PROCESS_CONTINUE_CHECK if (! fEnabled) { kData->engine->callback(CALLBACK_DEBUG, fId, 0, 0, 0.0, nullptr); return; }
@@ -393,7 +394,6 @@ struct CarlaPluginProtectedData {
void* lib;

// misc
unsigned int availOptions;
unsigned int extraHints;
int8_t ctrlChannel;

@@ -523,7 +523,6 @@ struct CarlaPluginProtectedData {
activeBefore(false),
needsReset(false),
lib(nullptr),
availOptions(0x0),
extraHints(0x0),
ctrlChannel(-1),
latency(0),


+ 9
- 12
source/backend/plugin/FluidSynthPlugin.cpp View File

@@ -727,25 +727,22 @@ public:
// ---------------------------------------

// plugin checks
fHints &= ~(PLUGIN_IS_SYNTH | PLUGIN_USES_CHUNKS | PLUGIN_CAN_DRYWET | PLUGIN_CAN_VOLUME | PLUGIN_CAN_BALANCE | PLUGIN_CAN_FORCE_STEREO);
fHints = 0;

fHints |= PLUGIN_IS_RTSAFE;
fHints |= PLUGIN_IS_SYNTH;
fHints |= PLUGIN_CAN_VOLUME;

if (! kUses16Outs)
{
fHints |= PLUGIN_CAN_BALANCE;
fHints |= PLUGIN_CAN_FORCE_STEREO;
}

// plugin options
kData->availOptions &= ~(PLUGIN_OPTION_FIXED_BUFFER | PLUGIN_OPTION_SELF_AUTOMATION | PLUGIN_OPTION_SEND_ALL_SOUND_OFF | PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH | PLUGIN_OPTION_SEND_PITCHBEND);
fOptions = 0;

// always available if needed
kData->availOptions |= PLUGIN_OPTION_SELF_AUTOMATION;
kData->availOptions |= PLUGIN_OPTION_SEND_ALL_SOUND_OFF;
kData->availOptions |= PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH;
kData->availOptions |= PLUGIN_OPTION_SEND_PITCHBEND;
fOptions |= PLUGIN_OPTION_SEND_ALL_SOUND_OFF;
fOptions |= PLUGIN_OPTION_SEND_PITCHBEND;

bufferSizeChanged(kData->engine->getBufferSize());
reloadPrograms(true);
@@ -1143,27 +1140,27 @@ public:

postponeRtEvent(kPluginPostRtEventNoteOn, channel, note, velo);
}
else if (MIDI_IS_STATUS_POLYPHONIC_AFTERTOUCH(status))
else if (MIDI_IS_STATUS_POLYPHONIC_AFTERTOUCH(status) && (fOptions & PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH) != 0)
{
//const uint8_t note = midiEvent.data[1];
//const uint8_t pressure = midiEvent.data[2];

// TODO, not in fluidsynth API
}
else if (MIDI_IS_STATUS_CONTROL_CHANGE(status) && (fHints & PLUGIN_OPTION_SELF_AUTOMATION) != 0)
else if (MIDI_IS_STATUS_CONTROL_CHANGE(status) && (fOptions & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0)
{
const uint8_t control = midiEvent.data[1];
const uint8_t value = midiEvent.data[2];

fluid_synth_cc(fSynth, channel, control, value);
}
else if (MIDI_IS_STATUS_AFTERTOUCH(status))
else if (MIDI_IS_STATUS_AFTERTOUCH(status) && (fOptions & PLUGIN_OPTION_SEND_CHANNEL_PRESSURE) != 0)
{
const uint8_t pressure = midiEvent.data[1];

fluid_synth_channel_pressure(fSynth, channel, pressure);;
}
else if (MIDI_IS_STATUS_PITCH_WHEEL_CONTROL(status))
else if (MIDI_IS_STATUS_PITCH_WHEEL_CONTROL(status) && (fOptions & PLUGIN_OPTION_SEND_PITCHBEND) != 0)
{
const uint8_t lsb = midiEvent.data[1];
const uint8_t msb = midiEvent.data[2];


+ 32
- 34
source/carla_shared.py View File

@@ -158,28 +158,26 @@ MAX_PATCHBAY_PLUGINS = 999
MAX_DEFAULT_PARAMETERS = 200

# Plugin Hints
PLUGIN_IS_BRIDGE = 0x0001
PLUGIN_IS_RTSAFE = 0x0002
PLUGIN_IS_SYNTH = 0x0004
PLUGIN_HAS_GUI = 0x0010
PLUGIN_USES_CHUNKS = 0x0020
PLUGIN_USES_SINGLE_THREAD = 0x0040
PLUGIN_CAN_DRYWET = 0x0100
PLUGIN_CAN_VOLUME = 0x0200
PLUGIN_CAN_BALANCE = 0x0400
PLUGIN_CAN_PANNING = 0x0800
PLUGIN_CAN_FORCE_STEREO = 0x1000
PLUGIN_IS_BRIDGE = 0x001
PLUGIN_IS_RTSAFE = 0x002
PLUGIN_IS_SYNTH = 0x004
PLUGIN_HAS_GUI = 0x010
PLUGIN_HAS_SINGLE_THREAD = 0x020
PLUGIN_CAN_DRYWET = 0x100
PLUGIN_CAN_VOLUME = 0x200
PLUGIN_CAN_BALANCE = 0x400
PLUGIN_CAN_PANNING = 0x800

# Plugin Options
PLUGIN_OPTION_FIXED_BUFFER = 0x001
PLUGIN_OPTION_FORCE_STEREO = 0x002
PLUGIN_OPTION_SELF_AUTOMATION = 0x004
PLUGIN_OPTION_USE_CHUNKS = 0x008
PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x010
PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x020
PLUGIN_OPTION_SEND_PITCHBEND = 0x040
PLUGIN_OPTION_VST_SUPPLY_IDLE = 0x100
PLUGIN_OPTION_VST_UPDATE_DISPLAY = 0x200
PLUGIN_OPTION_FIXED_BUFFER = 0x001
PLUGIN_OPTION_FORCE_STEREO = 0x002
PLUGIN_OPTION_MAP_PROGRAM_CHANGES = 0x004
PLUGIN_OPTION_USE_CHUNKS = 0x008
PLUGIN_OPTION_SEND_CONTROL_CHANGES = 0x010
PLUGIN_OPTION_SEND_CHANNEL_PRESSURE = 0x020
PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x040
PLUGIN_OPTION_SEND_PITCHBEND = 0x080
PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100

# Parameter Hints
PARAMETER_IS_BOOLEAN = 0x01
@@ -1557,20 +1555,20 @@ class PluginEdit(QDialog):
self.ui.dial_b_right.setEnabled(pluginHints & PLUGIN_CAN_BALANCE)

# Set options
self.ui.ch_fixed_buffer.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_FIXED_BUFFER)
self.ui.ch_fixed_buffer.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_FIXED_BUFFER)
self.ui.ch_force_stereo.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_FORCE_STEREO)
self.ui.ch_force_stereo.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_FORCE_STEREO)
self.ui.ch_self_automation.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SELF_AUTOMATION)
self.ui.ch_self_automation.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SELF_AUTOMATION)
self.ui.ch_use_chunks.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_USE_CHUNKS)
self.ui.ch_use_chunks.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_USE_CHUNKS)
self.ui.ch_send_all_sound_off.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
self.ui.ch_send_all_sound_off.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
self.ui.ch_send_note_aftertouch.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH)
self.ui.ch_send_note_aftertouch.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH)
self.ui.ch_send_pitchbend.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_PITCHBEND)
self.ui.ch_send_pitchbend.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_PITCHBEND)
#self.ui.ch_fixed_buffer.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_FIXED_BUFFER)
#self.ui.ch_fixed_buffer.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_FIXED_BUFFER)
#self.ui.ch_force_stereo.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_FORCE_STEREO)
#self.ui.ch_force_stereo.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_FORCE_STEREO)
#self.ui.ch_self_automation.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SELF_AUTOMATION)
#self.ui.ch_self_automation.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SELF_AUTOMATION)
#self.ui.ch_use_chunks.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_USE_CHUNKS)
#self.ui.ch_use_chunks.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_USE_CHUNKS)
#self.ui.ch_send_all_sound_off.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
#self.ui.ch_send_all_sound_off.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
#self.ui.ch_send_note_aftertouch.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH)
#self.ui.ch_send_note_aftertouch.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH)
#self.ui.ch_send_pitchbend.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_PITCHBEND)
#self.ui.ch_send_pitchbend.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_PITCHBEND)

# Show/hide keyboard
showKeyboard = (pluginHints & PLUGIN_IS_SYNTH) != 0 or (midiCountInfo['ins'] > 0 < midiCountInfo['outs'])


+ 8
- 10
source/utils/CarlaBackendUtils.hpp View File

@@ -34,22 +34,20 @@ const char* PluginOption2Str(const unsigned int& option)
return "PLUGIN_OPTION_FIXED_BUFFER";
case PLUGIN_OPTION_FORCE_STEREO:
return "PLUGIN_OPTION_FORCE_STEREO";
case PLUGIN_OPTION_SELF_AUTOMATION:
return "PLUGIN_OPTION_SELF_AUTOMATION";
case PLUGIN_OPTION_MAP_PROGRAM_CHANGES:
return "PLUGIN_OPTION_MAP_PROGRAM_CHANGES";
case PLUGIN_OPTION_USE_CHUNKS:
return "PLUGIN_OPTION_USE_CHUNKS";
case PLUGIN_OPTION_SEND_ALL_SOUND_OFF:
return "PLUGIN_OPTION_SEND_ALL_SOUND_OFF";
case PLUGIN_OPTION_SEND_CONTROL_CHANGES:
return "PLUGIN_OPTION_SEND_CONTROL_CHANGES";
case PLUGIN_OPTION_SEND_CHANNEL_PRESSURE:
return "PLUGIN_OPTION_SEND_CHANNEL_PRESSURE";
case PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH:
return "PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH";
case PLUGIN_OPTION_SEND_PITCHBEND:
return "PLUGIN_OPTION_SEND_PITCHBEND";
#ifdef WANT_VST
case PLUGIN_OPTION_VST_SUPPLY_IDLE:
return "PLUGIN_OPTION_VST_SUPPLY_IDLE";
case PLUGIN_OPTION_VST_UPDATE_DISPLAY:
return "PLUGIN_OPTION_VST_UPDATE_DISPLAY";
#endif
case PLUGIN_OPTION_SEND_ALL_SOUND_OFF:
return "PLUGIN_OPTION_SEND_ALL_SOUND_OFF";
}

carla_stderr("CarlaBackend::PluginOption2Str(%i) - invalid type", option);


+ 3
- 3
source/utils/CarlaString.hpp View File

@@ -120,7 +120,7 @@ public:

~CarlaString()
{
CARLA_ASSERT(buffer);
CARLA_ASSERT(buffer != nullptr);

delete[] buffer;
}
@@ -444,7 +444,7 @@ private:
{
if (! firstInit)
{
CARLA_ASSERT(buffer);
CARLA_ASSERT(buffer != nullptr);
delete[] buffer;
}

@@ -467,7 +467,7 @@ private:
{
if (! firstInit)
{
CARLA_ASSERT(buffer);
CARLA_ASSERT(buffer != nullptr);
delete[] buffer;
}



Loading…
Cancel
Save