FS#11587 - Voice for SWCODEC and low memory

Attached to Project: Rockbox
Opened by Rafaël Carré (funman) - Tuesday, 31 August 2010, 00:06 GMT
Last edited by Rafaël Carré (funman) - Wednesday, 01 September 2010, 00:10 GMT
Task Type Patches
Category User Interface
Status Closed
Assigned To No-one
Operating System Another
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Voice doesn't work on Clipv1/c200v2 & cie, the voice file is too big to fit entirely in RAM

Trying to use a voice file will give a panic on startup.

This patch reuses the code set up for the Ondios (which load the entire file in RAM but progressively), and will only load 64 (the size of the clips queue) clips maximum, (+ the "SILENCE" clip).

It reserves 64 * the_size_of_the_biggest_clip bytes, which is ~300kB for the default voice on Clipv1 (450kB audiobuffer left after that).

It works correctly at startup but later fails (easily seen when spelling a directory for example)
This task depends upon

Closed by  Rafaël Carré (funman)
Wednesday, 01 September 2010, 00:10 GMT
Reason for closing:  Accepted
Additional comments about closing:  r27961
Comment by Rafaël Carré (funman) - Tuesday, 31 August 2010, 04:34 GMT
Now works correctly.

Bump the age of each buffered clip when we are loading a new entry, and reset the age for the clip to 0 each time it is used.

When we load a new entry we unload the oldest entry. It works in O(n) because finding the oldest entry is done in the same loop than bumping the ages of loaded clips.

I will commit it sometime soon.