Моя обертка может успешно воспроизводить звуки, но проблемы начинаются, как только звуки воспроизводятся в последовательности.
Код: Выделить всё
void playSound( const std::string & category,
const std::string & soundName,
const std::string & whenChannelsBusy = "return" )
{
//Check: Is the category and soundName combo a persistently loaded sound?
if( stevensSound::isPersistentlyStored( category, soundName ) )
{
//If so, play the preloaded sound
stevensSound::playPersistentSound( category, soundName, whenChannelsBusy );
return;
}
//Also check: is the category and soundName combo an existing sound in the 2D sounds map?
else if( !stevensSound::soundsContains( category, soundName ) )
{
//If not, print an error and return
std::string errorMsg = "stevensSound::playSound() error, requested to play sound with category \"" + category + "\" and name \""
+ soundName + "\", but no such sound matching the category and name exists in stevensSound::sounds";
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79573895/sdl-mixer-leaking-memory-upon-playing-sounds-quickly[/url]
Мобильная версия