[CM] shortcut

Rick Taube taube@uiuc.edu
Tue, 24 Jan 2006 06:28:43 -0600

> is it possible to define a keyboard-shortcut to
> break a midishare output?

its a short question, but a long answer...sorry!

if by "keyboard shortcut" you mean "can I define an emacs command that 
does this?" the answer is "yes and no".
its "yes" in the sense that you can easily define an emacs command to 
send the command to lisp (see below)
its "no" in the sense that neither Midishare nor Portmidi allow you to 
flush their pending output queue (at least that I can see) -- so you 
cannot use events to queue a passage of music and then flush the queue 
before its done plying.

however, its "yes" again in the sense that you can work around this 
limitation if you use RTS. If rts is running then IT can flush its own 
cue if you call (rts-hush). So if you use RTS you could define an emacs 
keyborad command that stops output to midishare and portmidi. For exam, 
this would define it on the Function6 key:

;; put this in your .emacs file
(global-set-key (kbd "<f6>") 'slime-hush)
(defun slime-hush ()
   (interactive )
   (slime-interactive-eval "(if (rts?) (rts-hush))"))

unfortunatly, the new rts code that implements rts-hush is still 
"unstable": it works on the mac (we think) but not yet on SBCL. There 
is a patch that may fix one of the problems with SBCL but I havent had 
time to find out.
also RTS is now a "breakout package" and has some changes that are not 
documented yet.
But you can try it if you are on the mac:

	1. do a cvs update of your CM tree and delete your cm/bin/openmcl_* 
	2. cd to your parent lisp directory and do
	     cvs checkout rts
	3. start CM and do:
	    (use-system :rts)
         (use-system :midishare)

then try it out.
also in cvs:  If RTS is running you can use (events ...) to schedule to 
(defparameter mp (midishare-open))
(rts mp)
(events (foo) mp)

you CANNOT use events to write a file if rts is running.