diff --git a/source/Makefile.mk b/source/Makefile.mk index 791a7d3ba..f34c6e0a2 100644 --- a/source/Makefile.mk +++ b/source/Makefile.mk @@ -62,7 +62,7 @@ CFLAGS += -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes CXXFLAGS += -Wnon-virtual-dtor -Woverloaded-virtual ifeq ($(LINUX),true) CFLAGS += -isystem /opt/kxstudio/include -CXXFLAGS += -isystem /opt/kxstudio/include -isystem /usr/include/qt5 +CXXFLAGS += -isystem /opt/kxstudio/include -isystem /usr/include/qt4 endif ifeq ($(MACOS),true) CFLAGS += -isystem /opt/local/include/ @@ -70,7 +70,7 @@ CXXFLAGS += -isystem /opt/local/include/ endif ifeq ($(WIN32),true) CFLAGS += -isystem /opt/mingw32/include -CXXFLAGS += -isystem /opt/mingw32/include -isystem /opt/mingw32/include/qt5 +CXXFLAGS += -isystem /opt/mingw32/include -isystem /opt/mingw32/include/qt4 endif endif diff --git a/source/backend/plugin/JucePlugin.cpp b/source/backend/plugin/JucePlugin.cpp index 9ac695f61..6e9db9138 100644 --- a/source/backend/plugin/JucePlugin.cpp +++ b/source/backend/plugin/JucePlugin.cpp @@ -30,7 +30,8 @@ using namespace juce; CARLA_BACKEND_START_NAMESPACE class JucePlugin : public CarlaPlugin, - public AudioPlayHead + public AudioPlayHead, + public AudioProcessorListener { public: JucePlugin(CarlaEngine* const engine, const uint id) @@ -890,6 +891,29 @@ public: for (uint32_t i=0; i < pData->audioOut.count; ++i) FloatVectorOperations::copy(outBuffer[i], fAudioBuffer.getSampleData(static_cast(i)), static_cast(frames)); + // -------------------------------------------------------------------------------------------------------- + // Midi out + + if (! fMidiBuffer.isEmpty()) + { + if (pData->event.portOut != nullptr) + { + const uint8* midiEventData; + int midiEventSize, midiEventPosition; + + for (MidiBuffer::Iterator i(fMidiBuffer); i.getNextEvent(midiEventData, midiEventSize, midiEventPosition);) + { + CARLA_SAFE_ASSERT_BREAK(midiEventPosition >= 0 && midiEventPosition < static_cast(frames)); + CARLA_SAFE_ASSERT_BREAK(midiEventSize > 0); + + if (! pData->event.portOut->writeMidiEvent(static_cast(midiEventPosition), static_cast(midiEventSize), midiEventData)) + break; + } + } + + fMidiBuffer.clear(); + } + // -------------------------------------------------------------------------------------------------------- pData->singleMutex.unlock(); @@ -935,6 +959,17 @@ public: // ------------------------------------------------------------------- protected: + void audioProcessorParameterChanged(AudioProcessor*, int /*parameterIndex*/, float /*newValue*/) override + { + } + + void audioProcessorChanged(AudioProcessor*) override + { + } + + void audioProcessorParameterChangeGestureBegin(AudioProcessor*, int) {} + void audioProcessorParameterChangeGestureEnd(AudioProcessor*, int) {} + bool getCurrentPosition(CurrentPositionInfo& result) override { carla_copyStruct(result, fPosInfo); @@ -1010,6 +1045,7 @@ public: fInstance->fillInPluginDescription(fDesc); fInstance->setPlayHead(this); + fInstance->addListener(this); // --------------------------------------------------------------- // get info diff --git a/source/widgets/qgraphicsembedscene.py b/source/widgets/qgraphicsembedscene.py index 2fd0e332c..b3407ed28 100644 --- a/source/widgets/qgraphicsembedscene.py +++ b/source/widgets/qgraphicsembedscene.py @@ -102,12 +102,12 @@ class QGraphicsEmbedScene(QGraphicsScene): # Render the scene into the fbo, scaling the QPainter's view # transform up to the power-of-two fbo size. painter = QPainter(self.fbo) - painter.setWindow(0, 0, size.width(), size.height()); - painter.setViewport(0, 0, fboSize.width(), fboSize.height()); + painter.setWindow(0, 0, size.width(), size.height()) + painter.setViewport(0, 0, fboSize.width(), fboSize.height()) self.render(painter) painter.end() self.dirty = False - return self.fbo.texture(); + return self.fbo.texture() def deliverEvent(self, event, texCoord): # Map the texture co-ordinate into "screen" co-ordinates. @@ -140,78 +140,78 @@ class QGraphicsEmbedScene(QGraphicsScene): QEvent.GraphicsSceneMouseDoubleClick): pass #QGraphicsSceneMouseEvent *ev = - #static_cast(event); - #QGraphicsSceneMouseEvent e(ev->type()); - #e.setPos(QPointF(screenX, screenY)); - #e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y())); - #e.setScreenPos(QPoint(screenX, screenY)); - #e.setButtonDownScreenPos(ev->button(), d->pressedPos); + #static_cast(event) + #QGraphicsSceneMouseEvent e(ev->type()) + #e.setPos(QPointF(screenX, screenY)) + #e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y())) + #e.setScreenPos(QPoint(screenX, screenY)) + #e.setButtonDownScreenPos(ev->button(), d->pressedPos) #e.setButtonDownScenePos #(ev->button(), QPointF(d->pressedPos.x() + bounds.x(), - #d->pressedPos.y() + bounds.y())); - #e.setButtons(ev->buttons()); - #e.setButton(ev->button()); - #e.setModifiers(ev->modifiers()); - #e.setAccepted(false); - #QApplication::sendEvent(this, &e); + #d->pressedPos.y() + bounds.y())) + #e.setButtons(ev->buttons()) + #e.setButton(ev->button()) + #e.setModifiers(ev->modifiers()) + #e.setAccepted(false) + #QApplication::sendEvent(this, &e) elif eventType == QEvent.GraphicsSceneWheel: pass #QGraphicsSceneWheelEvent *ev = - #static_cast(event); - #QGraphicsSceneWheelEvent e(QEvent::GraphicsSceneWheel); - #e.setPos(QPointF(screenX, screenY)); - #e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y())); - #e.setScreenPos(QPoint(screenX, screenY)); - #e.setButtons(ev->buttons()); - #e.setModifiers(ev->modifiers()); - #e.setDelta(ev->delta()); - #e.setOrientation(ev->orientation()); - #e.setAccepted(false); - #QApplication::sendEvent(this, &e); + #static_cast(event) + #QGraphicsSceneWheelEvent e(QEvent::GraphicsSceneWheel) + #e.setPos(QPointF(screenX, screenY)) + #e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y())) + #e.setScreenPos(QPoint(screenX, screenY)) + #e.setButtons(ev->buttons()) + #e.setModifiers(ev->modifiers()) + #e.setDelta(ev->delta()) + #e.setOrientation(ev->orientation()) + #e.setAccepted(false) + #QApplication::sendEvent(this, &e) elif eventType in (QEvent.MouseButtonPress, QEvent.MouseButtonRelease, QEvent.MouseButtonDblClick, QEvent.MouseMove): pass - #QMouseEvent *ev = static_cast(event); - #QEvent::Type type; + #QMouseEvent *ev = static_cast(event) + #QEvent::Type type #if (ev->type() == QEvent::MouseButtonPress) - #type = QEvent::GraphicsSceneMousePress; + #type = QEvent::GraphicsSceneMousePress #else if (ev->type() == QEvent::MouseButtonRelease) - #type = QEvent::GraphicsSceneMouseRelease; + #type = QEvent::GraphicsSceneMouseRelease #else if (ev->type() == QEvent::MouseButtonDblClick) - #type = QEvent::GraphicsSceneMouseDoubleClick; + #type = QEvent::GraphicsSceneMouseDoubleClick #else - #type = QEvent::GraphicsSceneMouseMove; - #QGraphicsSceneMouseEvent e(type); - #e.setPos(QPointF(screenX, screenY)); - #e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y())); - #e.setScreenPos(QPoint(screenX, screenY)); - #e.setButtonDownScreenPos(ev->button(), d->pressedPos); + #type = QEvent::GraphicsSceneMouseMove + #QGraphicsSceneMouseEvent e(type) + #e.setPos(QPointF(screenX, screenY)) + #e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y())) + #e.setScreenPos(QPoint(screenX, screenY)) + #e.setButtonDownScreenPos(ev->button(), d->pressedPos) #e.setButtonDownScenePos #(ev->button(), QPointF(d->pressedPos.x() + bounds.x(), - #d->pressedPos.y() + bounds.y())); - #e.setButtons(ev->buttons()); - #e.setButton(ev->button()); - #e.setModifiers(ev->modifiers()); - #e.setAccepted(false); - #QApplication::sendEvent(this, &e); + #d->pressedPos.y() + bounds.y())) + #e.setButtons(ev->buttons()) + #e.setButton(ev->button()) + #e.setModifiers(ev->modifiers()) + #e.setAccepted(false) + #QApplication::sendEvent(this, &e) elif eventType == QEvent.Wheel: pass - #QWheelEvent *ev = static_cast(event); - #QGraphicsSceneWheelEvent e(QEvent::GraphicsSceneWheel); - #e.setPos(QPointF(screenX, screenY)); - #e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y())); - #e.setScreenPos(QPoint(screenX, screenY)); - #e.setButtons(ev->buttons()); - #e.setModifiers(ev->modifiers()); - #e.setDelta(ev->delta()); - #e.setOrientation(ev->orientation()); - #e.setAccepted(false); - #QApplication::sendEvent(this, &e); + #QWheelEvent *ev = static_cast(event) + #QGraphicsSceneWheelEvent e(QEvent::GraphicsSceneWheel) + #e.setPos(QPointF(screenX, screenY)) + #e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y())) + #e.setScreenPos(QPoint(screenX, screenY)) + #e.setButtons(ev->buttons()) + #e.setModifiers(ev->modifiers()) + #e.setDelta(ev->delta()) + #e.setOrientation(ev->orientation()) + #e.setAccepted(false) + #QApplication::sendEvent(this, &e) #else: # Send the event directly without any conversion.