Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions res/controllers/midi-components-0.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,17 @@
},
disconnect: function () {
if (this.connections[0] !== undefined) {
this.connections.forEach(function (connection) {
connection.disconnect();
this.connections.forEach(function (conn) {
conn.disconnect();
});
}
},
trigger: function() {
engine.trigger(this.group, this.outKey);
if (this.connections[0] !== undefined) {
this.connections.forEach(function (conn) {
conn.trigger();
});
}
},
shiftOffset: 0,
sendShifted: false,
Expand Down
23 changes: 19 additions & 4 deletions src/controllers/controllerengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,10 +808,8 @@ QScriptValue ControllerEngine::connectControl(
}

/* -------- ------------------------------------------------------
Purpose: (Dis)connects a ControlObject valueChanged() signal to/from a script function
Input: Control group (e.g. [Channel1]), Key name (e.g. [filterHigh]),
script function name, true if you want to disconnect
Output: true if successful
Purpose: (Dis)connects a ControllerEngineConnection
Input: the ControllerEngineConnection to disconnect
-------- ------------------------------------------------------ */
void ControllerEngine::disconnectControl(const ControllerEngineConnection conn) {
ControlObjectScript* coScript = getControlObjectScript(conn.key.group, conn.key.item);
Expand All @@ -832,6 +830,23 @@ void ControllerEngineConnectionScriptValue::disconnect() {
m_conn.ce->disconnectControl(m_conn);
}

/* -------- ------------------------------------------------------
Purpose: Triggers the callback function of a ControllerEngineConnection
Input: the ControllerEngineConnection to trigger
-------- ------------------------------------------------------ */
void ControllerEngine::triggerControl(const ControllerEngineConnection conn) {
ControlObjectScript* coScript = getControlObjectScript(conn.key.group, conn.key.item);

if (m_pEngine == nullptr || coScript == nullptr) {
return;
}

coScript->emitValueChanged();
}

void ControllerEngineConnectionScriptValue::trigger() {
m_conn.ce->triggerControl(m_conn);
}

/* -------- ------------------------------------------------------
Purpose: Evaluate a script file
Expand Down
2 changes: 2 additions & 0 deletions src/controllers/controllerengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class ControllerEngineConnectionScriptValue : public QObject {
}
const QString& readId() const { return m_conn.id; }
Q_INVOKABLE void disconnect();
Q_INVOKABLE void trigger();

private:
ControllerEngineConnection m_conn;
Expand Down Expand Up @@ -87,6 +88,7 @@ class ControllerEngine : public QObject {

// Disconnect a ControllerEngineConnection
void disconnectControl(const ControllerEngineConnection conn);
void triggerControl(const ControllerEngineConnection conn);

protected:
Q_INVOKABLE double getValue(QString group, QString name);
Expand Down