
A few notes to clarify the use of memory in ARlib
-------------------------------------------------

The following memory areas are used. The first two cannot be changed but the last three can be altered to suit your environment and machine.

 (1) Various small amounts of memory are used for structures and strings. This is always allocated off the malloc heap, but should never amount to more than a few K (and then only if you have a number of movies queued).

 (2) Memory is allocated from the RMA for the sound code (the SoundXX files in !ARMovie). Only one is loaded at a time and stays loaded until a different one is needed. The maximum used then is currently 12k (the size of the ADPCM code).

 (3) Memory is needed for the chunk catalogues. These are typically small but can get up to tens of K for long movies with small chunk sizes.

    The default is to use the malloc heeap but if you use flex you should call armovie_registercataloguememfns(f_alloc, f_free) to reuce the risk of running out of room within the wimpslot.

 (3) A temporary buffer is needed into which each chunk of sound data is loaded before being transferred into the actual buffers it will be played from. This buffer will be allocated when the sound starts and deallocated when the last sound in a queue finishes. It will be the size of the largest chunk in the first movie played.

     It defaults to the malloc heap. If you use flex then you should call
armovie_registermemfns(f_alloc, f_free). There is no benefit to using any of the other memory allocators.

 (4) Two buffers are needed, accessible under interrupts, for the sound code to draw data from, they will be the size of the largest chunk, adjusted by the difference in sample size between the movie and the playback device being used.

     By default the RMA is used. On a Risc PC you should use a dynamic area and so call armovie_registersoundmemfns(d_alloc, d_free). This will help to minimise RMA fragmentation.


So in summary:

If you use use flex then you should call the following in your initialisation (after armovie_init()).

   armovie_registermemfns(f_alloc, f_free);
   armovie_registercataloguememfns(f_alloc, f_free);
   if (dynamicarea_init())
      armovie_registersoundmemfns(d_alloc, d_free);

If you don't use flex then include the following

   if (dynamicarea_init())
      armovie_registersoundmemfns(d_alloc, d_free);

eof MemoryUse.
