Browse Source

More general work and Vex fixing

tags/1.9.4
falkTX 11 years ago
parent
commit
9f10cdf000
15 changed files with 467 additions and 182 deletions
  1. +1
    -0
      source/Makefile.mk
  2. +1
    -1
      source/backend/plugin/CarlaPlugin.cpp
  3. +14
    -13
      source/backend/plugin/Lv2Plugin.cpp
  4. +1
    -0
      source/backend/standalone/CarlaStandalone.cpp
  5. +25
    -59
      source/bridges/Makefile
  6. +5
    -0
      source/carla-rack
  7. +1
    -2
      source/carla_host.py
  8. +2
    -1
      source/modules/carla_native/Makefile
  9. +34
    -0
      source/modules/carla_native/vex-src.cpp
  10. +350
    -59
      source/modules/carla_native/vex.cpp
  11. +8
    -11
      source/modules/carla_native/vex/VexChorus.h
  12. +6
    -9
      source/modules/carla_native/vex/VexDelay.h
  13. +2
    -7
      source/modules/carla_native/vex/VexReverb.h
  14. +15
    -20
      source/modules/carla_native/vex/VexSyntModule.h
  15. +2
    -0
      source/utils/CarlaLv2Utils.hpp

+ 1
- 0
source/Makefile.mk View File

@@ -74,6 +74,7 @@ HAVE_GTK3 = $(shell pkg-config --exists gtk+-3.0 && echo true)
HAVE_PULSEAUDIO = $(shell pkg-config --exists libpulse-simple && echo true)
HAVE_QT4 = $(shell pkg-config --exists QtCore && echo true)
HAVE_QT5 = $(shell pkg-config --exists Qt5Core && echo true)
HAVE_X11 = $(shell pkg-config --exists x11 && echo true)

HAVE_AF_DEPS = $(shell pkg-config --exists sndfile && echo true)
HAVE_MF_DEPS = $(shell pkg-config --exists smf && echo true)


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

@@ -1996,7 +1996,7 @@ void CarlaPlugin::uiNoteOff(const uint8_t channel, const uint8_t note)

bool CarlaPlugin::canRunInRack() const noexcept
{
return false; // TODO
return (pData->extraHints & PLUGIN_EXTRA_HINT_CAN_RUN_RACK) != 0;
}

CarlaEngine* CarlaPlugin::getEngine() const noexcept


+ 14
- 13
source/backend/plugin/Lv2Plugin.cpp View File

@@ -28,11 +28,6 @@ extern "C" {
#include "rtmempool/rtmempool-lv2.h"
}

// -----------------------------------------------------
// Our LV2 World class object

Lv2WorldClass gLv2World;

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

CARLA_BACKEND_START_NAMESPACE
@@ -1024,7 +1019,9 @@ public:

if (index >= 0 && index < static_cast<int32_t>(fRdfDescriptor->PresetCount))
{
if (const LilvState* state = gLv2World.getState(fRdfDescriptor->Presets[index].URI, (const LV2_URID_Map*)fFeatures[kFeatureIdUridMap]->data))
Lv2WorldClass& lv2World(Lv2WorldClass::getInstance());

if (const LilvState* state = lv2World.getState(fRdfDescriptor->Presets[index].URI, (const LV2_URID_Map*)fFeatures[kFeatureIdUridMap]->data))
{
const ScopedSingleProcessLocker spl(this, (sendGui || sendOsc || sendCallback));

@@ -2243,7 +2240,9 @@ public:
else
{
// load default state
if (const LilvState* state = gLv2World.getState(fDescriptor->URI, (const LV2_URID_Map*)fFeatures[kFeatureIdUridMap]->data))
Lv2WorldClass& lv2World(Lv2WorldClass::getInstance());

if (const LilvState* state = lv2World.getState(fDescriptor->URI, (const LV2_URID_Map*)fFeatures[kFeatureIdUridMap]->data))
{
lilv_state_restore(state, fExt.state, fHandle, carla_lilv_set_port_value, this, 0, fFeatures);

@@ -4150,7 +4149,8 @@ public:
// ---------------------------------------------------------------
// get plugin from lv2_rdf (lilv)

gLv2World.init();
Lv2WorldClass& lv2World(Lv2WorldClass::getInstance());
lv2World.init();

fRdfDescriptor = lv2_rdf_new(uri, true);

@@ -4474,11 +4474,12 @@ public:
int eQt4, eQt5, eCocoa, eWindows, eX11, eGtk2, eGtk3, iCocoa, iWindows, iX11, iQt4, iQt5, iExt, iFinal;
eQt4 = eQt5 = eCocoa = eWindows = eX11 = eGtk2 = eGtk3 = iQt4 = iQt5 = iCocoa = iWindows = iX11 = iExt = iFinal = -1;

#ifdef BUILD_BRIDGE
const bool preferUiBridges(pData->engine->getOptions().preferUiBridges);
#else
const bool preferUiBridges(pData->engine->getOptions().preferUiBridges && (fHints & PLUGIN_IS_BRIDGE) == 0);
#endif
const bool preferUiBridges(true);
//#ifdef BUILD_BRIDGE
// const bool preferUiBridges(pData->engine->getOptions().preferUiBridges);
//#else
// const bool preferUiBridges(pData->engine->getOptions().preferUiBridges && (fHints & PLUGIN_IS_BRIDGE) == 0);
//#endif

for (uint32_t i=0; i < fRdfDescriptor->UICount; ++i)
{


+ 1
- 0
source/backend/standalone/CarlaStandalone.cpp View File

@@ -337,6 +337,7 @@ bool carla_engine_init(const char* driverName, const char* clientName)
gStandalone.engine->setCallback(gStandalone.callback, nullptr);

#ifndef BUILD_BRIDGE
gStandalone.engine->setOption(CB::OPTION_PROCESS_MODE, static_cast<int>(gStandalone.options.processMode), nullptr);
gStandalone.engine->setOption(CB::OPTION_TRANSPORT_MODE, static_cast<int>(gStandalone.options.transportMode), nullptr);
#endif
gStandalone.engine->setOption(CB::OPTION_FORCE_STEREO, gStandalone.options.forceStereo ? 1 : 0, nullptr);


+ 25
- 59
source/bridges/Makefile View File

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

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

ifeq ($(HAVE_QT4),true)
QT_UI_FLAGS = $(shell pkg-config --cflags QtGui)
QT_UI_LIBS = $(shell pkg-config --libs QtGui)
else
QT_UI_FLAGS = $(shell pkg-config --cflags Qt5Gui Qt5Widgets)
QT_UI_LIBS = $(shell pkg-config --libs Qt5Gui Qt5Widgets)
endif
# TODO: remove in favour of juce gui stuff
QT5_UI_FLAGS = $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets)
QT5_UI_LIBS = $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Widgets)

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

@@ -23,14 +19,6 @@ BUILD_CXX_FLAGS += -I. -I../backend -I../includes -I../modules -I../modules/them
BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo)
LINK_FLAGS += $(shell pkg-config --libs liblo)

ifeq ($(HAVE_QT4),true)
BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtCore)
LINK_FLAGS += $(shell pkg-config --libs QtCore)
else
BUILD_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core)
LINK_FLAGS += $(shell pkg-config --libs Qt5Core)
endif

