[Haskell-cafe] FFI woes!
Sebastian Sylvan
sebastian.sylvan at gmail.com
Thu Dec 16 10:25:55 EST 2004
On Thu, 16 Dec 2004 12:35:55 +0000, Keean Schupke
<k.schupke at imperial.ac.uk> wrote:
> Okay, you want to poll to see if the sound is still playing... This is
> not very
> easy to do...
>
> You really want to use the low-buffer callback from the soundcard
> driver to load the next sample into the buffer using DMA. (IE you
> can pass a function to the driver to call when you sample has been
> copied completely to the sound-cards memory). This is the way to
> do it...
>
> play_then_free = do
> set_callback (free_sample my_sample)
> play_sample my_sample
>
> You can see that this provides the interface you want to the user (IE
> samples are freed once they are finished with)...
>
> Keean.
This is exactly how I do it for the Stream sound type, since this type
of sound supplies a callback for when it reaches the end. The sound
sample does not, though.
(stream is streamed from disk, sound sample is loaded into memory).
/S
--
Sebastian Sylvan
+46(0)736-818655
UIN: 44640862
More information about the Haskell-Cafe
mailing list