changeset 204:c9fbb822d269

core: allocate sound channels at startup
author David Demelier <markand@malikania.fr>
date Tue, 10 Nov 2020 09:10:52 +0100
parents d3ef968745f5
children 6b29e487da13
files libcore/core/sound.h libcore/core/sys.c
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libcore/core/sound.h	Mon Nov 09 21:18:41 2020 +0100
+++ b/libcore/core/sound.h	Tue Nov 10 09:10:52 2020 +0100
@@ -32,7 +32,7 @@
 /**
  * \brief Number of channels allocated.
  */
-#define SOUND_MAX_CHANNELS	(256)
+#define SOUND_CHANNELS_MAX      (256)
 
 /**
  * \brief Sound chunk.
--- a/libcore/core/sys.c	Mon Nov 09 21:18:41 2020 +0100
+++ b/libcore/core/sys.c	Tue Nov 10 09:10:52 2020 +0100
@@ -32,6 +32,7 @@
 #endif
 
 #include "error.h"
+#include "sound.h"
 #include "sys.h"
 
 #if defined(_WIN32)
@@ -116,6 +117,8 @@
 	if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 4096) < 0)
 		return errorf("%s", SDL_GetError());
 
+	Mix_AllocateChannels(SOUND_CHANNELS_MAX);
+
 	return true;
 }