summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2005-01-20 07:50:49 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2005-01-20 07:50:49 (GMT)
commit41ab49da7dece2a57bef290734e67ba10eeee942 (patch)
tree1a69701cee12718cd79173b27f3a7749d1526e38
parent81ac07a0b1b5ea784473531ca8103f5c3882f7c3 (diff)
downloadTASS-41ab49da7dece2a57bef290734e67ba10eeee942.zip
TASS-41ab49da7dece2a57bef290734e67ba10eeee942.tar.gz
TASS-41ab49da7dece2a57bef290734e67ba10eeee942.tar.bz2
mouse coordinate stores are now 11 bits wide.
Added inline functions for volume and gain control.
-rw-r--r--Graphic_Equalizer/src/events.hcc105
1 files changed, 104 insertions, 1 deletions
diff --git a/Graphic_Equalizer/src/events.hcc b/Graphic_Equalizer/src/events.hcc
index 2e8c272..275bc25 100644
--- a/Graphic_Equalizer/src/events.hcc
+++ b/Graphic_Equalizer/src/events.hcc
@@ -26,6 +26,7 @@
/******** Application Includes ********/
#include "configuration.hch"
+#include "display_shared.hch"
#include "eventhandler_shared.hch"
#include "events.hch"
@@ -40,6 +41,108 @@ ram unsigned 8 presets_default_values[768] = {
+/*! \fn void set_preset(unsigned 10 *active_preset,
+ * unsigned 10 *preset_offset, unsigned 8 new_preset,
+ * unsigned 4 *equalizer_levels_ptr,
+ * unsigned 4 *equalizer_levels)
+ * \brief This function changes the active preset to the new_preset
+ * received from the userinterface and updates internal pointers.
+ *
+ * \param *active_preset Local store that holds the current
+ * active preset.
+ * \param *preset_offset Local store that holds the index to the
+ * current active preset in the presets
+ * array.
+ * \param new_preset The new preset.
+ * \param *equalizer_levels_ptr Pointer pointing to the current
+ * equalizer settings.
+ * \param *equalizer_levels Local store with all presets.
+ */
+inline void set_preset(unsigned 10 *active_preset, unsigned 10 *preset_offset, unsigned 8 new_preset, unsigned 4 *equalizer_levels_ptr, unsigned 4 *equalizer_levels) {
+ /*
+ * The active preset is determined by the mask minus an offset. Hence
+ * ranging our active preset from 0 to 6.
+ */
+ *active_preset = 0 @ new_preset;
+ /*
+ * 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 = *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.
+ */
+ equalizer_levels_ptr = &equalizer_levels[*preset_offset];
+}
+
+
+
+/*
+ */
+inline unsigned 5 change_volume_from_coordinate(unsigned 11 coordinate, events_t *events, skindata_t *skindata) {
+ unsigned 5 retval;
+ unsigned 5 volumeleft;
+
+ /*
+ * Copy the current Y cursor position to the events struct. This we
+ * need for drawing purposes.
+ */
+ events->volume_position = coordinate;
+ /*
+ * Look the relative y-coordinate up in the volumecontrol lookup table.
+ * We make a local copy here because the RC200 call doesn't behave
+ * nicely when passing anything else.
+ */
+ volumeleft = volumecontrol_table[(coordinate -skindata->volume.top) <- 6];
+ /*
+ * We feel that volume gets softer the closer it gets to the 0, and
+ * louder as it approaches 0x1f. The SetVolume RC200 call does this in
+ * an unnatural reverse way. Therefor we 'fix' it.
+ */
+ RC200AudioOutSetVolume(!volumeleft, (0x1f -volumeleft), (0x1f -volumeleft));
+ /*
+ * Now that we have set the gain, we return it incase someone needs it.
+ */
+ retval = volumeleft;
+
+ return retval;
+}
+
+
+
+/*
+ */
+inline unsigned 4 change_inputgain_from_coordinate(unsigned 11 coordinate, events_t *events, skindata_t *skindata) {
+ unsigned 4 retval;
+ unsigned 4 gainleft;
+
+ /*
+ * Copy the current Y cursor position to the events struct. This we
+ * then later use for drawing purposes.
+ */
+ events->inputgain_position = coordinate;
+ /*
+ * Look the relative y-coordinate up in the inputgain lookup table. We
+ * make a local copy here because the RC200 call doesn't behave nicely
+ * when passing anything else.
+ */
+ gainleft = inputgain_table[(coordinate -skindata->inputgain.top) <- 6];
+ /*
+ * Finally we set the gain as calculated.
+ */
+ RC200AudioInSetGain(!gainleft, gainleft, gainleft);
+ /*
+ * Now that we have set the gain, we return it incase someone needs it.
+ */
+ retval = gainleft;
+
+ return retval;
+}
+
+
+
/*! \fn void load_preset(unsigned 10 preset, unsigned 4 *equalizer_levels_ptr);
* \brief This function loads 768 4bits presets into the equalizer_levels
* array pointed to by equalizer_levels.
@@ -73,4 +176,4 @@ void load_preset(unsigned 10 preset, unsigned 4 *equalizer_levels_ptr) {
* should be dynamically loaded.
*/
ram unsigned 4 equalizer_table[640] = {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};
-ram unsigned 10 equalizer_table_inv[16] = {446, 444, 440, 436, 432, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 384};
+ram unsigned 11 equalizer_table_inv[16] = {446, 444, 440, 436, 432, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 384};