From e79b76ec56e9bca66e0393bf584e07b205d7da58 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 4 Aug 2013 22:06:53 +0100 Subject: [PATCH] Move some files around --- source/backend/engine/CarlaEngine.pro | 25 +- source/backend/engine/CarlaEngineJuce.cpp | 175 ++++++ source/backend/engine/CarlaEnginePlugin.cpp | 581 ------------------ .../engine/distrho/DistrhoPluginInfo.h | 38 -- source/backend/plugin/CarlaPlugin.pro | 17 +- source/backend/plugin/JucePlugin.cpp | 1 + source/includes/CarlaDefines.hpp | 20 +- source/includes/CarlaMIDI.h | 2 +- source/modules/utils/Makefile | 16 - .../{modules => }/utils/CarlaBackendUtils.hpp | 0 .../{modules => }/utils/CarlaBridgeUtils.hpp | 0 source/{modules => }/utils/CarlaDssiUtils.hpp | 0 source/{modules => }/utils/CarlaJuceUtils.hpp | 0 .../{modules => }/utils/CarlaLadspaUtils.hpp | 0 source/{modules => }/utils/CarlaLibUtils.hpp | 0 source/{modules => }/utils/CarlaLogThread.hpp | 0 source/{modules => }/utils/CarlaLv2Utils.hpp | 0 source/{modules => }/utils/CarlaMutex.hpp | 0 source/{modules => }/utils/CarlaOscUtils.hpp | 0 .../{modules => }/utils/CarlaRingBuffer.hpp | 0 source/{modules => }/utils/CarlaShmUtils.hpp | 0 .../{modules => }/utils/CarlaStateUtils.hpp | 0 source/{modules => }/utils/CarlaString.hpp | 0 source/{modules => }/utils/CarlaUtils.hpp | 0 source/{modules => }/utils/CarlaVstUtils.hpp | 0 source/{modules => }/utils/Lv2AtomQueue.hpp | 0 source/{modules => }/utils/RtList.hpp | 0 27 files changed, 209 insertions(+), 666 deletions(-) create mode 100644 source/backend/engine/CarlaEngineJuce.cpp delete mode 100644 source/backend/engine/CarlaEnginePlugin.cpp delete mode 100644 source/backend/engine/distrho/DistrhoPluginInfo.h create mode 100644 source/backend/plugin/JucePlugin.cpp delete mode 100644 source/modules/utils/Makefile rename source/{modules => }/utils/CarlaBackendUtils.hpp (100%) rename source/{modules => }/utils/CarlaBridgeUtils.hpp (100%) rename source/{modules => }/utils/CarlaDssiUtils.hpp (100%) rename source/{modules => }/utils/CarlaJuceUtils.hpp (100%) rename source/{modules => }/utils/CarlaLadspaUtils.hpp (100%) rename source/{modules => }/utils/CarlaLibUtils.hpp (100%) rename source/{modules => }/utils/CarlaLogThread.hpp (100%) rename source/{modules => }/utils/CarlaLv2Utils.hpp (100%) rename source/{modules => }/utils/CarlaMutex.hpp (100%) rename source/{modules => }/utils/CarlaOscUtils.hpp (100%) rename source/{modules => }/utils/CarlaRingBuffer.hpp (100%) rename source/{modules => }/utils/CarlaShmUtils.hpp (100%) rename source/{modules => }/utils/CarlaStateUtils.hpp (100%) rename source/{modules => }/utils/CarlaString.hpp (100%) rename source/{modules => }/utils/CarlaUtils.hpp (100%) rename source/{modules => }/utils/CarlaVstUtils.hpp (100%) rename source/{modules => }/utils/Lv2AtomQueue.hpp (100%) rename source/{modules => }/utils/RtList.hpp (100%) diff --git a/source/backend/engine/CarlaEngine.pro b/source/backend/engine/CarlaEngine.pro index ac60d4edf..15145d6af 100644 --- a/source/backend/engine/CarlaEngine.pro +++ b/source/backend/engine/CarlaEngine.pro @@ -49,9 +49,6 @@ DEFINES += __UNIX_JACK__ DEFINES += __LINUX_PULSE__ PKGCONFIG += libpulse-simple -# DISTRHO Plugin -DEFINES += DISTRHO_PLUGIN_TARGET_VST - # ------------------------------------------------------- SOURCES = \ @@ -60,8 +57,8 @@ SOURCES = \ CarlaEngineThread.cpp \ CarlaEngineBridge.cpp \ CarlaEngineJack.cpp \ + CarlaEngineJuce.cpp \ CarlaEngineNative.cpp \ - CarlaEnginePlugin.cpp \ CarlaEngineRtAudio.cpp HEADERS = \ @@ -72,11 +69,14 @@ HEADERS = \ HEADERS += \ ../CarlaBackend.hpp \ ../CarlaEngine.hpp \ + ../CarlaNative.h \ ../CarlaPlugin.hpp HEADERS += \ ../../includes/CarlaDefines.hpp \ - ../../includes/CarlaMIDI.h \ + ../../includes/CarlaMIDI.h + +HEADERS += \ ../../utils/CarlaMutex.hpp \ ../../utils/CarlaRingBuffer.hpp \ ../../utils/CarlaString.hpp \ @@ -86,14 +86,12 @@ HEADERS += \ ../../utils/CarlaBridgeUtils.hpp \ ../../utils/CarlaJuceUtils.hpp \ ../../utils/CarlaOscUtils.hpp \ - ../../utils/CarlaStateUtils.hpp + ../../utils/CarlaStateUtils.hpp \ + ../../utils/RtList.hpp -HEADERS += \ - distrho/DistrhoPluginInfo.h - -INCLUDEPATH = . .. plugin \ +INCLUDEPATH = . .. \ ../../includes \ - ../../libs \ + ../../modules \ ../../utils # RtAudio/RtMidi @@ -101,9 +99,4 @@ INCLUDEPATH += rtaudio-4.0.12 rtmidi-2.0.1 SOURCES += rtaudio-4.0.12/RtAudio.cpp SOURCES += rtmidi-2.0.1/RtMidi.cpp -# Plugin -INCLUDEPATH += distrho -INCLUDEPATH += ../../libs/distrho -INCLUDEPATH += ../../includes/vst - QMAKE_CXXFLAGS += -std=c++0x diff --git a/source/backend/engine/CarlaEngineJuce.cpp b/source/backend/engine/CarlaEngineJuce.cpp new file mode 100644 index 000000000..f398c04e8 --- /dev/null +++ b/source/backend/engine/CarlaEngineJuce.cpp @@ -0,0 +1,175 @@ +/* + * Carla Juce Engine + * Copyright (C) 2013 Filipe Coelho + * + * 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 GPL.txt file + */ + +#include "CarlaEngineInternal.hpp" +#include "CarlaBackendUtils.hpp" +#include "CarlaMIDI.h" +#include "RtList.hpp" + +#include "JuceHeader.h" + +CARLA_BACKEND_START_NAMESPACE + +#if 0 +} // Fix editor indentation +#endif + +// ------------------------------------------------------------------------------------------------------------------- +// Juce Engine + +static const char** gRetNames = nullptr; + +class CarlaEngineJuce : public CarlaEngine, + public AudioIODeviceCallback +{ +public: + CarlaEngineJuce() + : CarlaEngine() + { + carla_debug("CarlaEngineJuce::CarlaEngineJuce()"); + } + + ~CarlaEngineJuce() override + { + if (gRetNames != nullptr) + { + delete[] gRetNames; + gRetNames = nullptr; + } + } + + // ------------------------------------- + + bool init(const char* const clientName) override + { + carla_debug("CarlaEngineJuce::init(\"%s\")", clientName); + + CarlaEngine::init(clientName); + return true; + } + + bool close() override + { + carla_debug("CarlaEngineJuce::close()"); + + return CarlaEngine::close(); + } + + bool isRunning() const override + { + return false; + } + + bool isOffline() const override + { + return false; + } + + EngineType type() const override + { + return kEngineTypeJuce; + } + + // ------------------------------------------------------------------- + +protected: + void audioDeviceIOCallback (const float** inputChannelData, + int numInputChannels, + float** outputChannelData, + int numOutputChannels, + int numSamples) + { + } + + void audioDeviceAboutToStart (AudioIODevice* device) + { + } + + void audioDeviceStopped() + { + } + + void audioDeviceError (const String& errorMessage) + { + } + + // ------------------------------------- + +private: + AudioIODeviceType* fDeviceType; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaEngineJuce) +}; + +// ----------------------------------------- + +CarlaEngine* CarlaEngine::newJuce() +{ + return new CarlaEngineJuce(); +} + +size_t CarlaEngine::getJuceApiCount() +{ + return 0; +} + +const char* CarlaEngine::getJuceApiName(const unsigned int index) +{ + return nullptr; +} + +const char** CarlaEngine::getJuceApiDeviceNames(const unsigned int index) +{ + ScopedPointer deviceType; + + switch(index) + { + case 0: + deviceType = AudioIODeviceType::createAudioIODeviceType_JACK(); + break; + default: + setLastError(""); + return nullptr; + } + + if (deviceType == nullptr) + { + setLastError(""); + return nullptr; + } + + deviceType->scanForDevices(); + + const StringArray devNames(deviceType->getDeviceNames()); + const int devNameCount(devNames.size()); + + if (devNameCount <= 0) + return nullptr; + + gRetNames = new const char*[devNameCount+1]; + + for (unsigned int i=0; i < devNameCount; ++i) + gRetNames[i] = carla_strdup(devNames[i].toRawUTF8()); + + gRetNames[devNameCount] = nullptr; + + return gRetNames; +} + +// ----------------------------------------- + +CARLA_BACKEND_END_NAMESPACE diff --git a/source/backend/engine/CarlaEnginePlugin.cpp b/source/backend/engine/CarlaEnginePlugin.cpp deleted file mode 100644 index 55ccf52f4..000000000 --- a/source/backend/engine/CarlaEnginePlugin.cpp +++ /dev/null @@ -1,581 +0,0 @@ -/* - * Carla Plugin Engine (DISTRHO) - * Copyright (C) 2012-2013 Filipe Coelho - * - * 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 "CarlaEngineInternal.hpp" -#include "CarlaStateUtils.hpp" - -#include "DistrhoPlugin.hpp" - -using DISTRHO::d_cconst; -using DISTRHO::d_string; - -#ifdef QTCREATOR_TEST -CARLA_BACKEND_START_NAMESPACE -#else -// ----------------------------------------- -// needed symbols - -#include "jackbridge/JackBridge.hpp" -#include "jackbridge/JackBridge2.cpp" - -CARLA_BACKEND_START_NAMESPACE - -CarlaEngine* CarlaEngine::newJack() { return nullptr; } - -# ifdef WANT_RTAUDIO -CarlaEngine* CarlaEngine::newRtAudio(RtAudioApi) { return nullptr; } -size_t CarlaEngine::getRtAudioApiCount() { return 0; } -const char* CarlaEngine::getRtAudioApiName(const unsigned int) { return nullptr; } -const char** CarlaEngine::getRtAudioApiDeviceNames(const unsigned int) { return nullptr; } -# endif -#endif - -// ----------------------------------------- -// Parameters - -static const unsigned char kParamMap[] = { - 0x01, 0x02, 0x03, 0x04, 0x05, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, - 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, - 0x50, 0x51, 0x52, 0x53, 0x54, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F -}; - -static const unsigned int kParamVolume = 5; -static const unsigned int kParamBalance = 6; -static const unsigned int kParamPan = 8; - -static const unsigned int kParamCount = sizeof(kParamMap); -static const unsigned int kProgramCount = 128; -static const unsigned int kStateCount = MAX_RACK_PLUGINS; - -// ----------------------------------------- - -class CarlaEnginePlugin : public DISTRHO::Plugin, - public CarlaEngine -{ -public: - CarlaEnginePlugin() - : DISTRHO::Plugin(kParamCount, kProgramCount, kStateCount), - CarlaEngine(), - fParamBuffers{0.0f}, - fPrevParamBuffers{0.0f} - { - carla_debug("CarlaEnginePlugin::CarlaEnginePlugin()"); - - // init parameters - fParamBuffers[kParamVolume] = 100.0f; - fParamBuffers[kParamBalance] = 63.5f; - fParamBuffers[kParamPan] = 63.5f; - - fPrevParamBuffers[kParamVolume] = 100.0f; - fPrevParamBuffers[kParamBalance] = 63.5f; - fPrevParamBuffers[kParamPan] = 63.5f; - - // set-up engine - fOptions.processMode = PROCESS_MODE_CONTINUOUS_RACK; - fOptions.transportMode = TRANSPORT_MODE_PLUGIN; - fOptions.forceStereo = true; - fOptions.preferPluginBridges = false; - fOptions.preferUiBridges = false; - init("Carla"); - } - - ~CarlaEnginePlugin() override - { - carla_debug("CarlaEnginePlugin::~CarlaEnginePlugin()"); - - setAboutToClose(); - removeAllPlugins(); - close(); - } - -protected: - // ------------------------------------- - // Carla Engine virtual calls - - bool init(const char* const clientName) override - { - carla_debug("CarlaEnginePlugin::init(\"%s\")", clientName); - - fBufferSize = d_bufferSize(); - fSampleRate = d_sampleRate(); - - CarlaEngine::init(clientName); - return true; - } - - bool close() override - { - carla_debug("CarlaEnginePlugin::close()"); - - proccessPendingEvents(); - return CarlaEngine::close(); - } - - bool isRunning() const override - { - return true; - } - - bool isOffline() const override - { - return false; - } - - EngineType type() const override - { - return kEngineTypePlugin; - } - - // --------------------------------------------- - // DISTRHO Plugin Information - - const char* d_label() const override - { - return "Carla"; - } - - const char* d_maker() const override - { - return "falkTX"; - } - - const char* d_license() const override - { - return "GPL v2+"; - } - - uint32_t d_version() const override - { - return 0x0600; - } - - long d_uniqueId() const override - { - return d_cconst('C', 'r', 'l', 'a'); - } - - // --------------------------------------------- - // DISTRHO Plugin Init - - void d_initParameter(uint32_t index, DISTRHO::Parameter& parameter) override - { - if (index >= kParamCount) - return; - - parameter.hints = DISTRHO::PARAMETER_IS_AUTOMABLE; - parameter.ranges.def = 0.0f; - parameter.ranges.min = 0.0f; - parameter.ranges.max = 127.0f; - - switch (kParamMap[index]) - { - case 0x01: - parameter.name = "0x01 Modulation"; - break; - case 0x02: - parameter.name = "0x02 Breath"; - break; - case 0x03: - parameter.name = "0x03 (Undefined)"; - break; - case 0x04: - parameter.name = "0x04 Foot"; - break; - case 0x05: - parameter.name = "0x05 Portamento"; - break; - case 0x07: - parameter.name = "0x07 Volume"; - parameter.ranges.def = 100.0f; - break; - case 0x08: - parameter.name = "0x08 Balance"; - parameter.ranges.def = 63.5f; - break; - case 0x09: - parameter.name = "0x09 (Undefined)"; - break; - case 0x0A: - parameter.name = "0x0A Pan"; - parameter.ranges.def = 63.5f; - break; - case 0x0B: - parameter.name = "0x0B Expression"; - break; - case 0x0C: - parameter.name = "0x0C FX Control 1"; - break; - case 0x0D: - parameter.name = "0x0D FX Control 2"; - break; - case 0x0E: - parameter.name = "0x0E (Undefined)"; - break; - case 0x0F: - parameter.name = "0x0F (Undefined)"; - break; - case 0x10: - parameter.name = "0x10 General Purpose 1"; - break; - case 0x11: - parameter.name = "0x11 General Purpose 2"; - break; - case 0x12: - parameter.name = "0x12 General Purpose 3"; - break; - case 0x13: - parameter.name = "0x13 General Purpose 4"; - break; - case 0x14: - parameter.name = "0x14 (Undefined)"; - break; - case 0x15: - parameter.name = "0x15 (Undefined)"; - break; - case 0x16: - parameter.name = "0x16 (Undefined)"; - break; - case 0x17: - parameter.name = "0x17 (Undefined)"; - break; - case 0x18: - parameter.name = "0x18 (Undefined)"; - break; - case 0x19: - parameter.name = "0x19 (Undefined)"; - break; - case 0x1A: - parameter.name = "0x1A (Undefined)"; - break; - case 0x1B: - parameter.name = "0x1B (Undefined)"; - break; - case 0x1C: - parameter.name = "0x1C (Undefined)"; - break; - case 0x1D: - parameter.name = "0x1D (Undefined)"; - break; - case 0x1E: - parameter.name = "0x1E (Undefined)"; - break; - case 0x1F: - parameter.name = "0x1F (Undefined)"; - break; - case 0x46: - parameter.name = "0x46 Control 1 [Variation]"; - break; - case 0x47: - parameter.name = "0x47 Control 2 [Timbre]"; - break; - case 0x48: - parameter.name = "0x48 Control 3 [Release]"; - break; - case 0x49: - parameter.name = "0x49 Control 4 [Attack]"; - break; - case 0x4A: - parameter.name = "0x4A Control 5 [Brightness]"; - break; - case 0x4B: - parameter.name = "0x4B Control 6 [Decay]"; - break; - case 0x4C: - parameter.name = "0x4C Control 7 [Vib Rate]"; - break; - case 0x4D: - parameter.name = "0x4D Control 8 [Vib Depth]"; - break; - case 0x4E: - parameter.name = "0x4E Control 9 [Vib Delay]"; - break; - case 0x4F: - parameter.name = "0x4F Control 10 [Undefined]"; - break; - case 0x50: - parameter.name = "0x50 General Purpose 5"; - break; - case 0x51: - parameter.name = "0x51 General Purpose 6"; - break; - case 0x52: - parameter.name = "0x52 General Purpose 7"; - break; - case 0x53: - parameter.name = "0x53 General Purpose 8"; - break; - case 0x54: - parameter.name = "0x54 Portamento Control"; - break; - case 0x5B: - parameter.name = "0x5B FX 1 Depth [Reverb]"; - break; - case 0x5C: - parameter.name = "0x5C FX 2 Depth [Tremolo]"; - break; - case 0x5D: - parameter.name = "0x5D FX 3 Depth [Chorus]"; - break; - case 0x5E: - parameter.name = "0x5E FX 4 Depth [Detune]"; - break; - case 0x5F: - parameter.name = "0x5F FX 5 Depth [Phaser]"; - break; - default: - parameter.name = ""; - break; - } - } - - void d_initProgramName(uint32_t index, d_string& programName) override - { - programName = "Program #" + d_string(index); - } - - void d_initStateKey(uint32_t index, d_string& stateKey) override - { - stateKey = "Plugin #" + d_string(index); - } - - // --------------------------------------------- - // DISTRHO Plugin Internal data - - float d_parameterValue(uint32_t index) override - { - if (index >= kParamCount) - return 0.0f; - - return fParamBuffers[index]; - } - - void d_setParameterValue(uint32_t index, float value) override - { - if (index >= kParamCount) - return; - - fParamBuffers[index] = value; - } - - void d_setProgram(uint32_t index) override - { - if (index >= kProgramCount) - return; - if (kData->curPluginCount == 0 || kData->plugins == nullptr) - return; - - CarlaPlugin* const plugin(kData->plugins[0].plugin); - - if (plugin == nullptr || ! plugin->enabled()) - return; - - if (plugin->midiProgramCount() > 0) - { - if (index <= plugin->midiProgramCount()) - plugin->setMidiProgram(index, true, true, false); - } - else if (plugin->programCount() > 0 && plugin->type() != PLUGIN_LV2) - { - if (index <= plugin->programCount()) - plugin->setProgram(index, true, true, false); - } - } - - void d_setState(const char* key, const char* value) override - { - // TODO - (void)key; - (void)value; - } - - // --------------------------------------------- - // DISTRHO Plugin Process - - void d_activate() override - { - for (unsigned int i=0; i < kData->curPluginCount; ++i) - { - CarlaPlugin* const plugin(kData->plugins[i].plugin); - - if (plugin != nullptr && plugin->enabled()) - plugin->setActive(true, true, false); - } - - carla_copyFloat(fPrevParamBuffers, fParamBuffers, kParamCount); - } - - void d_deactivate() override - { - for (unsigned int i=0; i < kData->curPluginCount; ++i) - { - CarlaPlugin* const plugin(kData->plugins[i].plugin); - - if (plugin != nullptr && plugin->enabled()) - plugin->setActive(false, true, false); - } - - // just in case - proccessPendingEvents(); - } - - void d_run(float** inputs, float** outputs, uint32_t frames, uint32_t midiEventCount, const DISTRHO::MidiEvent* midiEvents) override - { - if (kData->curPluginCount == 0) - { - carla_zeroFloat(outputs[0], frames); - carla_zeroFloat(outputs[1], frames); - return proccessPendingEvents(); - } - - // --------------------------------------------------------------- - // create audio buffers - - float* inBuf[2] = { inputs[0], inputs[1] }; - float* outBuf[2] = { outputs[0], outputs[1] }; - - // --------------------------------------------------------------- - // initialize input events - - carla_zeroStruct(kData->bufEvents.in, INTERNAL_EVENT_COUNT); - { - uint32_t engineEventIndex = 0; - - for (unsigned int i=0; i < kParamCount && engineEventIndex+midiEventCount < INTERNAL_EVENT_COUNT; ++i) - { - if (fParamBuffers[i] == fPrevParamBuffers[i]) - continue; - - EngineEvent& engineEvent(kData->bufEvents.in[engineEventIndex++]); - engineEvent.clear(); - - engineEvent.type = kEngineEventTypeControl; - engineEvent.time = 0; - engineEvent.channel = 0; - - engineEvent.ctrl.type = kEngineControlEventTypeParameter; - engineEvent.ctrl.param = kParamMap[i]; - engineEvent.ctrl.value = fParamBuffers[i]/127.0f; - - fPrevParamBuffers[i] = fParamBuffers[i]; - } - - for (uint32_t i=0; i < midiEventCount && engineEventIndex < INTERNAL_EVENT_COUNT; ++i) - { - const DISTRHO::MidiEvent& midiEvent(midiEvents[i]); - - if (midiEvent.size > 4) - continue; - - const uint8_t status = MIDI_GET_STATUS_FROM_DATA(midiEvent.buf); - const uint8_t channel = MIDI_GET_CHANNEL_FROM_DATA(midiEvent.buf); - - // we don't want some events - if (status == MIDI_STATUS_PROGRAM_CHANGE) - continue; - - // handle note/sound off properly - if (status == MIDI_STATUS_CONTROL_CHANGE) - { - const uint8_t control = midiEvent.buf[1]; - - if (MIDI_IS_CONTROL_BANK_SELECT(control)) - continue; - - if (control == MIDI_CONTROL_ALL_SOUND_OFF || control == MIDI_CONTROL_ALL_NOTES_OFF) - { - EngineEvent& engineEvent(kData->bufEvents.in[engineEventIndex++]); - engineEvent.clear(); - - engineEvent.type = kEngineEventTypeControl; - engineEvent.time = midiEvent.frame; - engineEvent.channel = channel; - - engineEvent.ctrl.type = (control == MIDI_CONTROL_ALL_SOUND_OFF) ? kEngineControlEventTypeAllSoundOff : kEngineControlEventTypeAllNotesOff; - engineEvent.ctrl.param = 0; - engineEvent.ctrl.value = 0.0f; - - continue; - } - } - - EngineEvent& engineEvent(kData->bufEvents.in[engineEventIndex++]); - engineEvent.clear(); - - engineEvent.type = kEngineEventTypeMidi; - engineEvent.time = midiEvent.frame; - engineEvent.channel = channel; - - engineEvent.midi.data[0] = MIDI_GET_STATUS_FROM_DATA(midiEvent.buf); - engineEvent.midi.data[1] = midiEvent.buf[1]; - engineEvent.midi.data[2] = midiEvent.buf[2]; - engineEvent.midi.data[3] = midiEvent.buf[3]; - engineEvent.midi.size = midiEvent.size; - } - } - - // --------------------------------------------------------------- - // process - - processRack(inBuf, outBuf, frames); - proccessPendingEvents(); - } - - // --------------------------------------------- - // Callbacks - - void d_bufferSizeChanged(uint32_t newBufferSize) override - { - if (fBufferSize == newBufferSize) - return; - - fBufferSize = newBufferSize; - bufferSizeChanged(newBufferSize); - } - - void d_sampleRateChanged(double newSampleRate) override - { - if (fSampleRate == newSampleRate) - return; - - fSampleRate = newSampleRate; - sampleRateChanged(newSampleRate); - } - - // --------------------------------------------- - -private: - float fParamBuffers[kParamCount]; - float fPrevParamBuffers[kParamCount]; -}; - -CARLA_BACKEND_END_NAMESPACE - -// ------------------------------------------------- - -START_NAMESPACE_DISTRHO - -Plugin* createPlugin() -{ - return new CarlaBackend::CarlaEnginePlugin(); -} - -END_NAMESPACE_DISTRHO - -// ------------------------------------------------- - -#include "DistrhoPluginMain.cpp" diff --git a/source/backend/engine/distrho/DistrhoPluginInfo.h b/source/backend/engine/distrho/DistrhoPluginInfo.h deleted file mode 100644 index 7dd4c095a..000000000 --- a/source/backend/engine/distrho/DistrhoPluginInfo.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Carla Plugin Engine (DISTRHO) - * Copyright (C) 2012-2013 Filipe Coelho - * - * 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 GPL.txt file - */ - -#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED -#define DISTRHO_PLUGIN_INFO_H_INCLUDED - -#define DISTRHO_PLUGIN_NAME "Carla" - -#define DISTRHO_PLUGIN_HAS_UI 1 -#define DISTRHO_PLUGIN_IS_SYNTH 1 - -#define DISTRHO_PLUGIN_NUM_INPUTS 2 -#define DISTRHO_PLUGIN_NUM_OUTPUTS 2 - -#define DISTRHO_PLUGIN_WANT_LATENCY 0 -#define DISTRHO_PLUGIN_WANT_PROGRAMS 1 -#define DISTRHO_PLUGIN_WANT_STATE 1 -#define DISTRHO_PLUGIN_WANT_TIMEPOS 1 - -#define DISTRHO_PLUGIN_URI "http://kxstudio.sf.net/carla" - -#define DISTRHO_UI_EXTERNAL - -#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED diff --git a/source/backend/plugin/CarlaPlugin.pro b/source/backend/plugin/CarlaPlugin.pro index 4871cad8d..cd4f30fbb 100644 --- a/source/backend/plugin/CarlaPlugin.pro +++ b/source/backend/plugin/CarlaPlugin.pro @@ -52,6 +52,8 @@ SOURCES = \ DssiPlugin.cpp \ Lv2Plugin.cpp \ VstPlugin.cpp \ + Vst3Plugin.cpp \ + JucePlugin.cpp \ FluidSynthPlugin.cpp \ LinuxSamplerPlugin.cpp @@ -67,19 +69,26 @@ HEADERS += \ ../CarlaPlugin.hpp HEADERS += \ + ../../includes/CarlaDefines.hpp \ + ../../includes/CarlaMIDI.h + +HEADERS += \ + ../../utils/CarlaMutex.hpp \ + ../../utils/CarlaRingBuffer.hpp \ + ../../utils/CarlaString.hpp ../../utils/CarlaUtils.hpp \ + ../../utils/CarlaBackendUtils.hpp \ ../../utils/CarlaBridgeUtils.hpp \ ../../utils/CarlaJuceUtils.hpp \ ../../utils/CarlaLibUtils.hpp \ ../../utils/CarlaOscUtils.hpp \ ../../utils/CarlaStateUtils.hpp \ - ../../utils/CarlaMutex.hpp \ - ../../utils/CarlaRingBuffer.hpp \ - ../../utils/CarlaString.hpp + ../../utils/Lv2AtomQueue.hpp \ + ../../utils/RtList.hpp INCLUDEPATH = . .. \ ../../includes \ - ../../libs \ + ../../modules \ ../../utils QMAKE_CXXFLAGS += -std=c++0x diff --git a/source/backend/plugin/JucePlugin.cpp b/source/backend/plugin/JucePlugin.cpp new file mode 100644 index 000000000..8d1c8b69c --- /dev/null +++ b/source/backend/plugin/JucePlugin.cpp @@ -0,0 +1 @@ + diff --git a/source/includes/CarlaDefines.hpp b/source/includes/CarlaDefines.hpp index 6cb7bbcef..9d15efa4b 100644 --- a/source/includes/CarlaDefines.hpp +++ b/source/includes/CarlaDefines.hpp @@ -135,9 +135,9 @@ // Define CARLA_DECLARE_NON_COPY_STRUCT #ifdef CARLA_PROPER_CPP11_SUPPORT # define CARLA_DECLARE_NON_COPY_STRUCT(StructName) \ - StructName(StructName&) = delete; \ - StructName(const StructName&) = delete; \ - StructName& operator=(const StructName&) = delete; + StructName(StructName&) = delete; \ + StructName(const StructName&) = delete; \ + StructName& operator=(const StructName&) = delete; #else # define CARLA_DECLARE_NON_COPY_STRUCT(StructName) #endif @@ -153,13 +153,6 @@ # endif #endif -// Define OS_SEP -#ifdef CARLA_OS_WIN -# define OS_SEP '\\' -#else -# define OS_SEP '/' -#endif - // Define PRE/POST_PACKED_STRUCTURE #if defined(__GNUC__) # define PRE_PACKED_STRUCTURE @@ -173,4 +166,11 @@ # define POST_PACKED_STRUCTURE #endif +// Define OS_SEP +#ifdef CARLA_OS_WIN +# define OS_SEP '\\' +#else +# define OS_SEP '/' +#endif + #endif // CARLA_DEFINES_HPP_INCLUDED diff --git a/source/includes/CarlaMIDI.h b/source/includes/CarlaMIDI.h index c3c701778..cc7afa5a7 100644 --- a/source/includes/CarlaMIDI.h +++ b/source/includes/CarlaMIDI.h @@ -36,7 +36,7 @@ #define MIDI_IS_STATUS_POLYPHONIC_AFTERTOUCH(status) (((status) & 0xF0) == MIDI_STATUS_POLYPHONIC_AFTERTOUCH) #define MIDI_IS_STATUS_CONTROL_CHANGE(status) (((status) & 0xF0) == MIDI_STATUS_CONTROL_CHANGE) #define MIDI_IS_STATUS_PROGRAM_CHANGE(status) (((status) & 0xF0) == MIDI_STATUS_PROGRAM_CHANGE) -#define MIDI_IS_STATUS_AFTERTOUCH(status) (((status) & 0xF0) == MIDI_STATUS_AFTERTOUCH) +#define MIDI_IS_STATUS_CHANNEL_PRESSURE(status) (((status) & 0xF0) == MIDI_STATUS_CHANNEL_PRESSURE) #define MIDI_IS_STATUS_PITCH_WHEEL_CONTROL(status) (((status) & 0xF0) == MIDI_STATUS_PITCH_WHEEL_CONTROL) // MIDI Utils diff --git a/source/modules/utils/Makefile b/source/modules/utils/Makefile deleted file mode 100644 index d7e76da5b..000000000 --- a/source/modules/utils/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/make -f -# Makefile for utils # -# ------------------ # -# Created by falkTX -# - -include ../../Makefile.mk - -# -------------------------------------------------------------- - -all: - -clean: - -debug: - $(MAKE) DEBUG=true diff --git a/source/modules/utils/CarlaBackendUtils.hpp b/source/utils/CarlaBackendUtils.hpp similarity index 100% rename from source/modules/utils/CarlaBackendUtils.hpp rename to source/utils/CarlaBackendUtils.hpp diff --git a/source/modules/utils/CarlaBridgeUtils.hpp b/source/utils/CarlaBridgeUtils.hpp similarity index 100% rename from source/modules/utils/CarlaBridgeUtils.hpp rename to source/utils/CarlaBridgeUtils.hpp diff --git a/source/modules/utils/CarlaDssiUtils.hpp b/source/utils/CarlaDssiUtils.hpp similarity index 100% rename from source/modules/utils/CarlaDssiUtils.hpp rename to source/utils/CarlaDssiUtils.hpp diff --git a/source/modules/utils/CarlaJuceUtils.hpp b/source/utils/CarlaJuceUtils.hpp similarity index 100% rename from source/modules/utils/CarlaJuceUtils.hpp rename to source/utils/CarlaJuceUtils.hpp diff --git a/source/modules/utils/CarlaLadspaUtils.hpp b/source/utils/CarlaLadspaUtils.hpp similarity index 100% rename from source/modules/utils/CarlaLadspaUtils.hpp rename to source/utils/CarlaLadspaUtils.hpp diff --git a/source/modules/utils/CarlaLibUtils.hpp b/source/utils/CarlaLibUtils.hpp similarity index 100% rename from source/modules/utils/CarlaLibUtils.hpp rename to source/utils/CarlaLibUtils.hpp diff --git a/source/modules/utils/CarlaLogThread.hpp b/source/utils/CarlaLogThread.hpp similarity index 100% rename from source/modules/utils/CarlaLogThread.hpp rename to source/utils/CarlaLogThread.hpp diff --git a/source/modules/utils/CarlaLv2Utils.hpp b/source/utils/CarlaLv2Utils.hpp similarity index 100% rename from source/modules/utils/CarlaLv2Utils.hpp rename to source/utils/CarlaLv2Utils.hpp diff --git a/source/modules/utils/CarlaMutex.hpp b/source/utils/CarlaMutex.hpp similarity index 100% rename from source/modules/utils/CarlaMutex.hpp rename to source/utils/CarlaMutex.hpp diff --git a/source/modules/utils/CarlaOscUtils.hpp b/source/utils/CarlaOscUtils.hpp similarity index 100% rename from source/modules/utils/CarlaOscUtils.hpp rename to source/utils/CarlaOscUtils.hpp diff --git a/source/modules/utils/CarlaRingBuffer.hpp b/source/utils/CarlaRingBuffer.hpp similarity index 100% rename from source/modules/utils/CarlaRingBuffer.hpp rename to source/utils/CarlaRingBuffer.hpp diff --git a/source/modules/utils/CarlaShmUtils.hpp b/source/utils/CarlaShmUtils.hpp similarity index 100% rename from source/modules/utils/CarlaShmUtils.hpp rename to source/utils/CarlaShmUtils.hpp diff --git a/source/modules/utils/CarlaStateUtils.hpp b/source/utils/CarlaStateUtils.hpp similarity index 100% rename from source/modules/utils/CarlaStateUtils.hpp rename to source/utils/CarlaStateUtils.hpp diff --git a/source/modules/utils/CarlaString.hpp b/source/utils/CarlaString.hpp similarity index 100% rename from source/modules/utils/CarlaString.hpp rename to source/utils/CarlaString.hpp diff --git a/source/modules/utils/CarlaUtils.hpp b/source/utils/CarlaUtils.hpp similarity index 100% rename from source/modules/utils/CarlaUtils.hpp rename to source/utils/CarlaUtils.hpp diff --git a/source/modules/utils/CarlaVstUtils.hpp b/source/utils/CarlaVstUtils.hpp similarity index 100% rename from source/modules/utils/CarlaVstUtils.hpp rename to source/utils/CarlaVstUtils.hpp diff --git a/source/modules/utils/Lv2AtomQueue.hpp b/source/utils/Lv2AtomQueue.hpp similarity index 100% rename from source/modules/utils/Lv2AtomQueue.hpp rename to source/utils/Lv2AtomQueue.hpp diff --git a/source/modules/utils/RtList.hpp b/source/utils/RtList.hpp similarity index 100% rename from source/modules/utils/RtList.hpp rename to source/utils/RtList.hpp