[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sound



   In article <gisAg8C00iUzM32VdJ@andrew.cmu.edu> Franklin Chang
   <fc0v+@andrew.cmu.edu> writes:

     I'm interested in being able to play simple snd resources from mcl. 
   I'm sure I could figure out how to do it, but I was just wondering if
   anyone out there has done this before, and has some c/lisp code for
   doing this.

You can get a named snd resource and play it synchronously as follows.

? (setq foo (with-pstrs ((snd-name "quack"))
              (#_getnamedresource "snd " snd-name)))
#<A Mac Handle to resource 'snd '(5) : Unlocked, Size 2082 #x7984C>
? (unless (%null-ptr-p foo)
    (#_SndPlay (%null-ptr) foo nil))
0
?

If you want to play it asynchronously, you must allocate a new
sound-channel record. Don't forget to dispose it when you do not need
it any more.

? (setq bar
        (rlet ((foo :ptr (%null-ptr)))
          (#_SndNewChannel foo #$sampledSynth
                           #$initStereo (%null-ptr))
          (%get-ptr foo)))
#<A Mac Zone Pointer Size 1060 #x1CC250>
? (#_SndPlay bar foo t)
0
? (#_disposptr bar)
NIL
?

----- Thanks -----
UEDA Masaya
ueda@shpcsl.sharp.co.jp
Information Technology Research Lab., SHARP Co.
2613-1 Ichinomoto, Tenri, Nara 632, JAPAN