summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2005-01-20 08:20:50 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2005-01-20 08:20:50 (GMT)
commitb936ceccaef2a62e5160cd8d4b06275d8371c8c7 (patch)
treefadef9f7252b6098d5902d583b301c01dc8b1bbb
parentdbd0ba4e58a87006957d198f4caddc4a55ba5072 (diff)
downloadTASS-b936ceccaef2a62e5160cd8d4b06275d8371c8c7.zip
TASS-b936ceccaef2a62e5160cd8d4b06275d8371c8c7.tar.gz
TASS-b936ceccaef2a62e5160cd8d4b06275d8371c8c7.tar.bz2
mouse coordinate stores are now 11 bits wide.
Input gain can be 'disabled' when playing audio from SMC. Volume and gain control is now done via functions. Added commented code for advanced audio player.
-rw-r--r--Graphic_Equalizer/src/eventhandler.hcc137
1 files changed, 66 insertions, 71 deletions
diff --git a/Graphic_Equalizer/src/eventhandler.hcc b/Graphic_Equalizer/src/eventhandler.hcc
index d17ce8f..5cdee4e 100644
--- a/Graphic_Equalizer/src/eventhandler.hcc
+++ b/Graphic_Equalizer/src/eventhandler.hcc
@@ -62,33 +62,25 @@ inline void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedat
rom unsigned 4 read[768];
} equalizer_levels with { block = "BlockRAM"};
+ unsigned 11 reference_point, reference_point_right;
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 6 gain_counter;
+ unsigned 5 old_volume;
+ unsigned 5 volume;
+ unsigned 4 gain;
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->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);
-
+ volume = change_volume_from_coordinate(volumecontrol_table_inv[0x18], events, skindata);
+ gain = change_inputgain_from_coordinate(inputgain_table_inv[0xf], events, skindata);
load_preset(LOAD_PRESET_RESET, equalizer_levels.write);
reload_equalizer(events, &equalizer_levels.write[preset_offset]);
@@ -97,19 +89,17 @@ inline void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedat
event_notification ? eventupdate;
if (audiodata->saturated) {
- gain_left_counter--;
- if (!gain_left_counter) {
+ gain_counter--;
+ if (!gain_counter) {
+ gain--;
+ change_inputgain_from_coordinate(inputgain_table_inv[gain], events, skindata);
events->saturated = TRUE;
- gain_left--;
- events->inputgain_position = inputgain_table_inv[gain_left];
- RC200AudioInSetGain(FALSE, gain_left, gain_left);
}
}
}
while (TRUE) {
maskupdate_notification ? newmaskupdate;
-
/*
* First we determine what mousestate we currently have. Then
* we check where we are to decide what to do.
@@ -266,74 +256,78 @@ inline void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedat
if (BUTTON_PLAY == events->mask) {
audiodata->play = !audiodata->play;
+ if (audiodata->play) {
+ events->locked_gain = TRUE;
+ } else {
+ events->locked_gain = FALSE;
+ }
+ } else {
+ delay;
+ }
+
+
+/*
+ if ((BUTTON_PAUSE == events->mask) && (audiodata->player != STOP_AUDIO)) {
+ if (PLAY_AUDIO == audiodata->player) {
+ audiodata->player = PAUSE_AUDIO;
+ } else {
+ audioplay->player = RESUME_AUDIO;
+ }
} else {
delay;
}
+ if (BUTTON_PLAY == events->mask) {
+ if (PAUSE_AUDIO == audiodata->player) {
+ audioplay->player = RESUME_AUDIO;
+ } else {
+ old_volume = volume;
+ change_volume_from_coordinate(volulmecontrol_table_inv[0x18], events, skindata);
+ audiodata->player = PLAY_AUDIO;
+ }
+ } else {
+ delay;
+ }
+
+ if (BUTTON_STOP == events->mask) {
+ audiodata->player = STOP_AUDIO;
+ volume = change_volume_from_coordinate(volulmecontrol_table_inv[old_volume], events, skindata);
+ } else {
+ delay;
+ }
+*/
break;
case MOUSE_STATE_DOWN:
-
/*
* If we are in the volume area we update the
* volume level for both channels.
*/
if (AREA_VOLUME_YAXIS == events->mask) {
/*
- * Copy the current Y cursor position
- * to the events struct. This we then
- * later use for drawing purposes.
+ * Change the volume depending
+ * on the y position.
*/
- events->volume_position = 0 @ mousedata->y;
- /*
- * 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.
- */
- volume_left = volumecontrol_table[((mousedata->y) -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(!volume_left, 0x1f -volume_left, 0x1f -volume_left);
+ volume = change_volume_from_coordinate(mousedata->y, events, skindata);
} else {
delay;
}
if (AREA_INPUTGAIN_YAXIS == events->mask) {
/*
- * We manually update the
- * inputgain so we change
- * the color of the slider.
- */
- events->saturated = FALSE;
- /*
- * Copy the current Y cursor position
- * to the events struct. This we then
- * later use for drawing purposes.
+ * Change the inputgain
+ * depending on the y position.
+ * We store the 'set' gain to
+ * be used with the automatic
+ * input gain detection.
*/
- events->inputgain_position = 0 @ mousedata->y;
+ gain = change_inputgain_from_coordinate(mousedata->y, events, skindata);
/*
- * 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.
- */
- gain_left = inputgain_table[((mousedata->y) -skindata->inputgain.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.
+ * We manually update the
+ * inputgain so we change the
+ * color of the slider.
*/
- RC200AudioInSetGain(!gain_left, gain_left, gain_left);
+ events->saturated = FALSE;
} else {
delay;
}
@@ -342,8 +336,8 @@ inline void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedat
if (EQUALIZERMODE_PRECISE == events->equalizer_mode) {
events->locked_display = TRUE;
- equalizer_levels.write[preset_offset +(0 @ events->mask) -AREA_EQUALIZER_MIN] = equalizer_table[mousedata->y -382];
- events->equalizer_display[(events->mask -AREA_EQUALIZER_MIN) <- 7] = mousedata->y;
+ equalizer_levels.write[preset_offset +(0 @ events->mask) -AREA_EQUALIZER_MIN] = equalizer_table[(mousedata->y -382) <- 10];
+ events->equalizer_display[(events->mask -AREA_EQUALIZER_MIN) <- 7] = 0 @ (mousedata->y);
events->locked_display = FALSE;
} else {
@@ -370,7 +364,7 @@ inline void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedat
events->locked_display = FALSE;
for (; index_offset != index_end; index_offset--) {
- unsigned 10 average_bar;
+ unsigned 11 average_bar;
unsigned 7 equalizer_index;
unsigned 4 bar_index;
@@ -397,7 +391,7 @@ inline void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedat
}
events->locked_display = TRUE;
- equalizer_levels.write[preset_offset +(0 @ equalizer_index)] = equalizer_table[average_bar -382];
+ equalizer_levels.write[preset_offset +(0 @ equalizer_index)] = equalizer_table[(average_bar -382) <- 10];
events->equalizer_display[equalizer_index] = average_bar;
events->locked_display = FALSE;
}
@@ -435,6 +429,7 @@ inline void eventhandler_main(audiodata_t *audiodata, events_t *events, mousedat
* should be dynamically loaded.
*/
ram unsigned 5 volumecontrol_table[46] = {31, 31, 30, 30, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0};
+ram unsigned 11 volumecontrol_table_inv[32] = {111, 110, 108, 106, 105, 103, 102, 100, 99, 97, 96, 94, 93, 91, 90, 88, 87, 85, 84, 82, 81, 79, 78, 76, 75, 73, 72, 70, 69, 67, 66};
ram unsigned 4 inputgain_table[46] = {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, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0};
-ram unsigned 10 inputgain_table_inv[16] = {111, 108, 105, 102, 99, 96, 93, 90, 87, 84, 81, 78, 75, 72, 69, 66};
+ram unsigned 11 inputgain_table_inv[16] = {111, 108, 105, 102, 99, 96, 93, 90, 87, 84, 81, 78, 75, 72, 69, 66};