diff options
Diffstat (limited to 'Graphic_Equalizer/doc/html/eventhandler_8hcc-source.html')
-rw-r--r-- | Graphic_Equalizer/doc/html/eventhandler_8hcc-source.html | 299 |
1 files changed, 0 insertions, 299 deletions
diff --git a/Graphic_Equalizer/doc/html/eventhandler_8hcc-source.html b/Graphic_Equalizer/doc/html/eventhandler_8hcc-source.html deleted file mode 100644 index f6433b3..0000000 --- a/Graphic_Equalizer/doc/html/eventhandler_8hcc-source.html +++ /dev/null @@ -1,299 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> -<title>Graphic Equalizer 2: C:/Project Marcel & Oliver/Graphic_Equalizer/src/eventhandler.hcc Source File</title> -<link href="doxygen.css" rel="stylesheet" type="text/css"> -</head><body> -<!-- Generated by Doxygen 1.3.9.1 --> -<div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div> -<div class="nav"> -<a class="el" href="dir_000000.html">C:</a> / <a class="el" href="dir_000001.html">Project Marcel & Oliver</a> / <a class="el" href="dir_000002.html">Graphic_Equalizer</a> / <a class="el" href="dir_000004.html">src</a></div> -<h1>eventhandler.hcc</h1><a href="eventhandler_8hcc.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 -00021 <span class="comment">/******** System Includes *************/</span> -00022 <span class="preprocessor">#include <stdlib.hch></span> -00023 -00024 <span class="preprocessor">#include "pal_master.hch"</span> -00025 -00026 <span class="comment">/******** Application Includes ********/</span> -00027 <span class="preprocessor">#include "<a class="code" href="configuration_8hch.html">configuration.hch</a>"</span> -00028 <span class="preprocessor">#include "<a class="code" href="audio_8hch.html">audio.hch</a>"</span> -00029 <span class="preprocessor">#include "<a class="code" href="mouse__shared_8hch.html">mouse_shared.hch</a>"</span> -00030 <span class="preprocessor">#include "<a class="code" href="eventhandler__shared_8hch.html">eventhandler_shared.hch</a>"</span> -00031 <span class="preprocessor">#include "<a class="code" href="eventhandler_8hch.html">eventhandler.hch</a>"</span> -00032 <span class="preprocessor">#include "<a class="code" href="events_8hch.html">events.hch</a>"</span> -00033 <span class="preprocessor">#include "<a class="code" href="display__shared_8hch.html">display_shared.hch</a>"</span> -00034 <span class="preprocessor">#include "<a class="code" href="display_8hch.html">display.hch</a>"</span> -00035 -00036 <span class="preprocessor">#if HAVE_DEBUG</span> -00037 <span class="preprocessor"></span><span class="preprocessor"> #include "debug.hch"</span> -00038 <span class="preprocessor">#endif</span> -00039 <span class="preprocessor"></span> -00040 -00041 -00042 <span class="comment">/*</span> -00043 <span class="comment"> */</span> -00044 <span class="keyword">extern</span> chan <span class="keywordtype">unsigned</span> 1 maskupdate_notification; -00045 -00046 -00047 -<a name="l00059"></a><a class="code" href="eventhandler_8hcc.html#a2">00059</a> <span class="keywordtype">void</span> <a class="code" href="eventhandler_8hcc.html#a2">eventhandler_main</a>(<a class="code" href="structaudiodata__t.html">audiodata_t</a> *audiodata, <a class="code" href="structevents__t.html">events_t</a> *events, <a class="code" href="structmousedata__t.html">mousedata_t</a> *mousedata) { -00060 mpram { -00061 ram <span class="keywordtype">unsigned</span> 4 write[768]; -00062 rom <span class="keywordtype">unsigned</span> 4 read[768]; -00063 } equalizer_levels with { block = <span class="stringliteral">"BlockRAM"</span>}; -00064 -00065 <span class="keywordtype">unsigned</span> 10 preset_offset; -00066 <span class="keywordtype">unsigned</span> 10 reference_point, reference_point_right; -00067 <span class="keywordtype">unsigned</span> 5 volume_left; -00068 <span class="keywordtype">unsigned</span> 4 index_offset, index_end; -00069 <span class="keywordtype">unsigned</span> 4 equalizer_mode_local; -00070 <span class="keywordtype">unsigned</span> 1 newmaskupdate; -00071 -00072 <a class="code" href="events_8hcc.html#a3">load_preset</a>(<a class="code" href="eventhandler_8hch.html#a1">LOAD_PRESET_RESET</a>, equalizer_levels.write); -00073 <a class="code" href="display_8hcc.html#a3">reload_equalizer</a>(events, &equalizer_levels.write[preset_offset]); -00074 -00075 <span class="keywordflow">while</span> (TRUE) { -00076 <a class="code" href="display_8hcc.html#a1">maskupdate_notification</a> ? newmaskupdate; -00077 -00078 <span class="comment">/*</span> -00079 <span class="comment"> * First we determine what mousestate we currently have. Then</span> -00080 <span class="comment"> * we check where we are to decide what to do.</span> -00081 <span class="comment"> */</span> -00082 <span class="keywordflow">switch</span> (mousedata-><a class="code" href="structmousedata__t.html#o2">state</a>) { -00083 <span class="keywordflow">case</span> <a class="code" href="mouse__shared_8hch.html#a4">MOUSE_STATE_ON_PRESS</a>: -00084 <span class="comment">/*</span> -00085 <span class="comment"> * If we are displaying the graphic visual,</span> -00086 <span class="comment"> * any press returns to the application.</span> -00087 <span class="comment"> */</span> -00088 <span class="keywordflow">if</span> (<a class="code" href="eventhandler__shared_8hch.html#a3">MODE_GRAPH</a> == events-><a class="code" href="structevents__t.html#o4">mode</a>) { -00089 events-><a class="code" href="structevents__t.html#o4">mode</a> = MODE_SKIN; -00090 events-><a class="code" href="structevents__t.html#o3">mask</a> = 0; -00091 } <span class="keywordflow">else</span> { -00092 delay; -00093 } -00094 -00095 <span class="comment">/*</span> -00096 <span class="comment"> */</span> -00097 <span class="keywordflow">if</span> (<a class="code" href="display__shared_8hch.html#a19">BUTTON_MODE</a> == events-><a class="code" href="structevents__t.html#o3">mask</a>) { -00098 <span class="keywordflow">if</span> (<a class="code" href="eventhandler__shared_8hch.html#a3">MODE_GRAPH</a> == events-><a class="code" href="structevents__t.html#o4">mode</a>) { -00099 events-><a class="code" href="structevents__t.html#o4">mode</a> = MODE_SKIN; -00100 } <span class="keywordflow">else</span> { -00101 events-><a class="code" href="structevents__t.html#o4">mode</a> = MODE_GRAPH; -00102 } -00103 } <span class="keywordflow">else</span> { -00104 delay; -00105 } -00106 -00107 <span class="comment">/*</span> -00108 <span class="comment"> * If the current mask equals the help button</span> -00109 <span class="comment"> * we set display mode to help.</span> -00110 <span class="comment"> */</span> -00111 <span class="keywordflow">if</span> (<a class="code" href="display__shared_8hch.html#a18">BUTTON_HELP</a> == events-><a class="code" href="structevents__t.html#o3">mask</a>) { -00112 <span class="comment">/*</span> -00113 <span class="comment"> * Change the mode to help if it's</span> -00114 <span class="comment"> * currently not set, otherwise go back</span> -00115 <span class="comment"> * to skin mode.</span> -00116 <span class="comment"> */</span> -00117 <span class="keywordflow">if</span> (<a class="code" href="eventhandler__shared_8hch.html#a2">MODE_HELP</a> == events-><a class="code" href="structevents__t.html#o4">mode</a>) { -00118 events-><a class="code" href="structevents__t.html#o4">mode</a> = MODE_SKIN; -00119 } <span class="keywordflow">else</span> { -00120 events-><a class="code" href="structevents__t.html#o4">mode</a> = MODE_HELP; -00121 } -00122 } <span class="keywordflow">else</span> { -00123 delay; -00124 } -00125 -00126 <span class="comment">/*</span> -00127 <span class="comment"> * The Preset buttons span from 1 to 6 so if</span> -00128 <span class="comment"> * the mask one of those, we'll change the</span> -00129 <span class="comment"> * pointer to point to the current preset.</span> -00130 <span class="comment"> */</span> -00131 <span class="keywordflow">if</span> ((<a class="code" href="display__shared_8hch.html#a7">BUTTON_PRESET_1</a> <= events-><a class="code" href="structevents__t.html#o3">mask</a>) && (events-><a class="code" href="structevents__t.html#o3">mask</a> <= BUTTON_PRESET_6)) { -00132 <span class="comment">/*</span> -00133 <span class="comment"> * The active preset is determined by</span> -00134 <span class="comment"> * the mask minus an offset. Hence</span> -00135 <span class="comment"> * ranging our active preset from 0 to</span> -00136 <span class="comment"> * 6.</span> -00137 <span class="comment"> */</span> -00138 events-><a class="code" href="structevents__t.html#o1">active_preset</a> = 0 @ (events-><a class="code" href="structevents__t.html#o3">mask</a> -BUTTON_PRESET_1); -00139 <span class="comment">/*</span> -00140 <span class="comment"> * Each equalizer is 128 bands wide,</span> -00141 <span class="comment"> * thus we need to add 128 * the preset</span> -00142 <span class="comment"> * for each different preset. This</span> -00143 <span class="comment"> * offset is calculated here.</span> -00144 <span class="comment"> */</span> -00145 preset_offset = events-><a class="code" href="structevents__t.html#o1">active_preset</a> << 7; -00146 <span class="comment">/*</span> -00147 <span class="comment"> * We set the pointer to the active</span> -00148 <span class="comment"> * part of the array by using the</span> -00149 <span class="comment"> * preset offset as our index. Hence</span> -00150 <span class="comment"> * depending on the selected preset</span> -00151 <span class="comment"> * we point to 0, 128, 256, 384, 512</span> -00152 <span class="comment"> * or 640.</span> -00153 <span class="comment"> */</span> -00154 audiodata-><a class="code" href="structaudiodata__t.html#o0">equalizer_levels_ptr</a> = &equalizer_levels.read[preset_offset]; -00155 <span class="comment">/*</span> -00156 <span class="comment"> * Finally update the equalizer bars</span> -00157 <span class="comment"> * that are drawn by the display.</span> -00158 <span class="comment"> */</span> -00159 <a class="code" href="display_8hcc.html#a3">reload_equalizer</a>(events, &equalizer_levels.write[preset_offset]); -00160 } <span class="keywordflow">else</span> { -00161 delay; -00162 } -00163 -00164 <span class="keywordflow">if</span> ((<a class="code" href="display__shared_8hch.html#a15">BUTTON_PRECISE</a> <= events-><a class="code" href="structevents__t.html#o3">mask</a>) && (events-><a class="code" href="structevents__t.html#o3">mask</a> <= BUTTON_CONVEX_FULL)) { -00165 events-><a class="code" href="structevents__t.html#o5">equalizer_mode</a> = (events-><a class="code" href="structevents__t.html#o3">mask</a> -BUTTON_PRECISE) <-4; -00166 } <span class="keywordflow">else</span> { -00167 delay; -00168 } -00169 -00170 <span class="comment">/*</span> -00171 <span class="comment"> * If the demo button was pressed load the</span> -00172 <span class="comment"> * demo preset values into the presets.</span> -00173 <span class="comment"> */</span> -00174 <span class="keywordflow">if</span> (<a class="code" href="display__shared_8hch.html#a5">BUTTON_DEMO</a> == events-><a class="code" href="structevents__t.html#o3">mask</a>) { -00175 <a class="code" href="events_8hcc.html#a3">load_preset</a>(<a class="code" href="eventhandler_8hch.html#a2">LOAD_PRESET_DEMO</a>, equalizer_levels.write); -00176 <a class="code" href="display_8hcc.html#a3">reload_equalizer</a>(events, &equalizer_levels.write[preset_offset]); -00177 } -00178 -00179 <span class="comment">/*</span> -00180 <span class="comment"> * If the reset button was pressed load the</span> -00181 <span class="comment"> * reset values into the presets.</span> -00182 <span class="comment"> */</span> -00183 <span class="keywordflow">if</span> (<a class="code" href="display__shared_8hch.html#a6">BUTTON_RESET</a> == events-><a class="code" href="structevents__t.html#o3">mask</a>) { -00184 <a class="code" href="events_8hcc.html#a3">load_preset</a>(<a class="code" href="eventhandler_8hch.html#a1">LOAD_PRESET_RESET</a>, equalizer_levels.write); -00185 <a class="code" href="display_8hcc.html#a3">reload_equalizer</a>(events, &equalizer_levels.write[preset_offset]); -00186 } -00187 -00188 <span class="comment">/*</span> -00189 <span class="comment"> * If the current mask equals the log button,</span> -00190 <span class="comment"> * we flip the display_log bit.</span> -00191 <span class="comment"> */</span> -00192 <span class="keywordflow">if</span> (<a class="code" href="display__shared_8hch.html#a4">BUTTON_LOG</a> == events-><a class="code" href="structevents__t.html#o3">mask</a>) { -00193 audiodata-><a class="code" href="structaudiodata__t.html#o1">display_log</a> = !audiodata-><a class="code" href="structaudiodata__t.html#o1">display_log</a>; -00194 } <span class="keywordflow">else</span> { -00195 delay; -00196 } -00197 -00198 <span class="keywordflow">break</span>; -00199 -00200 <span class="keywordflow">case</span> <a class="code" href="mouse__shared_8hch.html#a5">MOUSE_STATE_DOWN</a>: -00201 <span class="comment">/*</span> -00202 <span class="comment"> * If we are in the volume area we update the</span> -00203 <span class="comment"> * volume level for both channels.</span> -00204 <span class="comment"> */</span> -00205 <span class="keywordflow">if</span> (<a class="code" href="display__shared_8hch.html#a2">AREA_VOLUME_YAXIS</a> == events-><a class="code" href="structevents__t.html#o3">mask</a>) { -00206 <span class="comment">/*</span> -00207 <span class="comment"> * Copy the current Y cursor position</span> -00208 <span class="comment"> * to the events struct. This we then</span> -00209 <span class="comment"> * later use for drawing purposes.</span> -00210 <span class="comment"> */</span> -00211 events-><a class="code" href="structevents__t.html#o2">volume_position</a> = 0 @ mousedata-><a class="code" href="structmousedata__t.html#o1">y</a>; -00212 <span class="comment">/*</span> -00213 <span class="comment"> * Look the relative y-coordinate up in</span> -00214 <span class="comment"> * the volumecontrol lookup table. We</span> -00215 <span class="comment"> * make a local copy here because the</span> -00216 <span class="comment"> * RC200 call doesn't behave nicely</span> -00217 <span class="comment"> * when passing anything else.</span> -00218 <span class="comment"> */</span> -00219 volume_left = <a class="code" href="eventhandler__shared_8hch.html#a7">volumecontrol_table</a>[((mousedata-><a class="code" href="structmousedata__t.html#o1">y</a>) -65) <- 6]; -00220 <span class="comment">/*</span> -00221 <span class="comment"> * We feel that volume gets softer the</span> -00222 <span class="comment"> * closer it gets to the 0, and louder</span> -00223 <span class="comment"> * as it approaches 0x1f. The SetVolume</span> -00224 <span class="comment"> * RC200 call does this in an unnatural</span> -00225 <span class="comment"> * reverse way. Therefor we fix it.</span> -00226 <span class="comment"> */</span> -00227 RC200AudioOutSetVolume(!volume_left, 0x1f -volume_left, 0x1f -volume_left); -00228 } <span class="keywordflow">else</span> { -00229 delay; -00230 } -00231 -00232 <span class="keywordflow">if</span> ((<a class="code" href="display__shared_8hch.html#a20">AREA_EQUALIZER_MIN</a> <= events-><a class="code" href="structevents__t.html#o3">mask</a>) && (events-><a class="code" href="structevents__t.html#o3">mask</a> <= AREA_EQUALIZER_MAX)) { -00233 -00234 <span class="keywordflow">if</span> (<a class="code" href="eventhandler__shared_8hch.html#a6">EQUALIZERMODE_PRECISE</a> == events-><a class="code" href="structevents__t.html#o5">equalizer_mode</a>) { -00235 events-><a class="code" href="structevents__t.html#o6">locked_display</a> = TRUE; -00236 equalizer_levels.write[preset_offset +(0 @ events-><a class="code" href="structevents__t.html#o3">mask</a>) -AREA_EQUALIZER_MIN] = <a class="code" href="eventhandler__shared_8hch.html#a8">equalizer_table</a>[mousedata-><a class="code" href="structmousedata__t.html#o1">y</a> -382]; -00237 events-><a class="code" href="structevents__t.html#o0">equalizer_display</a>[(events-><a class="code" href="structevents__t.html#o3">mask</a> -AREA_EQUALIZER_MIN) <- 7] = mousedata-><a class="code" href="structmousedata__t.html#o1">y</a>; -00238 events-><a class="code" href="structevents__t.html#o6">locked_display</a> = FALSE; -00239 } <span class="keywordflow">else</span> { -00240 -00241 equalizer_mode_local = events-><a class="code" href="structevents__t.html#o5">equalizer_mode</a> +1; -00242 -00243 events-><a class="code" href="structevents__t.html#o6">locked_display</a> = TRUE; -00244 index_offset = ((equalizer_mode_local << 1)); <span class="comment">/* delay; */</span> -00245 -00246 <span class="keywordflow">if</span> (events-><a class="code" href="structevents__t.html#o3">mask</a> < (<a class="code" href="display__shared_8hch.html#a20">AREA_EQUALIZER_MIN</a> +(0 @ equalizer_mode_local))) { -00247 reference_point = events-><a class="code" href="structevents__t.html#o0">equalizer_display</a>[<a class="code" href="display__shared_8hch.html#a20">AREA_EQUALIZER_MIN</a> -AREA_EQUALIZER_MIN]; -00248 index_offset -= (((0 @ equalizer_mode_local) -(events-><a class="code" href="structevents__t.html#o3">mask</a> -AREA_EQUALIZER_MIN)) <- 4); -00249 } <span class="keywordflow">else</span> { -00250 reference_point = events-><a class="code" href="structevents__t.html#o0">equalizer_display</a>[(events-><a class="code" href="structevents__t.html#o3">mask</a> - (0 @ equalizer_mode_local) -AREA_EQUALIZER_MIN) <- 7]; -00251 index_offset -= 1; -00252 } -00253 -00254 <span class="keywordflow">if</span> (events-><a class="code" href="structevents__t.html#o3">mask</a> > (<a class="code" href="display__shared_8hch.html#a21">AREA_EQUALIZER_MAX</a> -(0 @ equalizer_mode_local))) { -00255 reference_point_right = events-><a class="code" href="structevents__t.html#o0">equalizer_display</a>[<a class="code" href="display__shared_8hch.html#a21">AREA_EQUALIZER_MAX</a> -AREA_EQUALIZER_MIN]; -00256 index_end = (((0 @ equalizer_mode_local) -(<a class="code" href="display__shared_8hch.html#a21">AREA_EQUALIZER_MAX</a> -events-><a class="code" href="structevents__t.html#o3">mask</a>)) <- 4) -1; -00257 } <span class="keywordflow">else</span> { -00258 reference_point_right = events-><a class="code" href="structevents__t.html#o0">equalizer_display</a>[(events-><a class="code" href="structevents__t.html#o3">mask</a> + (0 @ equalizer_mode_local) -AREA_EQUALIZER_MIN) <- 7]; -00259 index_end = 0; -00260 } -00261 events-><a class="code" href="structevents__t.html#o6">locked_display</a> = FALSE; -00262 -00263 <span class="keywordflow">for</span> (; index_offset != index_end; index_offset--) { -00264 <span class="keywordtype">unsigned</span> 10 average_bar; -00265 <span class="keywordtype">unsigned</span> 7 equalizer_index; -00266 <span class="keywordtype">unsigned</span> 4 bar_index; -00267 -00268 <span class="keywordflow">if</span> (index_offset == equalizer_mode_local) { -00269 reference_point = reference_point_right; -00270 } <span class="keywordflow">else</span> { -00271 delay; -00272 } -00273 -00274 <span class="keywordflow">if</span> (index_offset > equalizer_mode_local) -00275 { -00276 bar_index = (index_offset -equalizer_mode_local); -00277 equalizer_index = ((events-><a class="code" href="structevents__t.html#o3">mask</a> -(0 @ bar_index) -AREA_EQUALIZER_MIN) <- 7); -00278 } <span class="keywordflow">else</span> -00279 { -00280 bar_index = (equalizer_mode_local -index_offset); -00281 equalizer_index = ((events-><a class="code" href="structevents__t.html#o3">mask</a> +(0 @ bar_index) -AREA_EQUALIZER_MIN) <- 7); -00282 } -00283 -00284 <span class="keywordflow">if</span> (reference_point > mousedata-><a class="code" href="structmousedata__t.html#o1">y</a>) { -00285 average_bar = mousedata-><a class="code" href="structmousedata__t.html#o1">y</a> +((reference_point -mousedata-><a class="code" href="structmousedata__t.html#o1">y</a>) >> (equalizer_mode_local -bar_index)); -00286 } <span class="keywordflow">else</span> { -00287 average_bar = mousedata-><a class="code" href="structmousedata__t.html#o1">y</a> -((mousedata-><a class="code" href="structmousedata__t.html#o1">y</a> -reference_point) >> (equalizer_mode_local -bar_index)); -00288 } -00289 -00290 events-><a class="code" href="structevents__t.html#o6">locked_display</a> = TRUE; -00291 equalizer_levels.write[preset_offset +(0 @ equalizer_index)] = <a class="code" href="eventhandler__shared_8hch.html#a8">equalizer_table</a>[average_bar -382]; -00292 events-><a class="code" href="structevents__t.html#o0">equalizer_display</a>[equalizer_index] = average_bar; -00293 events-><a class="code" href="structevents__t.html#o6">locked_display</a> = FALSE; -00294 } -00295 } -00296 } <span class="keywordflow">else</span> { -00297 delay; -00298 } -00299 -00300 <span class="keywordflow">break</span>; -00301 -00302 <span class="keywordflow">default</span>: -00303 <span class="keywordflow">break</span>; -00304 } -00305 } -00306 } <span class="comment">/* --- eventhandler_main() --- */</span> -00307 -00308 -00309 -00310 <span class="comment">/*</span> -00311 <span class="comment"> * Volume Control lookuptable.</span> -00312 <span class="comment"> * TODO: This table is now hardcoded. To ensure full skinability this table</span> -00313 <span class="comment"> * should be dynamically loaded.</span> -00314 <span class="comment"> */</span> -<a name="l00315"></a><a class="code" href="eventhandler_8hcc.html#a1">00315</a> rom <span class="keywordtype">unsigned</span> 5 <a class="code" href="eventhandler__shared_8hch.html#a7">volumecontrol_table</a>[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}; -</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Dec 9 14:37:06 2004 for Graphic Equalizer 2 by -<a href="http://www.doxygen.org/index.html"> -<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address> -</body> -</html> |