[plt-scheme] Music player :o)

From: Laurent (Ouaibou at gmail.com)
Date: Mon Apr 9 15:52:23 EDT 2007


I seek to manage the music playing in MrEd.
For that I made a small class:

(define music-player%
  (class object%
    (define thread-sound '?)

    (define/public (play file)
      (set! thread-sound (thread (lambda ()
                                   (play-sound file #t)))))
    (define/public (pause)
      (if (thread? thread-sound)
          (thread-suspend thread-sound)
          (error "You must play sound before pause !")))

    (define/public (stop)
       (if (thread? thread-sound)
           (begin (kill-thread thread-sound)
                     (set! thread-sound '?))
           (error "You must play sound before stop !")))


(define m (new music-player%))

(send m play "./audio/bg2.wav")
(sleep/yield 3)
(send m pause)

However that doesn't perform. The thread is not associated with the
Is it possible with MrEd to stop and put in pause the reading of an
audio file?


Posted on the users mailing list.