From 76dda8291cf5b73a65b3809910c4980b80521f7c Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Tue, 2 Aug 2011 17:26:45 +0200 Subject: [PATCH] Simplify tdspeed.c for review --- apps/dsp.c | 2 +- apps/tdspeed.c | 44 ++++---------------------------------------- 2 files changed, 5 insertions(+), 41 deletions(-) diff --git a/apps/dsp.c b/apps/dsp.c index 31a44e343..bbdfc6dde 100644 --- a/apps/dsp.c +++ b/apps/dsp.c @@ -1211,7 +1211,7 @@ int dsp_callback(int msg, intptr_t param) */ int dsp_process(struct dsp_config *dsp, char *dst, const char *src[], int count) { - static int32_t *tmp[2]; /* tdspeed_doit() needs it static */ + int32_t *tmp[2]; static long last_yield; long tick; int written = 0; diff --git a/apps/tdspeed.c b/apps/tdspeed.c index 9acaddba3..2000952e8 100644 --- a/apps/tdspeed.c +++ b/apps/tdspeed.c @@ -38,44 +38,9 @@ #define FIXED_BUFSIZE 3072 /* 48KHz factor 3.0 */ -static int32_t** dsp_src; static int32_t *overlap_buffer[2] = { NULL, NULL }; static int32_t *outbuf[2] = { NULL, NULL }; -static int move_callback(int handle, void* current, void* new) -{ - /* TODO */ - (void)handle; - if (dsp_src) - { - int ch = (current == outbuf[0]) ? 0 : 1; - dsp_src[ch] = outbuf[ch] = new; - } - return BUFLIB_CB_OK; -} - -static struct buflib_callbacks ops = { - .move_callback = move_callback, - .shrink_callback = NULL, -}; -static int ovl_move_callback(int handle, void* current, void* new) -{ - /* TODO */ - (void)handle; - if (dsp_src) - { - int ch = (current == overlap_buffer[0]) ? 0 : 1; - overlap_buffer[ch] = new; - } - return BUFLIB_CB_OK; -} - -static struct buflib_callbacks ovl_ops = { - .move_callback = ovl_move_callback, - .shrink_callback = NULL, -}; - - struct tdspeed_state_s { bool stereo; @@ -98,22 +63,22 @@ void tdspeed_init() int handle; if (overlap_buffer[0] == NULL) { - handle = core_alloc_ex("tdspeed ovl left", FIXED_BUFSIZE * sizeof(int32_t), &ovl_ops); + handle = core_alloc("tdspeed ovl left", FIXED_BUFSIZE * sizeof(int32_t)); overlap_buffer[0] = core_get_data(handle); } if (overlap_buffer[1] == NULL) { - handle = core_alloc_ex("tdspeed ovl right", FIXED_BUFSIZE * sizeof(int32_t), &ovl_ops); + handle = core_alloc("tdspeed ovl right", FIXED_BUFSIZE * sizeof(int32_t)); overlap_buffer[1] = core_get_data(handle); } if (outbuf[0] == NULL) { - handle = core_alloc_ex("tdspeed left", TDSPEED_OUTBUFSIZE * sizeof(int32_t), &ops); + handle = core_alloc("tdspeed left", TDSPEED_OUTBUFSIZE * sizeof(int32_t)); outbuf[0] = core_get_data(handle); } if (outbuf[1] == NULL) { - handle = core_alloc_ex("tdspeed right", TDSPEED_OUTBUFSIZE * sizeof(int32_t), &ops); + handle = core_alloc("tdspeed right", TDSPEED_OUTBUFSIZE * sizeof(int32_t)); outbuf[1] = core_get_data(handle); } } @@ -373,7 +338,6 @@ long tdspeed_est_input_size(long size) int tdspeed_doit(int32_t *src[], int count) { - dsp_src = src; count = tdspeed_apply( (int32_t *[2]) { outbuf[0], outbuf[1] }, src, count, 0, TDSPEED_OUTBUFSIZE); src[0] = outbuf[0]; -- 2.11.4.GIT