summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2005-01-18 16:00:30 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2005-01-18 16:00:30 (GMT)
commit228191a9f3e4fbe855a573a2899fee8a1da73641 (patch)
tree814807b36d02f6bad4f99d4a5add55886ed9bd1f
parent53313f1415eca1cf26d91ca58793c20248161596 (diff)
downloadTASS-228191a9f3e4fbe855a573a2899fee8a1da73641.zip
TASS-228191a9f3e4fbe855a573a2899fee8a1da73641.tar.gz
TASS-228191a9f3e4fbe855a573a2899fee8a1da73641.tar.bz2
Added audio playback button.
Fixed demo and reset buttons beeing pressed when 'cursor' was not on the button. Fixed bug where auto gain correction would always go to 0 when started.
-rw-r--r--Graphic_Equalizer/src/eventhandler.hcc97
1 files changed, 56 insertions, 41 deletions
diff --git a/Graphic_Equalizer/src/eventhandler.hcc b/Graphic_Equalizer/src/eventhandler.hcc
index 30e1b7d..d17ce8f 100644
--- a/Graphic_Equalizer/src/eventhandler.hcc
+++ b/Graphic_Equalizer/src/eventhandler.hcc
@@ -56,7 +56,7 @@ extern chan unsigned 1 event_notification;
* \return Never Returns.
* \retval void
*/
-void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedata_t *mousedata, skindata_t *skindata) {
+inline void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedata_t *mousedata, skindata_t *skindata) {
mpram {
ram unsigned 4 write[768];
rom unsigned 4 read[768];
@@ -64,21 +64,28 @@ void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedata_t *mo
unsigned 10 preset_offset;
unsigned 10 reference_point, reference_point_right;
+ unsigned 6 gain_left_counter;
unsigned 5 volume_left;
unsigned 4 gain_left;
unsigned 4 index_offset, index_end;
unsigned 4 equalizer_mode_local;
unsigned 1 newmaskupdate, eventupdate;
+ gain_left = 0x6;
+ gain_left_counter = 0;
+
audiodata->display_log = TRUE;
+ audiodata->play = FALSE;
events->image = IMAGE_SKIN;
events->button_demo_state = FALSE;
events->button_reset_state = FALSE;
- events->inputgain_position = skindata->inputgain.bottom -10;
- RC200AudioInSetGain(FALSE, 8, 8);
+ events->saturated = FALSE;
+
+ events->inputgain_position = skindata->inputgain.top -20;
+ RC200AudioInSetGain(FALSE, gain_left, gain_left);
events->volume_position = skindata->volume.bottom -30;
RC200AudioOutSetVolume(FALSE, 0x1f -24, 0x1f -24);
@@ -90,10 +97,13 @@ void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedata_t *mo
event_notification ? eventupdate;
if (audiodata->saturated) {
- events->saturated = TRUE;
- gain_left--;
- events->inputgain_position = inputgain_table_inv[gain_left];
- RC200AudioInSetGain(FALSE, gain_left, gain_left);
+ gain_left_counter--;
+ if (!gain_left_counter) {
+ events->saturated = TRUE;
+ gain_left--;
+ events->inputgain_position = inputgain_table_inv[gain_left];
+ RC200AudioInSetGain(FALSE, gain_left, gain_left);
+ }
}
}
while (TRUE) {
@@ -176,9 +186,6 @@ void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedata_t *mo
*/
if ((BUTTON_URL_FONTYS <= events->mask) && (events->mask <= BUTTON_URL_DETAILS)) {
events->image_about = (events->mask -BUTTON_URL_FONTYS) <- 5;
- #if HAVE_DEBUG
- print_string(" image: ");print_hex_value(0@events->image_about);print_eol();
- #endif
} else {
delay;
}
@@ -189,32 +196,32 @@ void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedata_t *mo
* pointer to point to the current preset.
*/
if ((BUTTON_PRESET_1 <= events->mask) && (events->mask <= BUTTON_PRESET_6)) {
- /*
- * The active preset is determined by
- * the mask minus an offset. Hence
- * ranging our active preset from 0 to
- * 6.
- */
- events->active_preset = 0 @ (events->mask -BUTTON_PRESET_1);
- /*
- * Each equalizer is 128 bands wide,
- * thus we need to add 128 * the preset
- * for each different preset. This
- * offset is calculated here.
- */
- preset_offset = events->active_preset << 7;
- /*
- * We set the pointer to the active
- * part of the array by using the
- * preset offset as our index. Hence
- * depending on the selected preset
- * we point to 0, 128, 256, 384, 512
- * or 640.
- */
- audiodata->equalizer_levels_ptr = &equalizer_levels.read[preset_offset];
- /*
- * Finally update the equalizer bars
- * that are drawn by the display.
+ /*
+ * The active preset is determined by
+ * the mask minus an offset. Hence
+ * ranging our active preset from 0 to
+ * 6.
+ */
+ events->active_preset = 0 @ (events->mask -BUTTON_PRESET_1);
+ /*
+ * Each equalizer is 128 bands wide,
+ * thus we need to add 128 * the preset
+ * for each different preset. This
+ * offset is calculated here.
+ */
+ preset_offset = events->active_preset << 7;
+ /*
+ * We set the pointer to the active
+ * part of the array by using the
+ * preset offset as our index. Hence
+ * depending on the selected preset
+ * we point to 0, 128, 256, 384, 512
+ * or 640.
+ */
+ audiodata->equalizer_levels_ptr = &equalizer_levels.read[preset_offset]; /*
+ * Reload the equalizer bars
+ * from our buffer into
+ * the display memory.
*/
reload_equalizer(events, &equalizer_levels.write[preset_offset]);
} else {
@@ -232,6 +239,7 @@ void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedata_t *mo
* demo preset values into the presets.
*/
if (BUTTON_DEMO == events->mask) {
+ events->button_demo_state = TRUE;
load_preset(LOAD_PRESET_DEMO, equalizer_levels.write);
reload_equalizer(events, &equalizer_levels.write[preset_offset]);
}
@@ -241,6 +249,7 @@ void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedata_t *mo
* reset values into the presets.
*/
if (BUTTON_RESET == events->mask) {
+ events->button_reset_state = TRUE;
load_preset(LOAD_PRESET_RESET, equalizer_levels.write);
reload_equalizer(events, &equalizer_levels.write[preset_offset]);
}
@@ -255,11 +264,10 @@ void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedata_t *mo
delay;
}
- if (BUTTON_DEMO == events->mask) {
- events->button_demo_state = TRUE;
- }
- if (BUTTON_RESET == events->mask) {
- events->button_reset_state = TRUE;
+ if (BUTTON_PLAY == events->mask) {
+ audiodata->play = !audiodata->play;
+ } else {
+ delay;
}
break;
@@ -397,6 +405,13 @@ void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedata_t *mo
} else {
delay;
}
+
+ if (BUTTON_DEMO != events->mask) {
+ events->button_demo_state = FALSE;
+ }
+ if (BUTTON_RESET != events->mask) {
+ events->button_reset_state = FALSE;
+ }
break;