Closed yaxu closed 4 years ago
@telephon Unless I've made a mistake, you can send multiple commands in one event, but only one of each type.
(The purpose of this bit of code was to make sure that a command is only sent once if its 'midicmd' is inferred from its parameters, as well as being set explicitly)
Ok, I just don't get what donecmd
is doing.
It unsets midicmd
if its action has already been inferred and done.
Ah I see. But wouldn't it have been easier to write instead of:
if(~progNum.notNil) { var num = ~progNum; donecmd.value(\program); schedmidi.value({ midiout.program(chan, num) })};
simply
if(~progNum.notNil or: { midicmd === \program }) { var num = ~progNum; schedmidi.value({ midiout.program(chan, num) })};
But then there's a bit later on that deals with the midicmd variable in a generic way, so it needs to be unset.
Although I think that now you can't send two commands in one event, right? Not sure what was intended. It is slightly messy in terms of functionality. Maybe you could add an explanation in a longer comment in the file?