
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 gone).
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 sample 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 samples to remain in memory until the program finishes (like sound effects in a game, you load them once and just keep them). Keean.