# --------------------------------------------------------------
# Plugin bridges

@@ -45,14 +33,6 @@ BUILD_PLUGIN_FLAGS += -DVESTIGE_HEADER
endif
endif

ifeq ($(HAVE_QT4),true)
BUILD_PLUGIN_FLAGS += $(shell pkg-config --cflags QtGui QtXml)
LINK_PLUGIN_FLAGS += $(shell pkg-config --libs QtGui QtXml)
else
BUILD_PLUGIN_FLAGS += $(shell pkg-config --cflags Qt5Gui Qt5Widgets Qt5Xml)
LINK_PLUGIN_FLAGS += $(shell pkg-config --libs Qt5Gui Qt5Widgets Qt5Xml)
endif

# --------------------------------------------------------------
# Plugin bridges (POSIX)

@@ -138,35 +118,35 @@ ifeq ($(CARLA_VESTIGE_HEADER),true)
BUILD_UI_VST_FLAGS += -DVESTIGE_HEADER
endif

BUILD_UI_LV2_GTK2_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_GTK2 -DBRIDGE_LV2_GTK2 $(shell pkg-config --cflags gtk+-2.0)
LINK_UI_LV2_GTK2_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs gtk+-2.0)
BUILD_UI_LV2_GTK2_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_GTK2 -DBRIDGE_LV2_GTK2 $(shell pkg-config --cflags gtk+-2.0 Qt5Core)
LINK_UI_LV2_GTK2_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs gtk+-2.0 Qt5Core)

BUILD_UI_LV2_GTK3_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_GTK3 -DBRIDGE_LV2_GTK3 $(shell pkg-config --cflags gtk+-3.0)
LINK_UI_LV2_GTK3_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs gtk+-3.0)
BUILD_UI_LV2_GTK3_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_GTK3 -DBRIDGE_LV2_GTK3 $(shell pkg-config --cflags gtk+-3.0 Qt5Core)
LINK_UI_LV2_GTK3_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs gtk+-3.0 Qt5Core)

BUILD_UI_LV2_QT4_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_QT4 -DBRIDGE_LV2_QT4 $(shell pkg-config --cflags QtGui)
LINK_UI_LV2_QT4_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs QtGui)
BUILD_UI_LV2_QT4_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_QT4 -DBRIDGE_LV2_QT4 $(shell pkg-config --cflags QtCore QtGui)
LINK_UI_LV2_QT4_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs QtCore QtGui)

BUILD_UI_LV2_QT5_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_QT5 -DBRIDGE_LV2_QT5 $(shell pkg-config --cflags Qt5Gui Qt5Widgets)
LINK_UI_LV2_QT5_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs Qt5Gui Qt5Widgets)
BUILD_UI_LV2_QT5_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_QT5 -DBRIDGE_LV2_QT5 $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets)
LINK_UI_LV2_QT5_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Widgets)

BUILD_UI_LV2_COCOA_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_COCOA -DBRIDGE_LV2_COCOA $(QT_UI_FLAGS)
LINK_UI_LV2_COCOA_FLAGS = $(LINK_UI_FLAGS) $(QT_UI_LIBS)
BUILD_UI_LV2_COCOA_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_COCOA -DBRIDGE_LV2_COCOA $(QT5_UI_FLAGS)
LINK_UI_LV2_COCOA_FLAGS = $(LINK_UI_FLAGS) $(QT5_UI_LIBS)

BUILD_UI_LV2_WIN32_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_HWND -DBRIDGE_LV2_WIN32 $(QT_UI_FLAGS)
LINK_UI_LV2_WIN32_FLAGS = $(LINK_FLAGS) $(QT_UI_LIBS) $(EXTRA_LIBS) -mwindows -lwinspool -lole32 -luuid -limm32 -lshell32 -lws2_32 -static
BUILD_UI_LV2_WIN32_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_HWND -DBRIDGE_LV2_WIN32 $(QT5_UI_FLAGS)
LINK_UI_LV2_WIN32_FLAGS = $(LINK_FLAGS) $(QT5_UI_LIBS) $(EXTRA_LIBS) -mwindows -lwinspool -lole32 -luuid -limm32 -lshell32 -lws2_32 -static

