Next: MIDI File I/O, Previous: MIDI Device Interface, Up: Function Reference [Contents][Index]
Get, set or clear the midicontrol object callback.
midicontrolObj - control object created using midicontrols.
functionHandle - function handle to set for call back. If it is [], the callback function will be cleared.
NOTE: currently anonymous functions will not work.
NOTE: callbacks should be cleared before losing all references to the midicontrols object.
oldhandle The previously set midicallback function handle when setting a new callback.
currhandle The current set midicallback function handle.
Set a callback on a midicontrols object
ctrl = midicontrols(2001) function dispCallback(ctrl),disp(midiread(ctrl)),endfunction; midicallback(ctrl, @dispCallback);
Clear the callback on a midicontrols object
ctrl = midicontrols(2001) midicallback(ctrl, []);
Get the current callback on a midicontrols object
ctrl = midicontrols(2001) cb = midicallback(ctrl);
See also: midicontrols, midisync, midiread.
Create a midi controls object
ctrlid - single control id or array of control ids to monitor, or [] to use any controller.
initialvalues - initial values to use for controls. It should be the same size as ctrlid
propertyname, propertyvalue - properties to set on the controller. If a device is not specified
the value from getpref("midi", "DefaultDevice", 0) will be used.
Known properties are:
name of the mididevice to monitor.
the scaling mode for values: ’rawmidi’ will return values between 0 .. 127, ’normalized’ will use values between 0 .. 1.
obj - returns a midicontrols object
Create a midicontrols object monitoring control id 2001 on the default midi device
ctrl = midicontrols(2001)
Create a midicontrols object monitoring control id 2001 on a a non default device
ctrl = midicontrols(2001, 'mididevice', 1)
See also: midiread, midisync.
Scan for control messages from midi devices to get the id of the device
Function will display a prompt for the user to move the midi control and return when a control messages is detected or ctrl-C is pressed.
None
ctrlid - control id made from the controller channel * 1000 + controller number.
dev = name of the midi device the controller was detected on.
Monitor midi devices for first moving controller
[ctrlid, devname] = midiid()
See also: mididevinfo, midicontrols.
Read current values of midi controls
midicontrolObj - control object created using midicontrols
val single value or array of current values from the midi device.
Read current value of midicontrols with a ctrlid 2001 on the default midi device.
ctrl = midicontrols(2001) val = midiread(ctrl);
Read current value of midicontrols with a ctrlid 2001 on a non default midi device.
ctrl = midicontrols(2001, 'mididevice', 1) val = midiread(ctrl);
See also: midicontrols, midisync.
Send the values of control object to the control, using ctrlvalues values if specified instead
midicontrolObj - control object created using midicontrols
ctrlvalues - values to send to the controls instead of initial values
None
Send sync command to a midicontrols with a ctrlid 2001 to set a value of 1
ctrl = midicontrols(2001) midisync(ctrl, 1);
See also: midicontrols.
Next: MIDI File I/O, Previous: MIDI Device Interface, Up: Function Reference [Contents][Index]