| @@ -25,7 +25,8 @@ CARLA_BRIDGE_START_NAMESPACE | |||||
| CarlaBridgeClient::CarlaBridgeClient(const char* const uiTitle) | CarlaBridgeClient::CarlaBridgeClient(const char* const uiTitle) | ||||
| : fOsc(this), | : fOsc(this), | ||||
| fOscData(fOsc.getControlData()), | fOscData(fOsc.getControlData()), | ||||
| fUI(CarlaBridgeToolkit::createNew(this, uiTitle)) | |||||
| fUI(CarlaBridgeToolkit::createNew(this, uiTitle)), | |||||
| leakDetector_CarlaBridgeClient() | |||||
| { | { | ||||
| CARLA_ASSERT(uiTitle != nullptr && uiTitle[0] != '\0'); | CARLA_ASSERT(uiTitle != nullptr && uiTitle[0] != '\0'); | ||||
| carla_debug("CarlaBridgeClient::CarlaBridgeClient(\"%s\")", uiTitle); | carla_debug("CarlaBridgeClient::CarlaBridgeClient(\"%s\")", uiTitle); | ||||
| @@ -110,6 +110,7 @@ private: | |||||
| UI(CarlaBridgeToolkit* const toolkit_) | UI(CarlaBridgeToolkit* const toolkit_) | ||||
| : toolkit(toolkit_), | : toolkit(toolkit_), | ||||
| filename(), | |||||
| lib(nullptr), | lib(nullptr), | ||||
| quit(false) | quit(false) | ||||
| { | { | ||||
| @@ -135,8 +136,7 @@ private: | |||||
| #ifdef CARLA_PROPER_CPP11_SUPPORT | #ifdef CARLA_PROPER_CPP11_SUPPORT | ||||
| UI() = delete; | UI() = delete; | ||||
| UI(UI&) = delete; | |||||
| UI(const UI&) = delete; | |||||
| CARLA_DECLARE_NON_COPY_STRUCT(UI) | |||||
| #endif | #endif | ||||
| } fUI; | } fUI; | ||||
| @@ -24,7 +24,11 @@ CARLA_BRIDGE_START_NAMESPACE | |||||
| CarlaBridgeOsc::CarlaBridgeOsc(CarlaBridgeClient* const client) | CarlaBridgeOsc::CarlaBridgeOsc(CarlaBridgeClient* const client) | ||||
| : kClient(client), | : kClient(client), | ||||
| fServer(nullptr) | |||||
| fControlData(), | |||||
| fName(), | |||||
| fServerPath(), | |||||
| fServer(nullptr), | |||||
| leakDetector_CarlaBridgeOsc() | |||||
| { | { | ||||
| CARLA_ASSERT(client != nullptr); | CARLA_ASSERT(client != nullptr); | ||||
| carla_debug("CarlaBridgeOsc::CarlaBridgeOsc(%p)", client); | carla_debug("CarlaBridgeOsc::CarlaBridgeOsc(%p)", client); | ||||
| @@ -288,11 +292,11 @@ int CarlaBridgeOsc::handleMsgMidi(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| const uint8_t* const data = argv[0]->m; | const uint8_t* const data = argv[0]->m; | ||||
| uint8_t status = data[1]; | uint8_t status = data[1]; | ||||
| uint8_t channel = status & 0x0F; | |||||
| uint8_t channel = status & MIDI_CHANNEL_BIT; | |||||
| // Fix bad note-off | // Fix bad note-off | ||||
| if (MIDI_IS_STATUS_NOTE_ON(status) && data[3] == 0) | if (MIDI_IS_STATUS_NOTE_ON(status) && data[3] == 0) | ||||
| status -= 0x10; | |||||
| status = uint8_t(MIDI_STATUS_NOTE_OFF | (channel & MIDI_CHANNEL_BIT)); | |||||
| if (MIDI_IS_STATUS_NOTE_OFF(status)) | if (MIDI_IS_STATUS_NOTE_OFF(status)) | ||||
| { | { | ||||
| @@ -49,9 +49,10 @@ protected: | |||||
| CarlaBridgeToolkit(CarlaBridgeClient* const client, const char* const windowTitle) | CarlaBridgeToolkit(CarlaBridgeClient* const client, const char* const windowTitle) | ||||
| : kClient(client), | : kClient(client), | ||||
| kWindowTitle(windowTitle) {} | |||||
| kWindowTitle(windowTitle), | |||||
| leakDetector_CarlaBridgeToolkit() {} | |||||
| CARLA_LEAK_DETECTOR(CarlaBridgeToolkit) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeToolkit) | |||||
| }; | }; | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| @@ -39,7 +39,8 @@ public: | |||||
| fLastX(0), | fLastX(0), | ||||
| fLastY(0), | fLastY(0), | ||||
| fLastWidth(0), | fLastWidth(0), | ||||
| fLastHeight(0) | |||||
| fLastHeight(0), | |||||
| leakDetector_CarlaBridgeToolkitGtk() | |||||
| { | { | ||||
| carla_debug("CarlaBridgeToolkitGtk::CarlaBridgeToolkitGtk(%p, \"%s\")", client, windowTitle); | carla_debug("CarlaBridgeToolkitGtk::CarlaBridgeToolkitGtk(%p, \"%s\")", client, windowTitle); | ||||
| } | } | ||||
| @@ -186,6 +187,8 @@ private: | |||||
| return false; | return false; | ||||
| } | } | ||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeToolkitGtk) | |||||
| }; | }; | ||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| @@ -31,7 +31,8 @@ public: | |||||
| CarlaBridgeToolkitPlugin(CarlaBridgeClient* const client, const char* const windowTitle) | CarlaBridgeToolkitPlugin(CarlaBridgeClient* const client, const char* const windowTitle) | ||||
| : CarlaBridgeToolkit(client, windowTitle), | : CarlaBridgeToolkit(client, windowTitle), | ||||
| fUI(nullptr), | fUI(nullptr), | ||||
| fIdling(false) | |||||
| fIdling(false), | |||||
| leakDetector_CarlaBridgeToolkitPlugin() | |||||
| { | { | ||||
| carla_debug("CarlaBridgeToolkitPlugin::CarlaBridgeToolkitPlugin(%p, \"%s\")", client, windowTitle); | carla_debug("CarlaBridgeToolkitPlugin::CarlaBridgeToolkitPlugin(%p, \"%s\")", client, windowTitle); | ||||
| } | } | ||||
| @@ -112,9 +113,11 @@ public: | |||||
| void resize(int width, int height) override | void resize(int width, int height) override | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fUI != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fUI != nullptr,); | ||||
| CARLA_SAFE_ASSERT_RETURN(width >= 0,); | |||||
| CARLA_SAFE_ASSERT_RETURN(height >= 0,); | |||||
| carla_debug("CarlaBridgeToolkitPlugin::resize(%i, %i)", width, height); | carla_debug("CarlaBridgeToolkitPlugin::resize(%i, %i)", width, height); | ||||
| fUI->setSize(width, height, false); | |||||
| fUI->setSize(static_cast<uint>(width), static_cast<uint>(height), false); | |||||
| } | } | ||||
| void* getContainerId() const override | void* getContainerId() const override | ||||
| @@ -150,6 +153,8 @@ protected: | |||||
| private: | private: | ||||
| CarlaPluginUI* fUI; | CarlaPluginUI* fUI; | ||||
| bool fIdling; | bool fIdling; | ||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeToolkitPlugin) | |||||
| }; | }; | ||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| @@ -51,7 +51,8 @@ public: | |||||
| fApp(nullptr), | fApp(nullptr), | ||||
| fWindow(nullptr), | fWindow(nullptr), | ||||
| fMsgTimer(0), | fMsgTimer(0), | ||||
| fNeedsShow(false) | |||||
| fNeedsShow(false), | |||||
| leakDetector_CarlaBridgeToolkitQt() | |||||
| { | { | ||||
| carla_debug("CarlaBridgeToolkitQt::CarlaBridgeToolkitQt(%p, \"%s\")", client, windowTitle); | carla_debug("CarlaBridgeToolkitQt::CarlaBridgeToolkitQt(%p, \"%s\")", client, windowTitle); | ||||
| @@ -208,12 +209,12 @@ protected: | |||||
| } | } | ||||
| private: | private: | ||||
| void timerEvent(QTimerEvent* const event) | |||||
| void timerEvent(QTimerEvent* const ev) | |||||
| { | { | ||||
| if (event->timerId() == fMsgTimer) | |||||
| if (ev->timerId() == fMsgTimer) | |||||
| handleTimeout(); | handleTimeout(); | ||||
| QObject::timerEvent(event); | |||||
| QObject::timerEvent(ev); | |||||
| } | } | ||||
| signals: | signals: | ||||
| @@ -233,6 +234,10 @@ private slots: | |||||
| else | else | ||||
| fWindow->setFixedSize(width, height); | fWindow->setFixedSize(width, height); | ||||
| } | } | ||||
| #ifndef MOC_PARSING | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeToolkitQt) | |||||
| #endif | |||||
| }; | }; | ||||
| #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | ||||
| @@ -254,6 +259,10 @@ CARLA_BRIDGE_END_NAMESPACE | |||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| // missing declaration | |||||
| int qInitResources(); | |||||
| int qCleanupResources(); | |||||
| #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | ||||
| # include "resources.qt5.cpp" | # include "resources.qt5.cpp" | ||||
| #else | #else | ||||
| @@ -32,8 +32,9 @@ CARLA_BRIDGE_START_NAMESPACE | |||||
| // ----------------------------------------------------- | // ----------------------------------------------------- | ||||
| static uint32_t gBufferSize = 1024; | |||||
| static double gSampleRate = 44100.0; | |||||
| //static uint32_t gBufferSize = 1024; | |||||
| static int gBufferSizei = 1024; | |||||
| static double gSampleRate = 44100.0; | |||||
| // Maximum default buffer size | // Maximum default buffer size | ||||
| const unsigned int MAX_DEFAULT_BUFFER_SIZE = 8192; // 0x2000 | const unsigned int MAX_DEFAULT_BUFFER_SIZE = 8192; // 0x2000 | ||||
| @@ -194,12 +195,16 @@ public: | |||||
| fDescriptor(nullptr), | fDescriptor(nullptr), | ||||
| fRdfDescriptor(nullptr), | fRdfDescriptor(nullptr), | ||||
| fRdfUiDescriptor(nullptr), | fRdfUiDescriptor(nullptr), | ||||
| fOptions(), | |||||
| fIsReady(false), | fIsReady(false), | ||||
| #if defined(BRIDGE_COCOA) || defined(BRIDGE_HWND) || defined(BRIDGE_X11) | #if defined(BRIDGE_COCOA) || defined(BRIDGE_HWND) || defined(BRIDGE_X11) | ||||
| fIsResizable(false) | |||||
| fIsResizable(false), | |||||
| #else | #else | ||||
| fIsResizable(true) | |||||
| fIsResizable(true), | |||||
| #endif | #endif | ||||
| fCustomURIDs(), | |||||
| fExt(), | |||||
| leakDetector_CarlaLv2Client() | |||||
| { | { | ||||
| carla_fill<LV2_Feature*>(fFeatures, nullptr, kFeatureCount+1); | carla_fill<LV2_Feature*>(fFeatures, nullptr, kFeatureCount+1); | ||||
| @@ -209,8 +214,8 @@ public: | |||||
| // --------------------------------------------------------------- | // --------------------------------------------------------------- | ||||
| // initialize options | // initialize options | ||||
| fOptions.minBufferSize = gBufferSize; | |||||
| fOptions.maxBufferSize = gBufferSize; | |||||
| fOptions.minBufferSize = gBufferSizei; | |||||
| fOptions.maxBufferSize = gBufferSizei; | |||||
| fOptions.sampleRate = gSampleRate; | fOptions.sampleRate = gSampleRate; | ||||
| // --------------------------------------------------------------- | // --------------------------------------------------------------- | ||||
| @@ -449,9 +454,10 @@ public: | |||||
| // ----------------------------------------------------------- | // ----------------------------------------------------------- | ||||
| // check if not resizable | // check if not resizable | ||||
| for (uint32_t i=0; i < fRdfUiDescriptor->FeatureCount && fIsResizable; ++i) | |||||
| for (uint32_t j=0; j < fRdfUiDescriptor->FeatureCount && fIsResizable; ++j) | |||||
| { | { | ||||
| if (std::strcmp(fRdfUiDescriptor->Features[i].URI, LV2_UI__fixedSize) == 0 || std::strcmp(fRdfUiDescriptor->Features[i].URI, LV2_UI__noUserResize) == 0) | |||||
| if (std::strcmp(fRdfUiDescriptor->Features[j].URI, LV2_UI__fixedSize ) == 0 || | |||||
| std::strcmp(fRdfUiDescriptor->Features[j].URI, LV2_UI__noUserResize) == 0) | |||||
| { | { | ||||
| fIsResizable = false; | fIsResizable = false; | ||||
| break; | break; | ||||
| @@ -515,11 +521,12 @@ public: | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,) | CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,) | ||||
| CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | ||||
| CARLA_SAFE_ASSERT_RETURN(rindex >= 0,) | |||||
| if (fDescriptor->port_event == nullptr) | if (fDescriptor->port_event == nullptr) | ||||
| return; | return; | ||||
| fDescriptor->port_event(fHandle, rindex, sizeof(float), 0, &value); | |||||
| fDescriptor->port_event(fHandle, static_cast<uint32_t>(rindex), sizeof(float), 0, &value); | |||||
| } | } | ||||
| void setProgram(const uint32_t) override | void setProgram(const uint32_t) override | ||||
| @@ -548,7 +555,7 @@ public: | |||||
| midiEv.event.time.frames = 0; | midiEv.event.time.frames = 0; | ||||
| midiEv.event.body.type = CARLA_URI_MAP_ID_MIDI_EVENT; | midiEv.event.body.type = CARLA_URI_MAP_ID_MIDI_EVENT; | ||||
| midiEv.event.body.size = 3; | midiEv.event.body.size = 3; | ||||
| midiEv.data[0] = MIDI_STATUS_NOTE_ON + channel; | |||||
| midiEv.data[0] = uint8_t(MIDI_STATUS_NOTE_ON | (channel & MIDI_CHANNEL_BIT)); | |||||
| midiEv.data[1] = note; | midiEv.data[1] = note; | ||||
| midiEv.data[2] = velo; | midiEv.data[2] = velo; | ||||
| @@ -567,7 +574,7 @@ public: | |||||
| midiEv.event.time.frames = 0; | midiEv.event.time.frames = 0; | ||||
| midiEv.event.body.type = CARLA_URI_MAP_ID_MIDI_EVENT; | midiEv.event.body.type = CARLA_URI_MAP_ID_MIDI_EVENT; | ||||
| midiEv.event.body.size = 3; | midiEv.event.body.size = 3; | ||||
| midiEv.data[0] = MIDI_STATUS_NOTE_OFF + channel; | |||||
| midiEv.data[0] = uint8_t(MIDI_STATUS_NOTE_OFF | (channel & MIDI_CHANNEL_BIT)); | |||||
| midiEv.data[1] = note; | midiEv.data[1] = note; | ||||
| midiEv.data[2] = 0; | midiEv.data[2] = 0; | ||||
| @@ -596,7 +603,7 @@ public: | |||||
| LV2_URID urid = CARLA_URI_MAP_ID_NULL; | LV2_URID urid = CARLA_URI_MAP_ID_NULL; | ||||
| for (size_t i=0; i < fCustomURIDs.count(); ++i) | |||||
| for (uint32_t i=0, count=static_cast<uint32_t>(fCustomURIDs.count()); i<count; ++i) | |||||
| { | { | ||||
| const char* const thisUri(fCustomURIDs.getAt(i, nullptr)); | const char* const thisUri(fCustomURIDs.getAt(i, nullptr)); | ||||
| @@ -609,7 +616,7 @@ public: | |||||
| if (urid == CARLA_URI_MAP_ID_NULL) | if (urid == CARLA_URI_MAP_ID_NULL) | ||||
| { | { | ||||
| urid = fCustomURIDs.count(); | |||||
| urid = static_cast<LV2_URID>(fCustomURIDs.count()); | |||||
| fCustomURIDs.append(carla_strdup(uri)); | fCustomURIDs.append(carla_strdup(uri)); | ||||
| } | } | ||||
| @@ -681,7 +688,7 @@ public: | |||||
| const float value(*(const float*)buffer); | const float value(*(const float*)buffer); | ||||
| if (isOscControlRegistered()) | if (isOscControlRegistered()) | ||||
| sendOscControl(portIndex, value); | |||||
| sendOscControl(static_cast<int32_t>(portIndex), value); | |||||
| } | } | ||||
| else if (format == CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM || CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT) | else if (format == CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM || CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT) | ||||
| { | { | ||||
| @@ -724,7 +731,7 @@ public: | |||||
| return; | return; | ||||
| } | } | ||||
| const uint32_t uridCount(fCustomURIDs.count()); | |||||
| const uint32_t uridCount(static_cast<uint32_t>(fCustomURIDs.count())); | |||||
| if (urid < uridCount) | if (urid < uridCount) | ||||
| { | { | ||||
| @@ -1197,7 +1204,7 @@ int CarlaBridgeOsc::handleMsgLv2AtomTransfer(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| CARLA_SAFE_ASSERT_RETURN(chunk.size() > 0, 0); | CARLA_SAFE_ASSERT_RETURN(chunk.size() > 0, 0); | ||||
| const LV2_Atom* const atom((const LV2_Atom*)chunk.data()); | const LV2_Atom* const atom((const LV2_Atom*)chunk.data()); | ||||
| lv2ClientPtr->handleAtomTransfer(portIndex, atom); | |||||
| lv2ClientPtr->handleAtomTransfer(static_cast<uint32_t>(portIndex), atom); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -1215,7 +1222,7 @@ int CarlaBridgeOsc::handleMsgLv2UridMap(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| if (urid < 0) | if (urid < 0) | ||||
| return 0; | return 0; | ||||
| lv2ClientPtr->handleUridMap(urid, uri); | |||||
| lv2ClientPtr->handleUridMap(static_cast<LV2_URID>(urid), uri); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -32,13 +32,15 @@ class CarlaVstClient : public CarlaBridgeClient | |||||
| { | { | ||||
| public: | public: | ||||
| CarlaVstClient(const char* const uiTitle) | CarlaVstClient(const char* const uiTitle) | ||||
| : CarlaBridgeClient(uiTitle) | |||||
| : CarlaBridgeClient(uiTitle), | |||||
| unique1(0), | |||||
| effect(nullptr), | |||||
| needIdle(false), | |||||
| unique2(1), | |||||
| leakDetector_CarlaVstClient() | |||||
| { | { | ||||
| effect = nullptr; | |||||
| needIdle = false; | |||||
| // make client valid | // make client valid | ||||
| srand(uiTitle[0]); | |||||
| srand((uint)(uintptr_t)uiTitle[0]); | |||||
| unique1 = unique2 = rand(); | unique1 = unique2 = rand(); | ||||
| } | } | ||||
| @@ -106,9 +108,9 @@ public: | |||||
| effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f); | effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f); | ||||
| #if ! VST_FORCE_DEPRECATED | #if ! VST_FORCE_DEPRECATED | ||||
| effect->dispatcher(effect, effSetBlockSizeAndSampleRate, 0, bufferSize, nullptr, sampleRate); | |||||
| effect->dispatcher(effect, effSetBlockSizeAndSampleRate, 0, bufferSize, nullptr, static_cast<float>(sampleRate)); | |||||
| #endif | #endif | ||||
| effect->dispatcher(effect, effSetSampleRate, 0, 0, nullptr, sampleRate); | |||||
| effect->dispatcher(effect, effSetSampleRate, 0, 0, nullptr, static_cast<float>(sampleRate)); | |||||
| effect->dispatcher(effect, effSetBlockSize, 0, bufferSize, nullptr, 0.0f); | effect->dispatcher(effect, effSetBlockSize, 0, bufferSize, nullptr, 0.0f); | ||||
| effect->dispatcher(effect, effSetProcessPrecision, 0, kVstProcessPrecision32, nullptr, 0.0f); | effect->dispatcher(effect, effSetProcessPrecision, 0, kVstProcessPrecision32, nullptr, 0.0f); | ||||
| @@ -201,43 +203,10 @@ public: | |||||
| void handleAudioMasterAutomate(const uint32_t index, const float value) | void handleAudioMasterAutomate(const uint32_t index, const float value) | ||||
| { | { | ||||
| effect->setParameter(effect, index, value); | |||||
| effect->setParameter(effect, static_cast<int32_t>(index), value); | |||||
| if (isOscControlRegistered()) | if (isOscControlRegistered()) | ||||
| sendOscControl(index, value); | |||||
| } | |||||
| intptr_t handleAudioMasterGetCurrentProcessLevel() | |||||
| { | |||||
| return kVstProcessLevelUser; | |||||
| } | |||||
| intptr_t handleAudioMasterGetBlockSize() | |||||
| { | |||||
| return bufferSize; | |||||
| } | |||||
| intptr_t handleAudioMasterGetSampleRate() | |||||
| { | |||||
| return sampleRate; | |||||
| } | |||||
| intptr_t handleAudioMasterGetTime() | |||||
| { | |||||
| memset(&vstTimeInfo, 0, sizeof(VstTimeInfo)); | |||||
| vstTimeInfo.sampleRate = sampleRate; | |||||
| // Tempo | |||||
| vstTimeInfo.tempo = 120.0; | |||||
| vstTimeInfo.flags |= kVstTempoValid; | |||||
| // Time Signature | |||||
| vstTimeInfo.timeSigNumerator = 4; | |||||
| vstTimeInfo.timeSigDenominator = 4; | |||||
| vstTimeInfo.flags |= kVstTimeSigValid; | |||||
| return (intptr_t)&vstTimeInfo; | |||||
| sendOscControl(static_cast<int32_t>(index), value); | |||||
| } | } | ||||
| void handleAudioMasterNeedIdle() | void handleAudioMasterNeedIdle() | ||||
| @@ -259,13 +228,13 @@ public: | |||||
| if (vstMidiEvent->type != kVstMidiType) | if (vstMidiEvent->type != kVstMidiType) | ||||
| { | { | ||||
| uint8_t status = vstMidiEvent->midiData[0]; | |||||
| uint8_t status = uint8_t(vstMidiEvent->midiData[0]); | |||||
| // Fix bad note-off | // Fix bad note-off | ||||
| if (MIDI_IS_STATUS_NOTE_ON(status) && vstMidiEvent->midiData[2] == 0) | if (MIDI_IS_STATUS_NOTE_ON(status) && vstMidiEvent->midiData[2] == 0) | ||||
| status -= 0x10; | |||||
| status = uint8_t(status - 0x10); | |||||
| uint8_t midiBuf[4] = { 0, status, (uint8_t)vstMidiEvent->midiData[1], (uint8_t)vstMidiEvent->midiData[2] }; | |||||
| uint8_t midiBuf[4] = { 0, status, uint8_t(vstMidiEvent->midiData[1]), uint8_t(vstMidiEvent->midiData[2]) }; | |||||
| sendOscMidi(midiBuf); | sendOscMidi(midiBuf); | ||||
| } | } | ||||
| } | } | ||||
| @@ -356,7 +325,7 @@ public: | |||||
| self = nullptr; | self = nullptr; | ||||
| } | } | ||||
| if (self) | |||||
| if (self != nullptr) | |||||
| { | { | ||||
| if (! self->effect) | if (! self->effect) | ||||
| self->effect = effect; | self->effect = effect; | ||||
| @@ -385,8 +354,8 @@ public: | |||||
| switch (opcode) | switch (opcode) | ||||
| { | { | ||||
| case audioMasterAutomate: | case audioMasterAutomate: | ||||
| if (self) | |||||
| self->handleAudioMasterAutomate(index, opt); | |||||
| if (self != nullptr && index >= 0) | |||||
| self->handleAudioMasterAutomate(static_cast<uint32_t>(index), opt); | |||||
| break; | break; | ||||
| case audioMasterVersion: | case audioMasterVersion: | ||||
| @@ -403,24 +372,25 @@ public: | |||||
| break; | break; | ||||
| case audioMasterGetTime: | case audioMasterGetTime: | ||||
| static VstTimeInfo timeInfo; | |||||
| memset(&timeInfo, 0, sizeof(VstTimeInfo)); | |||||
| timeInfo.sampleRate = sampleRate; | |||||
| static VstTimeInfo vstTimeInfo; | |||||
| carla_zeroStruct(vstTimeInfo); | |||||
| vstTimeInfo.sampleRate = sampleRate; | |||||
| // Tempo | // Tempo | ||||
| timeInfo.tempo = 120.0; | |||||
| timeInfo.flags |= kVstTempoValid; | |||||
| vstTimeInfo.tempo = 120.0; | |||||
| vstTimeInfo.flags |= kVstTempoValid; | |||||
| // Time Signature | // Time Signature | ||||
| timeInfo.timeSigNumerator = 4; | |||||
| timeInfo.timeSigDenominator = 4; | |||||
| timeInfo.flags |= kVstTimeSigValid; | |||||
| vstTimeInfo.timeSigNumerator = 4; | |||||
| vstTimeInfo.timeSigDenominator = 4; | |||||
| vstTimeInfo.flags |= kVstTimeSigValid; | |||||
| ret = (intptr_t)&timeInfo; | |||||
| ret = (intptr_t)&vstTimeInfo; | |||||
| break; | break; | ||||
| case audioMasterProcessEvents: | case audioMasterProcessEvents: | ||||
| if (self && ptr) | |||||
| if (self != nullptr && ptr != nullptr) | |||||
| ret = self->handleAudioMasterProcessEvents((const VstEvents*)ptr); | ret = self->handleAudioMasterProcessEvents((const VstEvents*)ptr); | ||||
| break; | break; | ||||
| @@ -432,16 +402,16 @@ public: | |||||
| #endif | #endif | ||||
| case audioMasterSizeWindow: | case audioMasterSizeWindow: | ||||
| if (self && index > 0 && value > 0) | |||||
| ret = self->handleAdioMasterSizeWindow(index, value); | |||||
| if (self != nullptr && index > 0 && value > 0) | |||||
| ret = self->handleAdioMasterSizeWindow(index, static_cast<int32_t>(value)); | |||||
| break; | break; | ||||
| case audioMasterGetSampleRate: | case audioMasterGetSampleRate: | ||||
| ret = sampleRate; | |||||
| ret = static_cast<intptr_t>(sampleRate); | |||||
| break; | break; | ||||
| case audioMasterGetBlockSize: | case audioMasterGetBlockSize: | ||||
| ret = bufferSize; | |||||
| ret = static_cast<intptr_t>(bufferSize); | |||||
| break; | break; | ||||
| case audioMasterGetCurrentProcessLevel: | case audioMasterGetCurrentProcessLevel: | ||||
| @@ -453,12 +423,12 @@ public: | |||||
| break; | break; | ||||
| case audioMasterGetVendorString: | case audioMasterGetVendorString: | ||||
| if (ptr) | |||||
| if (ptr != nullptr) | |||||
| std::strcpy((char*)ptr, "falkTX"); | std::strcpy((char*)ptr, "falkTX"); | ||||
| break; | break; | ||||
| case audioMasterGetProductString: | case audioMasterGetProductString: | ||||
| if (ptr) | |||||
| if (ptr != nullptr) | |||||
| std::strcpy((char*)ptr, "Carla-Bridge"); | std::strcpy((char*)ptr, "Carla-Bridge"); | ||||
| break; | break; | ||||
| @@ -467,7 +437,7 @@ public: | |||||
| break; | break; | ||||
| case audioMasterCanDo: | case audioMasterCanDo: | ||||
| if (ptr) | |||||
| if (ptr != nullptr) | |||||
| ret = hostCanDo((const char*)ptr); | ret = hostCanDo((const char*)ptr); | ||||
| break; | break; | ||||
| @@ -476,7 +446,7 @@ public: | |||||
| break; | break; | ||||
| case audioMasterUpdateDisplay: | case audioMasterUpdateDisplay: | ||||
| if (self) | |||||
| if (self != nullptr) | |||||
| self->handleAudioMasterUpdateDisplay(); | self->handleAudioMasterUpdateDisplay(); | ||||
| break; | break; | ||||
| @@ -494,12 +464,13 @@ private: | |||||
| int unique1; | int unique1; | ||||
| AEffect* effect; | AEffect* effect; | ||||
| VstTimeInfo vstTimeInfo; | |||||
| bool needIdle; | bool needIdle; | ||||
| static CarlaVstClient* lastVstPlugin; | static CarlaVstClient* lastVstPlugin; | ||||
| int unique2; | int unique2; | ||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaVstClient) | |||||
| }; | }; | ||||
| CarlaVstClient* CarlaVstClient::lastVstPlugin = nullptr; | CarlaVstClient* CarlaVstClient::lastVstPlugin = nullptr; | ||||