diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2011-07-09 01:49:00 +0000 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2011-07-09 01:49:00 +0000 |
| commit | a802ebac060159015b91e266e5bff5ce7ec7918a (patch) | |
| tree | cfa85abcacc8d9ea505e928a34565532707ceebf /apps/playback.c | |
| parent | d8cb05e31ea896e4b8272b2e931f5f927294cc34 (diff) | |
| download | rockbox-a802ebac060159015b91e266e5bff5ce7ec7918a.zip rockbox-a802ebac060159015b91e266e5bff5ce7ec7918a.tar.gz rockbox-a802ebac060159015b91e266e5bff5ce7ec7918a.tar.bz2 rockbox-a802ebac060159015b91e266e5bff5ce7ec7918a.tar.xz | |
The voice PCM buffer has nothing to do with the playback PCM buffer any longer. Allocate it independently from the playback engine's PCM buffer and only when voice is required. Additionally, allocate actual space for the crossfade buffer only when using crossfade. Will save 18.3KB when neither is needed (10.3KB for voice and 8.0KB for crossfade).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30133 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playback.c')
| -rw-r--r-- | apps/playback.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/playback.c b/apps/playback.c index c74c606..fe9bd57 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -738,7 +738,7 @@ static void audio_reset_buffer(void) { /* * Layout audio buffer as follows: - * [[|TALK]|SCRATCH|BUFFERING|PCM|] + * [[|TALK]|SCRATCH|BUFFERING|PCM|[VOICE|]] */ /* see audio_get_recording_buffer if this is modified */ @@ -755,6 +755,18 @@ static void audio_reset_buffer(void) ALIGN_BUFFER(filebuf, filebuflen, sizeof (intptr_t)); + if (talk_voice_required()) + { + /* Need a space for voice PCM output */ + allocsize = voicebuf_init(filebuf + filebuflen); + + allocsize = ALIGN_UP(allocsize, sizeof (intptr_t)); + if (allocsize > filebuflen) + goto bufpanic; + + filebuflen -= allocsize; + } + /* Subtract whatever the pcm buffer says it used plus the guard buffer */ allocsize = pcmbuf_init(filebuf + filebuflen); @@ -3475,7 +3487,7 @@ unsigned char * audio_get_buffer(bool talk_buf, size_t *buffer_size) swap space */ logf("get buffer: audio"); buf = audiobuf + talk_get_bufsize(); - end = audiobufend - pcmbuf_init(audiobufend); + end = audiobufend - voicebuf_init(audiobufend); buffer_state = AUDIOBUF_STATE_VOICED_ONLY; } |