[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] MIDI help files



Hi,

someone posted about the MIDI help files some time ago...

I'd like to suggest after the paragraph:

"For this reason, it's generally too much trouble to work with MIDIIn
directly for regular use (note on/off, controller messages). It's
better to wrap the core functionality within higher-level classes that
handle the internals for you."

to add:

"One way of working around this problem is using a Dictionary for the
MIDIIn responders:

(
var mididict;
mididict = Dictionary.new;
mididict = (
	10: {|val|
		"midicontrol ".post; 10.post; ": ".post; val.postln;
	},
	11: {|val|
		"midicontrol ".post; 11.post; ": ".post; val.postln;
	},
	3:	{|val|
		"midicontrol ".post; 3.post; ": ".post; val.postln;
	}
);

mididict.postln;

MIDIIn.control = { arg src, chan, num, val; 
	mididict.at(num).value(val/127); };

/// adding a function later:
mididict.add( 8 -> { |val| 
	"midicontrol ".post; 8.post; ": ".post; val.postln;
});

mididict.postln;
)
"

in case people do not want to use other higher level libraries or want
to create their own.



sincerely,
Marije