[SDL] "ERROR: Couldn't load music Out of sample handles to load sample" ?
wizard at syntheticsw.com
Tue Jul 12 17:39:39 PDT 2011
> I think I have reached some limit to the number of MOD musics I can load?
> Got up to about 20 MOD musics being loaded at program start,
> and now can't add anymore?
I just tried to load the same module a few times in my programm
and got the same error message like you, so there really is a "Nr. of samples"
limit in MikMod. (37x worked, 38x failed)
It seems MikMod adds all the samples from the loaded modules to a sample pool.
> Anyone have any idea on how to solve this?
The easiest solution is to just load the musics you need right now and free them
as soon as they are not needed any longer. When you are in the game, you probably do not
need the menu music or the credits music.
Another way is to load them to a memory area, copying the file 1:1 from disk to the memory,
without using SDL_mixer and the using SDL_mixer + RWops to load it from the memory and then free
it when you do not need it anymore. That way you can load all the modules into memory on start,
but do not overflow MikMods sample pool.
More information about the SDL