@@ -20,6 +20,8 @@ | |||||
#include "CarlaStateUtils.hpp" | #include "CarlaStateUtils.hpp" | ||||
#include "CarlaMIDI.h" | #include "CarlaMIDI.h" | ||||
#include <cmath> | |||||
#include <QtCore/QDir> | #include <QtCore/QDir> | ||||
#include <QtCore/QFile> | #include <QtCore/QFile> | ||||
#include <QtCore/QFileInfo> | #include <QtCore/QFileInfo> | ||||
@@ -26,6 +26,7 @@ | |||||
#include "jackbridge/JackBridge.hpp" | #include "jackbridge/JackBridge.hpp" | ||||
#include <cerrno> | |||||
#include <ctime> | #include <ctime> | ||||
CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
@@ -334,7 +334,7 @@ public: | |||||
fConnectName.clear(); | fConnectName.clear(); | ||||
for (auto it = fMidiIns.begin(); it.valid(); it.next()) | |||||
for (NonRtList<MidiPort>::Itenerator it = fMidiIns.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
MidiPort& port(*it); | MidiPort& port(*it); | ||||
RtMidiIn* const midiInPort((RtMidiIn*)port.rtmidi); | RtMidiIn* const midiInPort((RtMidiIn*)port.rtmidi); | ||||
@@ -343,7 +343,7 @@ public: | |||||
delete midiInPort; | delete midiInPort; | ||||
} | } | ||||
for (auto it = fMidiOuts.begin(); it.valid(); it.next()) | |||||
for (NonRtList<MidiPort>::Itenerator it = fMidiOuts.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
MidiPort& port(*it); | MidiPort& port(*it); | ||||
RtMidiOut* const midiOutPort((RtMidiOut*)port.rtmidi); | RtMidiOut* const midiOutPort((RtMidiOut*)port.rtmidi); | ||||
@@ -504,7 +504,7 @@ public: | |||||
return false; | return false; | ||||
} | } | ||||
for (auto it=fUsedConnections.begin(); it.valid(); it.next()) | |||||
for (NonRtList<ConnectionToId>::Itenerator it=fUsedConnections.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const ConnectionToId& connection(*it); | const ConnectionToId& connection(*it); | ||||
@@ -517,7 +517,7 @@ public: | |||||
{ | { | ||||
const int portId(targetPort-PATCHBAY_GROUP_MIDI_OUT*1000); | const int portId(targetPort-PATCHBAY_GROUP_MIDI_OUT*1000); | ||||
for (auto it=fMidiOuts.begin(); it.valid(); it.next()) | |||||
for (NonRtList<MidiPort>::Itenerator it=fMidiOuts.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
MidiPort& midiPort(*it); | MidiPort& midiPort(*it); | ||||
@@ -536,7 +536,7 @@ public: | |||||
{ | { | ||||
const int portId(targetPort-PATCHBAY_GROUP_MIDI_IN*1000); | const int portId(targetPort-PATCHBAY_GROUP_MIDI_IN*1000); | ||||
for (auto it=fMidiIns.begin(); it.valid(); it.next()) | |||||
for (NonRtList<MidiPort>::Itenerator it=fMidiIns.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
MidiPort& midiPort(*it); | MidiPort& midiPort(*it); | ||||
@@ -690,7 +690,7 @@ public: | |||||
// Connections | // Connections | ||||
fConnectAudioLock.lock(); | fConnectAudioLock.lock(); | ||||
for (auto it = fConnectedAudioIns[0].begin(); it.valid(); it.next()) | |||||
for (NonRtList<uint>::Itenerator it = fConnectedAudioIns[0].begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const uint& port(*it); | const uint& port(*it); | ||||
CARLA_ASSERT(port < fAudioCountIn); | CARLA_ASSERT(port < fAudioCountIn); | ||||
@@ -706,7 +706,7 @@ public: | |||||
fLastConnectionId++; | fLastConnectionId++; | ||||
} | } | ||||
for (auto it = fConnectedAudioIns[1].begin(); it.valid(); it.next()) | |||||
for (NonRtList<uint>::Itenerator it = fConnectedAudioIns[1].begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const uint& port(*it); | const uint& port(*it); | ||||
CARLA_ASSERT(port < fAudioCountIn); | CARLA_ASSERT(port < fAudioCountIn); | ||||
@@ -722,7 +722,7 @@ public: | |||||
fLastConnectionId++; | fLastConnectionId++; | ||||
} | } | ||||
for (auto it = fConnectedAudioOuts[0].begin(); it.valid(); it.next()) | |||||
for (NonRtList<uint>::Itenerator it = fConnectedAudioOuts[0].begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const uint& port(*it); | const uint& port(*it); | ||||
CARLA_ASSERT(port < fAudioCountOut); | CARLA_ASSERT(port < fAudioCountOut); | ||||
@@ -738,7 +738,7 @@ public: | |||||
fLastConnectionId++; | fLastConnectionId++; | ||||
} | } | ||||
for (auto it = fConnectedAudioOuts[1].begin(); it.valid(); it.next()) | |||||
for (NonRtList<uint>::Itenerator it = fConnectedAudioOuts[1].begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const uint& port(*it); | const uint& port(*it); | ||||
CARLA_ASSERT(port < fAudioCountOut); | CARLA_ASSERT(port < fAudioCountOut); | ||||
@@ -756,7 +756,7 @@ public: | |||||
fConnectAudioLock.unlock(); | fConnectAudioLock.unlock(); | ||||
for (auto it=fMidiIns.begin(); it.valid(); it.next()) | |||||
for (NonRtList<MidiPort>::Itenerator it=fMidiIns.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const MidiPort& midiPort(*it); | const MidiPort& midiPort(*it); | ||||
@@ -771,7 +771,7 @@ public: | |||||
fLastConnectionId++; | fLastConnectionId++; | ||||
} | } | ||||
for (auto it=fMidiOuts.begin(); it.valid(); it.next()) | |||||
for (NonRtList<MidiPort>::Itenerator it=fMidiOuts.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const MidiPort& midiPort(*it); | const MidiPort& midiPort(*it); | ||||
@@ -934,7 +934,7 @@ protected: | |||||
{ | { | ||||
bool first = true; | bool first = true; | ||||
for (auto it = fConnectedAudioIns[0].begin(); it.valid(); it.next()) | |||||
for (NonRtList<uint>::Itenerator it = fConnectedAudioIns[0].begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const uint& port(*it); | const uint& port(*it); | ||||
CARLA_ASSERT(port < fAudioCountIn); | CARLA_ASSERT(port < fAudioCountIn); | ||||
@@ -960,7 +960,7 @@ protected: | |||||
{ | { | ||||
bool first = true; | bool first = true; | ||||
for (auto it = fConnectedAudioIns[1].begin(); it.valid(); it.next()) | |||||
for (NonRtList<uint>::Itenerator it = fConnectedAudioIns[1].begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const uint& port(*it); | const uint& port(*it); | ||||
CARLA_ASSERT(port < fAudioCountIn); | CARLA_ASSERT(port < fAudioCountIn); | ||||
@@ -984,7 +984,7 @@ protected: | |||||
// connect output buffers | // connect output buffers | ||||
if (fConnectedAudioOuts[0].count() != 0) | if (fConnectedAudioOuts[0].count() != 0) | ||||
{ | { | ||||
for (auto it = fConnectedAudioOuts[0].begin(); it.valid(); it.next()) | |||||
for (NonRtList<uint>::Itenerator it = fConnectedAudioOuts[0].begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const uint& port(*it); | const uint& port(*it); | ||||
CARLA_ASSERT(port < fAudioCountOut); | CARLA_ASSERT(port < fAudioCountOut); | ||||
@@ -995,7 +995,7 @@ protected: | |||||
if (fConnectedAudioOuts[1].count() != 0) | if (fConnectedAudioOuts[1].count() != 0) | ||||
{ | { | ||||
for (auto it = fConnectedAudioOuts[1].begin(); it.valid(); it.next()) | |||||
for (NonRtList<uint>::Itenerator it = fConnectedAudioOuts[1].begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const uint& port(*it); | const uint& port(*it); | ||||
CARLA_ASSERT(port < fAudioCountOut); | CARLA_ASSERT(port < fAudioCountOut); | ||||
@@ -33,10 +33,19 @@ struct AudioFilePool { | |||||
uint32_t startFrame; | uint32_t startFrame; | ||||
uint32_t size; | uint32_t size; | ||||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||||
AudioFilePool() | AudioFilePool() | ||||
: buffer{nullptr}, | : buffer{nullptr}, | ||||
startFrame(0), | startFrame(0), | ||||
size(0) {} | size(0) {} | ||||
#else | |||||
AudioFilePool() | |||||
: startFrame(0), | |||||
size(0) | |||||
{ | |||||
buffer[0] = buffer[1] = nullptr; | |||||
} | |||||
#endif | |||||
~AudioFilePool() | ~AudioFilePool() | ||||
{ | { | ||||
@@ -32,9 +32,17 @@ struct RawMidiEvent { | |||||
uint32_t time; | uint32_t time; | ||||
RawMidiEvent() | RawMidiEvent() | ||||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||||
: data{0}, | : data{0}, | ||||
size(0), | size(0), | ||||
time(0) {} | time(0) {} | ||||
#else | |||||
: size(0), | |||||
time(0) | |||||
{ | |||||
carla_fill<uint8_t>(data, MAX_EVENT_DATA_SIZE, 0); | |||||
} | |||||
#endif | |||||
}; | }; | ||||
class AbstractMidiPlayer | class AbstractMidiPlayer | ||||
@@ -172,7 +180,7 @@ public: | |||||
if (! fMutex.tryLock()) | if (! fMutex.tryLock()) | ||||
return; | return; | ||||
for (auto it = fData.begin(); it.valid(); it.next()) | |||||
for (NonRtList<const RawMidiEvent*>::Itenerator it = fData.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const RawMidiEvent* const rawMidiEvent(*it); | const RawMidiEvent* const rawMidiEvent(*it); | ||||
@@ -211,7 +219,7 @@ private: | |||||
return; | return; | ||||
} | } | ||||
for (auto it = fData.begin(); it.valid(); it.next()) | |||||
for (NonRtList<const RawMidiEvent*>::Itenerator it = fData.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const RawMidiEvent* const oldEvent(*it); | const RawMidiEvent* const oldEvent(*it); | ||||
@@ -24,6 +24,8 @@ | |||||
#include "jackbridge/JackBridge.hpp" | #include "jackbridge/JackBridge.hpp" | ||||
#include <cerrno> | |||||
#include <cmath> | |||||
#include <ctime> | #include <ctime> | ||||
#include <QtCore/QDir> | #include <QtCore/QDir> | ||||
@@ -56,7 +56,7 @@ public: | |||||
const CarlaMutex::ScopedLocker sl(&mutex); | const CarlaMutex::ScopedLocker sl(&mutex); | ||||
for (auto it = libs.begin(); it.valid(); it.next()) | |||||
for (NonRtList<Lib>::Itenerator it = libs.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
Lib& lib(*it); | Lib& lib(*it); | ||||
@@ -72,7 +72,11 @@ public: | |||||
if (libPtr == nullptr) | if (libPtr == nullptr) | ||||
return nullptr; | return nullptr; | ||||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||||
Lib lib{libPtr, carla_strdup(filename), 1}; | Lib lib{libPtr, carla_strdup(filename), 1}; | ||||
#else | |||||
Lib lib(libPtr, carla_strdup(filename)); | |||||
#endif | |||||
libs.append(lib); | libs.append(lib); | ||||
return libPtr; | return libPtr; | ||||
@@ -87,7 +91,7 @@ public: | |||||
const CarlaMutex::ScopedLocker sl(&mutex); | const CarlaMutex::ScopedLocker sl(&mutex); | ||||
for (auto it = libs.begin(); it.valid(); it.next()) | |||||
for (NonRtList<Lib>::Itenerator it = libs.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
Lib& lib(*it); | Lib& lib(*it); | ||||
@@ -116,6 +120,13 @@ private: | |||||
void* const lib; | void* const lib; | ||||
const char* const filename; | const char* const filename; | ||||
int count; | int count; | ||||
#ifndef CARLA_PROPER_CPP11_SUPPORT | |||||
Lib(void* const lib_, const char* const filename_) | |||||
: lib(lib_), | |||||
filename(filename_), | |||||
count(1) {} | |||||
#endif | |||||
}; | }; | ||||
CarlaMutex mutex; | CarlaMutex mutex; | ||||
@@ -728,7 +739,7 @@ const SaveState& CarlaPlugin::getSaveState() | |||||
// ---------------------------- | // ---------------------------- | ||||
// Custom Data | // Custom Data | ||||
for (auto it = kData->custom.begin(); it.valid(); it.next()) | |||||
for (NonRtList<CustomData>::Itenerator it = kData->custom.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const CustomData& cData(*it); | const CustomData& cData(*it); | ||||
@@ -747,6 +758,31 @@ const SaveState& CarlaPlugin::getSaveState() | |||||
return saveState; | return saveState; | ||||
} | } | ||||
struct ParamSymbol { | |||||
uint32_t index; | |||||
const char* symbol; | |||||
ParamSymbol(uint32_t index_, const char* symbol_) | |||||
: index(index_), | |||||
symbol(carla_strdup(symbol_)) {} | |||||
void free() | |||||
{ | |||||
if (symbol != nullptr) | |||||
{ | |||||
delete[] symbol; | |||||
symbol = nullptr; | |||||
} | |||||
} | |||||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||||
ParamSymbol() = delete; | |||||
ParamSymbol(ParamSymbol&) = delete; | |||||
ParamSymbol(const ParamSymbol&) = delete; | |||||
#endif | |||||
}; | |||||
void CarlaPlugin::loadSaveState(const SaveState& saveState) | void CarlaPlugin::loadSaveState(const SaveState& saveState) | ||||
{ | { | ||||
char strBuf[STR_MAX+1]; | char strBuf[STR_MAX+1]; | ||||
@@ -754,7 +790,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
// Part 1 - set custom data (except binary/chunks) | // Part 1 - set custom data (except binary/chunks) | ||||
for (auto it = saveState.customData.begin(); it.valid(); it.next()) | |||||
for (NonRtList<StateCustomData*>::Itenerator it = saveState.customData.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const StateCustomData* const stateCustomData(*it); | const StateCustomData* const stateCustomData(*it); | ||||
@@ -812,28 +848,6 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
// Part 4a - get plugin parameter symbols | // Part 4a - get plugin parameter symbols | ||||
struct ParamSymbol { | |||||
uint32_t index; | |||||
const char* symbol; | |||||
ParamSymbol(uint32_t index_, const char* symbol_) | |||||
: index(index_), | |||||
symbol(carla_strdup(symbol_)) {} | |||||
void free() | |||||
{ | |||||
if (symbol != nullptr) | |||||
{ | |||||
delete[] symbol; | |||||
symbol = nullptr; | |||||
} | |||||
} | |||||
ParamSymbol() = delete; | |||||
ParamSymbol(ParamSymbol&) = delete; | |||||
ParamSymbol(const ParamSymbol&) = delete; | |||||
}; | |||||
NonRtList<ParamSymbol*> paramSymbols; | NonRtList<ParamSymbol*> paramSymbols; | ||||
if (type() == PLUGIN_LADSPA || type() == PLUGIN_LV2) | if (type() == PLUGIN_LADSPA || type() == PLUGIN_LV2) | ||||
@@ -855,7 +869,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||||
const float sampleRate(kData->engine->getSampleRate()); | const float sampleRate(kData->engine->getSampleRate()); | ||||
for (auto it = saveState.parameters.begin(); it.valid(); it.next()) | |||||
for (NonRtList<StateParameter*>::Itenerator it = saveState.parameters.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
StateParameter* const stateParameter(*it); | StateParameter* const stateParameter(*it); | ||||
@@ -866,7 +880,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||||
// Try to set by symbol, otherwise use index | // Try to set by symbol, otherwise use index | ||||
if (stateParameter->symbol != nullptr && *stateParameter->symbol != 0) | if (stateParameter->symbol != nullptr && *stateParameter->symbol != 0) | ||||
{ | { | ||||
for (auto it = paramSymbols.begin(); it.valid(); it.next()) | |||||
for (NonRtList<ParamSymbol*>::Itenerator it = paramSymbols.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
ParamSymbol* const paramSymbol(*it); | ParamSymbol* const paramSymbol(*it); | ||||
@@ -887,7 +901,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||||
// Symbol only | // Symbol only | ||||
if (stateParameter->symbol != nullptr && *stateParameter->symbol != 0) | if (stateParameter->symbol != nullptr && *stateParameter->symbol != 0) | ||||
{ | { | ||||
for (auto it = paramSymbols.begin(); it.valid(); it.next()) | |||||
for (NonRtList<ParamSymbol*>::Itenerator it = paramSymbols.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
ParamSymbol* const paramSymbol(*it); | ParamSymbol* const paramSymbol(*it); | ||||
@@ -926,7 +940,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||||
} | } | ||||
// clear | // clear | ||||
for (auto it = paramSymbols.begin(); it.valid(); it.next()) | |||||
for (NonRtList<ParamSymbol*>::Itenerator it = paramSymbols.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
ParamSymbol* const paramSymbol(*it); | ParamSymbol* const paramSymbol(*it); | ||||
paramSymbol->free(); | paramSymbol->free(); | ||||
@@ -938,7 +952,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
// Part 5 - set chunk data | // Part 5 - set chunk data | ||||
for (auto it = saveState.customData.begin(); it.valid(); it.next()) | |||||
for (NonRtList<StateCustomData*>::Itenerator it = saveState.customData.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const StateCustomData* const stateCustomData(*it); | const StateCustomData* const stateCustomData(*it); | ||||
@@ -1372,7 +1386,7 @@ void CarlaPlugin::setCustomData(const char* const type, const char* const key, c | |||||
return; | return; | ||||
// Check if we already have this key | // Check if we already have this key | ||||
for (auto it = kData->custom.begin(); it.valid(); it.next()) | |||||
for (NonRtList<CustomData>::Itenerator it = kData->custom.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
CustomData& cData(*it); | CustomData& cData(*it); | ||||
@@ -1805,7 +1819,7 @@ void CarlaPlugin::updateOscData(const lo_address& source, const char* const url) | |||||
osc_send_sample_rate(&kData->osc.data, kData->engine->getSampleRate()); | osc_send_sample_rate(&kData->osc.data, kData->engine->getSampleRate()); | ||||
for (auto it = kData->custom.begin(); it.valid(); it.next()) | |||||
for (NonRtList<CustomData>::Itenerator it = kData->custom.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const CustomData& cData(*it); | const CustomData& cData(*it); | ||||
@@ -518,9 +518,11 @@ struct CarlaPluginProtectedData { | |||||
OSC(CarlaEngine* const engine, CarlaPlugin* const plugin) | OSC(CarlaEngine* const engine, CarlaPlugin* const plugin) | ||||
: thread(engine, plugin) {} | : thread(engine, plugin) {} | ||||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||||
OSC() = delete; | OSC() = delete; | ||||
OSC(OSC&) = delete; | OSC(OSC&) = delete; | ||||
OSC(const OSC&) = delete; | OSC(const OSC&) = delete; | ||||
#endif | |||||
CARLA_LEAK_DETECTOR(OSC) | CARLA_LEAK_DETECTOR(OSC) | ||||
} osc; | } osc; | ||||
@@ -539,9 +541,11 @@ struct CarlaPluginProtectedData { | |||||
latencyBuffers(nullptr), | latencyBuffers(nullptr), | ||||
osc(engine, plugin) {} | osc(engine, plugin) {} | ||||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||||
CarlaPluginProtectedData() = delete; | CarlaPluginProtectedData() = delete; | ||||
CarlaPluginProtectedData(CarlaPluginProtectedData&) = delete; | CarlaPluginProtectedData(CarlaPluginProtectedData&) = delete; | ||||
CarlaPluginProtectedData(const CarlaPluginProtectedData&) = delete; | CarlaPluginProtectedData(const CarlaPluginProtectedData&) = delete; | ||||
#endif | |||||
CARLA_LEAK_DETECTOR(CarlaPluginProtectedData) | CARLA_LEAK_DETECTOR(CarlaPluginProtectedData) | ||||
~CarlaPluginProtectedData() | ~CarlaPluginProtectedData() | ||||
@@ -579,7 +583,7 @@ struct CarlaPluginProtectedData { | |||||
client = nullptr; | client = nullptr; | ||||
} | } | ||||
for (auto it = custom.begin(); it.valid(); it.next()) | |||||
for (NonRtList<CustomData>::Itenerator it = custom.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
CustomData& cData(*it); | CustomData& cData(*it); | ||||
@@ -42,12 +42,21 @@ public: | |||||
fSettings(nullptr), | fSettings(nullptr), | ||||
fSynth(nullptr), | fSynth(nullptr), | ||||
fSynthId(-1), | fSynthId(-1), | ||||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||||
fAudio16Buffers(nullptr), | fAudio16Buffers(nullptr), | ||||
fParamBuffers{0.0f}, | fParamBuffers{0.0f}, | ||||
fCurMidiProgs{0} | fCurMidiProgs{0} | ||||
#else | |||||
fAudio16Buffers(nullptr) | |||||
#endif | |||||
{ | { | ||||
carla_debug("FluidSynthPlugin::FluidSynthPlugin(%p, %i, %s)", engine, id, bool2str(use16Outs)); | carla_debug("FluidSynthPlugin::FluidSynthPlugin(%p, %i, %s)", engine, id, bool2str(use16Outs)); | ||||
#ifndef CARLA_PROPER_CPP11_SUPPORT | |||||
carla_zeroFloat(fParamBuffers, FluidSynthParametersMax); | |||||
carla_fill<int32_t>(fCurMidiProgs, MAX_MIDI_CHANNELS, 0); | |||||
#endif | |||||
// create settings | // create settings | ||||
fSettings = new_fluid_settings(); | fSettings = new_fluid_settings(); | ||||
CARLA_ASSERT(fSettings != nullptr); | CARLA_ASSERT(fSettings != nullptr); | ||||
@@ -357,7 +357,9 @@ public: | |||||
: CarlaPlugin(engine, id), | : CarlaPlugin(engine, id), | ||||
fHandle(nullptr), | fHandle(nullptr), | ||||
fHandle2(nullptr), | fHandle2(nullptr), | ||||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||||
fFeatures{nullptr}, | fFeatures{nullptr}, | ||||
#endif | |||||
fDescriptor(nullptr), | fDescriptor(nullptr), | ||||
fRdfDescriptor(nullptr), | fRdfDescriptor(nullptr), | ||||
fAudioInBuffers(nullptr), | fAudioInBuffers(nullptr), | ||||
@@ -367,6 +369,10 @@ public: | |||||
{ | { | ||||
carla_debug("Lv2Plugin::Lv2Plugin(%p, %i)", engine, id); | carla_debug("Lv2Plugin::Lv2Plugin(%p, %i)", engine, id); | ||||
#ifndef CARLA_PROPER_CPP11_SUPPORT | |||||
carla_fill<LV2_Feature*>(fFeatures, kFeatureCount+1, nullptr); | |||||
#endif | |||||
kData->osc.thread.setMode(CarlaPluginThread::PLUGIN_THREAD_LV2_GUI); | kData->osc.thread.setMode(CarlaPluginThread::PLUGIN_THREAD_LV2_GUI); | ||||
for (uint32_t i=0; i < CARLA_URI_MAP_ID_COUNT; ++i) | for (uint32_t i=0; i < CARLA_URI_MAP_ID_COUNT; ++i) | ||||
@@ -503,7 +509,7 @@ public: | |||||
delete fFeatures[i]; | delete fFeatures[i]; | ||||
} | } | ||||
for (auto it = fCustomURIDs.begin(); it.valid(); it.next()) | |||||
for (NonRtList<const char*>::Itenerator it = fCustomURIDs.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const char*& uri(*it); | const char*& uri(*it); | ||||
@@ -3584,7 +3590,7 @@ protected: | |||||
} | } | ||||
// Check if we already have this key | // Check if we already have this key | ||||
for (auto it = kData->custom.begin(); it.valid(); it.next()) | |||||
for (NonRtList<CustomData>::Itenerator it = kData->custom.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
CustomData& data(*it); | CustomData& data(*it); | ||||
@@ -3646,7 +3652,7 @@ protected: | |||||
const char* stype = nullptr; | const char* stype = nullptr; | ||||
const char* stringData = nullptr; | const char* stringData = nullptr; | ||||
for (auto it = kData->custom.begin(); it.valid(); it.next()) | |||||
for (NonRtList<CustomData>::Itenerator it = kData->custom.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
CustomData& data(*it); | CustomData& data(*it); | ||||
@@ -168,11 +168,19 @@ public: | |||||
fIsUiVisible(false), | fIsUiVisible(false), | ||||
fAudioInBuffers(nullptr), | fAudioInBuffers(nullptr), | ||||
fAudioOutBuffers(nullptr), | fAudioOutBuffers(nullptr), | ||||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||||
fMidiEventCount(0), | fMidiEventCount(0), | ||||
fCurMidiProgs{0} | fCurMidiProgs{0} | ||||
#else | |||||
fMidiEventCount(0) | |||||
#endif | |||||
{ | { | ||||
carla_debug("NativePlugin::NativePlugin(%p, %i)", engine, id); | carla_debug("NativePlugin::NativePlugin(%p, %i)", engine, id); | ||||
#ifndef CARLA_PROPER_CPP11_SUPPORT | |||||
carla_fill<int32_t>(fCurMidiProgs, MAX_MIDI_CHANNELS, 0); | |||||
#endif | |||||
carla_zeroStruct< ::MidiEvent>(fMidiEvents, MAX_MIDI_EVENTS*2); | carla_zeroStruct< ::MidiEvent>(fMidiEvents, MAX_MIDI_EVENTS*2); | ||||
fHost.handle = this; | fHost.handle = this; | ||||
@@ -697,7 +705,7 @@ public: | |||||
// Update UI values, FIXME? (remove?) | // Update UI values, FIXME? (remove?) | ||||
if (fDescriptor->ui_set_custom_data != nullptr) | if (fDescriptor->ui_set_custom_data != nullptr) | ||||
{ | { | ||||
for (auto it = kData->custom.begin(); it.valid(); it.next()) | |||||
for (NonRtList<CustomData>::Itenerator it = kData->custom.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
const CustomData& cData(*it); | const CustomData& cData(*it); | ||||
@@ -2166,7 +2174,7 @@ public: | |||||
// --------------------------------------------------------------- | // --------------------------------------------------------------- | ||||
// get descriptor that matches label | // get descriptor that matches label | ||||
for (auto it = sPluginDescriptors.begin(); it.valid(); it.next()) | |||||
for (NonRtList<const PluginDescriptor*>::Itenerator it = sPluginDescriptors.begin(); it.valid(); it.next()) | |||||
{ | { | ||||
fDescriptor = *it; | fDescriptor = *it; | ||||
@@ -2345,8 +2345,15 @@ private: | |||||
FixedVstEvents() | FixedVstEvents() | ||||
: numEvents(0), | : numEvents(0), | ||||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||||
reserved(0), | reserved(0), | ||||
data{nullptr} {} | data{nullptr} {} | ||||
#else | |||||
reserved(0) | |||||
{ | |||||
carla_fill<VstEvent*>(data, MAX_MIDI_EVENTS*2, nullptr); | |||||
} | |||||
#endif | |||||
} fEvents; | } fEvents; | ||||
struct GuiInfo { | struct GuiInfo { | ||||
@@ -58,8 +58,12 @@ ifeq ($(HAVE_LINUXSAMPLER),true) | |||||
W32_LIBS += -lrpcrt4 | W32_LIBS += -lrpcrt4 | ||||
endif | endif | ||||
else | else | ||||
ifeq ($(MACOS),true) | |||||
DGL_LIBS = -framework Cocoa | |||||
else | |||||
DGL_LIBS = -lX11 | DGL_LIBS = -lX11 | ||||
endif | endif | ||||
endif | |||||
ifeq ($(HAVE_AF_DEPS),true) | ifeq ($(HAVE_AF_DEPS),true) | ||||
LINK_FLAGS += $(shell pkg-config --libs sndfile) | LINK_FLAGS += $(shell pkg-config --libs sndfile) | ||||
@@ -83,9 +87,13 @@ LINK_FLAGS += $(shell pkg-config --libs ntk ntk_images) | |||||
endif | endif | ||||
endif | endif | ||||
EXTRA_LIBS = -ldl -lrt | |||||
EXTRA_LIBS = -ldl | |||||
LINK_FLAGS += $(EXTRA_LIBS) | LINK_FLAGS += $(EXTRA_LIBS) | ||||
ifneq ($(MACOS),true) | |||||
EXTRA_LIBS += -lrt | |||||
endif | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
LIBS = ../libcarla_engine.a | LIBS = ../libcarla_engine.a | ||||
@@ -135,7 +143,7 @@ debug: | |||||
$(CXX) $^ -shared $(LINK_FLAGS) $(W32_LIBS) -Wl,--output-def,$@.def -o $@ && $(STRIP) $@ | $(CXX) $^ -shared $(LINK_FLAGS) $(W32_LIBS) -Wl,--output-def,$@.def -o $@ && $(STRIP) $@ | ||||
../libcarla_standalone.dylib: $(OBJS) $(LIBS) | ../libcarla_standalone.dylib: $(OBJS) $(LIBS) | ||||
$(CXX) $^ -dynamiclib $(LINK_FLAGS) -framework CoreAudio -framework CoreMidi -framework CoreFoundation -o $@ | |||||
$(CXX) $^ -dynamiclib $(LINK_FLAGS) -framework CoreAudio -framework CoreMIDI -framework CoreFoundation -o $@ | |||||
../libcarla_standalone.so: $(OBJS) $(LIBS) | ../libcarla_standalone.so: $(OBJS) $(LIBS) | ||||
$(CXX) $^ -shared $(LINK_FLAGS) -o $@ && $(STRIP) $@ | $(CXX) $^ -shared $(LINK_FLAGS) -o $@ && $(STRIP) $@ | ||||
@@ -20,6 +20,9 @@ | |||||
#include "CarlaMIDI.h" | #include "CarlaMIDI.h" | ||||
#include "RtList.hpp" | #include "RtList.hpp" | ||||
// TODO - remove | |||||
#include <vector> | |||||
#include <QtCore/QDir> | #include <QtCore/QDir> | ||||
extern "C" { | extern "C" { | ||||
@@ -61,7 +61,11 @@ endif | |||||
POSIX_BUILD_FLAGS = $(BUILD_PLUGIN_FLAGS) | POSIX_BUILD_FLAGS = $(BUILD_PLUGIN_FLAGS) | ||||
POSIX_32BIT_FLAGS = $(32BIT_FLAGS) -L/usr/lib32 -L/usr/lib/i386-linux-gnu | POSIX_32BIT_FLAGS = $(32BIT_FLAGS) -L/usr/lib32 -L/usr/lib/i386-linux-gnu | ||||
POSIX_64BIT_FLAGS = $(64BIT_FLAGS) -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu | POSIX_64BIT_FLAGS = $(64BIT_FLAGS) -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu | ||||
POSIX_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) -ldl -lrt | |||||
POSIX_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) -ldl | |||||
ifneq ($(MACOS),true) | |||||
POSIX_LINK_FLAGS += -lrt | |||||
endif | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# Plugin bridges (Windows) | # Plugin bridges (Windows) | ||||
@@ -74,7 +78,11 @@ WIN_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) -mwindows -lwinspool -lole32 -luuid - | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# Plugin bridges (Native) | # Plugin bridges (Native) | ||||
ifeq ($(MACOS),true) | |||||
DGL_LIBS = -framework Cocoa | |||||
else | |||||
DGL_LIBS = -lX11 | DGL_LIBS = -lX11 | ||||
endif | |||||
NATIVE_BUILD_FLAGS = $(POSIX_BUILD_FLAGS) | NATIVE_BUILD_FLAGS = $(POSIX_BUILD_FLAGS) | ||||
NATIVE_LINK_FLAGS = $(POSIX_LINK_FLAGS) | NATIVE_LINK_FLAGS = $(POSIX_LINK_FLAGS) | ||||
@@ -25,16 +25,30 @@ | |||||
#include <cstdlib> | #include <cstdlib> | ||||
#include <cstring> | #include <cstring> | ||||
#ifdef PROPER_CPP11_SUPPORT | |||||
# include <cstdint> | |||||
#else | |||||
# include <stdint.h> | |||||
#endif | |||||
#ifdef DISTRHO_OS_WINDOWS | #ifdef DISTRHO_OS_WINDOWS | ||||
# include <windows.h> | # include <windows.h> | ||||
#else | #else | ||||
# include <unistd.h> | # include <unistd.h> | ||||
#endif | #endif | ||||
#ifdef PROPER_CPP11_SUPPORT | |||||
# include <cstdint> | |||||
#else | |||||
# include <stdint.h> | |||||
#if defined(DISTRHO_OS_MAC) && ! defined(CARLA_OS_MAC) | |||||
namespace std { | |||||
inline float | |||||
fmin(float __x, float __y) | |||||
{ return __builtin_fminf(__x, __y); } | |||||
inline float | |||||
fmax(float __x, float __y) | |||||
{ return __builtin_fmaxf(__x, __y); } | |||||
inline float | |||||
rint(float __x) | |||||
{ return __builtin_rintf(__x); } | |||||
} | |||||
#endif | #endif | ||||
START_NAMESPACE_DISTRHO | START_NAMESPACE_DISTRHO | ||||
@@ -139,7 +139,7 @@ struct HexString | |||||
// specialization to enable fast concatenating of our string tokens to a string | // specialization to enable fast concatenating of our string tokens to a string | ||||
template <typename T> | template <typename T> | ||||
struct QConcatenable<HexString<T>> | |||||
struct QConcatenable<HexString<T> > | |||||
{ | { | ||||
typedef HexString<T> type; | typedef HexString<T> type; | ||||
enum { ExactSize = true }; | enum { ExactSize = true }; | ||||
@@ -19,6 +19,8 @@ | |||||
#ifndef __CARLA_STYLE_HPP__ | #ifndef __CARLA_STYLE_HPP__ | ||||
#define __CARLA_STYLE_HPP__ | #define __CARLA_STYLE_HPP__ | ||||
#include "CarlaDefines.hpp" | |||||
#include <QtGui/QStylePlugin> | #include <QtGui/QStylePlugin> | ||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | ||||
@@ -19,6 +19,8 @@ | |||||
#ifndef __CARLA_STYLE_ANIMATIONS_HPP__ | #ifndef __CARLA_STYLE_ANIMATIONS_HPP__ | ||||
#define __CARLA_STYLE_ANIMATIONS_HPP__ | #define __CARLA_STYLE_ANIMATIONS_HPP__ | ||||
#include "CarlaStyle.hpp" | |||||
#include <QtCore/QAbstractAnimation> | #include <QtCore/QAbstractAnimation> | ||||
#include <QtCore/QCoreApplication> | #include <QtCore/QCoreApplication> | ||||
#include <QtCore/QDateTime> | #include <QtCore/QDateTime> | ||||
@@ -8,7 +8,7 @@ include ../Makefile.mk | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
BUILD_CXX_FLAGS += -fvisibility=hidden -I. | |||||
BUILD_CXX_FLAGS += -fvisibility=hidden -I. -I../includes | |||||
ifeq ($(HAVE_QT5),true) | ifeq ($(HAVE_QT5),true) | ||||
BUILD_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets) | BUILD_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets) | ||||
@@ -379,20 +379,17 @@ void carla_zeroFloat(float* const data, const size_t size) | |||||
carla_fill<float>(data, size, 0.0f); | carla_fill<float>(data, size, 0.0f); | ||||
} | } | ||||
#ifdef CARLA_OS_MAC | |||||
#if defined(CARLA_OS_MAC) && ! defined(DISTRHO_OS_MAC) | |||||
namespace std { | namespace std { | ||||
// inline float | |||||
// fabs(float __x) | |||||
// { return __builtin_fabsf(__x); } | |||||
// inline float | |||||
// fmin(float __x, float __y) | |||||
// { return __builtin_fminf(__x, __y); } | |||||
// inline float | |||||
// fmax(float __x, float __y) | |||||
// { return __builtin_fmaxf(__x, __y); } | |||||
// inline float | |||||
// rint(float __x) | |||||
// { return __builtin_rintf(__x); } | |||||
inline float | |||||
fmin(float __x, float __y) | |||||
{ return __builtin_fminf(__x, __y); } | |||||
inline float | |||||
fmax(float __x, float __y) | |||||
{ return __builtin_fmaxf(__x, __y); } | |||||
inline float | |||||
rint(float __x) | |||||
{ return __builtin_rintf(__x); } | |||||
} | } | ||||
#endif | #endif | ||||
@@ -8,7 +8,7 @@ include ../Makefile.mk | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
BUILD_CXX_FLAGS += -fvisibility=hidden -I. | |||||
BUILD_CXX_FLAGS += -fvisibility=hidden -I. -I../includes | |||||
ifeq ($(HAVE_QT5),true) | ifeq ($(HAVE_QT5),true) | ||||
BUILD_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets) | BUILD_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets) | ||||
@@ -18,6 +18,8 @@ | |||||
#ifndef __DIGITALPEAKMETER_HPP__ | #ifndef __DIGITALPEAKMETER_HPP__ | ||||
#define __DIGITALPEAKMETER_HPP__ | #define __DIGITALPEAKMETER_HPP__ | ||||
#include "CarlaDefines.hpp" | |||||
#include <QtCore/QTimer> | #include <QtCore/QTimer> | ||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | ||||
@@ -18,6 +18,8 @@ | |||||
#ifndef __LEDBUTTON_HPP__ | #ifndef __LEDBUTTON_HPP__ | ||||
#define __LEDBUTTON_HPP__ | #define __LEDBUTTON_HPP__ | ||||
#include "CarlaDefines.hpp" | |||||
#include <QtGui/QPixmap> | #include <QtGui/QPixmap> | ||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | ||||
@@ -18,6 +18,8 @@ | |||||
#ifndef __PARAMSPINBOX_HPP__ | #ifndef __PARAMSPINBOX_HPP__ | ||||
#define __PARAMSPINBOX_HPP__ | #define __PARAMSPINBOX_HPP__ | ||||
#include "CarlaDefines.hpp" | |||||
#include <QtCore/Qt> | #include <QtCore/Qt> | ||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | ||||
@@ -18,6 +18,8 @@ | |||||
#ifndef __PIXMAPDIAL_HPP__ | #ifndef __PIXMAPDIAL_HPP__ | ||||
#define __PIXMAPDIAL_HPP__ | #define __PIXMAPDIAL_HPP__ | ||||
#include "CarlaDefines.hpp" | |||||
#include <QtGui/QPixmap> | #include <QtGui/QPixmap> | ||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | ||||
@@ -22,7 +22,10 @@ | |||||
#include <QtGui/QMouseEvent> | #include <QtGui/QMouseEvent> | ||||
#include <QtGui/QPainter> | #include <QtGui/QPainter> | ||||
static std::map<int, QRectF> kMidiKey2RectMapHorizontal = { | |||||
#ifndef HAVE_CPP11_SUPPORT | |||||
static std::map<int, QRectF> kMidiKey2RectMapHorizontal; | |||||
#else | |||||
static const std::map<int, QRectF> kMidiKey2RectMapHorizontal = { | |||||
{0, QRectF(0, 0, 18, 64)}, // C | {0, QRectF(0, 0, 18, 64)}, // C | ||||
{1, QRectF(13, 0, 11, 42)}, // C# | {1, QRectF(13, 0, 11, 42)}, // C# | ||||
{2, QRectF(18, 0, 25, 64)}, // D | {2, QRectF(18, 0, 25, 64)}, // D | ||||
@@ -36,8 +39,12 @@ static std::map<int, QRectF> kMidiKey2RectMapHorizontal = { | |||||
{10, QRectF(121, 0, 11, 42)}, // A# | {10, QRectF(121, 0, 11, 42)}, // A# | ||||
{11, QRectF(126, 0, 18, 64)} // B | {11, QRectF(126, 0, 18, 64)} // B | ||||
}; | }; | ||||
#endif | |||||
static std::map<int, QRectF> kMidiKey2RectMapVertical = { | |||||
#ifndef HAVE_CPP11_SUPPORT | |||||
static std::map<int, QRectF> kMidiKey2RectMapVertical; | |||||
#else | |||||
static const std::map<int, QRectF> kMidiKey2RectMapVertical = { | |||||
{11, QRectF(0, 0, 64, 18)}, // B | {11, QRectF(0, 0, 64, 18)}, // B | ||||
{10, QRectF(0, 14, 42, 7)}, // A# | {10, QRectF(0, 14, 42, 7)}, // A# | ||||
{9, QRectF(0, 18, 64, 24)}, // A | {9, QRectF(0, 18, 64, 24)}, // A | ||||
@@ -51,7 +58,11 @@ static std::map<int, QRectF> kMidiKey2RectMapVertical = { | |||||
{1, QRectF(0, 122, 42, 7)}, // C# | {1, QRectF(0, 122, 42, 7)}, // C# | ||||
{0, QRectF(0, 126, 64, 18)} // C | {0, QRectF(0, 126, 64, 18)} // C | ||||
}; | }; | ||||
#endif | |||||
#ifndef HAVE_CPP11_SUPPORT | |||||
static std::map<int, int> kMidiKeyboard2KeyMap; | |||||
#else | |||||
static const std::map<int, int> kMidiKeyboard2KeyMap = { | static const std::map<int, int> kMidiKeyboard2KeyMap = { | ||||
// 3th octave | // 3th octave | ||||
{Qt::Key_Z, 48}, | {Qt::Key_Z, 48}, | ||||
@@ -80,11 +91,12 @@ static const std::map<int, int> kMidiKeyboard2KeyMap = { | |||||
{Qt::Key_7, 70}, | {Qt::Key_7, 70}, | ||||
{Qt::Key_U, 71} | {Qt::Key_U, 71} | ||||
}; | }; | ||||
#endif | |||||
#ifdef HAVE_CPP11_SUPPORT | |||||
static const QVector<int> kBlackNotes = {1, 3, 6, 8, 10}; | |||||
#else | |||||
#ifndef HAVE_CPP11_SUPPORT | |||||
static QVector<int> kBlackNotes; | static QVector<int> kBlackNotes; | ||||
#else | |||||
static const QVector<int> kBlackNotes = {1, 3, 6, 8, 10}; | |||||
#endif | #endif | ||||
PixmapKeyboard::PixmapKeyboard(QWidget* parent) | PixmapKeyboard::PixmapKeyboard(QWidget* parent) | ||||
@@ -106,6 +118,7 @@ PixmapKeyboard::PixmapKeyboard(QWidget* parent) | |||||
#ifndef HAVE_CPP11_SUPPORT | #ifndef HAVE_CPP11_SUPPORT | ||||
if (kBlackNotes.count() == 0) | if (kBlackNotes.count() == 0) | ||||
{ | { | ||||
// TODO - rest of data | |||||
kBlackNotes << 1; | kBlackNotes << 1; | ||||
kBlackNotes << 3; | kBlackNotes << 3; | ||||
kBlackNotes << 6; | kBlackNotes << 6; | ||||
@@ -18,6 +18,8 @@ | |||||
#ifndef __PIXMAPKEYBOARD_HPP__ | #ifndef __PIXMAPKEYBOARD_HPP__ | ||||
#define __PIXMAPKEYBOARD_HPP__ | #define __PIXMAPKEYBOARD_HPP__ | ||||
#include "CarlaDefines.hpp" | |||||
#include <map> | #include <map> | ||||
#include <QtGui/QPixmap> | #include <QtGui/QPixmap> | ||||