08-08-2024, 01:48 AM
(08-07-2024, 10:30 PM)SMcNeill Wrote:That's a good solution. The second parameter would need to be optional however to avoid breaking existing code that currently uses _SNDSTOP.(08-07-2024, 02:48 PM)a740g Wrote: I think _SNDSTOPCOPIES may be a good idea. A fair amount of complexity is involved in getting this done on the BASIC side using arrays, _SNDCOPY & _SNDCLOSE. There is no way to stop and dispose of copies until it finishes playing. Also, the C++ side implementation is trivial.
Maybe we can have this in 3.15 when we make more audio-specific improvements.
Instead of a new command, might I suggest a tweaking of the existing commands?
_SNDSTOP handle, (flags$)
Where the optional flag$ would be
"ONLY" <-- this only stops the original
"COPIES" <--- this would stop the original and any _SNDPLAYCOPY
"ALL" <-- this would stop the original and and copies.
Would save creating another sound related keyword for folks to have to chug through and remember, when there's already a boatload of them out there. Usage would be similar to:
Code: (Select All)DIM AS LONG h, i
h = _SNDOPEN("explosion.wav")
_SNDPLAY h
_SNDPLAYCOPY h
_SNDPLAYCOPY h
_SNDPLAYCOPY h
_SNDSTOP h, "ONLY" <-- to stop the _SNDPLAY with the original
_SNDSTOP h, "COPIES" <-- to stop all copies using that original handle
_SNDSTOP h, "BOTH" <--- to stop both at once