| @@ -66,7 +66,8 @@ endif | |||
| ifneq ($(MACOS),true) | |||
| BASE_FLAGS += -Wlogical-op | |||
| ifeq ($(TESTBUILD),true) | |||
| BASE_FLAGS += -Wmissing-declarations -Wsign-conversion -Wsuggest-attribute=noreturn | |||
| BASE_FLAGS += -Wmissing-declarations -Wsign-conversion | |||
| # -Wsuggest-attribute=noreturn | |||
| endif | |||
| endif | |||
| @@ -324,7 +324,7 @@ public: | |||
| /*! | |||
| * Initialize the port's internal buffer. | |||
| */ | |||
| virtual void initBuffer() = 0; | |||
| virtual void initBuffer() noexcept = 0; | |||
| /*! | |||
| * Check if this port is an input. | |||
| @@ -371,7 +371,7 @@ public: | |||
| /*! | |||
| * Initialize the port's internal buffer. | |||
| */ | |||
| virtual void initBuffer() override; | |||
| virtual void initBuffer() noexcept override; | |||
| /*! | |||
| * Direct access to the port's audio buffer. | |||
| @@ -417,7 +417,7 @@ public: | |||
| /*! | |||
| * Initialize the port's internal buffer for \a engine. | |||
| */ | |||
| virtual void initBuffer() override; | |||
| virtual void initBuffer() noexcept override; | |||
| /*! | |||
| * Set a new buffer size. | |||
| @@ -430,7 +430,6 @@ public: | |||
| * Write buffer back into the engine. | |||
| */ | |||
| virtual void writeBuffer(const uint32_t frames, const uint32_t timeOffset); | |||
| #endif | |||
| /*! | |||
| @@ -478,7 +477,7 @@ public: | |||
| /*! | |||
| * Initialize the port's internal buffer for \a engine. | |||
| */ | |||
| virtual void initBuffer() override; | |||
| virtual void initBuffer() noexcept override; | |||
| /*! | |||
| * Get the number of events present in the buffer. | |||
| @@ -490,41 +489,41 @@ public: | |||
| * Get the event at \a index. | |||
| * \note You must only call this for input ports. | |||
| */ | |||
| virtual const EngineEvent& getEvent(const uint32_t index) noexcept; | |||
| virtual const EngineEvent& getEvent(const uint32_t index) const noexcept; | |||
| /*! | |||
| * Get the event at \a index, faster unchecked version. | |||
| */ | |||
| virtual const EngineEvent& getEventUnchecked(const uint32_t index) noexcept; | |||
| virtual const EngineEvent& getEventUnchecked(const uint32_t index) const noexcept; | |||
| /*! | |||
| * Write a control event into the buffer.\n | |||
| * Arguments are the same as in the EngineControlEvent struct. | |||
| * \note You must only call this for output ports. | |||
| */ | |||
| virtual bool writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEventType type, const uint16_t param, const float value = 0.0f); | |||
| virtual bool writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEventType type, const uint16_t param, const float value = 0.0f) noexcept; | |||
| /*! | |||
| * Write a control event into the buffer, overloaded call. | |||
| */ | |||
| bool writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEvent& ctrl); | |||
| bool writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEvent& ctrl) noexcept; | |||
| /*! | |||
| * Write a MIDI event into the buffer.\n | |||
| * Arguments are the same as in the EngineMidiEvent struct. | |||
| * \note You must only call this for output ports. | |||
| */ | |||
| virtual bool writeMidiEvent(const uint32_t time, const uint8_t channel, const uint8_t port, const uint8_t size, const uint8_t* const data); | |||
| virtual bool writeMidiEvent(const uint32_t time, const uint8_t channel, const uint8_t port, const uint8_t size, const uint8_t* const data) noexcept; | |||
| /*! | |||
| * Write a MIDI event into the buffer, overloaded call. | |||
| */ | |||
| bool writeMidiEvent(const uint32_t time, const uint8_t size, const uint8_t* const data); | |||
| bool writeMidiEvent(const uint32_t time, const uint8_t size, const uint8_t* const data) noexcept; | |||
| /*! | |||
| * Write a MIDI event into the buffer, overloaded call. | |||
| */ | |||
| bool writeMidiEvent(const uint32_t time, const uint8_t channel, const EngineMidiEvent& midi); | |||
| bool writeMidiEvent(const uint32_t time, const uint8_t channel, const EngineMidiEvent& midi) noexcept; | |||
| #ifndef DOXYGEN | |||
| protected: | |||
| @@ -896,7 +895,7 @@ public: | |||
| /*! | |||
| * Disconnect patchbay connection \a connectionId. | |||
| */ | |||
| virtual bool patchbayDisconnect(const int connectionId); | |||
| virtual bool patchbayDisconnect(const uint connectionId); | |||
| /*! | |||
| * Force the engine to resend all patchbay clients, ports and connections again. | |||
| @@ -624,7 +624,7 @@ CARLA_EXPORT bool carla_patchbay_connect(int portIdA, int portIdB); | |||
| * @param connectionId Connection Id | |||
| * @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED | |||
| */ | |||
| CARLA_EXPORT bool carla_patchbay_disconnect(int connectionId); | |||
| CARLA_EXPORT bool carla_patchbay_disconnect(uint connectionId); | |||
| /*! | |||
| * Force the engine to resend all patchbay clients, ports and connections again. | |||
| @@ -1076,4 +1076,9 @@ CARLA_EXPORT const char* carla_get_host_osc_url_udp(); | |||
| /** @} */ | |||
| /*! | |||
| * Implemented in standalone. | |||
| */ | |||
| extern const char* carla_standalone_file_callback(FileCallbackOpcode action, bool isDir, const char* title, const char* filter); | |||
| #endif /* CARLA_HOST_H_INCLUDED */ | |||
| @@ -83,7 +83,7 @@ CarlaEngineAudioPort::~CarlaEngineAudioPort() | |||
| carla_debug("CarlaEngineAudioPort::~CarlaEngineAudioPort()"); | |||
| } | |||
| void CarlaEngineAudioPort::initBuffer() | |||
| void CarlaEngineAudioPort::initBuffer() noexcept | |||
| { | |||
| } | |||
| @@ -114,7 +114,7 @@ CarlaEngineCVPort::~CarlaEngineCVPort() | |||
| } | |||
| } | |||
| void CarlaEngineCVPort::initBuffer() | |||
| void CarlaEngineCVPort::initBuffer() noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(fProcessMode != ENGINE_PROCESS_MODE_SINGLE_CLIENT && fProcessMode != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS,); | |||
| @@ -158,7 +158,7 @@ CarlaEngineEventPort::~CarlaEngineEventPort() | |||
| } | |||
| } | |||
| void CarlaEngineEventPort::initBuffer() | |||
| void CarlaEngineEventPort::initBuffer() noexcept | |||
| { | |||
| if (fProcessMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK || fProcessMode == ENGINE_PROCESS_MODE_BRIDGE) | |||
| fBuffer = fEngine.getInternalEventBuffer(fIsInput); | |||
| @@ -183,7 +183,7 @@ uint32_t CarlaEngineEventPort::getEventCount() const noexcept | |||
| return i; | |||
| } | |||
| const EngineEvent& CarlaEngineEventPort::getEvent(const uint32_t index) noexcept | |||
| const EngineEvent& CarlaEngineEventPort::getEvent(const uint32_t index) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fIsInput, kFallbackEngineEvent); | |||
| CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr, kFallbackEngineEvent); | |||
| @@ -193,12 +193,12 @@ const EngineEvent& CarlaEngineEventPort::getEvent(const uint32_t index) noexcept | |||
| return fBuffer[index]; | |||
| } | |||
| const EngineEvent& CarlaEngineEventPort::getEventUnchecked(const uint32_t index) noexcept | |||
| const EngineEvent& CarlaEngineEventPort::getEventUnchecked(const uint32_t index) const noexcept | |||
| { | |||
| return fBuffer[index]; | |||
| } | |||
| bool CarlaEngineEventPort::writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEventType type, const uint16_t param, const float value) | |||
| bool CarlaEngineEventPort::writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEventType type, const uint16_t param, const float value) noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(! fIsInput, false); | |||
| CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr, false); | |||
| @@ -211,6 +211,7 @@ bool CarlaEngineEventPort::writeControlEvent(const uint32_t time, const uint8_t | |||
| CARLA_SAFE_ASSERT(! MIDI_IS_CONTROL_BANK_SELECT(param)); | |||
| } | |||
| // FIXME? should not fix range if midi-program | |||
| const float fixedValue(carla_fixValue<float>(0.0f, 1.0f, value)); | |||
| for (uint32_t i=0; i < kMaxEngineEventInternalCount; ++i) | |||
| @@ -235,12 +236,12 @@ bool CarlaEngineEventPort::writeControlEvent(const uint32_t time, const uint8_t | |||
| return false; | |||
| } | |||
| bool CarlaEngineEventPort::writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEvent& ctrl) | |||
| bool CarlaEngineEventPort::writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEvent& ctrl) noexcept | |||
| { | |||
| return writeControlEvent(time, channel, ctrl.type, ctrl.param, ctrl.value); | |||
| } | |||
| bool CarlaEngineEventPort::writeMidiEvent(const uint32_t time, const uint8_t channel, const uint8_t port, const uint8_t size, const uint8_t* const data) | |||
| bool CarlaEngineEventPort::writeMidiEvent(const uint32_t time, const uint8_t channel, const uint8_t port, const uint8_t size, const uint8_t* const data) noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(! fIsInput, false); | |||
| CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr, false); | |||
| @@ -278,12 +279,12 @@ bool CarlaEngineEventPort::writeMidiEvent(const uint32_t time, const uint8_t cha | |||
| return false; | |||
| } | |||
| bool CarlaEngineEventPort::writeMidiEvent(const uint32_t time, const uint8_t size, const uint8_t* const data) | |||
| bool CarlaEngineEventPort::writeMidiEvent(const uint32_t time, const uint8_t size, const uint8_t* const data) noexcept | |||
| { | |||
| return writeMidiEvent(time, uint8_t(MIDI_GET_CHANNEL_FROM_DATA(data)), 0, size, data); | |||
| } | |||
| bool CarlaEngineEventPort::writeMidiEvent(const uint32_t time, const uint8_t channel, const EngineMidiEvent& midi) | |||
| bool CarlaEngineEventPort::writeMidiEvent(const uint32_t time, const uint8_t channel, const EngineMidiEvent& midi) noexcept | |||
| { | |||
| return writeMidiEvent(time, channel, midi.port, midi.size, midi.data); | |||
| } | |||
| @@ -1615,8 +1616,7 @@ bool CarlaEngine::patchbayConnect(const int portA, const int portB) | |||
| connectionToId.portOut = portA; | |||
| connectionToId.portIn = portB; | |||
| CARLA_SAFE_ASSERT(rack->lastConnectionId >= 0); | |||
| callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, static_cast<uint>(rack->lastConnectionId), portA, portB, 0.0f, nullptr); | |||
| callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, rack->lastConnectionId, portA, portB, 0.0f, nullptr); | |||
| rack->usedConnections.append(connectionToId); | |||
| rack->lastConnectionId++; | |||
| @@ -1624,7 +1624,7 @@ bool CarlaEngine::patchbayConnect(const int portA, const int portB) | |||
| return true; | |||
| } | |||
| bool CarlaEngine::patchbayDisconnect(const int connectionId) | |||
| bool CarlaEngine::patchbayDisconnect(const uint connectionId) | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->options.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK || pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY, false); | |||
| CARLA_SAFE_ASSERT_RETURN(pData->bufAudio.isReady, false); | |||
| @@ -1694,8 +1694,7 @@ bool CarlaEngine::patchbayDisconnect(const int connectionId) | |||
| CARLA_SAFE_ASSERT_RETURN(false, false); | |||
| } | |||
| CARLA_SAFE_ASSERT(connection.id >= 0); | |||
| callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, static_cast<uint>(connection.id), connection.portOut, connection.portIn, 0.0f, nullptr); | |||
| callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, connection.id, connection.portOut, connection.portIn, 0.0f, nullptr); | |||
| rack->usedConnections.remove(it); | |||
| break; | |||
| @@ -72,9 +72,9 @@ struct PortNameToId { | |||
| }; | |||
| struct ConnectionToId { | |||
| int id; | |||
| int portOut; | |||
| int portIn; | |||
| uint id; | |||
| int portOut; | |||
| int portIn; | |||
| }; | |||
| // ----------------------------------------------------------------------- | |||
| @@ -89,7 +89,7 @@ struct EngineRackBuffers { | |||
| LinkedList<int> connectedOuts[2]; | |||
| CarlaMutex connectLock; | |||
| int lastConnectionId; | |||
| uint lastConnectionId; | |||
| LinkedList<ConnectionToId> usedConnections; | |||
| EngineRackBuffers(const uint32_t bufferSize); | |||
| @@ -80,7 +80,7 @@ public: | |||
| } | |||
| } | |||
| void initBuffer() override | |||
| void initBuffer() noexcept override | |||
| { | |||
| if (fPort == nullptr) | |||
| return CarlaEngineAudioPort::initBuffer(); | |||
| @@ -140,7 +140,7 @@ public: | |||
| } | |||
| } | |||
| void initBuffer() override | |||
| void initBuffer() noexcept override | |||
| { | |||
| if (fPort == nullptr) | |||
| return CarlaEngineCVPort::initBuffer(); | |||
| @@ -198,7 +198,7 @@ public: | |||
| } | |||
| } | |||
| void initBuffer() override | |||
| void initBuffer() noexcept override | |||
| { | |||
| if (fPort == nullptr) | |||
| return CarlaEngineEventPort::initBuffer(); | |||
| @@ -220,7 +220,7 @@ public: | |||
| return jackbridge_midi_get_event_count(fJackBuffer); | |||
| } | |||
| const EngineEvent& getEvent(const uint32_t index) noexcept override | |||
| const EngineEvent& getEvent(const uint32_t index) const noexcept override | |||
| { | |||
| if (fPort == nullptr) | |||
| return CarlaEngineEventPort::getEvent(index); | |||
| @@ -231,7 +231,7 @@ public: | |||
| return getEventUnchecked(index); | |||
| } | |||
| const EngineEvent& getEventUnchecked(const uint32_t index) noexcept override | |||
| const EngineEvent& getEventUnchecked(const uint32_t index) const noexcept override | |||
| { | |||
| jack_midi_event_t jackEvent; | |||
| @@ -246,7 +246,7 @@ public: | |||
| return fRetEvent; | |||
| } | |||
| bool writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEventType type, const uint16_t param, const float value) override | |||
| bool writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEventType type, const uint16_t param, const float value) noexcept override | |||
| { | |||
| if (fPort == nullptr) | |||
| return CarlaEngineEventPort::writeControlEvent(time, channel, type, param, value); | |||
| @@ -274,7 +274,7 @@ public: | |||
| return jackbridge_midi_event_write(fJackBuffer, time, data, size); | |||
| } | |||
| bool writeMidiEvent(const uint32_t time, const uint8_t channel, const uint8_t port, const uint8_t size, const uint8_t* const data) override | |||
| bool writeMidiEvent(const uint32_t time, const uint8_t channel, const uint8_t port, const uint8_t size, const uint8_t* const data) noexcept override | |||
| { | |||
| if (fPort == nullptr) | |||
| return CarlaEngineEventPort::writeMidiEvent(time, channel, port, size, data); | |||
| @@ -298,9 +298,9 @@ public: | |||
| private: | |||
| jack_client_t* fClient; | |||
| jack_port_t* fPort; | |||
| void* fJackBuffer; | |||
| void* fJackBuffer; | |||
| EngineEvent fRetEvent; | |||
| mutable EngineEvent fRetEvent; | |||
| friend class CarlaEngineJack; | |||
| @@ -890,7 +890,7 @@ public: | |||
| return true; | |||
| } | |||
| bool patchbayDisconnect(int connectionId) override | |||
| bool patchbayDisconnect(uint connectionId) override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, false); | |||
| @@ -1360,7 +1360,7 @@ protected: | |||
| connectionToId.setData(fLastConnectionId++, portIdA, portIdB); | |||
| fUsedConnections.append(connectionToId); | |||
| callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, static_cast<uint>(connectionToId.id), connectionToId.portOut, connectionToId.portIn, 0.0f, nullptr); | |||
| callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, connectionToId.portOut, connectionToId.portIn, 0.0f, nullptr); | |||
| } | |||
| else | |||
| { | |||
| @@ -1549,18 +1549,18 @@ private: | |||
| }; | |||
| struct ConnectionToId { | |||
| int id; | |||
| int portOut; | |||
| int portIn; | |||
| uint id; | |||
| int portOut; | |||
| int portIn; | |||
| void clear() noexcept | |||
| { | |||
| id = -1; | |||
| id = 0; | |||
| portOut = -1; | |||
| portIn = -1; | |||
| } | |||
| void setData(const int i, const int out, const int in) noexcept | |||
| void setData(const uint i, const int out, const int in) noexcept | |||
| { | |||
| id = i; | |||
| portOut = out; | |||
| @@ -1584,9 +1584,9 @@ private: | |||
| } | |||
| }; | |||
| int fLastGroupId; | |||
| int fLastPortId; | |||
| int fLastConnectionId; | |||
| int fLastGroupId; | |||
| int fLastPortId; | |||
| uint fLastConnectionId; | |||
| LinkedList<GroupNameToId> fUsedGroupNames; | |||
| LinkedList<PortNameToId> fUsedPortNames; | |||
| @@ -1798,7 +1798,7 @@ private: | |||
| connectionToId.setData(fLastConnectionId++, thisPortId, targetPortId); | |||
| fUsedConnections.append(connectionToId); | |||
| callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, static_cast<uint>(connectionToId.id), connectionToId.portOut, connectionToId.portIn, 0.0f, nullptr); | |||
| callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, connectionToId.portOut, connectionToId.portIn, 0.0f, nullptr); | |||
| } | |||
| jackbridge_free(connections); | |||
| @@ -146,9 +146,9 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "patchbay_disconnect") == 0) | |||
| { | |||
| int connectionId; | |||
| uint connectionId; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(connectionId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(connectionId),); | |||
| fEngine->patchbayDisconnect(connectionId); | |||
| } | |||
| @@ -207,9 +207,9 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "remove_plugin") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| fEngine->removePlugin(pluginId); | |||
| } | |||
| @@ -219,10 +219,10 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "rename_plugin") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| const char* newName; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(newName),); | |||
| /*const char* name =*/ fEngine->renamePlugin(pluginId, newName); | |||
| @@ -231,35 +231,35 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "clone_plugin") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| fEngine->clonePlugin(pluginId); | |||
| } | |||
| else if (std::strcmp(msg, "replace_plugin") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| fEngine->replacePlugin(pluginId); | |||
| } | |||
| else if (std::strcmp(msg, "switch_plugins") == 0) | |||
| { | |||
| int pluginIdA, pluginIdB; | |||
| uint pluginIdA, pluginIdB; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginIdA),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginIdB),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginIdA),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginIdB),); | |||
| fEngine->switchPlugins(pluginIdA, pluginIdB); | |||
| } | |||
| else if (std::strcmp(msg, "load_plugin_state") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| const char* filename; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(filename),); | |||
| if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
| @@ -269,10 +269,10 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "save_plugin_state") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| const char* filename; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(filename),); | |||
| if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
| @@ -282,12 +282,12 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "set_option") == 0) | |||
| { | |||
| int pluginId; | |||
| int option; | |||
| uint pluginId; | |||
| uint option; | |||
| bool yesNo; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(option),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(option),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsBool(yesNo),); | |||
| if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
| @@ -295,10 +295,10 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "set_active") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| bool onOff; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsBool(onOff),); | |||
| if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
| @@ -306,10 +306,10 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "set_drywet") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| float value; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsFloat(value),); | |||
| if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
| @@ -317,10 +317,10 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "set_volume") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| float value; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsFloat(value),); | |||
| if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
| @@ -328,10 +328,10 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "set_balance_left") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| float value; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsFloat(value),); | |||
| if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
| @@ -339,10 +339,10 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "set_balance_right") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| float value; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsFloat(value),); | |||
| if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
| @@ -350,10 +350,10 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "set_panning") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| float value; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsFloat(value),); | |||
| if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
| @@ -361,10 +361,10 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "set_ctrl_channel") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| int channel; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(channel),); | |||
| CARLA_SAFE_ASSERT_RETURN(channel >= -1 && channel < MAX_MIDI_CHANNELS,); | |||
| @@ -373,12 +373,12 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "set_parameter_value") == 0) | |||
| { | |||
| int pluginId; | |||
| int parameterId; | |||
| uint pluginId; | |||
| uint parameterId; | |||
| float value; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(parameterId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(parameterId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsFloat(value),); | |||
| if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
| @@ -386,12 +386,12 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "set_parameter_midi_channel") == 0) | |||
| { | |||
| int pluginId; | |||
| int parameterId; | |||
| uint pluginId; | |||
| uint parameterId; | |||
| int channel; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(parameterId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(parameterId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(channel),); | |||
| CARLA_SAFE_ASSERT_RETURN(channel >= 0 && channel < MAX_MIDI_CHANNELS,); | |||
| @@ -400,12 +400,12 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "set_parameter_midi_cc") == 0) | |||
| { | |||
| int pluginId; | |||
| int parameterId; | |||
| uint pluginId; | |||
| uint parameterId; | |||
| int cc; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(parameterId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(parameterId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(cc),); | |||
| CARLA_SAFE_ASSERT_RETURN(cc >= -1 && cc < 0x5F,); | |||
| @@ -414,10 +414,10 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "set_program") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| int index; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(index),); | |||
| if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
| @@ -425,10 +425,10 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "set_midi_program") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| int index; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(index),); | |||
| if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
| @@ -436,12 +436,12 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "set_custom_data") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| const char* type; | |||
| const char* key; | |||
| const char* value; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(type),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(key),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(value),); | |||
| @@ -451,10 +451,10 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "set_chunk_data") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| const char* cdata; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(cdata),); | |||
| if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
| @@ -462,19 +462,19 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "prepare_for_save") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
| plugin->prepareForSave(); | |||
| } | |||
| else if (std::strcmp(msg, "send_midi_note") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| int channel, note, velocity; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(channel),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(note),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(velocity),); | |||
| @@ -487,10 +487,10 @@ protected: | |||
| } | |||
| else if (std::strcmp(msg, "show_custom_ui") == 0) | |||
| { | |||
| int pluginId; | |||
| uint pluginId; | |||
| bool yesNo; | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(pluginId),); | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsBool(yesNo),); | |||
| if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
| @@ -1577,6 +1577,8 @@ static const NativePluginDescriptor carlaPatchbayDesc = { | |||
| CARLA_BACKEND_END_NAMESPACE | |||
| CARLA_EXPORT | |||
| void carla_register_native_plugin_carla(); | |||
| void carla_register_native_plugin_carla() | |||
| { | |||
| CARLA_BACKEND_USE_NAMESPACE | |||
| @@ -445,7 +445,7 @@ public: | |||
| for (uint i=0; i < pData->bufAudio.inCount; ++i) | |||
| { | |||
| std::snprintf(strBuf, STR_MAX, "capture_%i", i+1); | |||
| callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_PATCHBAY_GROUP_AUDIO_IN, RACK_PATCHBAY_GROUP_AUDIO_IN*1000 + i, PATCHBAY_PORT_TYPE_AUDIO, 0.0f, strBuf); | |||
| callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_PATCHBAY_GROUP_AUDIO_IN, int(RACK_PATCHBAY_GROUP_AUDIO_IN*1000 + i), int(PATCHBAY_PORT_TYPE_AUDIO), 0.0f, strBuf); | |||
| } | |||
| } | |||
| @@ -461,7 +461,7 @@ public: | |||
| for (uint i=0; i < pData->bufAudio.outCount; ++i) | |||
| { | |||
| std::snprintf(strBuf, STR_MAX, "playback_%i", i+1); | |||
| callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_PATCHBAY_GROUP_AUDIO_OUT, RACK_PATCHBAY_GROUP_AUDIO_OUT*1000 + i, PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, 0.0f, strBuf); | |||
| callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_PATCHBAY_GROUP_AUDIO_OUT, int(RACK_PATCHBAY_GROUP_AUDIO_OUT*1000 + i), int(PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT), 0.0f, strBuf); | |||
| } | |||
| } | |||
| @@ -469,11 +469,12 @@ public: | |||
| { | |||
| callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_MIDI_IN, 0, 0, 0.0f, "Readable MIDI ports"); | |||
| for (unsigned int i=0, count=fDummyMidiIn.getPortCount(); i < count; ++i) | |||
| for (uint i=0, count=fDummyMidiIn.getPortCount(); i < count; ++i) | |||
| { | |||
| PortNameToId portNameToId; | |||
| portNameToId.portId = RACK_PATCHBAY_GROUP_MIDI_IN*1000 + i; | |||
| portNameToId.portId = int(RACK_PATCHBAY_GROUP_MIDI_IN*1000 + i); | |||
| std::strncpy(portNameToId.name, fDummyMidiIn.getPortName(i).c_str(), STR_MAX); | |||
| portNameToId.name[STR_MAX] = '\0'; | |||
| fUsedMidiIns.append(portNameToId); | |||
| callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_PATCHBAY_GROUP_MIDI_IN, portNameToId.portId, PATCHBAY_PORT_TYPE_MIDI, 0.0f, portNameToId.name); | |||
| @@ -488,8 +489,9 @@ public: | |||
| for (unsigned int i=0, count=fDummyMidiOut.getPortCount(); i < count; ++i) | |||
| { | |||
| PortNameToId portNameToId; | |||
| portNameToId.portId = RACK_PATCHBAY_GROUP_MIDI_OUT*1000 + i; | |||
| portNameToId.portId = int(RACK_PATCHBAY_GROUP_MIDI_OUT*1000 + i); | |||
| std::strncpy(portNameToId.name, fDummyMidiOut.getPortName(i).c_str(), STR_MAX); | |||
| portNameToId.name[STR_MAX] = '\0'; | |||
| fUsedMidiOuts.append(portNameToId); | |||
| callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, 0, RACK_PATCHBAY_GROUP_MIDI_OUT, portNameToId.portId, PATCHBAY_PORT_TYPE_MIDI|PATCHBAY_PORT_IS_INPUT, portNameToId.name); | |||
| @@ -754,27 +756,29 @@ protected: | |||
| CARLA_SAFE_ASSERT_RETURN(static_cast<size_t>(portId) < fUsedMidiIns.count(), false); | |||
| carla_debug("CarlaEngineRtAudio::connectRackMidiInPort(%i)", portId); | |||
| const char* const portName(fUsedMidiIns.getAt(portId).name); | |||
| const char* const portName(fUsedMidiIns.getAt(static_cast<size_t>(portId)).name); | |||
| char newPortName[STR_MAX+1]; | |||
| std::snprintf(newPortName, STR_MAX, "%s:in-%i", (const char*)getName(), portId+1); | |||
| int rtMidiPortIndex = -1; | |||
| bool found = false; | |||
| uint rtMidiPortIndex; | |||
| RtMidiIn* const rtMidiIn(new RtMidiIn(getMatchedAudioMidiAPi(fAudio.getCurrentApi()), newPortName, 512)); | |||
| rtMidiIn->ignoreTypes(); | |||
| rtMidiIn->setCallback(carla_rtmidi_callback, this); | |||
| for (unsigned int i=0, count=rtMidiIn->getPortCount(); i < count; ++i) | |||
| for (uint i=0, count=rtMidiIn->getPortCount(); i < count; ++i) | |||
| { | |||
| if (rtMidiIn->getPortName(i) == portName) | |||
| { | |||
| found = true; | |||
| rtMidiPortIndex = i; | |||
| break; | |||
| } | |||
| } | |||
| if (rtMidiPortIndex == -1) | |||
| if (! found) | |||
| { | |||
| delete rtMidiIn; | |||
| return false; | |||
| @@ -798,25 +802,27 @@ protected: | |||
| CARLA_SAFE_ASSERT_RETURN(static_cast<size_t>(portId) < fUsedMidiOuts.count(), false); | |||
| carla_debug("CarlaEngineRtAudio::connectRackMidiOutPort(%i)", portId); | |||
| const char* const portName(fUsedMidiOuts.getAt(portId).name); | |||
| const char* const portName(fUsedMidiOuts.getAt(static_cast<size_t>(portId)).name); | |||
| char newPortName[STR_MAX+1]; | |||
| std::snprintf(newPortName, STR_MAX, "%s:out-%i", (const char*)getName(), portId+1); | |||
| int rtMidiPortIndex = -1; | |||
| bool found = false; | |||
| uint rtMidiPortIndex; | |||
| RtMidiOut* const rtMidiOut(new RtMidiOut(getMatchedAudioMidiAPi(fAudio.getCurrentApi()), newPortName)); | |||
| for (unsigned int i=0, count=rtMidiOut->getPortCount(); i < count; ++i) | |||
| for (uint i=0, count=rtMidiOut->getPortCount(); i < count; ++i) | |||
| { | |||
| if (rtMidiOut->getPortName(i) == portName) | |||
| { | |||
| found = true; | |||
| rtMidiPortIndex = i; | |||
| break; | |||
| } | |||
| } | |||
| if (rtMidiPortIndex == -1) | |||
| if (! found) | |||
| { | |||
| delete rtMidiOut; | |||
| return false; | |||
| @@ -41,11 +41,11 @@ static bool gIsLoadingProject = false; | |||
| // ParamSymbol struct, needed for CarlaPlugin::loadSaveState() | |||
| struct ParamSymbol { | |||
| uint32_t index; | |||
| int32_t index; | |||
| const char* symbol; | |||
| ParamSymbol(uint32_t i, const char* s) | |||
| : index(i), | |||
| : index(static_cast<int32_t>(i)), | |||
| symbol(carla_strdup(s)) {} | |||
| ~ParamSymbol() | |||
| @@ -480,8 +480,8 @@ const SaveState& CarlaPlugin::getSaveState() | |||
| { | |||
| const MidiProgramData& mpData(pData->midiprog.getCurrent()); | |||
| pData->saveState.currentMidiBank = mpData.bank; | |||
| pData->saveState.currentMidiProgram = mpData.program; | |||
| pData->saveState.currentMidiBank = static_cast<int32_t>(mpData.bank); | |||
| pData->saveState.currentMidiProgram = static_cast<int32_t>(mpData.program); | |||
| } | |||
| // --------------------------------------------------------------- | |||
| @@ -496,7 +496,7 @@ const SaveState& CarlaPlugin::getSaveState() | |||
| if (paramData.type != PARAMETER_INPUT || (paramData.hints & PARAMETER_IS_ENABLED) == 0) | |||
| continue; | |||
| StateParameter* stateParameter(new StateParameter()); | |||
| StateParameter* const stateParameter(new StateParameter()); | |||
| stateParameter->index = paramData.index; | |||
| stateParameter->midiCC = paramData.midiCC; | |||
| @@ -584,7 +584,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||
| if (strBuf[0] != '\0' && std::strcmp(saveState.currentProgramName, strBuf) == 0) | |||
| { | |||
| programId = i; | |||
| programId = static_cast<int32_t>(i); | |||
| break; | |||
| } | |||
| } | |||
| @@ -599,7 +599,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||
| // Part 3 - set midi program | |||
| if (saveState.currentMidiBank >= 0 && saveState.currentMidiProgram >= 0 && ! usesMultiProgs) | |||
| setMidiProgramById(saveState.currentMidiBank, saveState.currentMidiProgram, true, true, true); | |||
| setMidiProgramById(static_cast<uint32_t>(saveState.currentMidiBank), static_cast<uint32_t>(saveState.currentMidiProgram), true, true, true); | |||
| // --------------------------------------------------------------- | |||
| // Part 4a - get plugin parameter symbols | |||
| @@ -686,10 +686,10 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||
| if (pData->param.data[index].hints & PARAMETER_USES_SAMPLERATE) | |||
| stateParameter->value *= sampleRate; | |||
| setParameterValue(index, stateParameter->value, true, true, true); | |||
| setParameterValue(static_cast<uint32_t>(index), stateParameter->value, true, true, true); | |||
| #ifndef BUILD_BRIDGE | |||
| setParameterMidiCC(index, stateParameter->midiCC, true, true); | |||
| setParameterMidiChannel(index, stateParameter->midiChannel, true, true); | |||
| setParameterMidiCC(static_cast<uint32_t>(index), stateParameter->midiCC, true, true); | |||
| setParameterMidiChannel(static_cast<uint32_t>(index), stateParameter->midiChannel, true, true); | |||
| #endif | |||
| } | |||
| else | |||
| @@ -1020,11 +1020,11 @@ void CarlaPlugin::setParameterValue(const uint32_t parameterId, const float valu | |||
| uiParameterChange(parameterId, value); | |||
| if (sendOsc && pData->engine->isOscControlRegistered()) | |||
| pData->engine->oscSend_control_set_parameter_value(pData->id, parameterId, value); | |||
| pData->engine->oscSend_control_set_parameter_value(pData->id, static_cast<int32_t>(parameterId), value); | |||
| #endif | |||
| if (sendCallback) | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, parameterId, 0, value, nullptr); | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, static_cast<int>(parameterId), 0, value, nullptr); | |||
| #ifdef BUILD_BRIDGE | |||
| return; | |||
| @@ -1088,7 +1088,7 @@ void CarlaPlugin::setParameterMidiChannel(const uint32_t parameterId, uint8_t ch | |||
| pData->engine->oscSend_control_set_parameter_midi_channel(pData->id, parameterId, channel); | |||
| if (sendCallback) | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED, pData->id, parameterId, channel, 0.0f, nullptr); | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED, pData->id, static_cast<int>(parameterId), channel, 0.0f, nullptr); | |||
| if (pData->hints & PLUGIN_IS_BRIDGE) | |||
| {} // TODO | |||
| @@ -1117,7 +1117,7 @@ void CarlaPlugin::setParameterMidiCC(const uint32_t parameterId, int16_t cc, con | |||
| pData->engine->oscSend_control_set_parameter_midi_cc(pData->id, parameterId, cc); | |||
| if (sendCallback) | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED, pData->id, parameterId, cc, 0.0f, nullptr); | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED, pData->id, static_cast<int>(parameterId), cc, 0.0f, nullptr); | |||
| if (pData->hints & PLUGIN_IS_BRIDGE) | |||
| {} // TODO | |||
| @@ -1233,7 +1233,7 @@ void CarlaPlugin::setProgram(const int32_t index, const bool sendGui, const bool | |||
| { | |||
| #ifndef BUILD_BRIDGE | |||
| if (sendGui) | |||
| uiProgramChange(index); | |||
| uiProgramChange(static_cast<uint32_t>(index)); | |||
| #endif | |||
| if (getType() == PLUGIN_FILE_CSD || getType() == PLUGIN_FILE_GIG || getType() == PLUGIN_FILE_SF2 || getType() == PLUGIN_FILE_SFZ) | |||
| @@ -1248,15 +1248,15 @@ void CarlaPlugin::setProgram(const int32_t index, const bool sendGui, const bool | |||
| #ifndef BUILD_BRIDGE | |||
| if (reallySendOsc) | |||
| { | |||
| pData->engine->oscSend_control_set_parameter_value(pData->id, static_cast<int32_t>(i), value); | |||
| pData->engine->oscSend_control_set_default_value(pData->id, i, value); | |||
| pData->engine->oscSend_control_set_parameter_value(pData->id, i, value); | |||
| } | |||
| #endif | |||
| if (sendCallback) | |||
| { | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, i, 0, value, nullptr); | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, pData->id, i, 0, value, nullptr); | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, static_cast<int>(i), 0, value, nullptr); | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, pData->id, static_cast<int>(i), 0, value, nullptr); | |||
| } | |||
| } | |||
| } | |||
| @@ -1295,7 +1295,7 @@ void CarlaPlugin::setMidiProgram(const int32_t index, const bool sendGui, const | |||
| { | |||
| #ifndef BUILD_BRIDGE | |||
| if (sendGui) | |||
| uiMidiProgramChange(index); | |||
| uiMidiProgramChange(static_cast<uint32_t>(index)); | |||
| #endif | |||
| if (getType() == PLUGIN_FILE_CSD || getType() == PLUGIN_FILE_GIG || getType() == PLUGIN_FILE_SF2 || getType() == PLUGIN_FILE_SFZ) | |||
| @@ -1310,15 +1310,15 @@ void CarlaPlugin::setMidiProgram(const int32_t index, const bool sendGui, const | |||
| #ifndef BUILD_BRIDGE | |||
| if (reallySendOsc) | |||
| { | |||
| pData->engine->oscSend_control_set_parameter_value(pData->id, static_cast<int32_t>(i), value); | |||
| pData->engine->oscSend_control_set_default_value(pData->id, i, value); | |||
| pData->engine->oscSend_control_set_parameter_value(pData->id, i, value); | |||
| } | |||
| #endif | |||
| if (sendCallback) | |||
| { | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, i, 0, value, nullptr); | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, pData->id, i, 0, value, nullptr); | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, static_cast<int>(i), 0, value, nullptr); | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, pData->id, static_cast<int>(i), 0, value, nullptr); | |||
| } | |||
| } | |||
| } | |||
| @@ -1337,7 +1337,7 @@ void CarlaPlugin::setMidiProgramById(const uint32_t bank, const uint32_t program | |||
| for (uint32_t i=0; i < pData->midiprog.count; ++i) | |||
| { | |||
| if (pData->midiprog.data[i].bank == bank && pData->midiprog.data[i].program == program) | |||
| return setMidiProgram(i, sendGui, sendOsc, sendCallback); | |||
| return setMidiProgram(static_cast<int32_t>(i), sendGui, sendOsc, sendCallback); | |||
| } | |||
| } | |||
| @@ -1516,7 +1516,7 @@ void CarlaPlugin::registerToOscClient() noexcept | |||
| pData->engine->oscSend_control_set_parameter_data(pData->id, i, paramData.type, paramData.hints, bufName, bufUnit); | |||
| pData->engine->oscSend_control_set_parameter_ranges1(pData->id, i, paramRanges.def, paramRanges.min, paramRanges.max); | |||
| pData->engine->oscSend_control_set_parameter_ranges2(pData->id, i, paramRanges.step, paramRanges.stepSmall, paramRanges.stepLarge); | |||
| pData->engine->oscSend_control_set_parameter_value(pData->id, i, getParameterValue(i)); | |||
| pData->engine->oscSend_control_set_parameter_value(pData->id, static_cast<int32_t>(i), getParameterValue(i)); | |||
| pData->engine->oscSend_control_set_parameter_midi_cc(pData->id, i, paramData.midiCC); | |||
| pData->engine->oscSend_control_set_parameter_midi_channel(pData->id, i, paramData.midiChannel); | |||
| #endif | |||
| @@ -1635,7 +1635,7 @@ void CarlaPlugin::updateOscData(const lo_address& source, const char* const url) | |||
| } | |||
| if (pData->prog.current >= 0) | |||
| osc_send_program(pData->osc.data, pData->prog.current); | |||
| osc_send_program(pData->osc.data, static_cast<uint32_t>(pData->prog.current)); | |||
| if (pData->midiprog.current >= 0) | |||
| { | |||
| @@ -1694,7 +1694,7 @@ void CarlaPlugin::sendMidiSingleNote(const uint8_t channel, const uint8_t note, | |||
| return; | |||
| ExternalMidiNote extNote; | |||
| extNote.channel = channel; | |||
| extNote.channel = static_cast<int8_t>(channel); | |||
| extNote.note = note; | |||
| extNote.velo = velo; | |||
| @@ -1764,7 +1764,7 @@ void CarlaPlugin::postRtEventsRun() | |||
| case kPluginPostRtEventParameterChange: | |||
| // Update UI | |||
| if (event.value1 >= 0) | |||
| uiParameterChange(event.value1, event.value3); | |||
| uiParameterChange(static_cast<uint32_t>(event.value1), event.value3); | |||
| #ifndef BUILD_BRIDGE | |||
| if (event.value2 != 1) | |||
| @@ -1782,7 +1782,7 @@ void CarlaPlugin::postRtEventsRun() | |||
| case kPluginPostRtEventProgramChange: | |||
| // Update UI | |||
| if (event.value1 >= 0) | |||
| uiProgramChange(event.value1); | |||
| uiProgramChange(static_cast<uint32_t>(event.value1)); | |||
| #ifndef BUILD_BRIDGE | |||
| // Update OSC control client | |||
| @@ -1798,16 +1798,16 @@ void CarlaPlugin::postRtEventsRun() | |||
| for (uint32_t j=0; j < pData->param.count; ++j) | |||
| { | |||
| const float value(getParameterValue(j)); | |||
| const float paramValue(getParameterValue(j)); | |||
| if (sendOsc) | |||
| { | |||
| pData->engine->oscSend_control_set_parameter_value(pData->id, j, value); | |||
| pData->engine->oscSend_control_set_parameter_value(pData->id, static_cast<int32_t>(j), paramValue); | |||
| pData->engine->oscSend_control_set_default_value(pData->id, j, pData->param.ranges[j].def); | |||
| } | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, j, 0, value, nullptr); | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, pData->id, j, 0, pData->param.ranges[j].def, nullptr); | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, static_cast<int>(j), 0, paramValue, nullptr); | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, pData->id, static_cast<int>(j), 0, pData->param.ranges[j].def, nullptr); | |||
| } | |||
| } | |||
| #endif | |||
| @@ -1816,7 +1816,7 @@ void CarlaPlugin::postRtEventsRun() | |||
| case kPluginPostRtEventMidiProgramChange: | |||
| // Update UI | |||
| if (event.value1 >= 0) | |||
| uiMidiProgramChange(event.value1); | |||
| uiMidiProgramChange(static_cast<uint32_t>(event.value1)); | |||
| #ifndef BUILD_BRIDGE | |||
| // Update OSC control client | |||
| @@ -1832,16 +1832,16 @@ void CarlaPlugin::postRtEventsRun() | |||
| for (uint32_t j=0; j < pData->param.count; ++j) | |||
| { | |||
| const float value(getParameterValue(j)); | |||
| const float paramValue(getParameterValue(j)); | |||
| if (sendOsc) | |||
| { | |||
| pData->engine->oscSend_control_set_parameter_value(pData->id, j, value); | |||
| pData->engine->oscSend_control_set_parameter_value(pData->id, static_cast<int32_t>(j), paramValue); | |||
| pData->engine->oscSend_control_set_default_value(pData->id, j, pData->param.ranges[j].def); | |||
| } | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, j, 0, value, nullptr); | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, pData->id, j, 0, pData->param.ranges[j].def, nullptr); | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, static_cast<int>(j), 0, paramValue, nullptr); | |||
| pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, pData->id, static_cast<int>(j), 0, pData->param.ranges[j].def, nullptr); | |||
| } | |||
| } | |||
| #endif | |||
| @@ -1849,9 +1849,9 @@ void CarlaPlugin::postRtEventsRun() | |||
| case kPluginPostRtEventNoteOn: | |||
| { | |||
| CARLA_SAFE_ASSERT_BREAK(event.value1 < MAX_MIDI_CHANNELS); | |||
| CARLA_SAFE_ASSERT_BREAK(event.value2 < MAX_MIDI_NOTE); | |||
| CARLA_SAFE_ASSERT_BREAK(event.value3 < MAX_MIDI_VALUE); | |||
| CARLA_SAFE_ASSERT_BREAK(event.value1 >= 0 && event.value1 < MAX_MIDI_CHANNELS); | |||
| CARLA_SAFE_ASSERT_BREAK(event.value2 >= 0 && event.value2 < MAX_MIDI_NOTE); | |||
| CARLA_SAFE_ASSERT_BREAK(event.value3 >= 0 && event.value3 < MAX_MIDI_VALUE); | |||
| const uint8_t channel = static_cast<uint8_t>(event.value1); | |||
| const uint8_t note = static_cast<uint8_t>(event.value2); | |||
| @@ -1873,11 +1873,11 @@ void CarlaPlugin::postRtEventsRun() | |||
| case kPluginPostRtEventNoteOff: | |||
| { | |||
| CARLA_SAFE_ASSERT_BREAK(event.value1 < MAX_MIDI_CHANNELS); | |||
| CARLA_SAFE_ASSERT_BREAK(event.value2 < MAX_MIDI_NOTE); | |||
| CARLA_SAFE_ASSERT_BREAK(event.value1 >= 0 && event.value1 < MAX_MIDI_CHANNELS); | |||
| CARLA_SAFE_ASSERT_BREAK(event.value2 >= 0 && event.value2 < MAX_MIDI_NOTE); | |||
| const uint8_t channel = static_cast<uint8_t>(event.value1); | |||
| const uint8_t note = static_cast<uint8_t>(event.value2); | |||
| const uint8_t channel = static_cast<uint8_t>(event.value1); | |||
| const uint8_t note = static_cast<uint8_t>(event.value2); | |||
| // Update UI | |||
| uiNoteOff(channel, note); | |||
| @@ -23,7 +23,7 @@ | |||
| CARLA_BACKEND_START_NAMESPACE | |||
| const char* PluginThreadMode2str(const CarlaPluginThread::Mode mode) | |||
| static const char* PluginThreadMode2str(const CarlaPluginThread::Mode mode) | |||
| { | |||
| switch (mode) | |||
| { | |||
| @@ -177,7 +177,7 @@ void CarlaPluginThread::run() | |||
| if (fProcess->state() != QProcess::NotRunning && shouldExit()) | |||
| { | |||
| fProcess->waitForFinished(fEngine->getOptions().uiBridgesTimeout); | |||
| fProcess->waitForFinished(static_cast<int>(fEngine->getOptions().uiBridgesTimeout)); | |||
| if (fProcess->state() == QProcess::Running) | |||
| { | |||
| @@ -98,7 +98,7 @@ public: | |||
| { | |||
| showCustomUI(false); | |||
| pData->osc.thread.stop(pData->engine->getOptions().uiBridgesTimeout * 2); | |||
| pData->osc.thread.stop(static_cast<int>(pData->engine->getOptions().uiBridgesTimeout * 2)); | |||
| } | |||
| pData->singleMutex.lock(); | |||
| @@ -163,7 +163,7 @@ public: | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, 0); | |||
| return fDescriptor->UniqueID; | |||
| return static_cast<long>(fDescriptor->UniqueID); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -371,7 +371,7 @@ public: | |||
| CARLA_SAFE_ASSERT_RETURN(chunk.size() > 0,); | |||
| const ScopedSingleProcessLocker spl(this, true); | |||
| fDssiDescriptor->set_custom_data(fHandle, chunk.data(), chunk.size()); | |||
| fDssiDescriptor->set_custom_data(fHandle, chunk.data(), static_cast<ulong>(chunk.size())); | |||
| } | |||
| void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override | |||
| @@ -421,7 +421,7 @@ public: | |||
| pData->osc.data.free(); | |||
| } | |||
| pData->osc.thread.stop(pData->engine->getOptions().uiBridgesTimeout); | |||
| pData->osc.thread.stop(static_cast<int>(pData->engine->getOptions().uiBridgesTimeout * 2)); | |||
| } | |||
| } | |||
| @@ -449,7 +449,7 @@ public: | |||
| const float sampleRate(static_cast<float>(pData->engine->getSampleRate())); | |||
| const uint32_t portCount(static_cast<uint32_t>(fDescriptor->PortCount)); | |||
| uint32_t aIns, aOuts, mIns, params, j; | |||
| uint32_t aIns, aOuts, mIns, params; | |||
| aIns = aOuts = mIns = params = 0; | |||
| bool forcedStereoIn, forcedStereoOut; | |||
| @@ -559,7 +559,7 @@ public: | |||
| if (LADSPA_IS_PORT_INPUT(portType)) | |||
| { | |||
| j = iAudioIn++; | |||
| uint32_t j = iAudioIn++; | |||
| pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true); | |||
| pData->audioIn.ports[j].rindex = i; | |||
| @@ -572,7 +572,7 @@ public: | |||
| } | |||
| else if (LADSPA_IS_PORT_OUTPUT(portType)) | |||
| { | |||
| j = iAudioOut++; | |||
| uint32_t j = iAudioOut++; | |||
| pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[j].rindex = i; | |||
| @@ -588,11 +588,11 @@ public: | |||
| } | |||
| else if (LADSPA_IS_PORT_CONTROL(portType)) | |||
| { | |||
| j = iCtrl++; | |||
| uint32_t j = iCtrl++; | |||
| pData->param.data[j].type = PARAMETER_UNKNOWN; | |||
| pData->param.data[j].hints = 0x0; | |||
| pData->param.data[j].index = j; | |||
| pData->param.data[j].rindex = i; | |||
| pData->param.data[j].index = static_cast<int32_t>(j); | |||
| pData->param.data[j].rindex = static_cast<int32_t>(i); | |||
| pData->param.data[j].midiCC = -1; | |||
| pData->param.data[j].midiChannel = 0; | |||
| @@ -824,7 +824,7 @@ public: | |||
| float tmpIn[aIns][2]; | |||
| float tmpOut[aOuts][2]; | |||
| for (j=0; j < aIns; ++j) | |||
| for (uint32_t j=0; j < aIns; ++j) | |||
| { | |||
| tmpIn[j][0] = 0.0f; | |||
| tmpIn[j][1] = 0.0f; | |||
| @@ -832,7 +832,7 @@ public: | |||
| fDescriptor->connect_port(fHandle, pData->audioIn.ports[j].rindex, tmpIn[j]); | |||
| } | |||
| for (j=0; j < aOuts; ++j) | |||
| for (uint32_t j=0; j < aOuts; ++j) | |||
| { | |||
| tmpOut[j][0] = 0.0f; | |||
| tmpOut[j][1] = 0.0f; | |||
| @@ -873,26 +873,26 @@ public: | |||
| void reloadPrograms(const bool doInit) override | |||
| { | |||
| carla_debug("DssiPlugin::reloadPrograms(%s)", bool2str(doInit)); | |||
| uint32_t i, oldCount = pData->midiprog.count; | |||
| const int32_t current = pData->midiprog.current; | |||
| const uint32_t oldCount = pData->midiprog.count; | |||
| const int32_t current = pData->midiprog.current; | |||
| // Delete old programs | |||
| pData->midiprog.clear(); | |||
| // Query new programs | |||
| uint32_t count = 0; | |||
| uint32_t newCount = 0; | |||
| if (fDssiDescriptor->get_program != nullptr && fDssiDescriptor->select_program != nullptr) | |||
| { | |||
| while (fDssiDescriptor->get_program(fHandle, count)) | |||
| count++; | |||
| while (fDssiDescriptor->get_program(fHandle, newCount)) | |||
| newCount++; | |||
| } | |||
| if (count > 0) | |||
| if (newCount > 0) | |||
| { | |||
| pData->midiprog.createNew(count); | |||
| pData->midiprog.createNew(newCount); | |||
| // Update data | |||
| for (i=0; i < count; ++i) | |||
| for (uint32_t i=0; i < newCount; ++i) | |||
| { | |||
| const DSSI_Program_Descriptor* const pdesc(fDssiDescriptor->get_program(fHandle, i)); | |||
| CARLA_ASSERT(pdesc != nullptr); | |||
| @@ -908,16 +908,16 @@ public: | |||
| // Update OSC Names | |||
| if (pData->engine->isOscControlRegistered()) | |||
| { | |||
| pData->engine->oscSend_control_set_midi_program_count(pData->id, count); | |||
| pData->engine->oscSend_control_set_midi_program_count(pData->id, newCount); | |||
| for (i=0; i < count; ++i) | |||
| for (uint32_t i=0; i < newCount; ++i) | |||
| pData->engine->oscSend_control_set_midi_program_data(pData->id, i, pData->midiprog.data[i].bank, pData->midiprog.data[i].program, pData->midiprog.data[i].name); | |||
| } | |||
| #endif | |||
| if (doInit) | |||
| { | |||
| if (count > 0) | |||
| if (newCount > 0) | |||
| setMidiProgram(0, false, false, false); | |||
| } | |||
| else | |||
| @@ -925,25 +925,25 @@ public: | |||
| // Check if current program is invalid | |||
| bool programChanged = false; | |||
| if (count == oldCount+1) | |||
| if (newCount == oldCount+1) | |||
| { | |||
| // one midi program added, probably created by user | |||
| pData->midiprog.current = oldCount; | |||
| pData->midiprog.current = static_cast<int32_t>(oldCount); | |||
| programChanged = true; | |||
| } | |||
| else if (current < 0 && count > 0) | |||
| else if (current < 0 && newCount > 0) | |||
| { | |||
| // programs exist now, but not before | |||
| pData->midiprog.current = 0; | |||
| programChanged = true; | |||
| } | |||
| else if (current >= 0 && count == 0) | |||
| else if (current >= 0 && newCount == 0) | |||
| { | |||
| // programs existed before, but not anymore | |||
| pData->midiprog.current = -1; | |||
| programChanged = true; | |||
| } | |||
| else if (current >= static_cast<int32_t>(count)) | |||
| else if (current >= static_cast<int32_t>(newCount)) | |||
| { | |||
| // current midi program > count | |||
| pData->midiprog.current = 0; | |||
| @@ -1049,7 +1049,7 @@ public: | |||
| for (unsigned char i=0; i < MAX_MIDI_NOTE; ++i) | |||
| { | |||
| fMidiEvents[i].type = SND_SEQ_EVENT_NOTEOFF; | |||
| fMidiEvents[i].data.note.channel = pData->ctrlChannel; | |||
| fMidiEvents[i].data.note.channel = static_cast<uchar>(pData->ctrlChannel); | |||
| fMidiEvents[i].data.note.note = i; | |||
| } | |||
| } | |||
| @@ -1085,7 +1085,7 @@ public: | |||
| carla_zeroStruct<snd_seq_event_t>(midiEvent); | |||
| midiEvent.type = (note.velo > 0) ? SND_SEQ_EVENT_NOTEON : SND_SEQ_EVENT_NOTEOFF; | |||
| midiEvent.data.note.channel = note.channel; | |||
| midiEvent.data.note.channel = static_cast<uchar>(note.channel); | |||
| midiEvent.data.note.note = note.note; | |||
| midiEvent.data.note.velocity = note.velo; | |||
| } | |||
| @@ -1266,8 +1266,9 @@ public: | |||
| { | |||
| if (pData->midiprog.data[k].bank == nextBankId && pData->midiprog.data[k].program == nextProgramId) | |||
| { | |||
| setMidiProgram(k, false, false, false); | |||
| pData->postponeRtEvent(kPluginPostRtEventMidiProgramChange, k, 0, 0.0f); | |||
| const int32_t index(static_cast<int32_t>(k)); | |||
| setMidiProgram(index, false, false, false); | |||
| pData->postponeRtEvent(kPluginPostRtEventMidiProgramChange, index, 0, 0.0f); | |||
| break; | |||
| } | |||
| } | |||
| @@ -135,7 +135,7 @@ public: | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, 0); | |||
| return fDescriptor->UniqueID; | |||
| return static_cast<long>(fDescriptor->UniqueID); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -415,7 +415,7 @@ public: | |||
| const float sampleRate(static_cast<float>(pData->engine->getSampleRate())); | |||
| const uint32_t portCount(static_cast<uint32_t>(fDescriptor->PortCount)); | |||
| uint32_t aIns, aOuts, params, j; | |||
| uint32_t aIns, aOuts, params; | |||
| aIns = aOuts = params = 0; | |||
| bool forcedStereoIn, forcedStereoOut; | |||
| @@ -520,7 +520,7 @@ public: | |||
| if (LADSPA_IS_PORT_INPUT(portType)) | |||
| { | |||
| j = iAudioIn++; | |||
| uint32_t j = iAudioIn++; | |||
| pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true); | |||
| pData->audioIn.ports[j].rindex = i; | |||
| @@ -533,7 +533,7 @@ public: | |||
| } | |||
| else if (LADSPA_IS_PORT_OUTPUT(portType)) | |||
| { | |||
| j = iAudioOut++; | |||
| uint32_t j = iAudioOut++; | |||
| pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[j].rindex = i; | |||
| @@ -549,11 +549,11 @@ public: | |||
| } | |||
| else if (LADSPA_IS_PORT_CONTROL(portType)) | |||
| { | |||
| j = iCtrl++; | |||
| uint32_t j = iCtrl++; | |||
| pData->param.data[j].type = PARAMETER_UNKNOWN; | |||
| pData->param.data[j].hints = 0x0; | |||
| pData->param.data[j].index = j; | |||
| pData->param.data[j].rindex = i; | |||
| pData->param.data[j].index = static_cast<int32_t>(j); | |||
| pData->param.data[j].rindex = static_cast<int32_t>(i); | |||
| pData->param.data[j].midiCC = -1; | |||
| pData->param.data[j].midiChannel = 0; | |||
| pData->param.special[j] = PARAMETER_SPECIAL_NULL; | |||
| @@ -774,7 +774,7 @@ public: | |||
| float tmpIn[aIns][2]; | |||
| float tmpOut[aOuts][2]; | |||
| for (j=0; j < aIns; ++j) | |||
| for (uint32_t j=0; j < aIns; ++j) | |||
| { | |||
| tmpIn[j][0] = 0.0f; | |||
| tmpIn[j][1] = 0.0f; | |||
| @@ -782,7 +782,7 @@ public: | |||
| fDescriptor->connect_port(fHandle, pData->audioIn.ports[j].rindex, tmpIn[j]); | |||
| } | |||
| for (j=0; j < aOuts; ++j) | |||
| for (uint32_t j=0; j < aOuts; ++j) | |||
| { | |||
| tmpOut[j][0] = 0.0f; | |||
| tmpOut[j][1] = 0.0f; | |||
| @@ -27,8 +27,6 @@ | |||
| #include <QtCore/QStringList> | |||
| extern const char* carla_file_callback(FileCallbackOpcode action, bool isDir, const char* title, const char* filter); | |||
| CARLA_BACKEND_START_NAMESPACE | |||
| #if 0 | |||
| @@ -2081,12 +2079,12 @@ protected: | |||
| const char* handleUiOpenFile(const bool isDir, const char* const title, const char* const filter) | |||
| { | |||
| return carla_file_callback(FILE_CALLBACK_OPEN, isDir, title, filter); | |||
| return carla_standalone_file_callback(FILE_CALLBACK_OPEN, isDir, title, filter); | |||
| } | |||
| const char* handleUiSaveFile(const bool isDir, const char* const title, const char* const filter) | |||
| { | |||
| return carla_file_callback(FILE_CALLBACK_SAVE, isDir, title, filter); | |||
| return carla_standalone_file_callback(FILE_CALLBACK_SAVE, isDir, title, filter); | |||
| } | |||
| intptr_t handleDispatcher(const NativeHostDispatcherOpcode opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt) | |||
| @@ -719,11 +719,11 @@ void carla_set_file_callback(FileCallbackFunc func, void* ptr) | |||
| gStandalone.fileCallbackPtr = ptr; | |||
| } | |||
| const char* carla_file_callback(FileCallbackOpcode action, bool isDir, const char* title, const char* filter) | |||
| const char* carla_standalone_file_callback(FileCallbackOpcode action, bool isDir, const char* title, const char* filter) | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(title != nullptr && title[0] != '\0', nullptr); | |||
| CARLA_SAFE_ASSERT_RETURN(filter != nullptr && filter[0] != '\0', nullptr); | |||
| carla_debug("carla_file_callback(%i:%s, %s, \"%s\", \"%s\")", action, CB::FileCallbackOpcode2Str(action), bool2str(isDir), title, filter); | |||
| carla_debug("carla_standalone_file_callback(%i:%s, %s, \"%s\", \"%s\")", action, CB::FileCallbackOpcode2Str(action), bool2str(isDir), title, filter); | |||
| if (gStandalone.fileCallback == nullptr) | |||
| return nullptr; | |||
| @@ -788,7 +788,7 @@ bool carla_patchbay_connect(int portIdA, int portIdB) | |||
| return false; | |||
| } | |||
| bool carla_patchbay_disconnect(int connectionId) | |||
| bool carla_patchbay_disconnect(uint connectionId) | |||
| { | |||
| carla_debug("carla_patchbay_disconnect(%i)", connectionId); | |||
| @@ -1750,7 +1750,7 @@ class Host(object): | |||
| self.lib.carla_patchbay_connect.argtypes = [c_int, c_int] | |||
| self.lib.carla_patchbay_connect.restype = c_bool | |||
| self.lib.carla_patchbay_disconnect.argtypes = [c_int] | |||
| self.lib.carla_patchbay_disconnect.argtypes = [c_uint] | |||
| self.lib.carla_patchbay_disconnect.restype = c_bool | |||
| self.lib.carla_patchbay_refresh.argtypes = None | |||
| @@ -229,6 +229,7 @@ private: \ | |||
| #endif | |||
| /* Useful typedefs */ | |||
| typedef unsigned char uchar; | |||
| typedef unsigned long int ulong; | |||
| typedef unsigned short int ushort; | |||
| typedef unsigned int uint; | |||
| @@ -315,6 +315,25 @@ public: | |||
| return false; | |||
| } | |||
| bool readNextLineAsUInt(uint& value) | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fIsReading, false); | |||
| if (const char* const msg = readline()) | |||
| { | |||
| int tmp = std::atoi(msg); | |||
| delete[] msg; | |||
| if (tmp >= 0) | |||
| { | |||
| value = static_cast<uint>(tmp); | |||
| return true; | |||
| } | |||
| } | |||
| return false; | |||
| } | |||
| bool readNextLineAsLong(long& value) | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fIsReading, false); | |||
| @@ -30,7 +30,7 @@ CARLA_BACKEND_START_NAMESPACE | |||
| // StateParameter | |||
| StateParameter::StateParameter() noexcept | |||
| : index(0), | |||
| : index(-1), | |||
| name(nullptr), | |||
| symbol(nullptr), | |||
| value(0.0f), | |||
| @@ -169,7 +169,7 @@ void SaveState::reset() | |||
| // ----------------------------------------------------------------------- | |||
| // xmlSafeString | |||
| QString xmlSafeString(const QString& string, const bool toXml) | |||
| static QString xmlSafeString(const QString& string, const bool toXml) | |||
| { | |||
| QString newString(string); | |||
| @@ -179,7 +179,7 @@ QString xmlSafeString(const QString& string, const bool toXml) | |||
| return newString.replace("&","&").replace("<","<").replace(">",">").replace("'","'").replace(""","\""); | |||
| } | |||
| const char* xmlSafeStringCharDup(const QString& string, const bool toXml) | |||
| static const char* xmlSafeStringCharDup(const QString& string, const bool toXml) | |||
| { | |||
| return carla_strdup(xmlSafeString(string, toXml).toUtf8().constData()); | |||
| } | |||
| @@ -334,8 +334,8 @@ void fillSaveStateFromXmlNode(SaveState& saveState, const QDomNode& xmlNode) | |||
| if (pTag.compare("index", Qt::CaseInsensitive) == 0) | |||
| { | |||
| bool ok; | |||
| const uint index(pText.toUInt(&ok)); | |||
| if (ok) stateParameter->index = index; | |||
| const int index(pText.toInt(&ok)); | |||
| if (ok && index >= 0) stateParameter->index = index; | |||
| } | |||
| else if (pTag.compare("name", Qt::CaseInsensitive) == 0) | |||
| { | |||
| @@ -34,7 +34,7 @@ CARLA_BACKEND_START_NAMESPACE | |||
| // ----------------------------------------------------------------------- | |||
| struct StateParameter { | |||
| uint32_t index; | |||
| int32_t index; | |||
| const char* name; | |||
| const char* symbol; | |||
| float value; | |||