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

Re: SND resources

   Date: 31 May 1994 14:25:04 U
   From: Steve_Casner@qmgate.arc.nasa.gov ("Steve Casner")
   Newsgroups: comp.lang.lisp.mcl
   Distribution: world

   > do some animation while the sound plays in the background.

     you need to do ASYNCHRONOUS sound play.  the best way to do this
     is to open your sound channel at startup (and leave it open) and then 
     call your SndPlay function whenever you need to.  Pass a t argument 
     to the SndPlay function as the asynch arg (the last argument i think).

This is a sample code to play sound asynchronously.

; at startup

(setq quux
      (rlet ((foo :ptr (%null-ptr)))
        (#_SndNewChannel foo #$sampledSynth #$initMono (%null-ptr))
        (%get-ptr foo)))

; async sound play

(defvar *quack*
  (with-pstrs ((snd-name "quack"))
    (#_getnamedresource "snd " snd-name)))

(dotimes (x 10) (#_SndPlay quux *quack* t))

(#_disposptr quux)

----- Thanks -----
Masaya UEDA	ueda@shpcsl.sharp.co.jp
Information Technology Research Lab., SHARP Co.
2613-1 Ichinomoto, Tenri, Nara 632, JAPAN
TEL: +81-7436-5-2466	FAX: +81-7436-5-2163