Merge lp://staging/~mixxxdevelopers/mixxx/features_direct_bind into lp://staging/~mixxxdevelopers/mixxx/trunk

Proposed by Phillip Whelan
Status: Merged
Merged at revision: 3214
Proposed branch: lp://staging/~mixxxdevelopers/mixxx/features_direct_bind
Merge into: lp://staging/~mixxxdevelopers/mixxx/trunk
Diff against target: 1162 lines (+598/-199)
8 files modified
mixxx/src/controllers/controller.cpp (+15/-14)
mixxx/src/controllers/controller.h (+2/-1)
mixxx/src/controllers/controllerengine.cpp (+321/-170)
mixxx/src/controllers/controllerengine.h (+61/-11)
mixxx/src/controllers/midi/midicontroller.cpp (+5/-2)
mixxx/src/controllers/mixxxcontrol.cpp (+7/-0)
mixxx/src/controllers/mixxxcontrol.h (+9/-0)
mixxx/src/test/controllerengine_test.cpp (+178/-1)
To merge this branch: bzr merge lp://staging/~mixxxdevelopers/mixxx/features_direct_bind
Reviewer Review Type Date Requested Status
RJ Skerry-Ryan Needs Fixing
Review via email: mp+104529@code.staging.launchpad.net

Description of the change

Call script functions directly as QScriptValues instead of parsing small javascript snippets for invoking MIDI Scripts.

To post a comment you must log in.
2875. By madjester <madjester@voidwalker>

Change declaration of ControllerEngine::timerEvent to match trunk.

Revision history for this message
Phillip Whelan (pwhelan) wrote :

The runtime evaluation option and file reloading are in the works for after this is merged.

Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

Thanks! -- here are my comments sofar:

* ControllerEngine::callFunctionOnObjects should check isFunction() before call()'ing the QScriptValue

* ControllerEngine::resolveFunction should check isFunction() in addition to isValid()

* In ControllerEngine::internalExecute(QScriptValue, QScriptValue) return false if !isFunction() to match execute(QScriptValue, QScriptValueList)

* In ControllerEngine you changed a bunch of debug outputs to say MidiScriptEngine instead of ControllerEngine -- please change those back :)

* In connectControl() in the first if(disconnect) path you set cb.key = key which seems redundant with a few lines above.

* ControllerEngineConnectionScriptValue::disconnect() shadows QObject::disconnect(). We probably shouldn't do that.

* connectControl() connects the valueChanged() signal from the ControlObject, not the ControlObjectThread which causes priority-inversion between the Engine and the Qt main-thread. This was a bug that was fixed in the control-system rewrite so please re-add that.

* MidiController::bindScriptFunction() calling preset() and casting the result -- that's for use by the superclass which doesn't know about MidiControllerPresets. You can just use m_preset. (though see my comment below)

* I think the m_scriptBindings cache in Controller/MidiController isn't really necessary. Instead of the cache living in MixxxControl/Controller and having to pre-cache every function we think we might want to call, why not put the cache in ControllerEngine::resolveFunction. Change ControllerEngine::resolveFunction(QString) to take a boolean shouldCache flag that tells it to first look in the QScriptValue cache and then just call resolveFunction() every time we want to call a method. I think this would be a lot cleaner and this branch would become almost totally contained to ControllerEngine and it would be just as fast as what is written now (and a little more robust to cache misses since it will cache on first use).

* thanks for the tests :)

review: Needs Fixing
Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

Any update Phil? If you're too hosed I can make these changes myself --
it'd be great to get these in 1.11.

On Fri, May 11, 2012 at 2:14 PM, RJ Ryan <email address hidden> wrote:

> Review: Needs Fixing
>
> Thanks! -- here are my comments sofar:
>
> * ControllerEngine::callFunctionOnObjects should check isFunction() before
> call()'ing the QScriptValue
>
> * ControllerEngine::resolveFunction should check isFunction() in addition
> to isValid()
>
> * In ControllerEngine::internalExecute(QScriptValue, QScriptValue) return
> false if !isFunction() to match execute(QScriptValue, QScriptValueList)
>
> * In ControllerEngine you changed a bunch of debug outputs to say
> MidiScriptEngine instead of ControllerEngine -- please change those back :)
>
> * In connectControl() in the first if(disconnect) path you set cb.key =
> key which seems redundant with a few lines above.
>
> * ControllerEngineConnectionScriptValue::disconnect() shadows
> QObject::disconnect(). We probably shouldn't do that.
>
> * connectControl() connects the valueChanged() signal from the
> ControlObject, not the ControlObjectThread which causes priority-inversion
> between the Engine and the Qt main-thread. This was a bug that was fixed in
> the control-system rewrite so please re-add that.
>
> * MidiController::bindScriptFunction() calling preset() and casting the
> result -- that's for use by the superclass which doesn't know about
> MidiControllerPresets. You can just use m_preset. (though see my comment
> below)
>
> * I think the m_scriptBindings cache in Controller/MidiController isn't
> really necessary. Instead of the cache living in MixxxControl/Controller
> and having to pre-cache every function we think we might want to call, why
> not put the cache in ControllerEngine::resolveFunction. Change
> ControllerEngine::resolveFunction(QString) to take a boolean shouldCache
> flag that tells it to first look in the QScriptValue cache and then just
> call resolveFunction() every time we want to call a method. I think this
> would be a lot cleaner and this branch would become almost totally
> contained to ControllerEngine and it would be just as fast as what is
> written now (and a little more robust to cache misses since it will cache
> on first use).
>
> * thanks for the tests :)
> --
>
> https://code.launchpad.net/~mixxxdevelopers/mixxx/features_direct_bind/+merge/104529
> You are reviewing the proposed merge of
> lp:~mixxxdevelopers/mixxx/features_direct_bind into lp:mixxx.
>

Revision history for this message
Phillip Whelan (pwhelan) wrote :

I'll see if I can get to them tomorrow. Been a bit busy lately with RL.

2876. By madjester <madjester@voidwalker>

merge from trunk.

2877. By madjester <madjester@voidwalker>

merge from trunk.

2878. By madjester <madjester@voidwalker>

merge from trunk.

2879. By madjester <madjester@voidwalker>

merge from trunk.

2880. By madjester <madjester@voidwalker>

merge from trunk.

2881. By madjester <madjester@voidwalker>

FIX: check isFunction in ControllerEngine::callFunctionOnObjects before calling a QScriptValue.

2882. By madjester <madjester@voidwalker>

FIX: check if object.isFunction in ControllerEngine::resolveFunction.

2883. By madjester <madjester@voidwalker>

FIX: return false in ControllerEngine::internalExecute(QScriptValue thisObject, QScriptValue functionObject) if functionObject is not an object to match the calling convention of the other overloads.

2884. By madjester <madjester@voidwalker>

Change occurances of MidiScriptEngine to ControllerEngine.

2885. By madjester <madjester@voidwalker>

Remove redundant assignment of cb.key in ControllerEngine::connectControl.

2886. By madjester <madjester@voidwalker>

Remove m_scriptBindings and bindScriptFunctions() from controllers and use ControllerEngine::resolveFunction to resolve functions (no more caching in the controllers themselves).

2887. By madjester <madjester@voidwalker>

FIX: only check if the object is a function right before returning it in ControllerEngine::resolveFunction.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches