do while, i don´t get it.

Discuss Lemur and share techniques.
Post Reply
dbk
Regular
Posts: 98
Joined: 14 Dec 2011 11:35

do while, i don´t get it.

Post by dbk »

Hello,

i use an on expression x script with this content:

Code: Select all

do 
{
midiout(0, {0xF0, 0x00, 0x20, 0x3C, 0x02, 00, 0x70, 0x02, 0xF7});
}
while (RESETMon2.value == 0);
isn´t this script supposed to stop the moment ResetMon2.value becomes anything other then 0 and ONLY if it´s not 0?

the sysex requests the current kit of a machinedrum, for some reason i sometimes get zeros only. Don´t know if it is becausese of the machinedrum or the lemur. so now i check MIDI_ARGS[8] if it has any value greater then 0.

sometimes it works, sometimes it doesn´t, sometimes i still get 0 and the script stops nonetheless and this i don´t understand.

Any help would be greatly apprechiated, again ;)

cheers,
Martin
mbncp
Regular
Posts: 87
Joined: 08 Dec 2011 07:25

Re: do while, i don´t get it.

Post by mbncp »

It's not a really good idea to enter a loop based on some external action.
Not sure exactly how Lemur works inside, but with this kind of loop you're blocking everything and probably overrun the midi out buffer, so Lemur probably activates the TGODKWHID switch ;)

Sending a bunch of midi data should be done in an OnFrane 'loop' giving the system time to take it's breath.
dbk
Regular
Posts: 98
Joined: 14 Dec 2011 11:35

Re: do while, i don´t get it.

Post by dbk »

Hello,

thanks for your suggestion, i think i found the problem.

the lemur goes through my router to my mac and then to my tm1 midiinterface and the other way round.
so i tried a direct connection, midi interface in to the ipad.

works like a charm, i tried it like 100 times and couldn´t manage to get a wrong value.

seems like the sysex data gets destroyed every now and then, when sent through Wi-Fi, even with an ad hoc network on the mac, i wonder if that´s something Liine will have a look at.

thanks,
Martin
mbncp
Regular
Posts: 87
Joined: 08 Dec 2011 07:25

Re: do while, i don´t get it.

Post by mbncp »

Don't know how midi over wifi works, not sure if there is some handshake going on and if the app is aware of any message loss.

Btw, I just tried some endless while loop, and obviously lemur will just end the script after some time or iteration. In the 'good' old days, when you accidentally entered an endless loop, your only choice was to reboot your pc.
Post Reply