[CM] a current CM class hierarchy?
Rick Taube
taube@uiuc.edu
Mon, 6 Dec 2004 14:42:05 -0600
>
> Where can one find the current CM class hierarchy tree?
>
> I have one but it seems too old.
The reason that I dont include one is because its dynamic -- the class
tree is augmented depending o nwhat software you have loaded. for
example, every time you load a clm insrument you get a new class, same
with cmn, midishare and so on. It also depends on what version of cm
you are using.
Here is a function you can use to return a list of subclasses. The CAR
of every list is a superclass of the rest of the classes in that list:
;---
(in-package :cm)
(defun class-tree (root)
(let ((subs #+clisp (clos::class-direct-subclasses root)
#+openmcl (ccl::class-direct-subclasses root)
#+sbcl (sb-mop:class-direct-subclasses root))
(name (class-name root)))
(if (null subs)
name
(cons name
(loop for c in subs
collect (class-tree c))))))
;---
The three main root classes in cm are EVENT, CONTAINER and
EVENT-STREAM. This is what it looks like in cm-2.5.0/openmcl with
nothing special laoded:
? (class-tree (find-class 'event))
(EVENT CMN MIDI (MIDI-EVENT (MIDI-META-EVENT MIDI-SEQUENCER-EVENT
MIDI-KEY-SIGNATURE MIDI-TIME-SIGNATURE MIDI-SMPTE-OFFSET
MIDI-TEMPO-CHANGE MIDI-EOT MIDI-TEXT-EVENT MIDI-SEQUENCE-NUMBER)
MIDI-SYSTEM-EVENT (MIDI-CHANNEL-EVENT MIDI-PITCH-BEND
MIDI-CHANNEL-PRESSURE MIDI-PROGRAM-CHANGE MIDI-CONTROL-CHANGE
MIDI-KEY-PRESSURE MIDI-NOTE-OFF MIDI-NOTE-ON)) F I)
? (class-tree (find-class 'container))
(CONTAINER (EVENT-STREAM CMN-STREAM (MIDI-STREAM (MIDISHARE-STREAM
PLAYER-STREAM MIDI-PORT) MIDI-FILE-STREAM) CLM-AUDIO-STREAM CLM-STREAM
SCO-STREAM) TRANSPOSER (PATTERN COPIER JOIN CHORD RANGE REWRITE FUNCALL
ACCUMULATION GRAPH MARKOV RANDOM LINE PALINDROME (CYCLE ROTATION HEAP))
(SCALE MODE TUNING) SEQ)
? (class-tree (find-class 'event-stream))
(EVENT-STREAM CMN-STREAM (MIDI-STREAM (MIDISHARE-STREAM PLAYER-STREAM
MIDI-PORT) MIDI-FILE-STREAM) CLM-AUDIO-STREAM CLM-STREAM SCO-STREAM)
?