From 1f451f302689a94a43c076e24a6e7f9037ede39a Mon Sep 17 00:00:00 2001 From: Oliver Schinagl Date: Tue, 16 Nov 2004 09:50:55 +0000 Subject: equalizer levels is no longer passed along as one large array, but as a mere pointer. --- Graphic_Equalizer/src/eventhandler.hcc | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/Graphic_Equalizer/src/eventhandler.hcc b/Graphic_Equalizer/src/eventhandler.hcc index 6194a77..c19077a 100644 --- a/Graphic_Equalizer/src/eventhandler.hcc +++ b/Graphic_Equalizer/src/eventhandler.hcc @@ -47,6 +47,11 @@ extern chan unsigned 1 maskupdate_notification; * \retval void */ void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedata_t *mousedata) { + mpram { + ram unsigned 4 write[128]; + rom unsigned 4 read[128]; + } equalizer_levels with { block = "BlockRAM"}; + unsigned 10 preset_offset; unsigned 8 equalizer_bands; unsigned 5 volume_left; @@ -56,10 +61,6 @@ void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedata_t *mo maskupdate_notification ? newmaskupdate; /* - */ - preset_offset = 0 @ events->mask -AREA_EQUALIZER_MIN; - - /* * First we determine what mousestate we currently have. Then * we check where we are to decide what to do. */ @@ -76,9 +77,18 @@ void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedata_t *mo } if ((BUTTON_PRESET_1 <= events->mask) && (events->mask <= BUTTON_PRESET_6)) { - audiodata->active_preset = 0 @ (events->mask -BUTTON_PRESET_1); + /* + */ + preset_offset = 0 @ ((events->mask -AREA_EQUALIZER_MIN) +(events->active_preset << 7)); + events->active_preset = 0 @ (events->mask -BUTTON_PRESET_1); + audiodata->equalizer_levels_ptr = equalizer_levels[0]; +#if HAVE_DEBUG +print_string("active preset: ");print_hex_value(0 @ events->active_preset);print_eol(); +print_string("preset offset: ");print_hex_value(0 @ preset_offset);print_eol(); +#endif + for (equalizer_bands = 0; equalizer_bands != 128; equalizer_bands++) { - events->equalizer_position[equalizer_bands <- 7] = equalizer_table_inv[audiodata->equalizer_levels.write[(0 @ equalizer_bands) +(audiodata->active_preset << 7)]]; + } } else { delay; @@ -137,7 +147,7 @@ void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedata_t *mo * The index is determined by the mask * minus the maskoffset. */ - events->equalizer_position[preset_offset <- 7] = mousedata->y; + events->equalizer_position[((events->mask -AREA_EQUALIZER_MIN) <- 7)] = mousedata->y; /* * We look our current possition up in * the lookup table. We determin our @@ -152,7 +162,7 @@ void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedata_t *mo * TODO: lock equalizer store with a * semaphore! */ - audiodata->equalizer_levels.write[(preset_offset +(audiodata->active_preset << 7))] = equalizer_table[((mousedata->y) -382) <- 7]; + audiodata->equalizer_levels.write[((events->mask -AREA_EQUALIZER_MIN) <- 7)] = equalizer_table[((mousedata->y) -382) <- 7]; } else { delay; } @@ -176,4 +186,4 @@ rom unsigned 5 volumecontrol_table[46] = {31, 30, 29, 28, 27, 26, 25, 24, 23, 22 * should be dynamically loaded. */ rom unsigned 4 equalizer_table[66] = {15, 15, 15, 15, 15, 14, 14, 14, 14, 13, 13, 13, 13, 12, 12, 12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0}; -rom unsigned 9 equalizer_table_inv[16] = {448, 444, 440, 436, 432, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 382}; \ No newline at end of file +rom unsigned 9 equalizer_table_inv[16] = {448, 444, 440, 436, 432, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 382}; -- cgit v0.12