[CM] a current CM class hierarchy?
Han Shin Kim
manseh1@yahoo.de
Tue, 7 Dec 2004 02:02:42 +0100
event-stream seems to be a subclass of event.
So, are there two main root classes...??
I use CM-2.4.2-bin-10.2/OpenMCL
And the result of (class-tree (find-class 'event)) is very different
from yours.
I would have to learn the new.
btw,
I wrote two fuction to represent it a little better.
They aren't so elegant but work. :)
(defun tabformat (sym n)
(format t (concatenate 'string "~%~" (format nil "~at~a" n sym))))
(defun view-tree (alist &optional (tab 1) (step 3))
(cond ((null alist) nil)
(t (tabformat (car alist) tab)
(loop for c in (cdr alist) do
(if (listp c) (view-tree c (+ tab step) step)
(tabformat c (+ tab step)))))))
? (view-tree (class-tree (find-class 'event-stream)))
EVENT-STREAM
CMN-STREAM
MIDI-STREAM
MIDISHARE-STREAM
PLAYER-STREAM
MIDI-FILE-STREAM
CLM-AUDIO-STREAM
CLM-STREAM
SCO-STREAM
NIL
2004. 12. 07, Dienstag, 12:04 Uhr, Han Shin Kim ÀÛ¼º:
> I appreciate your detailed answer.
> It is very helpful.
>
> 2004. 12. 06, Montag, 09:42 Uhr, Rick Taube ÀÛ¼º:
>
>>>
>>> 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)
>>
>> ?
---------------------------------------------------------------------
A korean community for Software Synthesizer & Programming
http://cafe.daum.net/klangsynthese
DOT.