BUILD_UI_LV2_X11_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_X11 -DBRIDGE_LV2_X11 $(QT_UI_FLAGS)
LINK_UI_LV2_X11_FLAGS = $(LINK_UI_FLAGS) $(QT_UI_LIBS)
BUILD_UI_LV2_X11_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_X11 -DBRIDGE_LV2_X11 $(QT5_UI_FLAGS)
LINK_UI_LV2_X11_FLAGS = $(LINK_UI_FLAGS) $(QT5_UI_LIBS)

BUILD_UI_VST_MAC_FLAGS = $(BUILD_UI_VST_FLAGS) -DBRIDGE_MAC -DBRIDGE_VST_MAC $(QT_UI_FLAGS)
LINK_UI_VST_MAC_FLAGS = $(LINK_UI_FLAGS) $(QT_UI_LIBS)
BUILD_UI_VST_MAC_FLAGS = $(BUILD_UI_VST_FLAGS) -DBRIDGE_MAC -DBRIDGE_VST_MAC $(QT5_UI_FLAGS)
LINK_UI_VST_MAC_FLAGS = $(LINK_UI_FLAGS) $(QT5_UI_LIBS)

BUILD_UI_VST_HWND_FLAGS = $(BUILD_UI_VST_FLAGS) -DBRIDGE_HWND -DBRIDGE_VST_HWND $(QT_UI_FLAGS)
LINK_UI_VST_HWND_FLAGS = $(LINK_FLAGS) $(QT_UI_LIBS) $(EXTRA_LIBS) -mwindows -lwinspool -lole32 -luuid -limm32 -lshell32 -lws2_32 -static
BUILD_UI_VST_HWND_FLAGS = $(BUILD_UI_VST_FLAGS) -DBRIDGE_HWND -DBRIDGE_VST_HWND $(QT5_UI_FLAGS)
LINK_UI_VST_HWND_FLAGS = $(LINK_FLAGS) $(QT5_UI_LIBS) $(EXTRA_LIBS) -mwindows -lwinspool -lole32 -luuid -limm32 -lshell32 -lws2_32 -static

BUILD_UI_VST_X11_FLAGS = $(BUILD_UI_VST_FLAGS) -DBRIDGE_X11 -DBRIDGE_VST_X11 $(QT_UI_FLAGS)
LINK_UI_VST_X11_FLAGS = $(LINK_UI_FLAGS) $(QT_UI_LIBS)
BUILD_UI_VST_X11_FLAGS = $(BUILD_UI_VST_FLAGS) -DBRIDGE_X11 -DBRIDGE_VST_X11 $(QT5_UI_FLAGS)
LINK_UI_VST_X11_FLAGS = $(LINK_UI_FLAGS) $(QT5_UI_LIBS)

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

@@ -371,12 +351,6 @@ carla-bridge-vst-x11: $(OBJS_UI_VST_X11) $(OBJS_UI_VST_LIBS) ../modules/theme.a
%__vst-x11.o: %.cpp CarlaBridgeToolkitQt.moc
$(CXX) $< $(BUILD_UI_VST_X11_FLAGS) -c -o $@

# --------------------------------------------------------------
# plugin common

FILES = \
../backend/plugin/moc_CarlaPluginGui.cpp

# --------------------------------------------------------------
# native

@@ -394,7 +368,6 @@ OBJS_NATIVE += \
# carla-plugin
OBJS_NATIVE += \
../backend/plugin/CarlaPlugin__native.o \
../backend/plugin/CarlaPluginGui__native.o \
../backend/plugin/CarlaPluginThread__native.o \
../backend/plugin/NativePlugin__native.o \
../backend/plugin/LadspaPlugin__native.o \
@@ -415,6 +388,8 @@ OBJS_NATIVE += \
../modules/dgl.a \
../modules/juce_audio_basics.a \
../modules/juce_core.a \
../modules/juce_data_structures.a \
../modules/juce_events.a \
../modules/rtmempool.a

ifeq ($(CARLA_PLUGIN_SUPPORT),true)
@@ -445,7 +420,6 @@ OBJS_POSIX32 += \
# carla-plugin
OBJS_POSIX32 += \
../backend/plugin/CarlaPlugin__posix32.o \
../backend/plugin/CarlaPluginGui__posix32.o \
../backend/plugin/CarlaPluginThread__posix32.o \
../backend/plugin/NativePlugin__posix32.o \
../backend/plugin/LadspaPlugin__posix32.o \
@@ -488,7 +462,6 @@ OBJS_POSIX64 += \
# carla-plugin
OBJS_POSIX64 += \
../backend/plugin/CarlaPlugin__posix64.o \
../backend/plugin/CarlaPluginGui__posix64.o \
../backend/plugin/CarlaPluginThread__posix64.o \
../backend/plugin/NativePlugin__posix64.o \
../backend/plugin/LadspaPlugin__posix64.o \
@@ -531,7 +504,6 @@ OBJS_WIN32 += \
# carla-plugin
OBJS_WIN32 += \
../backend/plugin/CarlaPlugin__win32.o \
../backend/plugin/CarlaPluginGui__win32.o \
../backend/plugin/CarlaPluginThread__win32.o \
../backend/plugin/NativePlugin__win32.o \
../backend/plugin/LadspaPlugin__win32.o \
@@ -574,7 +546,6 @@ OBJS_WIN64 += \
# carla-plugin
OBJS_WIN64 += \
../backend/plugin/CarlaPlugin__win64.o \
../backend/plugin/CarlaPluginGui__win64.o \
../backend/plugin/CarlaPluginThread__win64.o \
../backend/plugin/NativePlugin__win64.o \
../backend/plugin/LadspaPlugin__win64.o \
@@ -602,11 +573,6 @@ carla-bridge-win64.exe: $(FILES) $(OBJS_WIN64) ../modules/jackbridge-win64.dll

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

