@@ -260,6 +260,7 @@ struct CARLA_API EngineOptions { | |||
Wine() noexcept; | |||
~Wine() noexcept; | |||
CARLA_DECLARE_NON_COPY_STRUCT(Wine) | |||
} wine; | |||
#ifndef DOXYGEN | |||
@@ -215,7 +215,8 @@ EngineOptions::EngineOptions() noexcept | |||
binaryDir(nullptr), | |||
resourceDir(nullptr), | |||
preventBadBehaviour(false), | |||
frontendWinId(0) {} | |||
frontendWinId(0), | |||
wine() {} | |||
EngineOptions::~EngineOptions() noexcept | |||
{ | |||
@@ -975,10 +975,8 @@ void RackGraph::processHelper(CarlaEngine::ProtectedData* const data, const floa | |||
EngineInternalGraph::EngineInternalGraph(CarlaEngine* const engine) noexcept | |||
: fIsReady(false), | |||
kEngine(engine) | |||
{ | |||
fRack = nullptr; | |||
} | |||
fRack(nullptr), | |||
kEngine(engine) {} | |||
EngineInternalGraph::~EngineInternalGraph() noexcept | |||
{ | |||
@@ -59,7 +59,7 @@ void EngineInternalEvents::clear() noexcept | |||
// ----------------------------------------------------------------------- | |||
// InternalTime | |||
static const float kTicksPerBeat = 1920.0f; | |||
static const double kTicksPerBeat = 1920.0; | |||
#if defined(HAVE_HYLIA) && !defined(BUILD_BRIDGE) | |||
static uint32_t calculate_link_latency(const double bufferSize, const double sampleRate) noexcept | |||
@@ -81,6 +81,9 @@ EngineInternalTime::EngineInternalTime(EngineTimeInfo& ti, const EngineTransport | |||
tick(0.0), | |||
needsReset(false), | |||
nextFrame(0), | |||
#ifndef BUILD_BRIDGE | |||
hylia(), | |||
#endif | |||
timeInfo(ti), | |||
transportMode(tm) {} | |||
@@ -197,7 +200,7 @@ void EngineInternalTime::fillEngineTimeInfo(const uint32_t newFrames) noexcept | |||
else | |||
#endif | |||
{ | |||
const double min = timeInfo.frame / (sampleRate * 60.0); | |||
const double min = static_cast<double>(timeInfo.frame) / (sampleRate * 60.0); | |||
abs_tick = min * beatsPerMinute * kTicksPerBeat; | |||
abs_beat = abs_tick / kTicksPerBeat; | |||
needsReset = false; | |||
@@ -228,7 +231,7 @@ void EngineInternalTime::fillEngineTimeInfo(const uint32_t newFrames) noexcept | |||
} | |||
} | |||
timeInfo.bbt.beatsPerBar = beatsPerBar; | |||
timeInfo.bbt.beatsPerBar = static_cast<float>(beatsPerBar); | |||
timeInfo.bbt.beatsPerMinute = beatsPerMinute; | |||
timeInfo.bbt.tick = (int32_t)(ticktmp + 0.5); | |||
tick = ticktmp; | |||
@@ -302,7 +305,7 @@ void EngineInternalTime::fillJackTimeInfo(jack_position_t* const pos, const uint | |||
} | |||
} | |||
pos->beats_per_bar = beatsPerBar; | |||
pos->beats_per_bar = static_cast<float>(beatsPerBar); | |||
pos->beats_per_minute = beatsPerMinute; | |||
pos->tick = (int32_t)(ticktmp + 0.5); | |||
tick = ticktmp; | |||
@@ -318,12 +321,12 @@ void EngineInternalTime::preProcess(const uint32_t numFrames) | |||
const double new_bpb = hylia.timeInfo.beatsPerBar; | |||
const double new_bpm = hylia.timeInfo.beatsPerMinute; | |||
if (new_bpb >= 1.0 && beatsPerBar != new_bpb) | |||
if (new_bpb >= 1.0 && carla_isNotEqual(beatsPerBar, new_bpb)) | |||
{ | |||
beatsPerBar = new_bpb; | |||
needsReset = true; | |||
} | |||
if (new_bpm > 0.0 && beatsPerMinute != new_bpm) | |||
if (new_bpm > 0.0 && carla_isNotEqual(beatsPerMinute, new_bpm)) | |||
{ | |||
beatsPerMinute = new_bpm; | |||
needsReset = true; | |||
@@ -341,13 +344,14 @@ void EngineInternalTime::preProcess(const uint32_t numFrames) | |||
#ifndef BUILD_BRIDGE | |||
EngineInternalTime::Hylia::Hylia() | |||
: enabled(false), | |||
# ifdef HAVE_HYLIA | |||
instance(hylia_create()) | |||
# else | |||
instance(nullptr) | |||
# endif | |||
instance(nullptr), | |||
timeInfo() | |||
{ | |||
carla_zeroStruct(timeInfo); | |||
# ifdef HAVE_HYLIA | |||
instance = hylia_create(); | |||
# endif | |||
} | |||
EngineInternalTime::Hylia::~Hylia() | |||
@@ -122,8 +122,10 @@ private: | |||
bool enabled; | |||
hylia_t* instance; | |||
hylia_time_info_t timeInfo; | |||
Hylia(); | |||
~Hylia(); | |||
CARLA_DECLARE_NON_COPY_STRUCT(Hylia) | |||
} hylia; | |||
#endif | |||
@@ -132,7 +132,7 @@ public: | |||
} | |||
if (! kIsInput) | |||
carla_zeroFloats(fBuffer, static_cast<int>(bufferSize)); | |||
carla_zeroFloats(fBuffer, bufferSize); | |||
} | |||
void invalidate() noexcept | |||
@@ -224,7 +224,7 @@ public: | |||
} | |||
if (! kIsInput) | |||
carla_zeroFloats(fBuffer, static_cast<int>(bufferSize)); | |||
carla_zeroFloats(fBuffer, bufferSize); | |||
} | |||
void invalidate() noexcept | |||
@@ -90,6 +90,7 @@ public: | |||
fBinary(), | |||
fLabel(), | |||
fShmIds(), | |||
fWinePrefix(), | |||
fProcess() {} | |||
void setData(const char* const winePrefix, | |||
@@ -328,10 +329,10 @@ private: | |||
CarlaEngine* const kEngine; | |||
CarlaPlugin* const kPlugin; | |||
String fWinePrefix; | |||
String fBinary; | |||
String fLabel; | |||
String fShmIds; | |||
String fWinePrefix; | |||
ScopedPointer<ChildProcess> fProcess; | |||
@@ -360,6 +361,7 @@ public: | |||
fShmRtClientControl(), | |||
fShmNonRtClientControl(), | |||
fShmNonRtServerControl(), | |||
fWinePrefix(), | |||
fInfo(), | |||
fUniqueId(0), | |||
fLatency(0), | |||
@@ -1318,6 +1320,9 @@ public: | |||
read += kBridgeBaseMidiOutHeaderSize + size; | |||
} | |||
// TODO | |||
(void)port; | |||
} // End of Control and MIDI Output | |||
} | |||
@@ -1408,10 +1408,16 @@ public: | |||
carla_zeroFloats(fAudio16Buffers[i], frames); | |||
// FIXME use '32' or '16' instead of outs | |||
fluid_synth_process(fSynth, frames, 0, nullptr, static_cast<int>(pData->audioOut.count), fAudio16Buffers); | |||
fluid_synth_process(fSynth, static_cast<int>(frames), | |||
0, nullptr, | |||
static_cast<int>(pData->audioOut.count), fAudio16Buffers); | |||
} | |||
else | |||
fluid_synth_write_float(fSynth, frames, outBuffer[0] + timeOffset, 0, 1, outBuffer[1] + timeOffset, 0, 1); | |||
{ | |||
fluid_synth_write_float(fSynth, static_cast<int>(frames), | |||
outBuffer[0] + timeOffset, 0, 1, | |||
outBuffer[1] + timeOffset, 0, 1); | |||
} | |||
#ifndef BUILD_BRIDGE | |||
// -------------------------------------------------------------------------------------------------------- | |||
@@ -467,7 +467,7 @@ void CarlaPlugin::ProtectedData::Latency::recreateBuffers(const uint32_t newChan | |||
{ | |||
const uint32_t diff = frames - oldFrames; | |||
carla_zeroFloats(buffers[i], diff); | |||
carla_copyFloats(buffers[i] + diff, oldBuffers[i], static_cast<int>(oldFrames)); | |||
carla_copyFloats(buffers[i] + diff, oldBuffers[i], oldFrames); | |||
} | |||
} | |||
else | |||
@@ -452,7 +452,7 @@ public: | |||
CarlaString portName; | |||
// Audio Ins | |||
for (uint32_t j=0; j < fInfo.aIns; ++j) | |||
for (uint8_t j=0; j < fInfo.aIns; ++j) | |||
{ | |||
portName.clear(); | |||
@@ -479,7 +479,7 @@ public: | |||
} | |||
// Audio Outs | |||
for (uint32_t j=0; j < fInfo.aOuts; ++j) | |||
for (uint8_t j=0; j < fInfo.aOuts; ++j) | |||
{ | |||
portName.clear(); | |||
@@ -871,6 +871,9 @@ public: | |||
read += kBridgeBaseMidiOutHeaderSize + size; | |||
} | |||
// TODO | |||
(void)port; | |||
} // End of Control and MIDI Output | |||
} | |||
@@ -1219,10 +1222,10 @@ public: | |||
CARLA_SAFE_ASSERT_RETURN(label[i] >= '0' && label[i] < '0'+0x4f, false); | |||
} | |||
fInfo.aIns = label[0] - '0'; | |||
fInfo.aOuts = label[1] - '0'; | |||
fInfo.mIns = carla_minPositive(label[2] - '0', 1); | |||
fInfo.mOuts = carla_minPositive(label[3] - '0', 1); | |||
fInfo.aIns = static_cast<uint8_t>(label[0] - '0'); | |||
fInfo.aOuts = static_cast<uint8_t>(label[1] - '0'); | |||
fInfo.mIns = static_cast<uint8_t>(carla_minPositive(label[2] - '0', 1)); | |||
fInfo.mOuts = static_cast<uint8_t>(carla_minPositive(label[3] - '0', 1)); | |||
fInfo.setupLabel = label; | |||
@@ -1339,8 +1342,8 @@ private: | |||
BridgeNonRtServerControl fShmNonRtServerControl; | |||
struct Info { | |||
uint32_t aIns, aOuts; | |||
uint32_t mIns, mOuts; | |||
uint8_t aIns, aOuts; | |||
uint8_t mIns, mOuts; | |||
uint optionsAvailable; | |||
CarlaString setupLabel; | |||
std::vector<uint8_t> chunk; | |||
@@ -1377,7 +1380,7 @@ private: | |||
void resizeAudioPool(const uint32_t bufferSize) | |||
{ | |||
fShmAudioPool.resize(bufferSize, fInfo.aIns+fInfo.aOuts, 0); | |||
fShmAudioPool.resize(bufferSize, static_cast<uint32_t>(fInfo.aIns+fInfo.aOuts), 0); | |||
fShmRtClientControl.writeOpcode(kPluginBridgeRtClientSetAudioPool); | |||
fShmRtClientControl.writeULong(static_cast<uint64_t>(fShmAudioPool.dataSize)); | |||
@@ -1263,7 +1263,7 @@ public: | |||
if (latframes <= frames) | |||
{ | |||
for (uint32_t i=0; i < pData->audioIn.count; ++i) | |||
carla_copyFloats(pData->latency.buffers[i], audioIn[i]+(frames-latframes), static_cast<int>(latframes)); | |||
carla_copyFloats(pData->latency.buffers[i], audioIn[i]+(frames-latframes), latframes); | |||
} | |||
else | |||
{ | |||
@@ -4537,8 +4537,10 @@ public: | |||
LV2_Inline_Display_Image_Surface* renderInlineDisplay(int width, int height) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fExt.inlineDisplay != nullptr && fExt.inlineDisplay->render != nullptr, nullptr); | |||
CARLA_SAFE_ASSERT_RETURN(width > 0, nullptr); | |||
CARLA_SAFE_ASSERT_RETURN(height > 0, nullptr); | |||
return fExt.inlineDisplay->render(fHandle, width, height); | |||
return fExt.inlineDisplay->render(fHandle, static_cast<uint32_t>(width), static_cast<uint32_t>(height)); | |||
} | |||
// ------------------------------------------------------------------- | |||
@@ -6314,6 +6316,9 @@ CarlaPlugin* CarlaPlugin::newLV2(const Initializer& init) | |||
return plugin; | |||
} | |||
// used in CarlaStandalone.cpp | |||
void* carla_render_inline_display_lv2(CarlaPlugin* plugin, int width, int height); | |||
void* carla_render_inline_display_lv2(CarlaPlugin* plugin, int width, int height) | |||
{ | |||
CarlaPluginLV2* const lv2Plugin = (CarlaPluginLV2*)plugin; | |||
@@ -30,18 +30,49 @@ | |||
#include "AppConfig.h" | |||
#include "juce_core/juce_core.h" | |||
// --------------------------------------------------------------------------------------------------------------------- | |||
// -Weffc++ compat ext widget | |||
extern "C" { | |||
typedef struct _LV2_External_UI_Widget_Compat { | |||
void (*run )(struct _LV2_External_UI_Widget_Compat*); | |||
void (*show)(struct _LV2_External_UI_Widget_Compat*); | |||
void (*hide)(struct _LV2_External_UI_Widget_Compat*); | |||
_LV2_External_UI_Widget_Compat() noexcept | |||
: run(nullptr), show(nullptr), hide(nullptr) {} | |||
} LV2_External_UI_Widget_Compat; | |||
} | |||
// --------------------------------------------------------------------------------------------------------------------- | |||
CARLA_BACKEND_START_NAMESPACE | |||
#if defined(__clang__) | |||
# pragma clang diagnostic push | |||
# pragma clang diagnostic ignored "-Weffc++" | |||
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||
# pragma GCC diagnostic push | |||
# pragma GCC diagnostic ignored "-Weffc++" | |||
#endif | |||
class CarlaEngineLV2Single : public CarlaEngine, | |||
public LV2_External_UI_Widget | |||
public LV2_External_UI_Widget_Compat | |||
{ | |||
#if defined(__clang__) | |||
# pragma clang diagnostic pop | |||
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||
# pragma GCC diagnostic pop | |||
#endif | |||
public: | |||
CarlaEngineLV2Single(const uint32_t bufferSize, const double sampleRate, const char* const bundlePath, const LV2_URID_Map* uridMap) | |||
: fPlugin(nullptr), | |||
fIsActive(false), | |||
fIsOffline(false) | |||
fIsOffline(false), | |||
fPorts(), | |||
fUI() | |||
{ | |||
run = extui_run; | |||
show = extui_show; | |||
@@ -326,8 +357,11 @@ protected: | |||
switch (action) | |||
{ | |||
case ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED: | |||
CARLA_SAFE_ASSERT_RETURN(value1 >= 0,); | |||
if (fUI.writeFunction != nullptr && fUI.controller != nullptr && fUI.visible) | |||
fUI.writeFunction(fUI.controller, value1+fPorts.indexOffset, sizeof(float), 0, &value3); | |||
fUI.writeFunction(fUI.controller, | |||
static_cast<uint32_t>(value1)+fPorts.indexOffset, | |||
sizeof(float), 0, &value3); | |||
break; | |||
case ENGINE_CALLBACK_UI_STATE_CHANGED: | |||
@@ -524,7 +558,6 @@ private: | |||
} | |||
CARLA_DECLARE_NON_COPY_STRUCT(Ports); | |||
} fPorts; | |||
struct UI { | |||
@@ -538,25 +571,26 @@ private: | |||
: writeFunction(nullptr), | |||
controller(nullptr), | |||
host(nullptr), | |||
name(), | |||
visible(false) {} | |||
CARLA_DECLARE_NON_COPY_STRUCT(UI) | |||
} fUI; | |||
// ------------------------------------------------------------------- | |||
#define handlePtr ((CarlaEngineLV2Single*)handle) | |||
static void extui_run(LV2_External_UI_Widget* handle) | |||
static void extui_run(LV2_External_UI_Widget_Compat* handle) | |||
{ | |||
handlePtr->handleUiRun(); | |||
} | |||
static void extui_show(LV2_External_UI_Widget* handle) | |||
static void extui_show(LV2_External_UI_Widget_Compat* handle) | |||
{ | |||
handlePtr->handleUiShow(); | |||
} | |||
static void extui_hide(LV2_External_UI_Widget* handle) | |||
static void extui_hide(LV2_External_UI_Widget_Compat* handle) | |||
{ | |||
handlePtr->handleUiHide(); | |||
} | |||
@@ -57,6 +57,8 @@ protected: | |||
private: | |||
Callback* const fCallback; | |||
CARLA_DECLARE_NON_COPY_CLASS(CarlaJackRealtimeThread) | |||
}; | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
@@ -82,6 +84,8 @@ protected: | |||
private: | |||
Callback* const fCallback; | |||
CARLA_DECLARE_NON_COPY_CLASS(CarlaJackNonRealtimeThread) | |||
}; | |||
static int carla_interposed_callback(int, void*); | |||
@@ -97,6 +101,11 @@ public: | |||
CarlaJackAppClient() | |||
: fServer(this), | |||
fClients(), | |||
fShmAudioPool(), | |||
fShmRtClientControl(), | |||
fShmNonRtClientControl(), | |||
fShmNonRtServerControl(), | |||
fAudioPoolCopy(nullptr), | |||
fAudioTmpBuf(nullptr), | |||
fDummyMidiInBuffer(true, "ignored"), | |||
@@ -141,10 +150,10 @@ public: | |||
fBaseNameNonRtClientControl[6] = '\0'; | |||
fBaseNameNonRtServerControl[6] = '\0'; | |||
fServer.numAudioIns = libjackSetup[0] - '0'; | |||
fServer.numAudioOuts = libjackSetup[1] - '0'; | |||
fServer.numMidiIns = libjackSetup[2] - '0'; | |||
fServer.numMidiOuts = libjackSetup[3] - '0'; | |||
fServer.numAudioIns = static_cast<uint8_t>(libjackSetup[0] - '0'); | |||
fServer.numAudioOuts = static_cast<uint8_t>(libjackSetup[1] - '0'); | |||
fServer.numMidiIns = static_cast<uint8_t>(libjackSetup[2] - '0'); | |||
fServer.numMidiOuts = static_cast<uint8_t>(libjackSetup[3] - '0'); | |||
fSessionManager = libjackSetup[4] - '0'; | |||
fSetupHints = libjackSetup[5] - '0'; | |||
@@ -483,25 +492,24 @@ bool CarlaJackAppClient::handleRtData() | |||
} | |||
break; | |||
case kPluginBridgeRtClientSetSampleRate: | |||
if (const double newSampleRate = fShmRtClientControl.readDouble()) | |||
case kPluginBridgeRtClientSetSampleRate: { | |||
const double newSampleRate = fShmRtClientControl.readDouble(); | |||
if (carla_isNotZero(newSampleRate) && carla_isNotEqual(fServer.sampleRate, newSampleRate)) | |||
{ | |||
if (fServer.sampleRate != newSampleRate) | |||
{ | |||
const CarlaMutexLocker cml(fRealtimeThreadMutex); | |||
const CarlaMutexLocker cml(fRealtimeThreadMutex); | |||
fServer.sampleRate = newSampleRate; | |||
fServer.sampleRate = newSampleRate; | |||
for (LinkedList<JackClientState*>::Itenerator it = fClients.begin2(); it.valid(); it.next()) | |||
{ | |||
JackClientState* const jclient(it.getValue(nullptr)); | |||
CARLA_SAFE_ASSERT_CONTINUE(jclient != nullptr); | |||
for (LinkedList<JackClientState*>::Itenerator it = fClients.begin2(); it.valid(); it.next()) | |||
{ | |||
JackClientState* const jclient(it.getValue(nullptr)); | |||
CARLA_SAFE_ASSERT_CONTINUE(jclient != nullptr); | |||
jclient->sampleRateCb(fServer.sampleRate, jclient->sampleRateCbPtr); | |||
} | |||
jclient->sampleRateCb(static_cast<uint32_t>(fServer.sampleRate), jclient->sampleRateCbPtr); | |||
} | |||
} | |||
break; | |||
} break; | |||
case kPluginBridgeRtClientSetOnline: | |||
// TODO inform changes | |||
@@ -627,9 +635,9 @@ bool CarlaJackAppClient::handleRtData() | |||
// set audio inputs | |||
i = 0; | |||
for (LinkedList<JackPortState*>::Itenerator it = jclient->audioIns.begin2(); it.valid(); it.next()) | |||
for (LinkedList<JackPortState*>::Itenerator it2 = jclient->audioIns.begin2(); it2.valid(); it2.next()) | |||
{ | |||
JackPortState* const jport = it.getValue(nullptr); | |||
JackPortState* const jport = it2.getValue(nullptr); | |||
CARLA_SAFE_ASSERT_CONTINUE(jport != nullptr); | |||
if (i++ < fServer.numAudioIns) | |||
@@ -660,9 +668,9 @@ bool CarlaJackAppClient::handleRtData() | |||
// set audio ouputs | |||
i = 0; | |||
for (LinkedList<JackPortState*>::Itenerator it = jclient->audioOuts.begin2(); it.valid(); it.next()) | |||
for (LinkedList<JackPortState*>::Itenerator it2 = jclient->audioOuts.begin2(); it2.valid(); it2.next()) | |||
{ | |||
JackPortState* const jport = it.getValue(nullptr); | |||
JackPortState* const jport = it2.getValue(nullptr); | |||
CARLA_SAFE_ASSERT_CONTINUE(jport != nullptr); | |||
if (i++ < fServer.numAudioOuts) | |||
@@ -685,9 +693,9 @@ bool CarlaJackAppClient::handleRtData() | |||
// set midi inputs | |||
i = 0; | |||
for (LinkedList<JackPortState*>::Itenerator it = jclient->midiIns.begin2(); it.valid(); it.next()) | |||
for (LinkedList<JackPortState*>::Itenerator it2 = jclient->midiIns.begin2(); it2.valid(); it2.next()) | |||
{ | |||
JackPortState* const jport = it.getValue(nullptr); | |||
JackPortState* const jport = it2.getValue(nullptr); | |||
CARLA_SAFE_ASSERT_CONTINUE(jport != nullptr); | |||
if (i++ < fServer.numMidiIns) | |||
@@ -698,9 +706,9 @@ bool CarlaJackAppClient::handleRtData() | |||
// set midi outputs | |||
i = 0; | |||
for (LinkedList<JackPortState*>::Itenerator it = jclient->midiOuts.begin2(); it.valid(); it.next()) | |||
for (LinkedList<JackPortState*>::Itenerator it2 = jclient->midiOuts.begin2(); it2.valid(); it2.next()) | |||
{ | |||
JackPortState* const jport = it.getValue(nullptr); | |||
JackPortState* const jport = it2.getValue(nullptr); | |||
CARLA_SAFE_ASSERT_CONTINUE(jport != nullptr); | |||
if (i++ < fServer.numMidiOuts) | |||
@@ -739,9 +747,9 @@ bool CarlaJackAppClient::handleRtData() | |||
if (jclient->audioOuts.count() == 1 && fServer.numAudioOuts > 1) | |||
{ | |||
for (uint8_t i=1; i<fServer.numAudioOuts; ++i) | |||
for (uint8_t j=1; j<fServer.numAudioOuts; ++j) | |||
{ | |||
carla_copyFloats(fdataRealOuts+(fServer.bufferSize*i), | |||
carla_copyFloats(fdataRealOuts+(fServer.bufferSize*j), | |||
fdataCopyOuts, | |||
fServer.bufferSize); | |||
} | |||
@@ -1051,7 +1059,7 @@ void CarlaJackAppClient::runNonRealtimeThread() | |||
} | |||
else if (JackClientState* const jclient = fClients.getLast(nullptr)) | |||
{ | |||
const CarlaMutexLocker cms(jclient->mutex); | |||
const CarlaMutexLocker cms2(jclient->mutex); | |||
activated = jclient->activated; | |||
} | |||
else | |||
@@ -91,6 +91,8 @@ struct JackMidiPortBuffer { | |||
delete[] events; | |||
delete[] bufferPool; | |||
} | |||
CARLA_DECLARE_NON_COPY_STRUCT(JackMidiPortBuffer) | |||
}; | |||
struct JackPortState { | |||
@@ -112,7 +114,8 @@ struct JackPortState { | |||
flags(0), | |||
isMidi(false), | |||
isSystem(false), | |||
isConnected(false) {} | |||
isConnected(false), | |||
unused(false) {} | |||
JackPortState(const char* const cn, const char* const pn, const uint i, const uint f, | |||
const bool midi, const bool sys, const bool con) | |||
@@ -123,7 +126,8 @@ struct JackPortState { | |||
flags(f), | |||
isMidi(midi), | |||
isSystem(sys), | |||
isConnected(con) | |||
isConnected(con), | |||
unused(false) | |||
{ | |||
char strBuf[STR_MAX+1]; | |||
snprintf(strBuf, STR_MAX, "%s:%s", cn, pn); | |||
@@ -137,6 +141,8 @@ struct JackPortState { | |||
free(name); | |||
free(fullname); | |||
} | |||
CARLA_DECLARE_NON_COPY_STRUCT(JackPortState) | |||
}; | |||
struct JackClientState { | |||
@@ -176,6 +182,7 @@ struct JackClientState { | |||
JackClientState(const JackServerState& s, const char* const n) | |||
: server(s), | |||
mutex(), | |||
activated(false), | |||
deactivated(false), | |||
name(strdup(n)), | |||
@@ -232,6 +239,8 @@ struct JackClientState { | |||
audioIns.clear(); | |||
audioOuts.clear(); | |||
} | |||
CARLA_DECLARE_NON_COPY_STRUCT(JackClientState) | |||
}; | |||
struct JackServerState { | |||
@@ -256,10 +265,13 @@ struct JackServerState { | |||
numAudioOuts(0), | |||
numMidiIns(0), | |||
numMidiOuts(0), | |||
playing(false) | |||
playing(false), | |||
position() | |||
{ | |||
carla_zeroStruct(position); | |||
} | |||
CARLA_DECLARE_NON_COPY_STRUCT(JackServerState) | |||
}; | |||
CARLA_BACKEND_END_NAMESPACE | |||
@@ -85,12 +85,12 @@ jack_port_t* jack_port_by_name(jack_client_t* client, const char* name) | |||
const int commonFlags = JackPortIsPhysical|JackPortIsTerminal; | |||
static const JackPortState capturePorts[] = { | |||
JackPortState("system", "capture_1", 0, JackPortIsOutput|commonFlags, false, true, jserver.numAudioIns > 0), | |||
JackPortState("system", "capture_2", 1, JackPortIsOutput|commonFlags, false, true, jserver.numAudioIns > 1), | |||
{ "system", "capture_1", 0, JackPortIsOutput|commonFlags, false, true, jserver.numAudioIns > 0 }, | |||
{ "system", "capture_2", 1, JackPortIsOutput|commonFlags, false, true, jserver.numAudioIns > 1 }, | |||
}; | |||
static const JackPortState playbackPorts[] = { | |||
JackPortState("system", "playback_1", 3, JackPortIsInput|commonFlags, false, true, jserver.numAudioOuts > 0), | |||
JackPortState("system", "playback_2", 4, JackPortIsInput|commonFlags, false, true, jserver.numAudioOuts > 1), | |||
{ "system", "playback_1", 3, JackPortIsInput|commonFlags, false, true, jserver.numAudioOuts > 0 }, | |||
{ "system", "playback_2", 4, JackPortIsInput|commonFlags, false, true, jserver.numAudioOuts > 1 }, | |||
}; | |||
if (std::strncmp(name, "system:", 7) == 0) | |||
@@ -18,6 +18,19 @@ | |||
#include "CarlaNative.hpp" | |||
#include "CarlaMathUtils.hpp" | |||
#if defined(__clang__) | |||
# pragma clang diagnostic push | |||
# pragma clang diagnostic ignored "-Weffc++" | |||
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||
# pragma GCC diagnostic push | |||
# pragma GCC diagnostic ignored "-Weffc++" | |||
# pragma GCC diagnostic ignored "-Wconversion" | |||
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor" | |||
# pragma GCC diagnostic ignored "-Wsign-conversion" | |||
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" | |||
#endif | |||
#include "Misc/Allocator.h" | |||
#include "Effects/Alienwah.h" | |||
#include "Effects/Chorus.h" | |||
#include "Effects/Distorsion.h" | |||
@@ -25,13 +38,17 @@ | |||
#include "Effects/Echo.h" | |||
#include "Effects/Phaser.h" | |||
#include "Effects/Reverb.h" | |||
#include "Misc/Allocator.h" | |||
#if defined(__clang__) | |||
# pragma clang diagnostic pop | |||
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||
# pragma GCC diagnostic pop | |||
#endif | |||
#include "AppConfig.h" | |||
#include "juce_core/juce_core.h" | |||
using juce::roundToIntAccurate; | |||
using juce::SharedResourcePointer; | |||
using namespace zyncarla; | |||
@@ -53,7 +70,8 @@ protected: | |||
fFilterParams(nullptr), | |||
fEffect(nullptr), | |||
efxoutl(nullptr), | |||
efxoutr(nullptr) | |||
efxoutr(nullptr), | |||
fAllocator() | |||
{ | |||
efxoutl = new float[fBufferSize]; | |||
efxoutr = new float[fBufferSize]; | |||
@@ -120,7 +138,7 @@ protected: | |||
void setMidiProgram(const uint8_t, const uint32_t, const uint32_t program) final | |||
{ | |||
fNextProgram = program; | |||
fNextProgram = static_cast<int32_t>(program); | |||
} | |||
// ------------------------------------------------------------------- | |||
@@ -197,7 +215,7 @@ protected: | |||
void sampleRateChanged(const double sampleRate) final | |||
{ | |||
if (fSampleRate == sampleRate) | |||
if (carla_isEqual(fSampleRate, sampleRate)) | |||
return; | |||
fSampleRate = sampleRate; | |||
@@ -217,7 +235,7 @@ protected: | |||
delete fEffect; | |||
} | |||
EffectParams pars(fAllocator.getObject(), false, efxoutl, efxoutr, 0, | |||
EffectParams pars(fAllocator, false, efxoutl, efxoutr, 0, | |||
static_cast<uint>(fSampleRate), static_cast<int>(fBufferSize), &fFilterParams); | |||
fEffect = new ZynFX(pars); | |||
@@ -257,8 +275,7 @@ protected: | |||
float* efxoutl; | |||
float* efxoutr; | |||
// FIXME - is this thread-safe? | |||
SharedResourcePointer<AllocatorClass> fAllocator; | |||
AllocatorClass fAllocator; | |||
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FxAbstractPlugin) | |||
}; | |||
@@ -23,14 +23,32 @@ | |||
#include "CarlaMathUtils.hpp" | |||
#include "distrho/extra/ScopedPointer.hpp" | |||
#include <ctime> | |||
#include <set> | |||
#include <string> | |||
#if defined(__clang__) | |||
# pragma clang diagnostic push | |||
# pragma clang diagnostic ignored "-Weffc++" | |||
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||
# pragma GCC diagnostic push | |||
# pragma GCC diagnostic ignored "-Weffc++" | |||
# pragma GCC diagnostic ignored "-Wconversion" | |||
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor" | |||
// # pragma GCC diagnostic ignored "-Wsign-conversion" | |||
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" | |||
#endif | |||
#include "Misc/Master.h" | |||
#include "Misc/MiddleWare.h" | |||
#include "Misc/Part.h" | |||
#include "Misc/Util.h" | |||
#include <ctime> | |||
#include <set> | |||
#include <string> | |||
#if defined(__clang__) | |||
# pragma clang diagnostic pop | |||
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||
# pragma GCC diagnostic pop | |||
#endif | |||
#include "AppConfig.h" | |||
#include "juce_core/juce_core.h" | |||
@@ -83,7 +101,7 @@ public: | |||
// refresh banks | |||
master.bank.rescanforbanks(); | |||
for (std::size_t i=0, size=master.bank.banks.size(); i<size; ++i) | |||
for (std::uint32_t i=0, size=static_cast<uint32_t>(master.bank.banks.size()); i<size; ++i) | |||
{ | |||
const std::string dir(master.bank.banks[i].dir); | |||
@@ -99,7 +117,7 @@ public: | |||
if (instrument.name.empty() || instrument.name[0] == ' ') | |||
continue; | |||
programs.push_back(new ProgramInfo(i+1, ninstrument, instrument.name.c_str(), instrument.filename.c_str())); | |||
programs.push_back(new ProgramInfo(i+1U, ninstrument, instrument.name.c_str(), instrument.filename.c_str())); | |||
} | |||
} | |||
@@ -293,6 +311,7 @@ public: | |||
fMiddleWare(nullptr), | |||
fMaster(nullptr), | |||
fSynth(), | |||
fConfig(), | |||
fDefaultState(nullptr), | |||
fMutex(), | |||
fMiddleWareThread(new MiddleWareThread()) | |||
@@ -986,29 +1005,34 @@ private: | |||
++msgtmp; | |||
} | |||
const int partn = std::atoi(partnstr); | |||
const int ipartn = std::atoi(partnstr); | |||
CARLA_SAFE_ASSERT_RETURN(ipartn >= 0,); | |||
const uint partn = static_cast<uint>(ipartn); | |||
++msgtmp; | |||
/**/ if (std::strcmp(msgtmp, "Penabled") == 0) | |||
{ | |||
const int index = kParamPart01Enabled+partn; | |||
const bool enbl = rtosc_argument(msg,0).T; | |||
const uint index = kParamPart01Enabled+partn; | |||
const bool enable = rtosc_argument(msg,0).T; | |||
fParameters[index] = enbl ? 1.0f : 0.0f; | |||
uiParameterChanged(kParamPart01Enabled+partn, enbl ? 1.0f : 0.0f); | |||
fParameters[index] = enable ? 1.0f : 0.0f; | |||
uiParameterChanged(kParamPart01Enabled+partn, enable ? 1.0f : 0.0f); | |||
} | |||
else if (std::strcmp(msgtmp, "Pvolume") == 0) | |||
{ | |||
const int index = kParamPart01Volume+partn; | |||
const int value = rtosc_argument(msg,0).i; | |||
const uint index = kParamPart01Volume+partn; | |||
const int ivalue = rtosc_argument(msg,0).i; | |||
const float value = static_cast<float>(ivalue); | |||
fParameters[index] = value; | |||
uiParameterChanged(kParamPart01Volume+partn, value); | |||
} | |||
else if (std::strcmp(msgtmp, "Ppanning") == 0) | |||
{ | |||
const int index = kParamPart01Panning+partn; | |||
const int value = rtosc_argument(msg,0).i; | |||
const uint index = kParamPart01Panning+partn; | |||
const int ivalue = rtosc_argument(msg,0).i; | |||
const float value = static_cast<float>(ivalue); | |||
fParameters[index] = value; | |||
uiParameterChanged(kParamPart01Panning+partn, value); | |||
@@ -25,6 +25,7 @@ | |||
CARLA_BACKEND_START_NAMESPACE | |||
static inline | |||
bool runMainLoopOnce() | |||
{ | |||
#if defined(CARLA_OS_WIN) | |||
@@ -230,6 +230,26 @@ float carla_findMaxNormalizedFloat(float floats[], const std::size_t count) | |||
return maxf2; | |||
} | |||
/* | |||
* Multiply an array with a fixed value, float-specific version. | |||
*/ | |||
static inline | |||
void carla_multiply(float data[], const float& multiplier, const std::size_t count) noexcept | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(data != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(count > 0,); | |||
if (carla_isZero(multiplier)) | |||
{ | |||
std::memset(data, 0, count*sizeof(float)); | |||
} | |||
else | |||
{ | |||
for (std::size_t i=0; i<count; ++i) | |||
*data++ *= multiplier; | |||
} | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
// Missing functions in old OSX versions. | |||