diff options
author | Thomas Martitz <kugel@rockbox.org> | 2011-08-30 14:01:33 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2011-08-30 14:01:33 +0000 |
commit | d0b72e25903574acb1cf9184a6052cdd646dbc37 (patch) | |
tree | 5be8db5ee00b2a727e4821cf51a5f7bcf3991073 /apps/tdspeed.c | |
parent | c940811ade7d99a0e0d414df7c6509672413684a (diff) |
GSoC/Buflib: Add buflib memory alocator to the core.
The buflib memory allocator is handle based and can free and
compact, move or resize memory on demand. This allows to effeciently
allocate memory dynamically without an MMU, by avoiding fragmentation
through memory compaction.
This patch adds the buflib library to the core, along with
convinience wrappers to omit the context parameter. Compaction is
not yet enabled, but will be in a later patch. Therefore, this acts as a
replacement for buffer_alloc/buffer_get_buffer() with the benifit of a debug
menu.
See buflib.h for some API documentation.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30380 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tdspeed.c')
-rw-r--r-- | apps/tdspeed.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/apps/tdspeed.c b/apps/tdspeed.c index b940c928fc..476995a271 100644 --- a/apps/tdspeed.c +++ b/apps/tdspeed.c @@ -25,7 +25,7 @@ #include <stdio.h> #include <string.h> #include "sound.h" -#include "buffer.h" +#include "core_alloc.h" #include "system.h" #include "tdspeed.h" #include "settings.h" @@ -56,21 +56,32 @@ static int32_t *outbuf[2] = { NULL, NULL }; void tdspeed_init(void) { + int handle; + if (!global_settings.timestretch_enabled) return; /* Allocate buffers */ if (overlap_buffer[0] == NULL) - overlap_buffer[0] = (int32_t *)buffer_alloc(FIXED_BUFSIZE * sizeof(int32_t)); - + { + handle = core_alloc("tdspeed ovl left", FIXED_BUFSIZE * sizeof(int32_t)); + overlap_buffer[0] = core_get_data(handle); + } if (overlap_buffer[1] == NULL) - overlap_buffer[1] = (int32_t *)buffer_alloc(FIXED_BUFSIZE * sizeof(int32_t)); - + { + handle = core_alloc("tdspeed ovl right", FIXED_BUFSIZE * sizeof(int32_t)); + overlap_buffer[1] = core_get_data(handle); + } if (outbuf[0] == NULL) - outbuf[0] = (int32_t *)buffer_alloc(TDSPEED_OUTBUFSIZE * sizeof(int32_t)); - + { + handle = core_alloc("tdspeed left", TDSPEED_OUTBUFSIZE * sizeof(int32_t)); + outbuf[0] = core_get_data(handle); + } if (outbuf[1] == NULL) - outbuf[1] = (int32_t *)buffer_alloc(TDSPEED_OUTBUFSIZE * sizeof(int32_t)); + { + handle = core_alloc("tdspeed right", TDSPEED_OUTBUFSIZE * sizeof(int32_t)); + outbuf[1] = core_get_data(handle); + } } |