@@ -300,58 +300,82 @@ unsigned short __inline ARGB2RGB565(int x)
300300 * @param row The current row to calculate from (0...numrows)
301301 * @return A short representing the ARGB value.
302302 */
303+ static int wheelrotate = 0 ;
303304unsigned short __inline COLORFROMROW (int row )
304- {
305- //
306- if (colormode == 0 ){
307-
308-
309-
310-
311- if (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE ) > 0 ){
312- return ARGB2RGB565 ( (int )
313- ((int )(256 - (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE ) ) ) << 0 ) |
314- ((int )(row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE )) << 16 )
315- );
316- }
317- return ARGB2RGB565 (0 );
318- } else if (colormode == 1 ){
319-
320- if (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE ) > 0 ){
321- return ARGB2RGB565 ( (int )
322- ((int )(256 - (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE ) ) ) << 8 ) |
323- ((int )(row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE )))
324- );
325- }
326- return ARGB2RGB565 (0 );
327- } else if (colormode == 2 ){
328- if (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE ) > 0 ){
305+ {
306+ if (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE ) > 0 ){
307+ // FIXME: consts, please.
308+ if (colormode == 0 ){
309+ // Black and white example
329310 return ARGB2RGB565 ( (int )
330311 ((int )(256 - (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE ) ) ) ) |
331312 ((int )(256 - (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE ) ) ) << 8 ) |
332313 ((int )(256 - (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE ) ) ) << 16 )
314+ );
315+ } else if (colormode == 1 ){
316+ // Green and blue
317+ if (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE ) > 0 ){
318+ return ARGB2RGB565 ( (int )
319+ ((int )(256 - (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE ) ) ) << 8 ) |
320+ ((int )(row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE )))
321+ );
322+ }
323+ return ARGB2RGB565 (0 );
324+ } else if (colormode == 2 ){
325+ // Purple and Blue sample
326+ return ARGB2RGB565 ( (int )
327+ ((int )(256 - (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE ) ) ) << 0 ) |
328+ ((int )(row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE )) << 16 )
333329 );
334- }
335- return ARGB2RGB565 (0 );
336- } else if (colormode == 3 ) {
337- if (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE ) > 0 ){
330+ return ARGB2RGB565 (0 );
331+ } else if (colormode == 3 ) {
332+ // Red to green
338333 return ARGB2RGB565 ( (int )
339334 ((int )(256 - (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE ) ) ) << 16 ) |
340335 ((int )(row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE )) << 8 )
341336 );
337+ return ARGB2RGB565 (0 );
338+
339+ // Green to red
340+ // Uncomment to reverse colors on this section
341+ /*if (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE) > 0){
342+ return ARGB2RGB565( (int)
343+ ((int)(256 - (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE) ) ) << 8) |
344+ ((int)(row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE)) << 16)
345+ );
346+ }
347+ return ARGB2RGB565(0);
348+ */
349+ // Red looks cooler, leave it red.
350+ } else {
351+ // Demo of tri-color wheel.
352+ int wheel = 160 ;
353+ int wheelie = wheel + wheelrotate ;
354+ switch (row / wheel )
355+ {
356+ case 0 :
357+ return ARGB2RGB565 ( (int )
358+ wheel - (row % wheel ) | // red down
359+ (row % wheel ) << 8 // Green up
360+ );
361+ break ;
362+ case 1 :
363+ return ARGB2RGB565 ( (int )
364+ (wheel - (row % wheel )) << 8 | // green down
365+ (row % wheel ) << 16 ); // blue up
366+ break ;
367+ case 2 :
368+ return ARGB2RGB565 ( (int )
369+ (row % wheel ) | // red up
370+ (wheel - (row % wheel )) << 16 ); // blue down
371+ break ;
372+ }
373+ wheelrotate += 1 ;
342374 }
343- return ARGB2RGB565 (0 );
344- } else {
345- if (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE ) > 0 ){
346- return ARGB2RGB565 ( (int )
347- ((int )(256 - (row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE ) ) ) << 8 ) |
348- ((int )(row * (256.0 / SWITCHBLADE_TOUCHPAD_Y_SIZE )) << 16 )
349- );
350- }
351- return ARGB2RGB565 (0 );
352375 }
376+ // Return black.
377+ return ARGB2RGB565 (0 );
353378}
354-
355379/**
356380 * visRender
357381 * This is the main loop that renders visualizations to the display. In the demo implementation
@@ -376,7 +400,8 @@ int visRender(struct winampVisModule *this_mod)
376400
377401 // Adjust the amplitude based on divLimit values
378402 // .6 works well at divLimit 200
379- double AMPLITUDE = .6 ;
403+ // .7 will keep things interesting on the high end
404+ double AMPLITUDE = .75 ;
380405
381406
382407 // step - counter for speed regulation
0 commit comments