Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > irrKlang
Preloading sounds, addSoundSourceFromMemory and memory usage

mvhooren
Registered User
Quote
2012-06-29 16:46:06

Our game has over 700 sound effects that need to be pre-loaded during the startup sequence of the game.
I used to do this by calling play2D on all of them with the startPaused and track flags set to true. However, on older hardware this takes about 30 seconds.
To reduce the loading time, I combined the sound effects into several large package files. I then load a package file into memory and call addSoundSourceFromMemory for each file in the package.

Now the problem is that using this method causes the memory usage of irrklang to double compared to what I was doing before. Apparently irrklang makes copies of the PCM data when calling play2D in combination with addSoundSourceFromMemory. This should realy not be necessary since the source files are simple .wav files and already contain PCM data. This even happens if I set the streamMode of play2D to ESM_STREAMING.

Also, I couldn't find a way to release the ISoundSource objects after the sounds were loaded using play2D.

Is there any way to load sound files from packaged data files without doubling the memory usage?


erik
Registered User
Quote
2012-06-30 10:21:56

I don't think preloading 700 (!) sounds is an entirely good idea. But I think irrKlang has a preload flag somewhere, when calling addSoundSourceFromFile. Maybe using that will help? Play2D is definately not designed to be used for preloading, it is for playing. :)


mvhooren
Registered User
Quote
2012-07-02 10:41:37

Preloading the sound files is a good idea because we get framedrops if we load any sound effects during gameplay. They are mostly very short sound effects, so it should be OK to preload that many sounds. (about 90MB in total).

addSoundSourceFromFile will not improve our current situation because it will still take 30 seconds to load.


oogst
Registered User
Quote
2012-07-06 16:28:31

The only problem we are having is that the sounds are all stored twice in memory. Does anyone know how to make Irrklang not use twice as much memory as needed?

(I am working on the same project as mvhooren)


niko
Moderator
Quote
2012-07-08 21:59:15

You could switch to WinMM, this reduces memory usage. Otherwise, there is no way to improve this further, sorry.


oogst
Registered User
Quote
2012-07-09 09:47:36

We are already using WinMM...

Just curious: what is the memory being used for?


niko
Moderator
Quote
2012-07-09 18:30:24

Hm that's strange, then it's probably windows using it internally? Not sure there.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internatio?al" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact