| @@ -214,7 +214,7 @@ struct CARLA_API EngineEvent { | |||
| /*! | |||
| * Fill this event from MIDI data. | |||
| */ | |||
| void fillFromMidiData(const uint8_t size, const uint8_t* const data) noexcept; | |||
| void fillFromMidiData(const uint8_t size, const uint8_t* const data, const uint8_t midiPortOffset) noexcept; | |||
| }; | |||
| // ----------------------------------------------------------------------- | |||
| @@ -319,7 +319,7 @@ protected: | |||
| * The constructor. | |||
| * All constructor parameters are constant and will never change in the lifetime of the port. | |||
| */ | |||
| CarlaEnginePort(const CarlaEngineClient& client, const bool isInputPort) noexcept; | |||
| CarlaEnginePort(const CarlaEngineClient& client, const bool isInputPort, const uint32_t indexOffset) noexcept; | |||
| public: | |||
| /*! | |||
| @@ -356,7 +356,8 @@ public: | |||
| #ifndef DOXYGEN | |||
| protected: | |||
| const CarlaEngineClient& kClient; | |||
| const bool kIsInput; | |||
| const bool kIsInput; | |||
| const uint32_t kIndexOffset; | |||
| CARLA_DECLARE_NON_COPY_CLASS(CarlaEnginePort) | |||
| #endif | |||
| @@ -372,7 +373,7 @@ public: | |||
| * The constructor. | |||
| * All constructor parameters are constant and will never change in the lifetime of the port. | |||
| */ | |||
| CarlaEngineAudioPort(const CarlaEngineClient& client, const bool isInputPort) noexcept; | |||
| CarlaEngineAudioPort(const CarlaEngineClient& client, const bool isInputPort, const uint32_t indexOffset) noexcept; | |||
| /*! | |||
| * The destructor. | |||
| @@ -419,7 +420,7 @@ public: | |||
| * The constructor. | |||
| * All constructor parameters are constant and will never change in the lifetime of the port. | |||
| */ | |||
| CarlaEngineCVPort(const CarlaEngineClient& client, const bool isInputPort) noexcept; | |||
| CarlaEngineCVPort(const CarlaEngineClient& client, const bool isInputPort, const uint32_t indexOffset) noexcept; | |||
| /*! | |||
| * The destructor. | |||
| @@ -466,7 +467,7 @@ public: | |||
| * The constructor. | |||
| * All constructor parameters are constant and will never change in the lifetime of the port. | |||
| */ | |||
| CarlaEngineEventPort(const CarlaEngineClient& client, const bool isInputPort) noexcept; | |||
| CarlaEngineEventPort(const CarlaEngineClient& client, const bool isInputPort, const uint32_t indexOffset) noexcept; | |||
| /*! | |||
| * The destructor. | |||
| @@ -533,7 +534,7 @@ public: | |||
| * 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) noexcept; | |||
| virtual bool writeMidiEvent(const uint32_t time, const uint8_t channel, const uint8_t size, const uint8_t* const data) noexcept; | |||
| #ifndef DOXYGEN | |||
| protected: | |||
| @@ -605,7 +606,7 @@ public: | |||
| * Add a new port of type @a portType. | |||
| * @note This function does nothing in rack processing mode since ports are static there. | |||
| */ | |||
| virtual CarlaEnginePort* addPort(const EnginePortType portType, const char* const name, const bool isInput); | |||
| virtual CarlaEnginePort* addPort(const EnginePortType portType, const char* const name, const bool isInput, const uint32_t indexOffset); | |||
| /*! | |||
| * Get this client's engine. | |||
| @@ -105,7 +105,7 @@ void CarlaEngineClient::setLatency(const uint32_t samples) noexcept | |||
| pData->latency = samples; | |||
| } | |||
| CarlaEnginePort* CarlaEngineClient::addPort(const EnginePortType portType, const char* const name, const bool isInput) | |||
| CarlaEnginePort* CarlaEngineClient::addPort(const EnginePortType portType, const char* const name, const bool isInput, const uint32_t indexOffset) | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', nullptr); | |||
| carla_debug("CarlaEngineClient::addPort(%i:%s, \"%s\", %s)", portType, EnginePortType2Str(portType), name, bool2str(isInput)); | |||
| @@ -116,13 +116,13 @@ CarlaEnginePort* CarlaEngineClient::addPort(const EnginePortType portType, const | |||
| break; | |||
| case kEnginePortTypeAudio: | |||
| _addAudioPortName(isInput, name); | |||
| return new CarlaEngineAudioPort(*this, isInput); | |||
| return new CarlaEngineAudioPort(*this, isInput, indexOffset); | |||
| case kEnginePortTypeCV: | |||
| _addCVPortName(isInput, name); | |||
| return new CarlaEngineCVPort(*this, isInput); | |||
| return new CarlaEngineCVPort(*this, isInput, indexOffset); | |||
| case kEnginePortTypeEvent: | |||
| _addEventPortName(isInput, name); | |||
| return new CarlaEngineEventPort(*this, isInput); | |||
| return new CarlaEngineEventPort(*this, isInput, indexOffset); | |||
| } | |||
| carla_stderr("CarlaEngineClient::addPort(%i, \"%s\", %s) - invalid type", portType, name, bool2str(isInput)); | |||
| @@ -84,7 +84,7 @@ void EngineControlEvent::convertToMidiData(const uint8_t channel, uint8_t& size, | |||
| // ----------------------------------------------------------------------- | |||
| // EngineEvent | |||
| void EngineEvent::fillFromMidiData(const uint8_t size, const uint8_t* const data) noexcept | |||
| void EngineEvent::fillFromMidiData(const uint8_t size, const uint8_t* const data, const uint8_t midiPortOffset) noexcept | |||
| { | |||
| if (size == 0 || data == nullptr || data[0] < MIDI_STATUS_NOTE_OFF) | |||
| { | |||
| @@ -156,7 +156,7 @@ void EngineEvent::fillFromMidiData(const uint8_t size, const uint8_t* const data | |||
| { | |||
| type = kEngineEventTypeMidi; | |||
| midi.port = 0; | |||
| midi.port = midiPortOffset; | |||
| midi.size = size; | |||
| if (size > EngineMidiEvent::kDataSize) | |||
| @@ -75,8 +75,8 @@ struct JackPortDeletionCallback { | |||
| class CarlaEngineJackAudioPort : public CarlaEngineAudioPort | |||
| { | |||
| public: | |||
| CarlaEngineJackAudioPort(const CarlaEngineClient& client, const bool isInputPort, jack_client_t* const jackClient, jack_port_t* const jackPort, JackPortDeletionCallback* const delCallback) noexcept | |||
| : CarlaEngineAudioPort(client, isInputPort), | |||
| CarlaEngineJackAudioPort(const CarlaEngineClient& client, const bool isInputPort, const uint32_t indexOffset, jack_client_t* const jackClient, jack_port_t* const jackPort, JackPortDeletionCallback* const delCallback) noexcept | |||
| : CarlaEngineAudioPort(client, isInputPort, indexOffset), | |||
| fJackClient(jackClient), | |||
| fJackPort(jackPort), | |||
| kDeletionCallback(delCallback), | |||
| @@ -168,8 +168,8 @@ private: | |||
| class CarlaEngineJackCVPort : public CarlaEngineCVPort | |||
| { | |||
| public: | |||
| CarlaEngineJackCVPort(const CarlaEngineClient& client, const bool isInputPort, jack_client_t* const jackClient, jack_port_t* const jackPort, JackPortDeletionCallback* const delCallback) noexcept | |||
| : CarlaEngineCVPort(client, isInputPort), | |||
| CarlaEngineJackCVPort(const CarlaEngineClient& client, const bool isInputPort, const uint32_t indexOffset, jack_client_t* const jackClient, jack_port_t* const jackPort, JackPortDeletionCallback* const delCallback) noexcept | |||
| : CarlaEngineCVPort(client, isInputPort, indexOffset), | |||
| fJackClient(jackClient), | |||
| fJackPort(jackPort), | |||
| kDeletionCallback(delCallback), | |||
| @@ -259,8 +259,8 @@ private: | |||
| class CarlaEngineJackEventPort : public CarlaEngineEventPort | |||
| { | |||
| public: | |||
| CarlaEngineJackEventPort(const CarlaEngineClient& client, const bool isInputPort, jack_client_t* const jackClient, jack_port_t* const jackPort, JackPortDeletionCallback* const delCallback) noexcept | |||
| : CarlaEngineEventPort(client, isInputPort), | |||
| CarlaEngineJackEventPort(const CarlaEngineClient& client, const bool isInputPort, const uint32_t indexOffset, jack_client_t* const jackClient, jack_port_t* const jackPort, JackPortDeletionCallback* const delCallback) noexcept | |||
| : CarlaEngineEventPort(client, isInputPort, indexOffset), | |||
| fJackClient(jackClient), | |||
| fJackPort(jackPort), | |||
| fJackBuffer(nullptr), | |||
| @@ -354,10 +354,22 @@ public: | |||
| if (! test) | |||
| return kFallbackJackEngineEvent; | |||
| CARLA_SAFE_ASSERT_RETURN(jackEvent.size < UINT8_MAX, kFallbackJackEngineEvent); | |||
| CARLA_SAFE_ASSERT_RETURN(jackEvent.size < 0xFF /* uint8_t max */, kFallbackJackEngineEvent); | |||
| uint8_t port; | |||
| if (kIndexOffset < 0xFF /* uint8_t max */) | |||
| { | |||
| port = kIndexOffset; | |||
| } | |||
| else | |||
| { | |||
| port = 0; | |||
| carla_safe_assert_int("kIndexOffset < 0xFF", __FILE__, __LINE__, kIndexOffset); | |||
| } | |||
| fRetEvent.time = jackEvent.time; | |||
| fRetEvent.fillFromMidiData(static_cast<uint8_t>(jackEvent.size), jackEvent.buffer); | |||
| fRetEvent.fillFromMidiData(static_cast<uint8_t>(jackEvent.size), jackEvent.buffer, port); | |||
| return fRetEvent; | |||
| } | |||
| @@ -392,10 +404,10 @@ public: | |||
| } CARLA_SAFE_EXCEPTION_RETURN("jack_midi_event_write", false); | |||
| } | |||
| 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 | |||
| bool writeMidiEvent(const uint32_t time, const uint8_t channel, const uint8_t size, const uint8_t* const data) noexcept override | |||
| { | |||
| if (fJackPort == nullptr) | |||
| return CarlaEngineEventPort::writeMidiEvent(time, channel, port, size, data); | |||
| return CarlaEngineEventPort::writeMidiEvent(time, channel, size, data); | |||
| CARLA_SAFE_ASSERT_RETURN(! kIsInput, false); | |||
| CARLA_SAFE_ASSERT_RETURN(fJackBuffer != nullptr, false); | |||
| @@ -514,7 +526,7 @@ public: | |||
| return CarlaEngineClient::isOk(); | |||
| } | |||
| CarlaEnginePort* addPort(const EnginePortType portType, const char* const name, const bool isInput) override | |||
| CarlaEnginePort* addPort(const EnginePortType portType, const char* const name, const bool isInput, const uint32_t indexOffset) override | |||
| { | |||
| carla_debug("CarlaEngineJackClient::addPort(%i:%s, \"%s\", %s)", portType, EnginePortType2Str(portType), name, bool2str(isInput)); | |||
| @@ -552,21 +564,21 @@ public: | |||
| case kEnginePortTypeAudio: { | |||
| _addAudioPortName(isInput, realName); | |||
| if (realName != name) delete[] realName; | |||
| CarlaEngineJackAudioPort* const enginePort(new CarlaEngineJackAudioPort(*this, isInput, fJackClient, jackPort, this)); | |||
| CarlaEngineJackAudioPort* const enginePort(new CarlaEngineJackAudioPort(*this, isInput, indexOffset, fJackClient, jackPort, this)); | |||
| fAudioPorts.append(enginePort); | |||
| return enginePort; | |||
| } | |||
| case kEnginePortTypeCV: { | |||
| _addCVPortName(isInput, realName); | |||
| if (realName != name) delete[] realName; | |||
| CarlaEngineJackCVPort* const enginePort(new CarlaEngineJackCVPort(*this, isInput, fJackClient, jackPort, this)); | |||
| CarlaEngineJackCVPort* const enginePort(new CarlaEngineJackCVPort(*this, isInput, indexOffset, fJackClient, jackPort, this)); | |||
| fCVPorts.append(enginePort); | |||
| return enginePort; | |||
| } | |||
| case kEnginePortTypeEvent: { | |||
| _addEventPortName(isInput, realName); | |||
| if (realName != name) delete[] realName; | |||
| CarlaEngineJackEventPort* const enginePort(new CarlaEngineJackEventPort(*this, isInput, fJackClient, jackPort, this)); | |||
| CarlaEngineJackEventPort* const enginePort(new CarlaEngineJackEventPort(*this, isInput, indexOffset, fJackClient, jackPort, this)); | |||
| fEventPorts.append(enginePort); | |||
| return enginePort; | |||
| } | |||
| @@ -1436,12 +1448,12 @@ protected: | |||
| if (! jackbridge_midi_event_get(&jackEvent, eventIn, jackEventIndex)) | |||
| continue; | |||
| CARLA_SAFE_ASSERT_CONTINUE(jackEvent.size <= 0xFF /* uint8_t max */); | |||
| CARLA_SAFE_ASSERT_CONTINUE(jackEvent.size < 0xFF /* uint8_t max */); | |||
| EngineEvent& engineEvent(pData->events.in[engineEventIndex++]); | |||
| engineEvent.time = jackEvent.time; | |||
| engineEvent.fillFromMidiData(static_cast<uint8_t>(jackEvent.size), jackEvent.buffer); | |||
| engineEvent.fillFromMidiData(static_cast<uint8_t>(jackEvent.size), jackEvent.buffer, 0); | |||
| if (engineEventIndex >= kMaxEngineEventInternalCount) | |||
| break; | |||
| @@ -455,7 +455,7 @@ protected: | |||
| else | |||
| engineEvent.time = static_cast<uint32_t>(midiEvent.time - pData->timeInfo.frame); | |||
| engineEvent.fillFromMidiData(midiEvent.size, midiEvent.data); | |||
| engineEvent.fillFromMidiData(midiEvent.size, midiEvent.data, 0); | |||
| if (engineEventIndex >= kMaxEngineEventInternalCount) | |||
| break; | |||
| @@ -1386,7 +1386,7 @@ protected: | |||
| EngineEvent& engineEvent(pData->events.in[engineEventIndex++]); | |||
| engineEvent.time = midiEvent.time; | |||
| engineEvent.fillFromMidiData(midiEvent.size, midiEvent.data); | |||
| engineEvent.fillFromMidiData(midiEvent.size, midiEvent.data, 0); | |||
| if (engineEventIndex >= kMaxEngineEventInternalCount) | |||
| break; | |||
| @@ -29,9 +29,10 @@ static const EngineEvent kFallbackEngineEvent = { kEngineEventTypeNull, 0, 0, {{ | |||
| // ----------------------------------------------------------------------- | |||
| // Carla Engine port (Abstract) | |||
| CarlaEnginePort::CarlaEnginePort(const CarlaEngineClient& client, const bool isInputPort) noexcept | |||
| CarlaEnginePort::CarlaEnginePort(const CarlaEngineClient& client, const bool isInputPort, const uint32_t indexOffset) noexcept | |||
| : kClient(client), | |||
| kIsInput(isInputPort) | |||
| kIsInput(isInputPort), | |||
| kIndexOffset(indexOffset) | |||
| { | |||
| carla_debug("CarlaEnginePort::CarlaEnginePort(%s)", bool2str(isInputPort)); | |||
| } | |||
| @@ -44,8 +45,8 @@ CarlaEnginePort::~CarlaEnginePort() noexcept | |||
| // ----------------------------------------------------------------------- | |||
| // Carla Engine Audio port | |||
| CarlaEngineAudioPort::CarlaEngineAudioPort(const CarlaEngineClient& client, const bool isInputPort) noexcept | |||
| : CarlaEnginePort(client, isInputPort), | |||
| CarlaEngineAudioPort::CarlaEngineAudioPort(const CarlaEngineClient& client, const bool isInputPort, const uint32_t indexOffset) noexcept | |||
| : CarlaEnginePort(client, isInputPort, indexOffset), | |||
| fBuffer(nullptr) | |||
| { | |||
| carla_debug("CarlaEngineAudioPort::CarlaEngineAudioPort(%s)", bool2str(isInputPort)); | |||
| @@ -63,8 +64,8 @@ void CarlaEngineAudioPort::initBuffer() noexcept | |||
| // ----------------------------------------------------------------------- | |||
| // Carla Engine CV port | |||
| CarlaEngineCVPort::CarlaEngineCVPort(const CarlaEngineClient& client, const bool isInputPort) noexcept | |||
| : CarlaEnginePort(client, isInputPort), | |||
| CarlaEngineCVPort::CarlaEngineCVPort(const CarlaEngineClient& client, const bool isInputPort, const uint32_t indexOffset) noexcept | |||
| : CarlaEnginePort(client, isInputPort, indexOffset), | |||
| fBuffer(nullptr) | |||
| { | |||
| carla_debug("CarlaEngineCVPort::CarlaEngineCVPort(%s)", bool2str(isInputPort)); | |||
| @@ -82,8 +83,8 @@ void CarlaEngineCVPort::initBuffer() noexcept | |||
| // ----------------------------------------------------------------------- | |||
| // Carla Engine Event port | |||
| CarlaEngineEventPort::CarlaEngineEventPort(const CarlaEngineClient& client, const bool isInputPort) noexcept | |||
| : CarlaEnginePort(client, isInputPort), | |||
| CarlaEngineEventPort::CarlaEngineEventPort(const CarlaEngineClient& client, const bool isInputPort, const uint32_t indexOffset) noexcept | |||
| : CarlaEnginePort(client, isInputPort, indexOffset), | |||
| fBuffer(nullptr), | |||
| kProcessMode(client.getEngine().getProccessMode()) | |||
| { | |||
| @@ -188,15 +189,16 @@ bool CarlaEngineEventPort::writeControlEvent(const uint32_t time, const uint8_t | |||
| 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); | |||
| return writeMidiEvent(time, uint8_t(MIDI_GET_CHANNEL_FROM_DATA(data)), size, data); | |||
| } | |||
| 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); | |||
| CARLA_SAFE_ASSERT(midi.port == kIndexOffset); | |||
| return writeMidiEvent(time, channel, midi.size, midi.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 | |||
| bool CarlaEngineEventPort::writeMidiEvent(const uint32_t time, const uint8_t channel, const uint8_t size, const uint8_t* const data) noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(! kIsInput, false); | |||
| CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr, false); | |||
| @@ -259,9 +261,18 @@ bool CarlaEngineEventPort::writeMidiEvent(const uint32_t time, const uint8_t cha | |||
| } | |||
| event.type = kEngineEventTypeMidi; | |||
| event.midi.port = port; | |||
| event.midi.size = size; | |||
| if (kIndexOffset < 0xFF /* uint8_t max */) | |||
| { | |||
| event.midi.port = kIndexOffset; | |||
| } | |||
| else | |||
| { | |||
| event.midi.port = 0; | |||
| carla_safe_assert_int("kIndexOffset < 0xFF", __FILE__, __LINE__, kIndexOffset); | |||
| } | |||
| event.midi.data[0] = status; | |||
| uint8_t j=1; | |||
| @@ -630,7 +630,7 @@ protected: | |||
| else | |||
| engineEvent.time = static_cast<uint32_t>(midiEvent.time - pData->timeInfo.frame); | |||
| engineEvent.fillFromMidiData(midiEvent.size, midiEvent.data); | |||
| engineEvent.fillFromMidiData(midiEvent.size, midiEvent.data, 0); | |||
| if (engineEventIndex >= kMaxEngineEventInternalCount) | |||
| break; | |||
| @@ -1279,7 +1279,7 @@ public: | |||
| portName.truncate(portNameSize); | |||
| pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true); | |||
| pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true, j); | |||
| pData->audioIn.ports[j].rindex = j; | |||
| } | |||
| @@ -1304,7 +1304,7 @@ public: | |||
| portName.truncate(portNameSize); | |||
| pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, j); | |||
| pData->audioOut.ports[j].rindex = j; | |||
| } | |||
| @@ -1323,7 +1323,7 @@ public: | |||
| portName += "event-in"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true, 0); | |||
| } | |||
| if (needsCtrlOut) | |||
| @@ -1339,7 +1339,7 @@ public: | |||
| portName += "event-out"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portOut = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false); | |||
| pData->event.portOut = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false, 0); | |||
| } | |||
| // extra plugin hints | |||
| @@ -875,26 +875,26 @@ public: | |||
| if (LADSPA_IS_PORT_INPUT(portType)) | |||
| { | |||
| const uint32_t j = iAudioIn++; | |||
| pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true); | |||
| pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true, j); | |||
| pData->audioIn.ports[j].rindex = i; | |||
| if (forcedStereoIn) | |||
| { | |||
| portName += "_2"; | |||
| pData->audioIn.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true); | |||
| pData->audioIn.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true, 1); | |||
| pData->audioIn.ports[1].rindex = i; | |||
| } | |||
| } | |||
| else if (LADSPA_IS_PORT_OUTPUT(portType)) | |||
| { | |||
| const uint32_t j = iAudioOut++; | |||
| pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, j); | |||
| pData->audioOut.ports[j].rindex = i; | |||
| if (forcedStereoOut) | |||
| { | |||
| portName += "_2"; | |||
| pData->audioOut.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, 1); | |||
| pData->audioOut.ports[1].rindex = i; | |||
| } | |||
| } | |||
| @@ -1075,7 +1075,7 @@ public: | |||
| portName += "events-in"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true, 0); | |||
| } | |||
| if (needsCtrlOut) | |||
| @@ -1091,7 +1091,7 @@ public: | |||
| portName += "events-out"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portOut = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false); | |||
| pData->event.portOut = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false, 0); | |||
| } | |||
| if (forcedStereoIn || forcedStereoOut) | |||
| @@ -588,7 +588,7 @@ public: | |||
| portName.truncate(portNameSize); | |||
| pData->audioOut.ports[i].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[i].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, i); | |||
| pData->audioOut.ports[i].rindex = i; | |||
| } | |||
| @@ -611,7 +611,7 @@ public: | |||
| portName += "out-left"; | |||
| portName.truncate(portNameSize); | |||
| pData->audioOut.ports[0].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[0].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, 0); | |||
| pData->audioOut.ports[0].rindex = 0; | |||
| // out-right | |||
| @@ -626,7 +626,7 @@ public: | |||
| portName += "out-right"; | |||
| portName.truncate(portNameSize); | |||
| pData->audioOut.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, 1); | |||
| pData->audioOut.ports[1].rindex = 1; | |||
| } | |||
| @@ -645,7 +645,7 @@ public: | |||
| portName += "events-in"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true, 0); | |||
| } | |||
| // --------------------------------------- | |||
| @@ -663,7 +663,7 @@ public: | |||
| portName += "events-out"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portOut = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false); | |||
| pData->event.portOut = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false, 0); | |||
| } | |||
| // --------------------------------------- | |||
| @@ -419,7 +419,7 @@ public: | |||
| portName.truncate(portNameSize); | |||
| pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true); | |||
| pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true, j); | |||
| pData->audioIn.ports[j].rindex = j; | |||
| } | |||
| @@ -444,7 +444,7 @@ public: | |||
| portName.truncate(portNameSize); | |||
| pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, j); | |||
| pData->audioOut.ports[j].rindex = j; | |||
| } | |||
| @@ -503,7 +503,7 @@ public: | |||
| portName += "events-in"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true, 0); | |||
| } | |||
| if (needsCtrlOut) | |||
| @@ -519,7 +519,7 @@ public: | |||
| portName += "events-out"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portOut = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false); | |||
| pData->event.portOut = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false, 0); | |||
| } | |||
| // plugin hints | |||
| @@ -561,26 +561,26 @@ public: | |||
| if (LADSPA_IS_PORT_INPUT(portType)) | |||
| { | |||
| const uint32_t j = iAudioIn++; | |||
| pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true); | |||
| pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true, j); | |||
| pData->audioIn.ports[j].rindex = i; | |||
| if (forcedStereoIn) | |||
| { | |||
| portName += "_2"; | |||
| pData->audioIn.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true); | |||
| pData->audioIn.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true, 1); | |||
| pData->audioIn.ports[1].rindex = i; | |||
| } | |||
| } | |||
| else if (LADSPA_IS_PORT_OUTPUT(portType)) | |||
| { | |||
| const uint32_t j = iAudioOut++; | |||
| pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, j); | |||
| pData->audioOut.ports[j].rindex = i; | |||
| if (forcedStereoOut) | |||
| { | |||
| portName += "_2"; | |||
| pData->audioOut.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, 1); | |||
| pData->audioOut.ports[1].rindex = i; | |||
| } | |||
| } | |||
| @@ -753,7 +753,7 @@ public: | |||
| portName += "events-in"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true, 0); | |||
| } | |||
| if (needsCtrlOut) | |||
| @@ -769,7 +769,7 @@ public: | |||
| portName += "events-out"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portOut = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false); | |||
| pData->event.portOut = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false, 0); | |||
| } | |||
| if (forcedStereoIn || forcedStereoOut) | |||
| @@ -1788,26 +1788,26 @@ public: | |||
| if (LV2_IS_PORT_INPUT(portTypes)) | |||
| { | |||
| const uint32_t j = iAudioIn++; | |||
| pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true); | |||
| pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true, j); | |||
| pData->audioIn.ports[j].rindex = i; | |||
| if (forcedStereoIn) | |||
| { | |||
| portName += "_2"; | |||
| pData->audioIn.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true); | |||
| pData->audioIn.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true, 1); | |||
| pData->audioIn.ports[1].rindex = i; | |||
| } | |||
| } | |||
| else if (LV2_IS_PORT_OUTPUT(portTypes)) | |||
| { | |||
| const uint32_t j = iAudioOut++; | |||
| pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, j); | |||
| pData->audioOut.ports[j].rindex = i; | |||
| if (forcedStereoOut) | |||
| { | |||
| portName += "_2"; | |||
| pData->audioOut.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, 1); | |||
| pData->audioOut.ports[1].rindex = i; | |||
| } | |||
| } | |||
| @@ -1819,13 +1819,13 @@ public: | |||
| if (LV2_IS_PORT_INPUT(portTypes)) | |||
| { | |||
| const uint32_t j = iCvIn++; | |||
| pData->cvIn.ports[j].port = (CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, portName, true); | |||
| pData->cvIn.ports[j].port = (CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, portName, true, j); | |||
| pData->cvIn.ports[j].rindex = i; | |||
| } | |||
| else if (LV2_IS_PORT_OUTPUT(portTypes)) | |||
| { | |||
| const uint32_t j = iCvOut++; | |||
| pData->cvOut.ports[j].port = (CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, portName, false); | |||
| pData->cvOut.ports[j].port = (CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, portName, false, j); | |||
| pData->cvOut.ports[j].rindex = i; | |||
| } | |||
| else | |||
| @@ -1862,7 +1862,7 @@ public: | |||
| else | |||
| { | |||
| if (portTypes & LV2_PORT_DATA_MIDI_EVENT) | |||
| fEventsIn.data[j].port = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true); | |||
| fEventsIn.data[j].port = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true, j); | |||
| if (LV2_IS_PORT_DESIGNATION_CONTROL(fRdfDescriptor->Ports[i].Designation)) | |||
| { | |||
| @@ -1900,7 +1900,7 @@ public: | |||
| else | |||
| { | |||
| if (portTypes & LV2_PORT_DATA_MIDI_EVENT) | |||
| fEventsOut.data[j].port = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false); | |||
| fEventsOut.data[j].port = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false, j); | |||
| if (LV2_IS_PORT_DESIGNATION_CONTROL(fRdfDescriptor->Ports[i].Designation)) | |||
| { | |||
| @@ -1943,7 +1943,7 @@ public: | |||
| else | |||
| { | |||
| if (portTypes & LV2_PORT_DATA_MIDI_EVENT) | |||
| fEventsIn.data[j].port = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true); | |||
| fEventsIn.data[j].port = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true, j); | |||
| if (LV2_IS_PORT_DESIGNATION_CONTROL(fRdfDescriptor->Ports[i].Designation)) | |||
| { | |||
| @@ -1981,7 +1981,7 @@ public: | |||
| else | |||
| { | |||
| if (portTypes & LV2_PORT_DATA_MIDI_EVENT) | |||
| fEventsOut.data[j].port = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false); | |||
| fEventsOut.data[j].port = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false, j); | |||
| if (LV2_IS_PORT_DESIGNATION_CONTROL(fRdfDescriptor->Ports[i].Designation)) | |||
| { | |||
| @@ -2015,7 +2015,7 @@ public: | |||
| } | |||
| else | |||
| { | |||
| fEventsIn.data[j].port = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true); | |||
| fEventsIn.data[j].port = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true, j); | |||
| if (LV2_IS_PORT_DESIGNATION_CONTROL(fRdfDescriptor->Ports[i].Designation)) | |||
| { | |||
| @@ -2044,7 +2044,7 @@ public: | |||
| } | |||
| else | |||
| { | |||
| fEventsOut.data[j].port = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false); | |||
| fEventsOut.data[j].port = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false, j); | |||
| if (LV2_IS_PORT_DESIGNATION_CONTROL(fRdfDescriptor->Ports[i].Designation)) | |||
| { | |||
| @@ -2291,7 +2291,7 @@ public: | |||
| portName += "events-in"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true, 0); | |||
| } | |||
| if (needsCtrlOut) | |||
| @@ -2307,7 +2307,7 @@ public: | |||
| portName += "events-out"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portOut = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false); | |||
| pData->event.portOut = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false, 0); | |||
| } | |||
| if (fExt.worker != nullptr || (fUI.type != UI::TYPE_NULL && fEventsIn.count > 0 && (fEventsIn.data[0].type & CARLA_EVENT_DATA_ATOM) != 0)) | |||
| @@ -579,7 +579,7 @@ public: | |||
| portName.truncate(portNameSize); | |||
| pData->audioOut.ports[i].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[i].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, i); | |||
| pData->audioOut.ports[i].rindex = i; | |||
| } | |||
| } | |||
| @@ -597,7 +597,7 @@ public: | |||
| portName += "out-left"; | |||
| portName.truncate(portNameSize); | |||
| pData->audioOut.ports[0].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[0].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, 0); | |||
| pData->audioOut.ports[0].rindex = 0; | |||
| // out-right | |||
| @@ -612,7 +612,7 @@ public: | |||
| portName += "out-right"; | |||
| portName.truncate(portNameSize); | |||
| pData->audioOut.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, 1); | |||
| pData->audioOut.ports[1].rindex = 1; | |||
| } | |||
| @@ -631,7 +631,7 @@ public: | |||
| portName += "events-in"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true, 0); | |||
| } | |||
| // --------------------------------------- | |||
| @@ -23,6 +23,7 @@ | |||
| #include "juce_core.h" | |||
| using juce::jmax; | |||
| using juce::String; | |||
| using juce::StringArray; | |||
| @@ -920,13 +921,13 @@ public: | |||
| portName.truncate(portNameSize); | |||
| pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true); | |||
| pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true, j); | |||
| pData->audioIn.ports[j].rindex = j; | |||
| if (forcedStereoIn) | |||
| { | |||
| portName += "_2"; | |||
| pData->audioIn.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true); | |||
| pData->audioIn.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true, 1); | |||
| pData->audioIn.ports[1].rindex = j; | |||
| break; | |||
| } | |||
| @@ -953,13 +954,13 @@ public: | |||
| portName.truncate(portNameSize); | |||
| pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, j); | |||
| pData->audioOut.ports[j].rindex = j; | |||
| if (forcedStereoOut) | |||
| { | |||
| portName += "_2"; | |||
| pData->audioOut.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[1].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, 1); | |||
| pData->audioOut.ports[1].rindex = j; | |||
| break; | |||
| } | |||
| @@ -982,9 +983,11 @@ public: | |||
| portName += CarlaString(j+1); | |||
| portName.truncate(portNameSize); | |||
| fMidiIn.ports[j] = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true); | |||
| fMidiIn.ports[j] = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true, j); | |||
| fMidiIn.indexes[j] = j; | |||
| } | |||
| pData->event.portIn = fMidiIn.ports[0]; | |||
| } | |||
| // MIDI Output (only if multiple) | |||
| @@ -1004,9 +1007,11 @@ public: | |||
| portName += CarlaString(j+1); | |||
| portName.truncate(portNameSize); | |||
| fMidiOut.ports[j] = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false); | |||
| fMidiOut.ports[j] = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false, j); | |||
| fMidiOut.indexes[j] = j; | |||
| } | |||
| pData->event.portOut = fMidiOut.ports[0]; | |||
| } | |||
| for (j=0; j < params; ++j) | |||
| @@ -1111,7 +1116,7 @@ public: | |||
| pData->param.ranges[j].stepLarge = stepLarge; | |||
| } | |||
| if (needsCtrlIn) | |||
| if (needsCtrlIn && mIns <= 1) | |||
| { | |||
| portName.clear(); | |||
| @@ -1124,10 +1129,10 @@ public: | |||
| portName += "events-in"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true, 0); | |||
| } | |||
| if (needsCtrlOut) | |||
| if (needsCtrlOut && mOuts <= 1) | |||
| { | |||
| portName.clear(); | |||
| @@ -1140,7 +1145,7 @@ public: | |||
| portName += "events-out"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portOut = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false); | |||
| pData->event.portOut = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false, 0); | |||
| } | |||
| if (forcedStereoIn || forcedStereoOut) | |||
| @@ -1450,9 +1455,13 @@ public: | |||
| else | |||
| nextBankId = 0; | |||
| for (uint32_t i=0, numEvents=pData->event.portIn->getEventCount(); i < numEvents; ++i) | |||
| for (uint32_t m=0, max=jmax(1U, fMidiIn.count); m < max; ++m) | |||
| { | |||
| CarlaEngineEventPort* const eventPort(m == 0 ? pData->event.portIn : fMidiIn.ports[m]); | |||
| for (uint32_t i=0, numEvents=eventPort->getEventCount(); i < numEvents; ++i) | |||
| { | |||
| const EngineEvent& event(pData->event.portIn->getEvent(i)); | |||
| const EngineEvent& event(eventPort->getEvent(i)); | |||
| if (event.time >= frames) | |||
| continue; | |||
| @@ -1751,6 +1760,8 @@ public: | |||
| if (frames > timeOffset) | |||
| processSingle(audioIn, audioOut, cvIn, cvOut, frames - timeOffset, timeOffset); | |||
| } // eventPort | |||
| } // End of Event Input and Processing | |||
| // -------------------------------------------------------------------------------------------------------- | |||
| @@ -1765,7 +1776,7 @@ public: | |||
| // -------------------------------------------------------------------------------------------------------- | |||
| // Control and MIDI Output | |||
| if (fMidiOut.count > 0 || pData->event.portOut != nullptr) | |||
| if (pData->event.portOut != nullptr) | |||
| { | |||
| #ifndef BUILD_BRIDGE | |||
| float value, curValue; | |||
| @@ -1795,12 +1806,10 @@ public: | |||
| const uint8_t channel = uint8_t(MIDI_GET_CHANNEL_FROM_DATA(fMidiEvents[k].data)); | |||
| const uint8_t port = fMidiEvents[k].port; | |||
| if (pData->event.portOut != nullptr) | |||
| pData->event.portOut->writeMidiEvent(fMidiEvents[k].time, channel, port, fMidiEvents[k].size, fMidiEvents[k].data); | |||
| else if (port < fMidiOut.count) | |||
| fMidiOut.ports[port]->writeMidiEvent(fMidiEvents[k].time, channel, port, fMidiEvents[k].size, fMidiEvents[k].data); | |||
| if (fMidiOut.count > 1 && port < fMidiOut.count) | |||
| fMidiOut.ports[port]->writeMidiEvent(fMidiEvents[k].time, channel, fMidiEvents[k].size, fMidiEvents[k].data); | |||
| else | |||
| carla_stdout("MIDI event output port out of bounds!"); | |||
| pData->event.portOut->writeMidiEvent(fMidiEvents[k].time, channel, fMidiEvents[k].size, fMidiEvents[k].data); | |||
| } | |||
| } // End of Control and MIDI Output | |||
| @@ -2077,6 +2086,12 @@ public: | |||
| fAudioOutBuffers = nullptr; | |||
| } | |||
| if (fMidiIn.count > 1) | |||
| pData->event.portIn = nullptr; | |||
| if (fMidiOut.count > 1) | |||
| pData->event.portOut = nullptr; | |||
| fMidiIn.clear(); | |||
| fMidiOut.clear(); | |||
| @@ -582,7 +582,7 @@ public: | |||
| portName.truncate(portNameSize); | |||
| pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true); | |||
| pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true, j); | |||
| pData->audioIn.ports[j].rindex = j; | |||
| } | |||
| @@ -607,7 +607,7 @@ public: | |||
| portName.truncate(portNameSize); | |||
| pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false); | |||
| pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false, j); | |||
| pData->audioOut.ports[j].rindex = j; | |||
| } | |||
| @@ -768,7 +768,7 @@ public: | |||
| portName += "events-in"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true); | |||
| pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true, 0); | |||
| } | |||
| if (needsCtrlOut) | |||
| @@ -784,7 +784,7 @@ public: | |||
| portName += "events-out"; | |||
| portName.truncate(portNameSize); | |||
| pData->event.portOut = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false); | |||
| pData->event.portOut = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, false, 0); | |||
| } | |||
| // plugin hints | |||
| @@ -1442,7 +1442,7 @@ public: | |||
| midiData[1] = static_cast<uint8_t>(vstMidiEvent.midiData[1]); | |||
| midiData[2] = static_cast<uint8_t>(vstMidiEvent.midiData[2]); | |||
| pData->event.portOut->writeMidiEvent(static_cast<uint32_t>(vstMidiEvent.deltaFrames), MIDI_GET_CHANNEL_FROM_DATA(midiData), 0, 3, midiData); | |||
| pData->event.portOut->writeMidiEvent(static_cast<uint32_t>(vstMidiEvent.deltaFrames), 3, midiData); | |||
| } | |||
| } // End of MIDI Output | |||
| @@ -50,6 +50,7 @@ OBJS += \ | |||
| $(OBJDIR)/lfo.c.o \ | |||
| $(OBJDIR)/midi-channel-filter.c.o \ | |||
| $(OBJDIR)/midi-gain.c.o \ | |||
| $(OBJDIR)/midi-join.c.o \ | |||
| $(OBJDIR)/midi-split.c.o \ | |||
| $(OBJDIR)/midi-through.c.o \ | |||
| $(OBJDIR)/midi-transpose.c.o \ | |||
| @@ -25,6 +25,7 @@ extern void carla_register_native_plugin_bypass(void); | |||
| extern void carla_register_native_plugin_lfo(void); | |||
| extern void carla_register_native_plugin_midichanfilter(void); | |||
| extern void carla_register_native_plugin_midigain(void); | |||
| extern void carla_register_native_plugin_midijoin(void); | |||
| extern void carla_register_native_plugin_midisplit(void); | |||
| extern void carla_register_native_plugin_midithrough(void); | |||
| extern void carla_register_native_plugin_miditranspose(void); | |||
| @@ -74,6 +75,7 @@ void carla_register_all_native_plugins(void) | |||
| carla_register_native_plugin_lfo(); | |||
| carla_register_native_plugin_midichanfilter(); | |||
| carla_register_native_plugin_midigain(); | |||
| carla_register_native_plugin_midijoin(); | |||
| carla_register_native_plugin_midisplit(); | |||
| carla_register_native_plugin_midithrough(); | |||
| carla_register_native_plugin_miditranspose(); | |||
| @@ -94,6 +94,22 @@ static const NativePluginDescriptor sNativePluginDescriptors[] = { | |||
| /* copyright */ "GNU GPL v2+", | |||
| DESCFUNCS | |||
| }, | |||
| { | |||
| /* category */ NATIVE_PLUGIN_CATEGORY_UTILITY, | |||
| /* hints */ NATIVE_PLUGIN_IS_RTSAFE, | |||
| /* supports */ NATIVE_PLUGIN_SUPPORTS_EVERYTHING, | |||
| /* audioIns */ 0, | |||
| /* audioOuts */ 0, | |||
| /* midiIns */ 16, | |||
| /* midiOuts */ 1, | |||
| /* paramIns */ 0, | |||
| /* paramOuts */ 0, | |||
| /* name */ "MIDI Join", | |||
| /* label */ "midijoin", | |||
| /* maker */ "falkTX", | |||
| /* copyright */ "GNU GPL v2+", | |||
| DESCFUNCS | |||
| }, | |||
| { | |||
| /* category */ NATIVE_PLUGIN_CATEGORY_UTILITY, | |||
| /* hints */ NATIVE_PLUGIN_IS_RTSAFE, | |||
| @@ -140,14 +140,12 @@ void fillEngineEventsFromJuceMidiBuffer(EngineEvent engineEvents[kMaxEngineEvent | |||
| { | |||
| CARLA_SAFE_ASSERT_CONTINUE(numBytes > 0); | |||
| CARLA_SAFE_ASSERT_CONTINUE(sampleNumber >= 0); | |||
| if (numBytes > UINT8_MAX) | |||
| continue; | |||
| CARLA_SAFE_ASSERT_CONTINUE(numBytes < 0xFF /* uint8_t max */); | |||
| EngineEvent& engineEvent(engineEvents[engineEventIndex++]); | |||
| engineEvent.time = static_cast<uint32_t>(sampleNumber); | |||
| engineEvent.fillFromMidiData(static_cast<uint8_t>(numBytes), midiData); | |||
| engineEvent.fillFromMidiData(static_cast<uint8_t>(numBytes), midiData, 0); | |||
| } | |||
| } | |||