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

soundmanager channel allocation




#|Hello, I am trying to play a sound on a specified channel (*channel*).
 However, I keep getting a -201 error. The function works when I replace 
 (%get-ptr *channel* 0) in sndstartfileplay with (%null-ptr) thereby allowing
 the soundmanager to allocate its own channel.  Any suggestions would be 
 greatly appreciated.

Nichole |#


(defparameter *channel* nil)

(def-load-pointers *channel* ()
  (setf *channel* (#_NewPtr 4)
        (%get-ptr *channel* 0) (make-record :sndChannel))
  (#_sndNewChannel *channel* 0 0 (%null-ptr)))


(defun sound-play (filename)
  (let ((fn (namestring (full-pathname filename))))
    (with-pstrs ((s fn))
      (%stack-block ((refnum 4))
        (#~FSOpen s 0 refnum)
        (#_sndstartfileplay (%get-ptr *channel* 0)
         (%get-signed-word refnum) 0
         (* 32 1024) (%null-ptr) (%null-ptr) (%null-ptr) t)))))