[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Re: MIDIFunc to control GUI elements: strange error



'works perfectly fine!
thanks!! :D
On 12/29/2013 03:11 PM, Kuivila, Ronald wrote:
The problem arises when the function is being called by the MIDI responder when MIDI comes in
So, you need to arrange to have the function executed separately from the MIDI responder. The easiest
way to do this is with defer:

	defer {if(val == 127, {~myButton.valueAction = 1}, {~myButton.valueAction = 0}) };

Cheers,

RJK

On Dec 29, 2013, at 8:08 AM, sc wrote:

so I found this on the GUI help:
WARNING: Executing code that uses the GUI system is restricted to main application context. There are many ways in SuperCollider for code to be executed in other contexts that run in parallel with the main one, and interacting with GUI objects is not allowed there. This includes:
Code scheduled on the SystemClock and the TempoClock
Code executed in response to OSC messages

then I enclosed all my GUI code in Routine that runs on AppClock, but still the same error....

do you have any idea??

On 12/29/2013 01:56 PM, sc wrote:
Hello,

I don't understand why if I evaluate this line manually,

~myButton.valueAction = 0
~myButton.valueAction = 1

it works perfectly fine, my GUI button will go off/on and my synth associated with that button will play and free.

BUT

if I do this:

~cc33 = MIDIFunc.cc({|val|
    if(val == 127, {~myButton.valueAction = 1}, {~myButton.valueAction = 0})
}, 33, 0);

it gives me this:
ERROR: Qt: You can not use this Qt functionality in the current thread. Try scheduling on AppClock instead.
ERROR: Primitive '_QObject_SetProperty' failed.
Failed.

current thread? that's strange. both actions are purely SC lang side operations, no?
Why AppClock? I'm not scheduling anything here, I just map a simple function to midi control.

how you guys deal with this error? it must be possible to control QT gui with midi controllers, no?

thanks!

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/