How would I halt the playing of a sound effect in SDL2?
Currently I'm playing sound effects using the SDL2 Mixer with this code.
Mix_PlayChannel(-1, soundEffect, 0);
However I want the play to be able to not have to listen to the entire sound effect and when they leave the menu the sound effect should stop.
I've tried Mix_HaltMusic(); however that doesn't seem to apply to Mix_Chunk.
How would I do so?
CodePudding user response:
To stop the Mix_Chunk started with Mix_PlayChannel, you have to use Mix_HaltChannel as explained in this answer for the opposite problem.