../backend/plugin/moc_%.cpp: ../backend/plugin/%.hpp
$(MOC) $< -DMOC_PARSING -o $@

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

.FORCE:
.PHONY: .FORCE



+ 5
- 0
source/carla-rack View File

@@ -72,6 +72,11 @@ if __name__ == '__main__':
# -------------------------------------------------------------
# Init host backend

Carla.isControl = False
Carla.isLocal = True
Carla.isPlugin = False
Carla.processMode = PROCESS_MODE_CONTINUOUS_RACK

initHost(appName, libPrefix)

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


+ 1
- 2
source/carla_host.py View File

@@ -322,7 +322,6 @@ class HostWindow(QMainWindow):
uisAlwaysOnTop = settings.value("Engine/OscUiTimeout", CARLA_DEFAULT_UIS_ALWAYS_ON_TOP, type=bool)
uiBridgesTimeout = settings.value("Engine/OscUiTimeout", CARLA_DEFAULT_UI_BRIDGES_TIMEOUT, type=int)

Carla.processMode = settings.value("Engine/ProcessMode", CARLA_DEFAULT_PROCESS_MODE, type=int)
Carla.maxParameters = settings.value("Engine/MaxParameters", CARLA_DEFAULT_MAX_PARAMETERS, type=int)

audioDriver = settings.value("Engine/AudioDriver", CARLA_DEFAULT_AUDIO_DRIVER, type=str)
@@ -344,7 +343,7 @@ class HostWindow(QMainWindow):

if Carla.processMode == PROCESS_MODE_CONTINUOUS_RACK:
forceStereo = True
elif Carla.processMode == PROCESS_MODE_MULTIPLE_CLIENTS: # and LADISH_APP_NAME:
elif Carla.processMode == PROCESS_MODE_MULTIPLE_CLIENTS and LADISH_APP_NAME:
print("LADISH detected but using multiple clients (not allowed), forcing single client now")
Carla.processMode = PROCESS_MODE_SINGLE_CLIENT



+ 2
- 1
source/modules/carla_native/Makefile View File

@@ -55,7 +55,8 @@ OBJS = \

# Simple plugins (C++)
OBJS += \
vex.cpp.o
vex.cpp.o \
vex-src.cpp.o

# AudioFile
ifeq ($(HAVE_AF_DEPS),true)


+ 34
- 0
source/modules/carla_native/vex-src.cpp View File

