MIDI channel / Interfaces / Machine.Remove / Functors (!)
Hello - this is my first post here but I've been experimenting with ChucK for quite a while, and have a few questions I can't manage to find the answers to by myself... I'm more familiar with the likes of OpenMusic or MaxMSP but enjoy the power of the ChucK language as well as the fact that all it requires is chuck.exe!!! (and the manual ;) 1. Is there a way to retrieve from MidiIn/MidiOut objects the channel originally passed to open or do I need to encapsulate open in a method of my own in a derived class? (I would override open but with super not implemented yet, I don't know how to call the implementation of open in the superclass) 2. If I'm not mistaken, ChucK only accepts single inheritance; are you (the language designers behind ChucK :) planning to implement some sort of mechanism similar to Java/.NET interfaces? I've implemented a dispatching mechanism for MidiIn (so that I don't have take care again and again of the synchronisation issues etc. and have a simple, reusable mechanism to map say a note on message with some onNoteOn callback each time I use MidiIn). I now would like to generalise it and I don't know how without multiple inheritance/interfaces... 3. Machine.remove(shred.id()) terminates a shred (great feature!) but could someone clarifies what happens behind the scene? In particular, is there a callback method automatically called when a shred exits that users could hijack to perform some cleanup? 4. Finally, does ChucK support functors (perhaps even through some clever mechanism to the same effect)? Mies
Hello, Mies!
Hello - this is my first post here but I've been experimenting with ChucK for quite a while, and have a few questions I can't manage to find the answers to by myself... I'm more familiar with the likes of OpenMusic or MaxMSP but enjoy the power of the ChucK language as well as the fact that all it requires is chuck.exe!!! (and the manual ;)
And /examples/! I think many people underestimate exactly how usefull the examples directory is.
1. Is there a way to retrieve from MidiIn/MidiOut objects the channel originally passed to open or do I need to encapsulate open in a method of my own in a derived class?
Looks like you found a bug (well, a missing feature)! According to the manual MidiIn.open() is both read and write but I just tried and -like you- I can't read from it so that might be a issue. ...This is asuming you meant "device" above, not "channel", the MIDI chanel would be in the message.
3. Machine.remove(shred.id()) terminates a shred (great feature!) but could someone clarifies what happens behind the scene? In particular, is there a callback method automatically called when a shred exits that users could hijack to perform some cleanup?
If successfull, machine.remove( int ) returns the id of the removed shred so yes, depending on what exactly you'd like to clean up. The real cleanup should be done by ChucK but other shreds might contain some sort of comunication device to talk to the removed shred that you might like to clean up. In that case it would be wisest to send the remove comand fromt he same shred that send the comunications because if you have a shred terminate itself everything it "knows" is of cource lost. It would be better if we'd have some way of getting the contents of the VM from within ChucK and know things like what shred has which childeren and the name of the function those are based on and so on, somewhere in the future.... :¬) Hope that helps at least a little, not sure what you are after here, exactly. Kas.
participants (2)
-
Kassen
-
mieslings@i12.com