summaryrefslogtreecommitdiffstats
path: root/Graphic_Equalizer/src/display.hcc
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2004-11-24 15:22:02 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2004-11-24 15:22:02 (GMT)
commit3ee11d85cf9e855ec15407d26f4f844e95eeec18 (patch)
tree7e307912ca77f4658443c8ffdd6c1000cb6962fc /Graphic_Equalizer/src/display.hcc
parent59cdec7e262c6b3f887e4548a96903e48c06b5fe (diff)
downloadTASS-3ee11d85cf9e855ec15407d26f4f844e95eeec18.zip
TASS-3ee11d85cf9e855ec15407d26f4f844e95eeec18.tar.gz
TASS-3ee11d85cf9e855ec15407d26f4f844e95eeec18.tar.bz2
display routine also depends on a few dynamic constansts that are in skindata, added that.
Added a store for the color of the visual graphic so we can perform the graph in 2 steps.
Diffstat (limited to 'Graphic_Equalizer/src/display.hcc')
-rw-r--r--Graphic_Equalizer/src/display.hcc249
1 files changed, 154 insertions, 95 deletions
diff --git a/Graphic_Equalizer/src/display.hcc b/Graphic_Equalizer/src/display.hcc
index dbc7fc5..5d1d830 100644
--- a/Graphic_Equalizer/src/display.hcc
+++ b/Graphic_Equalizer/src/display.hcc
@@ -42,8 +42,9 @@ chan unsigned 1 maskupdate_notification;
-/*! \fn void display_main(audiodata_t *audiodata, equalizer_levels_t *equalizer_levels, events_t *events,
- * mousedata_t *mousedata, ClockRate, RAM_BANK0);
+/*! \fn void display_main(skindata_t *skindata, audiodata_t *audiodata,
+ * equalizer_levels_t *equalizer_levels, events_t *events,
+ * mousedata_t *mousedata, ClockRate, RAM_BANK0)
*
* \brief This routine handles all drawing of pixels. It never returns!
*
@@ -54,7 +55,7 @@ chan unsigned 1 maskupdate_notification;
* \return Never Returns.
* \retval void
*/
-macro proc display_main(audiodata, events, mousedata, CLOCKRATE, VIDEOOUT, RAM_BANK0) {
+macro proc display_main(skindata, audiodata, events, mousedata, CLOCKRATE, VIDEOOUT, RAM_BANK0) {
/*
* Setup macro's RAM/Video handles and to coordinate pixel writing.
*/
@@ -66,8 +67,9 @@ macro proc display_main(audiodata, events, mousedata, CLOCKRATE, VIDEOOUT, RAM_B
macro expr SCANX = PalVideoOutGetX(VIDEOOUT);
macro expr SCANY = PalVideoOutGetY(VIDEOOUT);
- unsigned AW address;
unsigned DW pixeldata;
+ unsigned 24 visual_graph_color;
+ unsigned AW address, address_offset;
/*
* To draw something usefull when only drawing our mask, we simply draw the
@@ -111,111 +113,141 @@ macro proc display_main(audiodata, events, mousedata, CLOCKRATE, VIDEOOUT, RAM_B
* for the next cycle.
*/
PalPL2RAMRead(RAM_BANK0, &pixeldata);
- PalPL2RAMSetReadAddress(RAM_BANK0, address);
+ PalPL2RAMSetReadAddress(RAM_BANK0, address_offset +address);
/*
- * 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);
- }
+ switch (events.mode) {
+ case MODE_HELP:
+ address_offset = ADDRESS_HELP_START;
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);
- }
+ case MODE_GRAPH:
+ address_offset = ADDRESS_GRAPHMASK_START;
break;
+ default:
+ address_offset = ADDRESS_SKIN_START;
+ break;
+ }
+ if (MODE_GRAPH == events.mode) {
+ par {
+ visual_graph_color = ((unsigned 8)(0 @ audiodata.fft_info.read[pixeldata[31:24]]) << 1) @ ((unsigned 8)(0 @ audiodata.fft_info.read[pixeldata[31:24]]) << -1) @ ((unsigned 8)(0 @ audiodata.fft_info.read[pixeldata[31:24]]) << 0);
+ PalVideoOutWrite(VIDEOOUT, 0 @ visual_graph_color);
+ }
+ } else {
/*
- * Since all buttons are drawn equally, either
- * we draw them normally or we inverse them, we
- * can handle them almost equally.
+ * 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.
*/
- 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:
+ switch (pixeldata[31:24]) {
/*
- * 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 AREA_WAVEFORM:
+ if (SCANY == 0 @ skindata.area_waveform_bottom -(0 @ (audiodata.ifft_info.read[((SCANX -(0 @ skindata.area_waveform_left)) <-8)]))) {
+ PalVideoOutWrite(VIDEOOUT, skindata.color_area_waveform);
+ } else {
+ PalVideoOutWrite(VIDEOOUT, PIXEL);
+ }
+ break;
- 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.
+ * Volume control over the Y-axis.
*/
- draw_button((0 @ events.equalizer_mode) +BUTTON_1);
- break;
+ 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, skindata.color_area_volume);
+ } else {
+ PalVideoOutWrite(VIDEOOUT, PIXEL);
+ }
+ break;
+
+ /*
+ * Spectrum Analyzer
+ */
+ case AREA_SPECTRUM_ANALYZER:
+ /*
+ * We draw every pixel that is smaller TODO
+ */
+ if ((SCANY >= (0 @ skindata.area_spectrum_bottom) -(0 @ audiodata.fft_info.read[(SCANX -(0 @ skindata.area_spectrum_left))[9:2]])) && ((SCANX -(0 @ skindata.area_spectrum_left)) <- 2)) {
+ PalVideoOutWrite(VIDEOOUT, PIXEL_SPECTRUM);
+ } else {
+ PalVideoOutWrite(VIDEOOUT, PIXEL);
+ }
+ break;
- case BUTTON_LOG:
/*
- *
+ * Since all buttons are drawn equally, either
+ * we draw them normally or we inverse them, we
+ * can handle them almost equally.
*/
- draw_button((0 @ audiodata.display_log) +BUTTON_LOG);
- break;
+ 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:
+ /*
+ * 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;
- /*
- * 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] -AREA_EQUALIZER_MIN) <- 7])) {
- PalVideoOutWrite(VIDEOOUT, PIXEL_EQUALIZER);
- } else {
- PalVideoOutWrite(VIDEOOUT, PIXEL);
- }
+ case BUTTON_CONVEX_FULL: /* fall through */
+ case BUTTON_CONVEX_HALF: /* fall through */
+ case BUTTON_PRECISE: /* fall through */
+ case BUTTON_CONCAVE_HALF: /* fall through */
+ case BUTTON_CONCAVE_FULL:
+ /*
+ * 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_CONVEX_FULL);
+ break;
- 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:
+ /* (pixeldata[31:24] <= AREA_EQUALIZER_MAX) && */
+ if (!events.locked_equalizer) {
+ if ((AREA_EQUALIZER_MIN <= pixeldata[31:24]) && ((SCANY -(0 @ SCANY <- 1)) == 0 @ events.equalizer_displayptr_get[(pixeldata[31:24] -AREA_EQUALIZER_MIN) <- 7])) {
+ PalVideoOutWrite(VIDEOOUT, skindata.color_equalizer);
+ } else {
+ PalVideoOutWrite(VIDEOOUT, PIXEL);
+ }
+ } else {
+ PalVideoOutWrite(VIDEOOUT, PIXEL);
+ }
+ break;
+ }
}
/*
@@ -256,10 +288,9 @@ macro proc display_main(audiodata, events, mousedata, CLOCKRATE, VIDEOOUT, RAM_B
*/
if (SCANY == (TOTALY -1)) {
/*
- * The reset address is determined by
- * the help bit.
+ * Reset our draw address counter to 0.
*/
- address = (events.help) ? ADDRESS_HELP_START : ADDRESS_SKIN_START;
+ address = 0;
} else {
/*
* We should not ever get inhere. To
@@ -278,4 +309,32 @@ macro proc display_main(audiodata, events, mousedata, CLOCKRATE, VIDEOOUT, RAM_B
}
}
}
-} /* --- display_main() --- */ \ No newline at end of file
+} /* --- display_main() --- */
+
+
+
+/*! \fn void reload_equalizer(events_t *events,
+ * unsigned 4 *equalizer_levels, unsigned 7 preset_offset)
+ * \brief This function copies the supplied equalizer values to the array
+ * used for displaying equalizer data.
+ *
+ * \param events_t *events events struct
+ * \param unsigned 4 *equalizer_levels pointer to 128 entries where
+ * equalizer is to be copied from.
+ *
+ * \return void
+ * \retval void
+ */
+macro proc reload_equalizer(events, equalizer_levels, preset_offset) {
+ unsigned 7 equalizer_band;
+
+ do {
+ events.equalizer_displayptr_set[(preset_offset +(0 @ equalizer_band))<-7] = equalizer_table_inv[equalizer_levels[preset_offset +(0 @ equalizer_band)]];
+ par {
+ events.equalizer_displayptr_set = events.equalizer_displayptr_get;
+ events.equalizer_displayptr_get = events.equalizer_displayptr_set;
+ }
+ events.equalizer_displayptr_set[(preset_offset +(0 @ equalizer_band))<-7] = equalizer_table_inv[equalizer_levels[preset_offset +(0 @ equalizer_band)]];
+ equalizer_band++;
+ } while (equalizer_band);
+} /* --- reload_equalizer() --- */