@@ -0,0 +1,34 @@
/*
* Carla Native Plugins
* Copyright (C) 2013 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/

#include "CarlaNative.hpp"

#include "juce_core.h"

using namespace juce;

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

#include "vex/freeverb/allpass.cpp"
#include "vex/freeverb/comb.cpp"
#include "vex/freeverb/revmodel.cpp"

#include "vex/ResourceFile.cpp"
#include "vex/VexVoice.cpp"
#include "vex/VexWaveRenderer.cpp"

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

+ 350
- 59
source/modules/carla_native/vex.cpp View File

@@ -234,7 +234,6 @@ protected:

const TimeInfo* const timeInfo(getTimeInfo());

int timeFrame = 0;
bool timePlaying = false;
double ppqPos = 0.0;
double barStartPos = 0.0;
@@ -242,7 +241,6 @@ protected:

if (timeInfo != nullptr)
{
timeFrame = timeInfo->frame;
timePlaying = timeInfo->playing;

if (timeInfo->bbt.valid)
@@ -310,8 +308,8 @@ class VexChorusPlugin : public PluginClass
{
public:
enum Params {
kParamDepth = 0,
kParamRate,
kParamRate = 0,
kParamDepth,
kParamCount
};

@@ -319,8 +317,10 @@ public:
: PluginClass(host),
fChorus(fParameters)
{
fParameters[0] = 0.6f;
fParameters[1] = 0.3f;
std::memset(fParameters, 0, sizeof(float)*92);

fParameters[76] = 0.3f;
fParameters[77] = 0.6f;

fChorus.setSampleRate(getSampleRate());
}
@@ -353,18 +353,18 @@ protected:

switch (index)
{
case kParamDepth:
paramInfo.name = "Depth";
paramInfo.ranges.def = 0.6f;
paramInfo.ranges.min = 0.0f;
paramInfo.ranges.max = 1.0f;
break;
case kParamRate:
paramInfo.name = "Rate";
paramInfo.ranges.def = 0.3f;
paramInfo.ranges.min = 0.0f;
paramInfo.ranges.max = 1.0f;
break;
case kParamDepth:
paramInfo.name = "Depth";
paramInfo.ranges.def = 0.6f;
paramInfo.ranges.min = 0.0f;
paramInfo.ranges.max = 1.0f;
break;
}

paramInfo.hints = static_cast<ParameterHints>(hints);
@@ -374,7 +374,15 @@ protected:

float getParameterValue(const uint32_t index) const override
{
return (index < kParamCount) ? fParameters[index] : 0.0f;
switch (index)
{
case kParamRate:
return fParameters[76];
case kParamDepth:
return fParameters[77];
default:
return 0.0f;
}
}

// -------------------------------------------------------------------
@@ -382,8 +390,17 @@ protected:

void setParameterValue(const uint32_t index, const float value) override
{
if (index < kParamCount)
fParameters[index] = value;
switch (index)
{
case kParamRate:
fParameters[76] = value;
break;
case kParamDepth:
fParameters[77] = value;
break;
default:
break;
}
}

// -------------------------------------------------------------------
@@ -409,7 +426,7 @@ protected:

private:
VexChorus fChorus;
float fParameters[2];
float fParameters[92];

PluginClassEND(VexChorusPlugin)
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexChorusPlugin)
@@ -430,8 +447,10 @@ public:
: PluginClass(host),
fDelay(fParameters)
{
fParameters[0] = 4.0f;
fParameters[1] = 40.0f;
std::memset(fParameters, 0, sizeof(float)*92);

fParameters[73] = 0.5f * 8.0f;
fParameters[74] = 0.4f * 100.0f;

fDelay.setSampleRate(getSampleRate());
}
@@ -487,7 +506,15 @@ protected:

float getParameterValue(const uint32_t index) const override
{
return (index < kParamCount) ? fParameters[index] : 0.0f;
switch (index)
{
case kParamTime:
return fParameters[73] * 8.0f;
case kParamFeedback:
return fParameters[74] * 100.0f;
default:
return 0.0f;
}
}

// -------------------------------------------------------------------
@@ -495,8 +522,17 @@ protected:

void setParameterValue(const uint32_t index, const float value) override
{
if (index < kParamCount)
fParameters[index] = value;
switch (index)
{
case kParamTime:
fParameters[73] = value/8.0f;
break;
case kParamFeedback:
fParameters[74] = value/100.0f;
break;
default:
break;
}
}

// -------------------------------------------------------------------
@@ -525,7 +561,7 @@ protected:

private:
VexDelay fDelay;
float fParameters[2];
float fParameters[92];

PluginClassEND(VexDelayPlugin)
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexDelayPlugin)
@@ -547,9 +583,12 @@ public:
: PluginClass(host),
fReverb(fParameters)
{
fParameters[0] = 0.6f;
fParameters[1] = 0.7f;
fParameters[2] = 0.6f;
std::memset(fParameters, 0, sizeof(float)*92);

// FIXME?
fParameters[79] = 0.6f;
fParameters[80] = 0.6f;
fParameters[81] = 0.7f;
}

protected:
@@ -607,7 +646,17 @@ protected:

float getParameterValue(const uint32_t index) const override
{
return (index < kParamCount) ? fParameters[index] : 0.0f;
switch (index)
{
case kParamSize:
return fParameters[79];
case kParamWidth:
return fParameters[80];
case kParamDamp:
return fParameters[81];
default:
return 0.0f;
}
}

// -------------------------------------------------------------------
@@ -615,8 +664,20 @@ protected:

void setParameterValue(const uint32_t index, const float value) override
{
if (index < kParamCount)
fParameters[index] = value;
switch (index)
{
case kParamSize:
fParameters[79] = value;
break;
case kParamWidth:
fParameters[80] = value;
break;
case kParamDamp:
fParameters[81] = value;
break;
default:
break;
}
}

// -------------------------------------------------------------------
@@ -634,7 +695,7 @@ protected:

private:
VexReverb fReverb;
float fParameters[3];
float fParameters[92];

PluginClassEND(VexReverbPlugin)
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexReverbPlugin)
@@ -645,14 +706,24 @@ private:
class VexSynthPlugin : public PluginClass
{
public:
static const unsigned int kParamCount = 1;
static const unsigned int kParamCount = 92;

VexSynthPlugin(const HostDescriptor* const host)
: PluginClass(host),
obf(nullptr),
abf(nullptr),
dbf1(nullptr),
dbf2(nullptr),
dbf3(nullptr),
fChorus(fParameters),
fDelay(fParameters),
fReverb(fParameters),
fSynth(fParameters)
{
std::memset(fParameters, 0, sizeof(float)*92);

fParameters[0] = 1.0f; // main volume

for (int i = 0; i < 3; ++i)
{
const int offset = i * 24;
@@ -683,13 +754,44 @@ public:
fParameters[offset + 24] = 0.5f;
}

// ^1 - 72

fParameters[73] = 0.5f; // Delay Time
fParameters[74] = 0.4f; // Delay Feedback
fParameters[75] = 0.0f; // Delay Volume

fParameters[76] = 0.3f; // Chorus Rate
fParameters[77] = 0.6f; // Chorus Depth
fParameters[78] = 0.5f; // Chorus Volume

fParameters[79] = 0.6f; // Reverb Size
fParameters[80] = 0.7f; // Reverb Width
fParameters[81] = 0.6f; // Reverb Damp
fParameters[82] = 0.0f; // Reverb Volume

fParameters[83] = 0.5f; // wave1 panning
fParameters[84] = 0.5f; // wave2 panning
fParameters[85] = 0.5f; // wave3 panning

fParameters[86] = 0.5f; // wave1 volume
fParameters[87] = 0.5f; // wave2 volume
fParameters[88] = 0.5f; // wave3 volume

fParameters[89] = 1.0f; // wave1 on/off
fParameters[90] = 1.0f; // wave2 on/off
fParameters[91] = 1.0f; // wave3 on/off

fParameters[89] = 1.0f;
bufferSizeChanged(getBufferSize());
sampleRateChanged(getSampleRate());
}

fSynth.setSampleRate(getSampleRate());
fSynth.update(89);
~VexSynthPlugin()
{
delete obf;
delete abf;
delete dbf1;
delete dbf2;
delete dbf3;
}

protected:
@@ -712,25 +814,168 @@ protected:
paramInfo.ranges.def = 0.0f;
paramInfo.ranges.min = 0.0f;
paramInfo.ranges.max = 1.0f;
paramInfo.ranges.step = 1.0f;
paramInfo.ranges.stepSmall = 1.0f;
paramInfo.ranges.stepLarge = 1.0f;
paramInfo.ranges.step = PARAMETER_RANGES_DEFAULT_STEP;
paramInfo.ranges.stepSmall = PARAMETER_RANGES_DEFAULT_STEP_SMALL;
paramInfo.ranges.stepLarge = PARAMETER_RANGES_DEFAULT_STEP_LARGE;
paramInfo.scalePointCount = 0;
paramInfo.scalePoints = nullptr;

if (index >= 1 && index <= 72)
{
uint32_t ri = index % 24;

switch (ri)
{
case 1:
paramInfo.name = "oct";
break;
case 2:
paramInfo.name = "cent";
break;
case 3:
paramInfo.name = "phaseOffset";
break;
case 4:
paramInfo.name = "phaseIncOffset";
break;
case 5:
paramInfo.name = "filter";
break;
case 6:
paramInfo.name = "filter";
break;
case 7:
paramInfo.name = "filter";
break;
case 8:
paramInfo.name = "filter";
break;
case 9:
paramInfo.name = "F ADSR";
break;
case 10:
paramInfo.name = "F ADSR";
break;
case 11:
paramInfo.name = "F ADSR";
break;
case 12:
paramInfo.name = "F ADSR";
break;
case 13:
paramInfo.name = "F velocity";
break;
case 14:
paramInfo.name = "A ADSR";
break;
case 15:
paramInfo.name = "A ADSR";
break;
case 16:
paramInfo.name = "A ADSR";
break;
case 17:
paramInfo.name = "A ADSR";
break;
case 18:
paramInfo.name = "A velocity";
break;
case 19:
paramInfo.name = "lfoC";
break;
case 20:
paramInfo.name = "lfoA";
break;
case 21:
paramInfo.name = "lfoF";
break;
case 22:
paramInfo.name = "fx vol D";
break;
case 23:
paramInfo.name = "fx vol C";
break;
case 24:
case 0:
paramInfo.name = "fx vol R";
break;
default:
paramInfo.name = "unknown2";
break;
}

paramInfo.hints = static_cast<ParameterHints>(hints);
return &paramInfo;
}

switch (index)
{
case 0:
hints |= PARAMETER_IS_INTEGER;
paramInfo.name = "Wave";
paramInfo.ranges.def = 0.0f;
paramInfo.ranges.min = 0.0f;
paramInfo.ranges.max = WaveRenderer::getWaveTableSize();
paramInfo.name = "Main volume";
break;
case 73:
paramInfo.name = "Delay Time";
break;
case 74:
paramInfo.name = "Delay Feedback";
break;
case 75:
paramInfo.name = "Delay Volume";
break;
case 76:
paramInfo.name = "Chorus Rate";
break;
case 77:
paramInfo.name = "Chorus Depth";
break;
case 78:
paramInfo.name = "Chorus Volume";
break;
case 79:
paramInfo.name = "Reverb Size";
break;
case 80:
paramInfo.name = "Reverb Width";
break;
case 81:
paramInfo.name = "Reverb Damp";
break;
case 82:
paramInfo.name = "Reverb Volume";
break;
case 83:
paramInfo.name = "Wave1 Panning";
break;
case 84:
paramInfo.name = "Wave2 Panning";
break;
case 85:
paramInfo.name = "Wave3 Panning";
break;
case 86:
paramInfo.name = "Wave1 Volume";
break;
case 87:
paramInfo.name = "Wave2 Volume";
break;
case 88:
paramInfo.name = "Wave3 Volume";
break;
case 89:
paramInfo.name = "Wave1 on/off";
break;
case 90:
paramInfo.name = "Wave2 on/off";
break;
case 91:
paramInfo.name = "Wave3 on/off";
break;
default:
paramInfo.name = "unknown";
break;
}

paramInfo.hints = static_cast<ParameterHints>(hints);

return &paramInfo;
}

@@ -747,9 +992,7 @@ protected:
if (index < kParamCount)
{
fParameters[index] = value;
fSynth.setWaveLater(1, WaveRenderer::getWaveTableName(value));

//synth.update(index);
fSynth.update(index);
}
}

@@ -758,6 +1001,9 @@ protected:

void process(float**, float** outBuffer, const uint32_t frames, const MidiEvent* const midiEvents, const uint32_t midiEventCount) override
{
const TimeInfo* const timeInfo(getTimeInfo());
const double bpm((timeInfo != nullptr && timeInfo->bbt.valid) ? timeInfo->bbt.beatsPerMinute : 120.0);

for (uint32_t i=0; i < midiEventCount; ++i)
{
const MidiEvent* const midiEvent(&midiEvents[i]);
@@ -783,24 +1029,79 @@ protected:
}
}

carla_zeroFloat(outBuffer[0], frames);
carla_zeroFloat(outBuffer[1], frames);
if (obf->getNumSamples() != frames)
{
obf->setSize(2, frames, 0, 0, 1);
abf->setSize(2, frames, 0, 0, 1);
dbf1->setSize(2, frames, 0, 0, 1);
dbf2->setSize(2, frames, 0, 0, 1);
dbf3->setSize(2, frames, 0, 0, 1);
}

obf ->clear();
dbf1->clear();
dbf2->clear();
dbf3->clear();

fSynth.doProcess(*obf, *abf, *dbf1, *dbf2, *dbf3);

fSynth.doProcess(outBuffer[0], outBuffer[1], frames);
if (fParameters[75] > 0.001f) fDelay.processBlock(dbf1, bpm);
if (fParameters[78] > 0.001f) fChorus.processBlock(dbf2);
if (fParameters[82] > 0.001f) fReverb.processBlock(dbf3);

AudioSampleBuffer output(outBuffer, 2, 0, frames);
output.clear();

obf->addFrom(0, 0, *dbf1, 0, 0, frames, fParameters[75]);
obf->addFrom(1, 0, *dbf1, 1, 0, frames, fParameters[75]);
obf->addFrom(0, 0, *dbf2, 0, 0, frames, fParameters[78]);
obf->addFrom(1, 0, *dbf2, 1, 0, frames, fParameters[78]);
obf->addFrom(0, 0, *dbf3, 0, 0, frames, fParameters[82]);
obf->addFrom(1, 0, *dbf3, 1, 0, frames, fParameters[82]);

output.addFrom(0, 0, *obf, 0, 0, frames, fParameters[0]);
output.addFrom(1, 0, *obf, 1, 0, frames, fParameters[0]);
}

// -------------------------------------------------------------------
// Plugin dispatcher calls

void bufferSizeChanged(const uint32_t bufferSize) override
{
delete obf;
delete abf;
delete dbf1;
delete dbf2;
delete dbf3;

obf = new AudioSampleBuffer(2, bufferSize);
abf = new AudioSampleBuffer(2, bufferSize);
dbf1 = new AudioSampleBuffer(2, bufferSize);
dbf2 = new AudioSampleBuffer(2, bufferSize);
dbf3 = new AudioSampleBuffer(2, bufferSize);
}

void sampleRateChanged(const double sampleRate) override
{
fChorus.setSampleRate(sampleRate);
fDelay.setSampleRate(sampleRate);
fSynth.setSampleRate(sampleRate);
}

private:
VexSyntModule fSynth;
float fParameters[92];

AudioSampleBuffer* obf;
AudioSampleBuffer* abf;
AudioSampleBuffer* dbf1; // delay
AudioSampleBuffer* dbf2; // chorus
AudioSampleBuffer* dbf3; // reverb

VexChorus fChorus;
VexDelay fDelay;
VexReverb fReverb;
VexSyntModule fSynth;

PluginClassEND(VexSynthPlugin)
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexSynthPlugin)
};
@@ -905,13 +1206,3 @@ void carla_register_native_plugin_vex()
}

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

#include "vex/freeverb/allpass.cpp"
#include "vex/freeverb/comb.cpp"
#include "vex/freeverb/revmodel.cpp"

#include "vex/ResourceFile.cpp"
#include "vex/VexVoice.cpp"
#include "vex/VexWaveRenderer.cpp"

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

+ 8
- 11
source/modules/carla_native/vex/VexChorus.h View File

@@ -54,15 +54,16 @@ public:
lastlfo1(0.0f),
lastlfo2(0.0f),
parameters(p),
sampleRate(44100.0f),
cycle(44100 / 32),
iRead(cycle * 0.5f),
sampleRate(0.0f),
cycle(0),
iRead(0),
iWrite(0),
buffer(2, cycle)
buffer(2, 0)
{
lfoS[0] = 0.5f;
lfoS[1] = 0.0f;
buffer.clear();
setSampleRate(44100.0f);
}
void updateParameterPtr(const float* const p)
@@ -92,13 +93,9 @@ public:
void processBlock(float* const outBufferL, float* const outBufferR, const int numSamples)
{
#ifdef CARLA_EXPORT
const float depth = parameters[0] * 0.2f;
const float speed = parameters[1] * parameters[1];
#else
const float depth = parameters[77] * 0.2f;
const float speed = parameters[76] * parameters[76];
#endif
const float depth = parameters[77] * 0.2f + 0.01f;
const int delay = int(cycle * 0.5f);
const float lfoC = 2.0f * sinf(float_Pi * (speed * 5.0f) / sampleRate);


+ 6
- 9
source/modules/carla_native/vex/VexDelay.h View File

@@ -50,13 +50,15 @@ class VexDelay
public:
VexDelay(const float* const p)
: parameters(p),
sampleRate(44100),
bufferSize(sampleRate*2),
sampleRate(0.0f),
bufferSize(0),
iRead(0),
iWrite(0),
buffer(2, bufferSize)
buffer(2, 0)
{
buffer.clear();
setSampleRate(44100.0f);
}
void updateParameterPtr(const float* const p)
@@ -88,13 +90,8 @@ public:
{
bpm = jlimit(10.0, 500.0, bpm);
#ifdef CARLA_EXPORT
const int delay = jmin(int(parameters[0]) * int(((60.0 / bpm) * sampleRate) / 4.0), 44100);
const float feedback = parameters[1]/100.0f;
#else
const int delay = jmin(int(parameters[73] * 8.0) * int(((60.0 / bpm) * sampleRate) / 4.0), 44100);
const int delay = jmin(int(parameters[73] * 8.0f) * int(((60.0 / bpm) * sampleRate) / 4.0), 44100);
const float feedback = parameters[74];
#endif
float* const bufferL = buffer.getSampleData(0, 0);
float* const bufferR = buffer.getSampleData(1, 0);


+ 2
- 7
source/modules/carla_native/vex/VexReverb.h View File

@@ -69,15 +69,10 @@ public:
void processBlock(float* const outBufferL, float* const outBufferR, const int numSamples)
{
#ifdef CARLA_EXPORT
model.setroomsize(parameters[0]);
model.setdamp(parameters[1]);
model.setwidth(parameters[2]);
#else
model.setroomsize(parameters[79]);
model.setdamp(parameters[81]);
model.setwidth(parameters[80]);
#endif
model.setdamp(parameters[81]);
model.processreplace(outBufferL, outBufferR, outBufferL, outBufferR, numSamples, 1);
}


+ 15
- 20
source/modules/carla_native/vex/VexSyntModule.h View File

@@ -77,30 +77,22 @@ public:
}
}
#ifdef CARLA_EXPORT
void doProcess(float* const outPtrL, float* const outPtrR, const int numSamples)
{
#else
void doProcess(AudioSampleBuffer& assbf, AudioSampleBuffer& obf, AudioSampleBuffer& ebf1, AudioSampleBuffer& ebf2, AudioSampleBuffer& ebf3)
void doProcess(AudioSampleBuffer& obf, AudioSampleBuffer& assbf, AudioSampleBuffer& ebf1, AudioSampleBuffer& ebf2, AudioSampleBuffer& ebf3)
{
const int numSamples = obf.getNumSamples();
float* const outPtrL = assbf.getSampleData(0,0);
float* const outPtrR = assbf.getSampleData(1,0);
#endif
if (part1)
{
#ifndef CARLA_EXPORT
float right = parameters[86] * parameters[83];
float left = parameters[86] * (1.0f - parameters[83]);
#endif
for (int i = 0; i < kNumVoices; ++i)
{
if (vo1[i]->getIsOn())
{
vo1[i]->doProcess(outPtrL, outPtrR, numSamples);
#ifndef CARLA_EXPORT
obf.addFrom(0, 0, assbf, 0, 0, numSamples, left);
obf.addFrom(1, 0, assbf, 1, 0, numSamples, right);
ebf1.addFrom(0, 0, assbf, 0, 0, numSamples, parameters[22] * left);
@@ -109,24 +101,20 @@ public:
ebf2.addFrom(1, 0, assbf, 1, 0, numSamples, parameters[23] * right);
ebf3.addFrom(0, 0, assbf, 0, 0, numSamples, parameters[24] * left);
ebf3.addFrom(1, 0, assbf, 1, 0, numSamples, parameters[24] * right);
#endif
}
}
}
if (part2)
{
#ifndef CARLA_EXPORT
float right = parameters[87] * parameters[84];
float left = parameters[87] * (1.0f - parameters[84]);
#endif
for (int i = 0; i < kNumVoices; ++i)
{
if (vo2[i]->getIsOn())
{
vo2[i]->doProcess(outPtrL, outPtrR, numSamples);
#ifndef CARLA_EXPORT
obf.addFrom(0, 0, assbf, 0, 0, numSamples, left);
obf.addFrom(1, 0, assbf, 1, 0, numSamples, right);
ebf1.addFrom(0, 0, assbf, 0, 0, numSamples, parameters[22 + 24] * left);
@@ -135,24 +123,20 @@ public:
ebf2.addFrom(1, 0, assbf, 1, 0, numSamples, parameters[23 + 24] * right);
ebf3.addFrom(0, 0, assbf, 0, 0, numSamples, parameters[24 + 24] * left);
ebf3.addFrom(1, 0, assbf, 1, 0, numSamples, parameters[24 + 24] * right);
#endif
}
}
}
if (part3)
{
#ifndef CARLA_EXPORT
float right = parameters[88] * parameters[85];
float left = parameters[88] * (1.0f - parameters[85]);
#endif
for (int i = 0; i < kNumVoices; ++i)
{
if (vo3[i]->getIsOn())
{
vo3[i]->doProcess(outPtrL, outPtrR, numSamples);
#ifndef CARLA_EXPORT
obf.addFrom(0, 0, assbf, 0, 0, numSamples, left);
obf.addFrom(1, 0, assbf, 1, 0, numSamples, right);
ebf1.addFrom(0, 0, assbf, 0, 0, numSamples, parameters[22 + 48] * left);
@@ -161,7 +145,6 @@ public:
ebf2.addFrom(1, 0, assbf, 1, 0, numSamples, parameters[23 + 48] * right);
ebf3.addFrom(0, 0, assbf, 0, 0, numSamples, parameters[24 + 48] * left);
ebf3.addFrom(1, 0, assbf, 1, 0, numSamples, parameters[24 + 48] * right);
#endif
}
}
}
@@ -169,7 +152,21 @@ public:
void setSampleRate(const double s)
{
if (sampleRate == s)
return;
sampleRate = s;
for (int i = 0; i < kNumVoices; ++i)
{
delete vo1[i];
delete vo2[i];
delete vo3[i];
vo1[i] = new VexVoice(parameters, 0, wr1);
vo2[i] = new VexVoice(parameters, 24, wr2);
vo3[i] = new VexVoice(parameters, 48, wr3);
}
}
void updateParameterPtr(const float* const p)
@@ -342,8 +339,6 @@ public:
case 1:
wr1.setWaveLater(waveName);
kill(1);
// REMOVE THIS
wr1.actuallySetWave();
break;
case 2:
wr2.setWaveLater(waveName);


+ 2
- 0
source/utils/CarlaLv2Utils.hpp View File

@@ -61,6 +61,8 @@
#include "lilv/lilvmm.hpp"
#include "sratom/sratom.h"

#include "juce_core.h"

// -----------------------------------------------------------------------
// Define namespaces and missing prefixes



Loading…
Cancel
Save