Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stopping _SNDPLAYCOPY ?Possible?
#14
(08-07-2024, 10:30 PM)SMcNeill Wrote:
(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. Wink

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
That's a good solution. The second parameter would need to be optional however to avoid breaking existing code that currently uses _SNDSTOP.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply


Messages In This Thread
RE: Stopping _SNDPLAYCOPY ?Possible? - by a740g - 08-07-2024, 02:48 PM
RE: Stopping _SNDPLAYCOPY ?Possible? - by TerryRitchie - 08-08-2024, 01:48 AM
RE: Stopping _SNDPLAYCOPY ?Possible? - by Pete - 08-07-2024, 03:44 PM
RE: Stopping _SNDPLAYCOPY ?Possible? - by Pete - 08-07-2024, 11:16 PM



Users browsing this thread: 3 Guest(s)