Thanks David - that gives me ALOT to chew on. TCL is the way to go, huh? ok. In the meantime, I'll ask about my current implementation, since I have a show and some recording to do with this instrument :) Hopefully I can rig it up to work in the short-term. > 1) Try to avoid using FLTK widgets whenever possible. I know it sounds > counterintuitive, but they always seem to crash Csound when you say, > for example try to control button widgets with program change messages. > There are several other things such as that that seem to contribute to > the instability of FLTK. This is the reason for my question, actually. I know the FLSetVal_i can set the value of an FLButton, so I am calling a deligate instrument everytime I receive a button-related controller change. Sloppy, huh? :) It works, but as I said, the midiin opcode's buffer doesn't empty after I read from it, so this delegate gets called repeatedly. Here's some code: instr 31 .... inputbuttons: inputbutton1: if kdata1 != 65 kgoto inputbutton2 ;call instr 32 to update buttons from global values. instr 32's note lasts .001 secs, which is quicker than I can produce midi messages with my controller. event "i",32,.001,.01,1 if kdata2 != 0 kgoto inputnext1 gkloop1 = 0 inputnext1: if kdata2 != 127 kgoto inputbutton2 gkloop1 = 1 ... endin instr 32 ;button switcher i1 = i(gkloop1) i2 = i(gkloop2) i3 = i(gkloop3) i4 = i(gkloop4) i5 = i(gkloopread1) i6 = i(gkloopread2) i7 = i(gkloopread3) i8 = i(gkloopread4) iset = p4 FLsetVal_i i1, gihbut1 FLsetVal_i i2, gihbut2 FLsetVal_i i3, gihbut3 FLsetVal_i i4, gihbut4 FLsetVal_i i5, gihbutread1 FLsetVal_i i6, gihbutread2 FLsetVal_i i7, gihbutread3 FLsetVal_i i8, gihbutread4 endin > > 2) midiin seems to work most efficiently when encapsulated inside of a > UDO, see > http://www.csounds.com/udo/displayOpcode.php?opcode_id=71 > http://www.csounds.com/udo/displayOpcode.php?opcode_id=69 > http://www.csounds.com/udo/displayOpcode.php?opcode_id=68 > http://www.csounds.com/udo/displayOpcode.php?opcode_id=65 > http://www.csounds.com/udo/displayOpcode.php?opcode_id=74 I will check this path out as well. > > for more examples. Note that the last one of those UDO's actually takes > the same formula for scaling as found in the source code for ctrl7, and > thus can be quite useful when used in combination with raw midiin. > > In general I would suggest to start looking towards TclCsound for GUI > display purposes. It seems much more robust and stable than the current > FLTK implementation, as I've been having extreme difficulty making > stable, cross-platform patches using FLTK, but not at all with > TclCsound. Thanks again for the help - I'll definitely be checking UDOs and TclCsound out. b