Create an object that responds to any control on the default
MIDI device.
Define an anonymous function to display the current value
of the MIDI control. Use midicallback
to associate
your MIDI control object with the function you created. Verify that
your object is associated with your function.
currentFunctionHandle =
@(object)disp(midiread(object))
Move any control on your default MIDI device to display
its current normalized value on the command line.
0.3095
0.4603
0.6746
0.7381
0.8175
0.8571
0.9048
Define an anonymous function to print the current value
of the MIDI control rounded to two significant digits. Use midicallback
to
associate your MIDI controls object with the function you created.
Return the old function handle.
oldFunctionHandle =
@(object)disp(midiread(object))
Move a control to display its current normalized value
rounded to two significant digits.
0.91
0.83
0.67
0.49
0.29
0.18
0.05
Remove the association between the object and the function.
Return the old function handle.
oldFunctionHandle =
@(object)fprintf('%.2f\n',midiread(object))
Verify that no function is associated with your MIDI controls
object.
currentFunctionHandle =
[]