summaryrefslogtreecommitdiffstats
path: root/Graphic_Equalizer/src/display.hcc
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2004-11-16 16:07:12 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2004-11-16 16:07:12 (GMT)
commitaf87b55d03ad6f13196d27c7483837a7c4606564 (patch)
tree09d2df7d043fc72d54114d61c10c518f726bfe2e /Graphic_Equalizer/src/display.hcc
parent75740fc47251c003d9d3b32efdf60fd2ca7f9e1e (diff)
downloadTASS-af87b55d03ad6f13196d27c7483837a7c4606564.zip
TASS-af87b55d03ad6f13196d27c7483837a7c4606564.tar.gz
TASS-af87b55d03ad6f13196d27c7483837a7c4606564.tar.bz2
Attempt to add Spectrum Analasys.
Diffstat (limited to 'Graphic_Equalizer/src/display.hcc')
-rw-r--r--Graphic_Equalizer/src/display.hcc94
1 files changed, 79 insertions, 15 deletions
diff --git a/Graphic_Equalizer/src/display.hcc b/Graphic_Equalizer/src/display.hcc
index 2238c1d..dbc7fc5 100644
--- a/Graphic_Equalizer/src/display.hcc
+++ b/Graphic_Equalizer/src/display.hcc
@@ -82,10 +82,12 @@ macro proc display_main(audiodata, events, mousedata, CLOCKRATE, VIDEOOUT, RAM_B
#endif
/*
- *
+ * If the passed button_state tells us the button is active, then we
+ * the button is 'on' and we draw it inverted. Otherwise we draw the
+ * area of the button normally.
*/
- macro proc draw_button(button) {
- if (button == pixeldata[31:24]) {
+ macro proc draw_button(button_state) {
+ if (button_state == pixeldata[31:24]) {
PalVideoOutWrite(VIDEOOUT, ~PIXEL);
} else {
PalVideoOutWrite(VIDEOOUT, PIXEL);
@@ -112,40 +114,102 @@ macro proc display_main(audiodata, events, mousedata, CLOCKRATE, VIDEOOUT, RAM_B
PalPL2RAMSetReadAddress(RAM_BANK0, address);
/*
- * Determin what to draw where here.
+ * Determin what to draw where here. Every case has an
+ * if else statement comparing wether to draw something
+ * special or the background. Every specific drawing
+ * obviously only happens in the masked area.
*/
switch (pixeldata[31:24]) {
+ /*
+ * Volume control over the Y-axis.
+ */
case AREA_VOLUME_YAXIS:
+ /*
+ * The volume_position stores the
+ * highest point of our bar. Every
+ * pixel after this point is drawn.
+ */
if (SCANY >= 0 @ events.volume_position) {
PalVideoOutWrite(VIDEOOUT, PIXEL_VOLUME_YAXIS);
} else {
PalVideoOutWrite(VIDEOOUT, PIXEL);
}
break;
+
+ /*
+ * Spectrum Analyzer
+ */
+ case AREA_SPECTRUM_ANALYZER:
+ /*
+ * fft_info tells us the highest point
+ * the spectrum. We draw every pixel
+ * higher then this point. The data
+ * received ranges from 0 to 2^7
+ * maximally, therefor we need to add
+ * the offset for to correct this.
+ */
+ if ((SCANY -200) >= 0 @ audiodata.fft_info.read[SCANX <- 8]) {
+ PalVideoOutWrite(VIDEOOUT, PIXEL_SPECTRUM);
+ } else {
+ PalVideoOutWrite(VIDEOOUT, PIXEL);
+ }
+ break;
- case BUTTON_PRESET_1:
- case BUTTON_PRESET_2:
- case BUTTON_PRESET_3:
- case BUTTON_PRESET_4:
- case BUTTON_PRESET_5:
+ /*
+ * Since all buttons are drawn equally, either
+ * we draw them normally or we inverse them, we
+ * can handle them almost equally.
+ */
+ case BUTTON_PRESET_1: /* fall through */
+ case BUTTON_PRESET_2: /* fall through */
+ case BUTTON_PRESET_3: /* fall through */
+ case BUTTON_PRESET_4: /* fall through */
+ case BUTTON_PRESET_5: /* fall through */
case BUTTON_PRESET_6:
- draw_button((audiodata.active_preset +BUTTON_PRESET_1) <- 8);
+ /*
+ * The active preset tells us what
+ * button is currently enabled. We must
+ * however not forget to add the preset
+ * button offset to possibly match it
+ * with the current mask.
+ */
+ draw_button((events.active_preset +BUTTON_PRESET_1) <- 8);
break;
- case BUTTON_1:
- case BUTTON_2:
- case BUTTON_3:
- case BUTTON_4:
+ case BUTTON_1: /* fall through */
+ case BUTTON_2: /* fall through */
+ case BUTTON_3: /* fall through */
+ case BUTTON_4: /* fall through */
case BUTTON_5:
+ /*
+ * equalizer mode tells us what button
+ * is currently enabled. By adding the
+ * equalizer mode button offset we can
+ * safley check wether it matches our
+ * mask.
+ */
draw_button((0 @ events.equalizer_mode) +BUTTON_1);
break;
case BUTTON_LOG:
+ /*
+ *
+ */
draw_button((0 @ audiodata.display_log) +BUTTON_LOG);
break;
+ /*
+ * The default case is split up into two parts
+ * actually. This is because we have 128 bands
+ * for the equalizer and thus as many mask
+ * entries. Since we don't want 128 identical
+ * cases we check wether the equalizer mask is
+ * currently active and if so draw it. If this
+ * is not the case we simply draw the
+ * background.
+ */
default:
- if ((AREA_EQUALIZER_MIN <= pixeldata[31:24]) && (pixeldata[31:24] <= AREA_EQUALIZER_MAX) && (SCANY == 0 @ events.equalizer_position[(pixeldata[31:24] -0x80) <- 7])) {
+ if ((AREA_EQUALIZER_MIN <= pixeldata[31:24]) && (pixeldata[31:24] <= AREA_EQUALIZER_MAX) && (SCANY == 0 @ events.equalizer_position[(pixeldata[31:24] -AREA_EQUALIZER_MIN) <- 7])) {
PalVideoOutWrite(VIDEOOUT, PIXEL_EQUALIZER);
} else {
PalVideoOutWrite(VIDEOOUT, PIXEL);