[Haskell-cafe] FFI woes!

Keean Schupke k.schupke at imperial.ac.uk
Sat Dec 18 04:07:12 EST 2004

Sebastian Sylvan wrote:

>What do you mean?
>Yes the sample is copied to memory when loaded, but I still have to
>"worry" because if it's garbage colleced (ie, a "free" call is called
>on it) then the sound can not be played anymore (because the data is
I mean the sound card has its own, independant memory, so it should be
okay to let the sample be garbage collected. I suggest this because if the
sound library has no way to tell if the sample has finished playing (they
provide a callback in some cases but not this case) then the library author
must have considered it not necessary for some reason. The only reason I
can think of that it would not be necessary to be notified of when the 
has been finished with is if the 'play' call makes an internal copy of 
the sample
in the sound-card buffer, and it is safe to delete the sample 
immediately play
returns. The other possibility is that the library author intended all 
to remain in memory until the program finishes (like sound effects in a 
you load them once and just keep them).


More information about the Haskell-Cafe mailing list