[CELT-dev] Allocating all memory up front

Chen-Po Sun chenpo at fmod.org
Tue Jul 21 23:54:28 PDT 2009


Hi guys,

I'm currently working on a CELT implementation for FMOD, and one of the 
things we want to do is have all memory required allocated beforehand. 
This is before we have any information about what sounds will be played.

We would like to create all of our CELTDecode instances up front. 
Because celt_mode_create() requires a sample rate and number of channels 
passed in, this doesn't seem like it is currently possible.

What I am thinking of doing is calling celt_mode_create() and 
celt_decoder_create() up front with the maximum values for sample rate 
and number of channels, this will allocate all the memory we need. Then 
when we actually go to play a sound and know the rate and number of 
channels, we can fix up the appropriate mode parameters before decoding.

The only problem I can see is that eBands and window are generated when 
celt_mode_create() is called. I'm thinking I can just generate these in 
our encoder, and store it in our sound banks. Then when we go to fix up 
the mode members before decoding, set the appropriate eBand and window.

Does this sound okay to you guys? Is there anything I might have 
overlooked that will make this approach not-doable?

Thanks for your help.

-- 
Chen-Po Sun
Firelight Technologies
http://www.fmod.org/




More information about the celt-dev mailing list