[SOLVED] Closing file handle for static sounds.


13-10-2014 08:14:17


I've noticed that OgreOggSound doesn't close file handle for sound until it is destroyed. It's ok for streamed sound, but what is the reason to keep it open for static (non-streamed) sound?
I use Marmalade with the restriction for maximum 32 file handles, therefore can not even preload all needed sounds.


16-10-2014 00:14:59

Are you talking about the mOggStream/mAudioStream pointers?

I guess they could be cleaned up after the data load..


16-10-2014 09:01:42

I've added the marked line in OgreOggSoundManager.cpp, function _loadSoundImpl():

// Load audio file
Ogre::DataStreamPtr stream = _openStream(file);

if (!sound->mStream) stream->close(); // it's my line!

Now it's ok.
The limit for the number of simultaneously opened files differs from system to system, from 512 in C run-time libraries to 16384 in Win32 API.
For some reason in cross-platform Marmalade library the limit is set to only 32, that's why I couldn't preload all sounds that I need.