
Hi Brad!
However, ideally I'd like the function to deliver/update the incoming value whenever it came from max/msp, something like this:
(i.e. no loop in the script, but during execution any change coming from maxin.inletval would indeed affect the sineosc frequency).
If I understand this correctly, then you might make maxinlet a chuckian Event (as Perry pointed out like the OSC-related objects, as well as MIDI, HID, and a few other objects in ChucK). In that case, you can write code that looks like: // infinite event loop while( true ) { // wait on event inlet => now; // set freq inlet.inletval => s.freq; } This would only fire as updates came in from the inlet object. It should work, but the code ain't pretty. Look in chuck_lang.* and midiio_rtmidi.* for MidiIn related-stuff. I think the crucial components are: 1. the class 'maxinlet' should extend "Event" in the type_engine_import_class_begin 2. the actual C++ class that does the work should extend Chuck_Event, or at least hold a pointer to a Chuck_Event to be notified on event 3. the actual C++ class may want to have a circular buffer of some kind for incoming events 4. as events come in, they get put on the buffer, and .queue_broadcast() should be called on the Chuck_Event to be notified - the rest is handled by chuck 5. the chuckian class 'maxinlet' should also implement the can_wait() function. Wow, yuck - what a disaster. Needless to say, we hope to improve this for the upcoming import mechanism... Best, Ge!