2003-11-04 00:19:51 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2003 Lee Pilgrim
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2003-11-04 00:19:51 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
**************************************************************************/
|
|
|
|
#include "plugin.h"
|
2008-11-20 11:27:31 +00:00
|
|
|
#include "lib/fixedpoint.h"
|
2009-02-26 17:10:27 +00:00
|
|
|
#include "lib/playback_control.h"
|
2003-11-04 00:19:51 +00:00
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
|
2006-01-15 18:20:18 +00:00
|
|
|
|
2004-10-22 00:22:07 +00:00
|
|
|
/* variable button definitions */
|
|
|
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
|
|
|
#define VUMETER_QUIT BUTTON_OFF
|
|
|
|
#define VUMETER_HELP BUTTON_ON
|
|
|
|
#define VUMETER_MENU BUTTON_F1
|
2006-03-05 19:34:54 +00:00
|
|
|
#define VUMETER_UP BUTTON_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_DOWN
|
2008-03-23 08:26:42 +00:00
|
|
|
#define LABEL_HELP "ON"
|
|
|
|
#define LABEL_QUIT "OFF"
|
|
|
|
#define LABEL_MENU "F1"
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
2004-10-22 00:22:07 +00:00
|
|
|
|
2007-01-14 13:48:09 +00:00
|
|
|
#elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
|
|
|
|
#define VUMETER_QUIT BUTTON_OFF
|
|
|
|
#define VUMETER_HELP BUTTON_ON
|
|
|
|
#define VUMETER_MENU BUTTON_F1
|
|
|
|
#define VUMETER_UP BUTTON_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_DOWN
|
2008-03-23 08:26:42 +00:00
|
|
|
#define LABEL_HELP "ON"
|
|
|
|
#define LABEL_QUIT "OFF"
|
|
|
|
#define LABEL_MENU "F1"
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
2007-01-14 13:48:09 +00:00
|
|
|
|
2004-10-22 00:22:07 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDIO_PAD
|
|
|
|
#define VUMETER_QUIT BUTTON_OFF
|
|
|
|
#define VUMETER_HELP_PRE BUTTON_MENU
|
|
|
|
#define VUMETER_HELP (BUTTON_MENU | BUTTON_REL)
|
|
|
|
#define VUMETER_MENU_PRE BUTTON_MENU
|
|
|
|
#define VUMETER_MENU (BUTTON_MENU | BUTTON_REPEAT)
|
2006-03-05 19:34:54 +00:00
|
|
|
#define VUMETER_UP BUTTON_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_DOWN
|
2008-03-23 08:26:42 +00:00
|
|
|
#define LABEL_HELP "MODE"
|
|
|
|
#define LABEL_QUIT "OFF"
|
|
|
|
#define LABEL_MENU "MODE.."
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
2006-03-05 19:34:54 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IRIVER_H300_PAD)
|
|
|
|
#define VUMETER_QUIT BUTTON_OFF
|
|
|
|
#define VUMETER_HELP BUTTON_ON
|
|
|
|
#define VUMETER_MENU BUTTON_SELECT
|
2007-06-14 20:02:27 +00:00
|
|
|
#define VUMETER_MENU2 BUTTON_MODE
|
2006-03-05 19:34:54 +00:00
|
|
|
#define VUMETER_UP BUTTON_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_DOWN
|
2008-03-23 08:26:42 +00:00
|
|
|
#define LABEL_HELP "PLAY"
|
|
|
|
#define LABEL_QUIT "STOP"
|
|
|
|
#define LABEL_MENU "SELECT,MODE"
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
2006-03-05 19:34:54 +00:00
|
|
|
|
2006-06-30 16:43:47 +00:00
|
|
|
#define VUMETER_RC_QUIT BUTTON_RC_STOP
|
|
|
|
|
2007-07-27 09:57:27 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
|
2006-03-05 19:34:54 +00:00
|
|
|
#define VUMETER_QUIT BUTTON_MENU
|
|
|
|
#define VUMETER_HELP BUTTON_PLAY
|
|
|
|
#define VUMETER_MENU BUTTON_SELECT
|
|
|
|
#define VUMETER_UP BUTTON_SCROLL_FWD
|
|
|
|
#define VUMETER_DOWN BUTTON_SCROLL_BACK
|
2008-03-23 08:26:42 +00:00
|
|
|
#define LABEL_HELP "PLAY"
|
|
|
|
#define LABEL_QUIT "MENU"
|
|
|
|
#define LABEL_MENU "SELECT"
|
|
|
|
#define LABEL_VOLUME "Wheel"
|
2006-03-05 19:34:54 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
|
|
|
|
#define VUMETER_QUIT BUTTON_POWER
|
|
|
|
#define VUMETER_HELP BUTTON_A
|
2007-05-19 23:38:09 +00:00
|
|
|
#define VUMETER_MENU BUTTON_MENU
|
2006-03-05 19:34:54 +00:00
|
|
|
#define VUMETER_UP BUTTON_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_DOWN
|
2008-03-23 08:26:42 +00:00
|
|
|
#define LABEL_HELP "A"
|
|
|
|
#define LABEL_QUIT "POWER"
|
|
|
|
#define LABEL_MENU "MENU"
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
2006-03-05 19:34:54 +00:00
|
|
|
|
2006-10-26 13:38:09 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD)
|
|
|
|
#define VUMETER_QUIT BUTTON_POWER
|
|
|
|
#define VUMETER_HELP BUTTON_REC
|
|
|
|
#define VUMETER_MENU BUTTON_SELECT
|
2008-01-10 08:08:31 +00:00
|
|
|
#define VUMETER_UP BUTTON_SCROLL_FWD
|
|
|
|
#define VUMETER_DOWN BUTTON_SCROLL_BACK
|
2008-03-23 08:26:42 +00:00
|
|
|
#define LABEL_HELP "REC"
|
|
|
|
#define LABEL_QUIT "POWER"
|
|
|
|
#define LABEL_MENU "SELECT"
|
|
|
|
#define LABEL_VOLUME "Wheel"
|
2006-10-26 13:38:09 +00:00
|
|
|
|
2009-01-04 23:33:15 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
|
2009-04-10 17:28:26 +00:00
|
|
|
#define VUMETER_QUIT (BUTTON_HOME|BUTTON_REPEAT)
|
2009-01-04 23:33:15 +00:00
|
|
|
#define VUMETER_HELP BUTTON_SELECT|BUTTON_REPEAT
|
|
|
|
#define VUMETER_MENU BUTTON_SELECT|BUTTON_REL
|
|
|
|
#define VUMETER_UP BUTTON_SCROLL_FWD
|
|
|
|
#define VUMETER_DOWN BUTTON_SCROLL_BACK
|
|
|
|
#define LABEL_HELP "Hold Select"
|
2009-04-10 17:28:26 +00:00
|
|
|
#define LABEL_QUIT "HOME"
|
2009-01-04 23:33:15 +00:00
|
|
|
#define LABEL_MENU "Select"
|
|
|
|
#define LABEL_VOLUME "Scrollwheel"
|
|
|
|
|
2007-09-20 10:49:48 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_C200_PAD)
|
|
|
|
#define VUMETER_QUIT BUTTON_POWER
|
|
|
|
#define VUMETER_HELP BUTTON_REC
|
|
|
|
#define VUMETER_MENU BUTTON_SELECT
|
|
|
|
#define VUMETER_UP BUTTON_VOL_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_VOL_DOWN
|
2008-03-23 08:26:42 +00:00
|
|
|
#define LABEL_HELP "REC"
|
|
|
|
#define LABEL_QUIT "POWER"
|
|
|
|
#define LABEL_MENU "SELECT"
|
|
|
|
#define LABEL_VOLUME "VOL UP/DN"
|
2007-09-20 10:49:48 +00:00
|
|
|
|
2008-11-28 00:37:28 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_CLIP_PAD)
|
|
|
|
#define VUMETER_QUIT BUTTON_POWER
|
|
|
|
#define VUMETER_HELP BUTTON_HOME
|
|
|
|
#define VUMETER_MENU BUTTON_SELECT
|
|
|
|
#define VUMETER_UP BUTTON_VOL_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define LABEL_HELP "HOME"
|
|
|
|
#define LABEL_QUIT "POWER"
|
|
|
|
#define LABEL_MENU "SELECT"
|
|
|
|
#define LABEL_VOLUME "VOL UP/DN"
|
|
|
|
|
2008-12-12 19:50:49 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_M200_PAD)
|
|
|
|
#define VUMETER_QUIT BUTTON_POWER
|
|
|
|
#define VUMETER_HELP (BUTTON_SELECT | BUTTON_UP)
|
|
|
|
#define VUMETER_MENU (BUTTON_SELECT | BUTTON_REL)
|
|
|
|
#define VUMETER_UP BUTTON_VOL_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define LABEL_HELP "SELECT + UP"
|
|
|
|
#define LABEL_QUIT "POWER"
|
|
|
|
#define LABEL_MENU "SELECT"
|
|
|
|
#define LABEL_VOLUME "VOL UP/DN"
|
|
|
|
|
2007-03-16 23:02:39 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
|
2006-03-05 19:34:54 +00:00
|
|
|
#define VUMETER_QUIT BUTTON_POWER
|
|
|
|
#define VUMETER_HELP BUTTON_PLAY
|
|
|
|
#define VUMETER_MENU BUTTON_SELECT
|
|
|
|
#define VUMETER_UP BUTTON_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_DOWN
|
2008-03-23 08:26:42 +00:00
|
|
|
#define LABEL_HELP "PLAY"
|
|
|
|
#define LABEL_QUIT "POWER"
|
|
|
|
#define LABEL_MENU "SELECT"
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
2004-10-22 00:22:07 +00:00
|
|
|
|
2006-08-03 20:17:25 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
|
|
|
|
#define VUMETER_QUIT BUTTON_POWER
|
|
|
|
#define VUMETER_HELP BUTTON_PLAY
|
|
|
|
#define VUMETER_MENU BUTTON_REW
|
|
|
|
#define VUMETER_UP BUTTON_SCROLL_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_SCROLL_DOWN
|
2008-03-23 08:26:42 +00:00
|
|
|
#define LABEL_HELP "PLAY"
|
|
|
|
#define LABEL_QUIT "POWER"
|
|
|
|
#define LABEL_MENU "REW"
|
|
|
|
#define LABEL_VOLUME "Scroller"
|
2006-08-03 20:17:25 +00:00
|
|
|
|
2008-02-17 12:23:02 +00:00
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD)
|
|
|
|
#define VUMETER_QUIT BUTTON_BACK
|
|
|
|
#define VUMETER_HELP BUTTON_NEXT
|
|
|
|
#define VUMETER_MENU BUTTON_MENU
|
|
|
|
#define VUMETER_UP BUTTON_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_DOWN
|
2008-03-23 08:26:42 +00:00
|
|
|
#define LABEL_HELP "NEXT"
|
|
|
|
#define LABEL_QUIT "BACK"
|
|
|
|
#define LABEL_MENU "MENU"
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
2008-02-17 12:23:02 +00:00
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#elif (CONFIG_KEYPAD == MROBE100_PAD)
|
|
|
|
#define VUMETER_QUIT BUTTON_POWER
|
|
|
|
#define VUMETER_HELP BUTTON_DISPLAY
|
|
|
|
#define VUMETER_MENU BUTTON_MENU
|
|
|
|
#define VUMETER_UP BUTTON_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_DOWN
|
2008-03-23 08:26:42 +00:00
|
|
|
#define LABEL_HELP "DISPLAY"
|
|
|
|
#define LABEL_QUIT "POWER"
|
|
|
|
#define LABEL_MENU "MENU"
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
2008-03-01 22:55:09 +00:00
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
|
|
|
#define VUMETER_QUIT BUTTON_RC_REC
|
|
|
|
#define VUMETER_HELP BUTTON_RC_MODE
|
|
|
|
#define VUMETER_MENU BUTTON_RC_MENU
|
|
|
|
#define VUMETER_UP BUTTON_RC_VOL_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_RC_VOL_DOWN
|
2008-03-23 08:26:42 +00:00
|
|
|
#define LABEL_HELP "MODE"
|
|
|
|
#define LABEL_QUIT "REC"
|
|
|
|
#define LABEL_MENU "MENU"
|
|
|
|
#define LABEL_VOLUME "VOL UP/DN"
|
2008-03-22 10:24:28 +00:00
|
|
|
|
2009-12-15 20:51:41 +00:00
|
|
|
#elif CONFIG_KEYPAD == COWON_D2_PAD
|
2008-03-22 22:03:34 +00:00
|
|
|
#define VUMETER_QUIT BUTTON_POWER
|
|
|
|
#define VUMETER_MENU BUTTON_MENU
|
2008-03-23 08:26:42 +00:00
|
|
|
#define LABEL_QUIT "POWER"
|
|
|
|
#define LABEL_MENU "MENU"
|
2008-03-22 22:03:34 +00:00
|
|
|
|
2008-12-04 21:28:56 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
|
|
|
|
#define VUMETER_QUIT BUTTON_BACK
|
|
|
|
#define VUMETER_HELP BUTTON_SELECT
|
|
|
|
#define VUMETER_MENU BUTTON_MENU
|
|
|
|
#define VUMETER_UP BUTTON_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_DOWN
|
2008-12-08 09:51:42 +00:00
|
|
|
#define LABEL_HELP "MIDDLE"
|
2008-12-04 21:28:56 +00:00
|
|
|
#define LABEL_QUIT "BACK"
|
|
|
|
#define LABEL_MENU "MENU"
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
|
|
|
|
2009-01-24 22:41:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
|
|
|
|
#define VUMETER_QUIT BUTTON_POWER
|
|
|
|
#define VUMETER_HELP BUTTON_VIEW
|
|
|
|
#define VUMETER_MENU BUTTON_MENU
|
|
|
|
#define VUMETER_UP BUTTON_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_DOWN
|
|
|
|
#define LABEL_HELP "VIEW"
|
|
|
|
#define LABEL_QUIT "POWER"
|
|
|
|
#define LABEL_MENU "MENU"
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
|
|
|
|
2010-11-03 02:45:53 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD
|
|
|
|
#define VUMETER_QUIT BUTTON_POWER
|
|
|
|
#define VUMETER_HELP BUTTON_NEXT
|
|
|
|
#define VUMETER_MENU BUTTON_MENU
|
|
|
|
#define VUMETER_UP BUTTON_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_DOWN
|
|
|
|
#define LABEL_HELP "NEXT"
|
|
|
|
#define LABEL_QUIT "QUIT"
|
|
|
|
#define LABEL_MENU "MENU"
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
|
|
|
|
2009-12-05 14:34:47 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
|
|
|
|
#define VUMETER_QUIT BUTTON_POWER
|
|
|
|
#define VUMETER_HELP BUTTON_RIGHT
|
|
|
|
#define VUMETER_MENU BUTTON_MENU
|
|
|
|
#define VUMETER_UP BUTTON_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_DOWN
|
|
|
|
#define LABEL_HELP "RIGHT"
|
|
|
|
#define LABEL_QUIT "POWER"
|
|
|
|
#define LABEL_MENU "MENU"
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
|
|
|
|
2009-04-07 23:41:44 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX747_PAD
|
|
|
|
#define VUMETER_QUIT BUTTON_POWER
|
|
|
|
#define VUMETER_MENU BUTTON_MENU
|
|
|
|
#define LABEL_QUIT "POWER"
|
|
|
|
#define LABEL_MENU "MENU"
|
|
|
|
|
2009-08-31 21:11:32 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX777_PAD
|
|
|
|
#define VUMETER_QUIT BUTTON_POWER
|
|
|
|
#define LABEL_QUIT "POWER"
|
|
|
|
|
2009-04-21 04:24:16 +00:00
|
|
|
#elif CONFIG_KEYPAD == MROBE500_PAD
|
|
|
|
#define VUMETER_QUIT BUTTON_POWER
|
|
|
|
#define LABEL_QUIT "POWER"
|
|
|
|
|
2009-08-04 03:08:32 +00:00
|
|
|
#elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
|
|
|
|
#define VUMETER_QUIT BUTTON_REC
|
|
|
|
#define VUMETER_HELP BUTTON_PLAY
|
|
|
|
#define VUMETER_MENU BUTTON_LEFT
|
|
|
|
#define VUMETER_UP BUTTON_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_DOWN
|
|
|
|
#define LABEL_HELP "PLAY"
|
|
|
|
#define LABEL_QUIT "REC"
|
|
|
|
#define LABEL_MENU "LEFT"
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
|
|
|
|
2010-02-13 15:46:34 +00:00
|
|
|
#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
|
|
|
|
#define VUMETER_QUIT BUTTON_REC
|
|
|
|
#define VUMETER_HELP BUTTON_PLAY
|
|
|
|
#define VUMETER_MENU BUTTON_MENU
|
|
|
|
#define VUMETER_UP BUTTON_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_DOWN
|
|
|
|
#define LABEL_HELP "PLAY"
|
|
|
|
#define LABEL_QUIT "REC"
|
|
|
|
#define LABEL_MENU "MENU"
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
|
|
|
|
2010-04-26 21:40:00 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD200_PAD
|
|
|
|
#define VUMETER_QUIT (BUTTON_REC|BUTTON_PLAY)
|
|
|
|
#define VUMETER_HELP BUTTON_PLAY
|
2010-11-02 10:44:34 +00:00
|
|
|
#define VUMETER_MENU BUTTON_FUNC
|
2010-04-26 21:40:00 +00:00
|
|
|
#define VUMETER_UP BUTTON_VOL_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define LABEL_HELP "PLAY"
|
|
|
|
#define LABEL_QUIT "MENU"
|
2010-11-02 10:44:34 +00:00
|
|
|
#define LABEL_MENU "FUNC"
|
2010-04-26 21:40:00 +00:00
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
|
|
|
|
2010-11-30 10:52:14 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD300_PAD
|
|
|
|
#define VUMETER_QUIT (BUTTON_REC|BUTTON_REPEAT)
|
|
|
|
#define VUMETER_HELP BUTTON_PLAY
|
|
|
|
#define VUMETER_MENU BUTTON_MENU
|
|
|
|
#define VUMETER_UP BUTTON_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_DOWN
|
|
|
|
#define LABEL_HELP "PLAY"
|
|
|
|
#define LABEL_QUIT "REC..."
|
|
|
|
#define LABEL_MENU "MENU"
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
|
|
|
|
2011-10-02 16:51:36 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
|
|
|
|
#define VUMETER_QUIT BUTTON_POWER
|
|
|
|
#define VUMETER_HELP BUTTON_PLAYPAUSE
|
|
|
|
#define VUMETER_MENU BUTTON_BACK
|
|
|
|
#define VUMETER_UP BUTTON_UP
|
|
|
|
#define VUMETER_DOWN BUTTON_DOWN
|
|
|
|
#define LABEL_HELP "PLAY"
|
|
|
|
#define LABEL_QUIT "POWER"
|
|
|
|
#define LABEL_MENU "BACK"
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#else
|
|
|
|
#error No keymap defined!
|
2004-10-22 00:22:07 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2008-04-27 15:30:19 +00:00
|
|
|
#ifndef VUMETER_QUIT
|
|
|
|
#define VUMETER_QUIT BUTTON_TOPLEFT
|
|
|
|
#define LABEL_QUIT "TOPLEFT"
|
|
|
|
#endif
|
|
|
|
#ifndef VUMETER_HELP
|
|
|
|
#define VUMETER_HELP BUTTON_CENTER
|
|
|
|
#define LABEL_HELP "CENTRE"
|
|
|
|
#endif
|
|
|
|
#ifndef VUMETER_MENU
|
|
|
|
#define VUMETER_MENU BUTTON_TOPRIGHT
|
|
|
|
#define LABEL_MENU "TOPRIGHT"
|
|
|
|
#endif
|
|
|
|
#ifndef VUMETER_UP
|
|
|
|
#define VUMETER_UP BUTTON_TOPMIDDLE
|
|
|
|
#endif
|
|
|
|
#ifndef VUMETER_DOWN
|
|
|
|
#define VUMETER_DOWN BUTTON_BOTTOMMIDDLE
|
|
|
|
#endif
|
|
|
|
#ifndef LABEL_VOLUME
|
|
|
|
#define LABEL_VOLUME "UP/DOWN"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2007-02-17 23:06:22 +00:00
|
|
|
#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
|
2004-08-22 00:28:13 +00:00
|
|
|
#define mas_codec_readreg(x) rand()%MAX_PEAK
|
|
|
|
#endif
|
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
/* Defines x positions on a logarithmic (dBfs) scale. */
|
2006-07-12 20:07:08 +00:00
|
|
|
unsigned char analog_db_scale[LCD_WIDTH/2];
|
|
|
|
|
|
|
|
/* Define's y positions, to make the needle arch, like a real needle would. */
|
|
|
|
unsigned char y_values[LCD_WIDTH/2];
|
2004-03-19 22:15:52 +00:00
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
const unsigned char digital_db_scale[] =
|
|
|
|
{0,2,3,5,5,6,6,6,7,7,7,7,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,
|
|
|
|
10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11};
|
2004-03-19 22:15:52 +00:00
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
const unsigned char needle_cover[] =
|
|
|
|
{0x18, 0x1c, 0x1c, 0x1e, 0x1e, 0x1f, 0x1f, 0x1f, 0x1e, 0x1e, 0x1c, 0x1c, 0x18};
|
2004-03-19 22:15:52 +00:00
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
const unsigned char sound_speaker[] = {0x18,0x24,0x42,0xFF};
|
|
|
|
const unsigned char sound_low_level[] = {0x24,0x18};
|
|
|
|
const unsigned char sound_med_level[] = {0x42,0x3C};
|
|
|
|
const unsigned char sound_high_level[] = {0x81,0x7E};
|
|
|
|
const unsigned char sound_max_level[] = {0x0E,0xDF,0x0E};
|
2004-03-01 09:52:24 +00:00
|
|
|
|
2006-07-12 20:07:08 +00:00
|
|
|
const int half_width = LCD_WIDTH / 2;
|
|
|
|
const int quarter_width = LCD_WIDTH / 4;
|
|
|
|
const int half_height = LCD_HEIGHT / 2;
|
|
|
|
|
|
|
|
/* approx ratio of the previous hard coded values */
|
|
|
|
const int analog_mini_1 = (LCD_WIDTH / 2)*0.1;
|
|
|
|
const int analog_mini_2 = (LCD_WIDTH / 2)*0.25;
|
|
|
|
const int analog_mini_3 = (LCD_WIDTH / 2)*0.4;
|
|
|
|
const int analog_mini_4 = (LCD_WIDTH / 2)*0.75;
|
|
|
|
|
|
|
|
const int digital_block_width = LCD_WIDTH / 11;
|
|
|
|
const int digital_block_gap = (int)(LCD_WIDTH / 11) / 10;
|
|
|
|
/* ammount to lead in on left so 11x blocks are centered - is often 0 */
|
|
|
|
const int digital_lead = (LCD_WIDTH - (((int)(LCD_WIDTH / 11))*11) ) / 2;
|
|
|
|
|
|
|
|
const int digital_block_height = (LCD_HEIGHT - 54) / 2 ;
|
|
|
|
|
2007-06-14 20:02:27 +00:00
|
|
|
#define ANALOG 0 /* The two meter types */
|
|
|
|
#define DIGITAL 1
|
2004-03-01 09:52:24 +00:00
|
|
|
|
|
|
|
int left_needle_top_y;
|
|
|
|
int left_needle_top_x;
|
2004-08-21 23:22:05 +00:00
|
|
|
int last_left_needle_top_x;
|
2004-03-01 09:52:24 +00:00
|
|
|
int right_needle_top_y;
|
|
|
|
int right_needle_top_x;
|
2006-07-12 20:07:08 +00:00
|
|
|
int last_right_needle_top_x = LCD_WIDTH / 2;
|
2004-03-01 09:52:24 +00:00
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
int num_left_leds;
|
|
|
|
int num_right_leds;
|
|
|
|
int last_num_left_leds;
|
|
|
|
int last_num_right_leds;
|
2004-03-19 22:15:52 +00:00
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
int i;
|
2008-10-07 08:13:05 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
int screen_foreground;
|
|
|
|
#endif
|
2003-11-04 00:19:51 +00:00
|
|
|
|
2006-03-26 23:00:24 +00:00
|
|
|
#define MAX_PEAK 0x8000
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2006-07-12 20:07:08 +00:00
|
|
|
/* gap at the top for left/right etc */
|
|
|
|
#define NEEDLE_TOP 25
|
|
|
|
|
|
|
|
/* pow(M_E, 5) * 65536 */
|
|
|
|
#define E_POW_5 9726404
|
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
struct saved_settings {
|
|
|
|
int meter_type;
|
|
|
|
bool analog_use_db_scale;
|
|
|
|
bool digital_use_db_scale;
|
|
|
|
bool analog_minimeters;
|
|
|
|
bool digital_minimeters;
|
|
|
|
int analog_decay;
|
|
|
|
int digital_decay;
|
2007-07-31 10:53:53 +00:00
|
|
|
} vumeter_settings;
|
2004-08-21 23:22:05 +00:00
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void reset_settings(void) {
|
2007-07-31 10:53:53 +00:00
|
|
|
vumeter_settings.meter_type=ANALOG;
|
|
|
|
vumeter_settings.analog_use_db_scale=true;
|
|
|
|
vumeter_settings.digital_use_db_scale=true;
|
|
|
|
vumeter_settings.analog_minimeters=true;
|
|
|
|
vumeter_settings.digital_minimeters=false;
|
|
|
|
vumeter_settings.analog_decay=3;
|
|
|
|
vumeter_settings.digital_decay=0;
|
2004-03-19 22:15:52 +00:00
|
|
|
}
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void calc_scales(void)
|
2006-07-12 20:07:08 +00:00
|
|
|
{
|
|
|
|
unsigned int fx_log_factor = E_POW_5/half_width;
|
|
|
|
unsigned int y,z;
|
|
|
|
|
2007-07-31 17:23:49 +00:00
|
|
|
long j;
|
|
|
|
long k;
|
|
|
|
int nh = LCD_HEIGHT - NEEDLE_TOP;
|
|
|
|
long nh2 = nh*nh;
|
|
|
|
|
2006-07-12 20:07:08 +00:00
|
|
|
for (i=1; i <= half_width; i++)
|
|
|
|
{
|
2007-07-31 17:23:49 +00:00
|
|
|
/* analog scale */
|
2009-07-05 18:06:07 +00:00
|
|
|
y = (half_width/5)*fp16_log(i*fx_log_factor);
|
2006-07-12 20:07:08 +00:00
|
|
|
|
|
|
|
/* better way of checking for negative values? */
|
|
|
|
z = y>>16;
|
|
|
|
if (z > LCD_WIDTH)
|
|
|
|
z = 0;
|
|
|
|
|
|
|
|
analog_db_scale[i-1] = z;
|
|
|
|
/* play nice */
|
|
|
|
rb->yield();
|
|
|
|
|
2007-07-31 17:23:49 +00:00
|
|
|
/* y values (analog needle co-ords) */
|
2006-07-12 20:07:08 +00:00
|
|
|
j = i - (int)(half_width/2);
|
|
|
|
k = nh2 - ( j * j );
|
|
|
|
|
2007-07-31 17:23:49 +00:00
|
|
|
/* fsqrt+1 seems to give a closer approximation */
|
2009-07-05 18:06:07 +00:00
|
|
|
y_values[i-1] = LCD_HEIGHT - (fp_sqrt(k, 16)>>8) - 1;
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->yield();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void load_settings(void) {
|
2011-03-02 23:43:54 +00:00
|
|
|
int fp = rb->open(PLUGIN_DEMOS_DATA_DIR "/.vu_meter", O_RDONLY);
|
2004-08-21 23:22:05 +00:00
|
|
|
if(fp>=0) {
|
2007-07-31 10:53:53 +00:00
|
|
|
rb->read(fp, &vumeter_settings, sizeof(struct saved_settings));
|
2004-08-21 23:22:05 +00:00
|
|
|
rb->close(fp);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
reset_settings();
|
2008-03-23 08:26:42 +00:00
|
|
|
rb->splash(HZ, "Press " LABEL_HELP " for help");
|
2004-08-21 23:22:05 +00:00
|
|
|
}
|
|
|
|
}
|
2004-03-19 22:15:52 +00:00
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void save_settings(void) {
|
2011-03-02 23:43:54 +00:00
|
|
|
int fp = rb->creat(PLUGIN_DEMOS_DATA_DIR "/.vu_meter", 0666);
|
2004-08-21 23:22:05 +00:00
|
|
|
if(fp >= 0) {
|
2007-07-31 10:53:53 +00:00
|
|
|
rb->write (fp, &vumeter_settings, sizeof(struct saved_settings));
|
2004-08-21 23:22:05 +00:00
|
|
|
rb->close(fp);
|
|
|
|
}
|
2004-03-19 22:15:52 +00:00
|
|
|
}
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void change_volume(int delta) {
|
2005-12-17 21:13:30 +00:00
|
|
|
int minvol = rb->sound_min(SOUND_VOLUME);
|
|
|
|
int maxvol = rb->sound_max(SOUND_VOLUME);
|
2004-08-21 23:22:05 +00:00
|
|
|
int vol = rb->global_settings->volume + delta;
|
|
|
|
|
2005-12-17 21:13:30 +00:00
|
|
|
if (vol > maxvol) vol = maxvol;
|
|
|
|
else if (vol < minvol) vol = minvol;
|
2004-08-21 23:22:05 +00:00
|
|
|
if (vol != rb->global_settings->volume) {
|
2005-04-01 13:41:03 +00:00
|
|
|
rb->sound_set(SOUND_VOLUME, vol);
|
2004-08-21 23:22:05 +00:00
|
|
|
rb->global_settings->volume = vol;
|
2010-08-28 21:46:45 +00:00
|
|
|
rb->lcd_putsxyf(0,0, "%d", vol);
|
2004-08-21 23:22:05 +00:00
|
|
|
rb->lcd_update();
|
|
|
|
rb->sleep(HZ/12);
|
|
|
|
}
|
2004-03-19 22:15:52 +00:00
|
|
|
}
|
|
|
|
|
2007-06-14 20:02:27 +00:00
|
|
|
static bool vu_meter_menu(void)
|
2004-03-19 22:15:52 +00:00
|
|
|
{
|
2007-06-14 20:02:27 +00:00
|
|
|
int selection;
|
|
|
|
bool menu_quit = false;
|
|
|
|
bool exit = false;
|
|
|
|
|
|
|
|
MENUITEM_STRINGLIST(menu,"VU Meter Menu",NULL,"Meter Type","Scale",
|
2009-02-26 17:10:27 +00:00
|
|
|
"Minimeters","Decay Speed","Playback Control",
|
|
|
|
"Quit");
|
2007-06-14 20:02:27 +00:00
|
|
|
|
|
|
|
static const struct opt_items meter_type_option[2] = {
|
|
|
|
{ "Analog", -1 },
|
|
|
|
{ "Digital", -1 },
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct opt_items decay_speed_option[7] = {
|
|
|
|
{ "No Decay", -1 },
|
|
|
|
{ "Very Fast", -1 },
|
|
|
|
{ "Fast", -1 },
|
|
|
|
{ "Medium", -1 },
|
|
|
|
{ "Medium-Slow", -1 },
|
|
|
|
{ "Slow", -1 },
|
|
|
|
{ "Very Slow", -1 },
|
|
|
|
};
|
|
|
|
|
|
|
|
while (!menu_quit) {
|
2008-03-26 03:35:24 +00:00
|
|
|
switch(rb->do_menu(&menu, &selection, NULL, false))
|
2004-03-19 22:15:52 +00:00
|
|
|
{
|
2007-06-14 20:02:27 +00:00
|
|
|
case 0:
|
2007-07-31 10:53:53 +00:00
|
|
|
rb->set_option("Meter Type", &vumeter_settings.meter_type, INT,
|
2007-06-14 20:02:27 +00:00
|
|
|
meter_type_option, 2, NULL);
|
2004-03-19 22:15:52 +00:00
|
|
|
break;
|
2007-06-14 20:02:27 +00:00
|
|
|
|
|
|
|
case 1:
|
2007-07-31 10:53:53 +00:00
|
|
|
if(vumeter_settings.meter_type==ANALOG)
|
2007-06-14 20:02:27 +00:00
|
|
|
{
|
2007-07-31 10:53:53 +00:00
|
|
|
rb->set_bool_options("Scale", &vumeter_settings.analog_use_db_scale,
|
2007-06-14 20:02:27 +00:00
|
|
|
"dBfs", -1, "Linear", -1, NULL);
|
2004-08-21 23:22:05 +00:00
|
|
|
}
|
2007-06-14 20:02:27 +00:00
|
|
|
else
|
|
|
|
{
|
2007-07-31 10:53:53 +00:00
|
|
|
rb->set_bool_options("Scale", &vumeter_settings.digital_use_db_scale,
|
2007-06-14 20:02:27 +00:00
|
|
|
"dBfs", -1, "Linear", -1, NULL);
|
2004-08-21 23:22:05 +00:00
|
|
|
}
|
|
|
|
break;
|
2007-06-14 20:02:27 +00:00
|
|
|
|
|
|
|
case 2:
|
2007-07-31 10:53:53 +00:00
|
|
|
if(vumeter_settings.meter_type==ANALOG)
|
2007-06-14 20:02:27 +00:00
|
|
|
{
|
|
|
|
rb->set_bool("Enable Minimeters",
|
2007-07-31 10:53:53 +00:00
|
|
|
&vumeter_settings.analog_minimeters);
|
2004-08-21 23:22:05 +00:00
|
|
|
}
|
2007-06-14 20:02:27 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
rb->set_bool("Enable Minimeters",
|
2007-07-31 10:53:53 +00:00
|
|
|
&vumeter_settings.digital_minimeters);
|
2004-08-21 23:22:05 +00:00
|
|
|
}
|
2004-03-19 22:15:52 +00:00
|
|
|
break;
|
2007-06-14 20:02:27 +00:00
|
|
|
|
|
|
|
case 3:
|
2007-07-31 10:53:53 +00:00
|
|
|
if(vumeter_settings.meter_type==ANALOG)
|
2007-06-14 20:02:27 +00:00
|
|
|
{
|
2007-07-31 10:53:53 +00:00
|
|
|
rb->set_option("Decay Speed", &vumeter_settings.analog_decay, INT,
|
2007-06-14 20:02:27 +00:00
|
|
|
decay_speed_option, 7, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-07-31 10:53:53 +00:00
|
|
|
rb->set_option("Decay Speed", &vumeter_settings.digital_decay, INT,
|
2007-06-14 20:02:27 +00:00
|
|
|
decay_speed_option, 7, NULL);
|
|
|
|
}
|
2004-03-19 22:15:52 +00:00
|
|
|
break;
|
2004-08-21 23:22:05 +00:00
|
|
|
|
2007-06-14 20:02:27 +00:00
|
|
|
case 4:
|
2009-02-26 17:10:27 +00:00
|
|
|
playback_control(NULL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
2007-06-14 20:02:27 +00:00
|
|
|
exit = true;
|
|
|
|
/* fall through to exit the menu */
|
|
|
|
default:
|
|
|
|
menu_quit = true;
|
|
|
|
break;
|
2004-03-19 22:15:52 +00:00
|
|
|
}
|
|
|
|
}
|
2007-06-14 20:02:27 +00:00
|
|
|
/* the menu uses the userfont, set it back to sysfont */
|
|
|
|
rb->lcd_setfont(FONT_SYSFIXED);
|
|
|
|
return exit;
|
2004-03-01 09:52:24 +00:00
|
|
|
}
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void draw_analog_minimeters(void) {
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_mono_bitmap(sound_speaker, quarter_width-28, 12, 4, 8);
|
2005-06-28 23:15:47 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_FG);
|
2006-07-12 20:07:08 +00:00
|
|
|
if(analog_mini_1<left_needle_top_x)
|
|
|
|
rb->lcd_mono_bitmap(sound_low_level, quarter_width-23, 12, 2, 8);
|
|
|
|
if(analog_mini_2<left_needle_top_x)
|
|
|
|
rb->lcd_mono_bitmap(sound_med_level, quarter_width-21, 12, 2, 8);
|
|
|
|
if(analog_mini_3<left_needle_top_x)
|
|
|
|
rb->lcd_mono_bitmap(sound_high_level, quarter_width-19, 12, 2, 8);
|
|
|
|
if(analog_mini_4<left_needle_top_x)
|
|
|
|
rb->lcd_mono_bitmap(sound_max_level, quarter_width-16, 12, 3, 8);
|
2004-08-21 23:22:05 +00:00
|
|
|
|
2005-06-28 23:15:47 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID);
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_mono_bitmap(sound_speaker, quarter_width+half_width-30, 12, 4, 8);
|
2005-06-28 23:15:47 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_FG);
|
2006-07-12 20:07:08 +00:00
|
|
|
if(analog_mini_1<(right_needle_top_x-half_width))
|
|
|
|
rb->lcd_mono_bitmap(sound_low_level, quarter_width+half_width-25, 12, 2, 8);
|
|
|
|
if(analog_mini_2<(right_needle_top_x-half_width))
|
|
|
|
rb->lcd_mono_bitmap(sound_med_level, quarter_width+half_width-23, 12, 2, 8);
|
|
|
|
if(analog_mini_3<(right_needle_top_x-half_width))
|
|
|
|
rb->lcd_mono_bitmap(sound_high_level, quarter_width+half_width-21, 12, 2, 8);
|
|
|
|
if(analog_mini_4<(right_needle_top_x-half_width))
|
|
|
|
rb->lcd_mono_bitmap(sound_max_level, quarter_width+half_width-18, 12, 3, 8);
|
2005-06-28 23:15:47 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID);
|
2004-03-19 22:15:52 +00:00
|
|
|
}
|
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void draw_digital_minimeters(void) {
|
2008-10-07 08:13:05 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
rb->lcd_set_foreground(LCD_RGBPACK(255, 255 - 23 * num_left_leds, 0));
|
|
|
|
#endif
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_mono_bitmap(sound_speaker, 34, half_height-8, 4, 8);
|
2005-06-28 23:15:47 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_FG);
|
2004-08-21 23:22:05 +00:00
|
|
|
if(1<num_left_leds)
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_mono_bitmap(sound_low_level, 39, half_height-8, 2, 8);
|
2004-08-21 23:22:05 +00:00
|
|
|
if(2<num_left_leds)
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_mono_bitmap(sound_med_level, 41, half_height-8, 2, 8);
|
2004-08-21 23:22:05 +00:00
|
|
|
if(5<num_left_leds)
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_mono_bitmap(sound_high_level, 43, half_height-8, 2, 8);
|
2004-08-21 23:22:05 +00:00
|
|
|
if(8<num_left_leds)
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_mono_bitmap(sound_max_level, 46, half_height-8, 3, 8);
|
2004-08-21 23:22:05 +00:00
|
|
|
|
2008-10-07 08:13:05 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
rb->lcd_set_foreground(LCD_RGBPACK(255, 255 - 23 * num_right_leds, 0));
|
|
|
|
#endif
|
2005-06-28 23:15:47 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID);
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_mono_bitmap(sound_speaker, 34, half_height+8, 4, 8);
|
2005-06-28 23:15:47 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_FG);
|
2004-08-21 23:22:05 +00:00
|
|
|
if(1<(num_right_leds))
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_mono_bitmap(sound_low_level, 39, half_height+8, 2, 8);
|
2004-08-21 23:22:05 +00:00
|
|
|
if(2<(num_right_leds))
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_mono_bitmap(sound_med_level, 41, half_height+8, 2, 8);
|
2004-08-21 23:22:05 +00:00
|
|
|
if(5<(num_right_leds))
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_mono_bitmap(sound_high_level, 43, half_height+8, 2, 8);
|
2004-08-21 23:22:05 +00:00
|
|
|
if(8<(num_right_leds))
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_mono_bitmap(sound_max_level, 46, half_height+8, 3, 8);
|
2005-06-28 23:15:47 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID);
|
2008-10-07 08:13:05 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
rb->lcd_set_foreground(screen_foreground);
|
|
|
|
#endif
|
2004-08-21 23:22:05 +00:00
|
|
|
}
|
2003-11-04 00:19:51 +00:00
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void analog_meter(void) {
|
2006-03-05 19:34:54 +00:00
|
|
|
|
|
|
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
|
|
|
int left_peak = rb->mas_codec_readreg(0xC);
|
|
|
|
int right_peak = rb->mas_codec_readreg(0xD);
|
|
|
|
#elif (CONFIG_CODEC == SWCODEC)
|
|
|
|
int left_peak, right_peak;
|
2011-07-02 11:55:38 +00:00
|
|
|
rb->mixer_channel_calculate_peaks(PCM_MIXER_CHAN_PLAYBACK,
|
|
|
|
&left_peak, &right_peak);
|
2006-03-05 19:34:54 +00:00
|
|
|
#endif
|
|
|
|
|
2007-07-31 10:53:53 +00:00
|
|
|
if(vumeter_settings.analog_use_db_scale) {
|
2006-07-12 20:07:08 +00:00
|
|
|
left_needle_top_x = analog_db_scale[left_peak * half_width / MAX_PEAK];
|
|
|
|
right_needle_top_x = analog_db_scale[right_peak * half_width / MAX_PEAK] + half_width;
|
2004-08-21 23:22:05 +00:00
|
|
|
}
|
|
|
|
else {
|
2006-07-12 20:07:08 +00:00
|
|
|
left_needle_top_x = left_peak * half_width / MAX_PEAK;
|
|
|
|
right_needle_top_x = right_peak * half_width / MAX_PEAK + half_width;
|
2004-08-21 23:22:05 +00:00
|
|
|
}
|
2004-03-19 22:15:52 +00:00
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
/* Makes a decay on the needle */
|
2007-07-31 10:53:53 +00:00
|
|
|
left_needle_top_x = (left_needle_top_x+last_left_needle_top_x*vumeter_settings.analog_decay)
|
|
|
|
/(vumeter_settings.analog_decay+1);
|
|
|
|
right_needle_top_x = (right_needle_top_x+last_right_needle_top_x*vumeter_settings.analog_decay)
|
|
|
|
/(vumeter_settings.analog_decay+1);
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
last_left_needle_top_x = left_needle_top_x;
|
|
|
|
last_right_needle_top_x = right_needle_top_x;
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
left_needle_top_y = y_values[left_needle_top_x];
|
2006-07-12 20:07:08 +00:00
|
|
|
right_needle_top_y = y_values[right_needle_top_x-half_width];
|
2003-11-04 00:19:51 +00:00
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
/* Needles */
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_drawline(quarter_width, LCD_HEIGHT-1, left_needle_top_x, left_needle_top_y);
|
|
|
|
rb->lcd_drawline((quarter_width+half_width), LCD_HEIGHT-1, right_needle_top_x, right_needle_top_y);
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2007-07-31 10:53:53 +00:00
|
|
|
if(vumeter_settings.analog_minimeters)
|
2004-08-21 23:22:05 +00:00
|
|
|
draw_analog_minimeters();
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
/* Needle covers */
|
2005-06-28 23:15:47 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_FG);
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_mono_bitmap(needle_cover, quarter_width-6, LCD_HEIGHT-5, 13, 5);
|
|
|
|
rb->lcd_mono_bitmap(needle_cover, half_width+quarter_width-6, LCD_HEIGHT-5, 13, 5);
|
2005-06-28 23:15:47 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID);
|
2003-11-04 00:19:51 +00:00
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
/* Show Left/Right */
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_putsxy(quarter_width-12, 12, "Left");
|
|
|
|
rb->lcd_putsxy(half_width+quarter_width-12, 12, "Right");
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
/* Line above/below the Left/Right text */
|
2008-04-12 09:51:16 +00:00
|
|
|
rb->lcd_hline(0,LCD_WIDTH-1,9);
|
|
|
|
rb->lcd_hline(0,LCD_WIDTH-1,21);
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2006-07-12 20:07:08 +00:00
|
|
|
for(i=0; i<half_width; i++) {
|
2004-08-21 23:22:05 +00:00
|
|
|
rb->lcd_drawpixel(i, (y_values[i])-2);
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_drawpixel(i+half_width, (y_values[i])-2);
|
2004-08-21 23:22:05 +00:00
|
|
|
}
|
|
|
|
}
|
2003-11-04 00:19:51 +00:00
|
|
|
|
2011-10-15 20:38:08 +00:00
|
|
|
static void digital_meter(void) {
|
2006-03-05 19:34:54 +00:00
|
|
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
|
|
|
int left_peak = rb->mas_codec_readreg(0xC);
|
|
|
|
int right_peak = rb->mas_codec_readreg(0xD);
|
|
|
|
#elif (CONFIG_CODEC == SWCODEC)
|
|
|
|
int left_peak, right_peak;
|
|
|
|
rb->pcm_calculate_peaks(&left_peak, &right_peak);
|
|
|
|
#endif
|
|
|
|
|
2007-07-31 10:53:53 +00:00
|
|
|
if(vumeter_settings.digital_use_db_scale) {
|
2006-03-05 19:34:54 +00:00
|
|
|
num_left_leds = digital_db_scale[left_peak * 44 / MAX_PEAK];
|
|
|
|
num_right_leds = digital_db_scale[right_peak * 44 / MAX_PEAK];
|
2004-08-21 23:22:05 +00:00
|
|
|
}
|
|
|
|
else {
|
2006-03-05 19:34:54 +00:00
|
|
|
num_left_leds = left_peak * 11 / MAX_PEAK;
|
|
|
|
num_right_leds = right_peak * 11 / MAX_PEAK;
|
2004-08-21 23:22:05 +00:00
|
|
|
}
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2007-07-31 10:53:53 +00:00
|
|
|
num_left_leds = (num_left_leds+last_num_left_leds*vumeter_settings.digital_decay)
|
|
|
|
/(vumeter_settings.digital_decay+1);
|
|
|
|
num_right_leds = (num_right_leds+last_num_right_leds*vumeter_settings.digital_decay)
|
|
|
|
/(vumeter_settings.digital_decay+1);
|
2006-07-12 20:07:08 +00:00
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
last_num_left_leds = num_left_leds;
|
|
|
|
last_num_right_leds = num_right_leds;
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2005-06-28 23:15:47 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_FG);
|
2004-08-21 23:22:05 +00:00
|
|
|
/* LEDS */
|
2008-10-07 08:13:05 +00:00
|
|
|
for(i=0; i<num_left_leds; i++) {
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
rb->lcd_set_foreground(LCD_RGBPACK(255, 255 - 23 * i, 0));
|
|
|
|
#endif
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_fillrect((digital_lead + (i*digital_block_width)),
|
|
|
|
14, digital_block_width - digital_block_gap, digital_block_height);
|
2008-10-07 08:13:05 +00:00
|
|
|
}
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2008-10-07 08:13:05 +00:00
|
|
|
for(i=0; i<num_right_leds; i++) {
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
rb->lcd_set_foreground(LCD_RGBPACK(255, 255 - 23 * i, 0));
|
|
|
|
#endif
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_fillrect((digital_lead + (i*digital_block_width)),
|
|
|
|
(half_height + 20), digital_block_width - digital_block_gap,
|
|
|
|
digital_block_height);
|
2008-10-07 08:13:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
rb->lcd_set_foreground(screen_foreground);
|
|
|
|
#endif
|
2005-06-28 23:15:47 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID);
|
2004-03-19 22:15:52 +00:00
|
|
|
|
2007-07-31 10:53:53 +00:00
|
|
|
if(vumeter_settings.digital_minimeters)
|
2004-08-21 23:22:05 +00:00
|
|
|
draw_digital_minimeters();
|
|
|
|
|
|
|
|
/* Lines above/below where the LEDS are */
|
2008-04-12 09:51:16 +00:00
|
|
|
rb->lcd_hline(0,LCD_WIDTH-1,12);
|
|
|
|
rb->lcd_hline(0,LCD_WIDTH-1,half_height-12);
|
2004-08-21 23:22:05 +00:00
|
|
|
|
2008-04-12 09:51:16 +00:00
|
|
|
rb->lcd_hline(0,LCD_WIDTH-1,half_height+18);
|
|
|
|
rb->lcd_hline(0,LCD_WIDTH-1,LCD_HEIGHT-6);
|
2004-08-21 23:22:05 +00:00
|
|
|
|
|
|
|
/* Show Left/Right */
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_putsxy(2, half_height-8, "Left");
|
|
|
|
rb->lcd_putsxy(2, half_height+8, "Right");
|
2004-08-21 23:22:05 +00:00
|
|
|
|
|
|
|
/* Line in the middle */
|
2008-04-12 09:51:16 +00:00
|
|
|
rb->lcd_hline(0,LCD_WIDTH-1,half_height+3);
|
2004-08-21 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
enum plugin_status plugin_start(const void* parameter) {
|
2004-08-21 23:29:55 +00:00
|
|
|
int button;
|
2011-05-01 14:44:20 +00:00
|
|
|
#if defined(VUMETER_HELP_PRE) || defined(VUMETER_MENU_PRE)
|
2004-10-22 00:22:07 +00:00
|
|
|
int lastbutton = BUTTON_NONE;
|
2011-05-01 14:44:20 +00:00
|
|
|
#endif
|
2006-07-12 20:07:08 +00:00
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
(void) parameter;
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2006-07-12 20:07:08 +00:00
|
|
|
calc_scales();
|
|
|
|
|
2004-08-21 23:22:05 +00:00
|
|
|
load_settings();
|
|
|
|
rb->lcd_setfont(FONT_SYSFIXED);
|
2008-10-07 08:13:05 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
screen_foreground = rb->lcd_get_foreground();
|
|
|
|
#endif
|
2004-08-21 23:22:05 +00:00
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
rb->lcd_clear_display();
|
2003-12-23 22:24:48 +00:00
|
|
|
|
2006-07-12 20:07:08 +00:00
|
|
|
rb->lcd_putsxy(half_width-23, 0, "VU Meter");
|
2004-08-21 23:22:05 +00:00
|
|
|
|
2007-07-31 10:53:53 +00:00
|
|
|
if(vumeter_settings.meter_type==ANALOG)
|
2004-08-21 23:22:05 +00:00
|
|
|
analog_meter();
|
|
|
|
else
|
|
|
|
digital_meter();
|
2006-07-12 20:07:08 +00:00
|
|
|
|
2004-03-19 22:15:52 +00:00
|
|
|
rb->lcd_update();
|
|
|
|
|
2004-08-21 23:29:55 +00:00
|
|
|
button = rb->button_get_w_tmo(1);
|
|
|
|
switch (button)
|
2003-11-04 00:19:51 +00:00
|
|
|
{
|
2006-06-30 16:43:47 +00:00
|
|
|
#ifdef VUMETER_RC_QUIT
|
|
|
|
case VUMETER_RC_QUIT:
|
|
|
|
#endif
|
2004-10-22 00:22:07 +00:00
|
|
|
case VUMETER_QUIT:
|
2004-08-21 23:22:05 +00:00
|
|
|
save_settings();
|
2003-11-10 22:00:27 +00:00
|
|
|
return PLUGIN_OK;
|
2004-03-01 09:52:24 +00:00
|
|
|
break;
|
|
|
|
|
2004-10-22 00:22:07 +00:00
|
|
|
case VUMETER_HELP:
|
|
|
|
#ifdef VUMETER_HELP_PRE
|
|
|
|
if (lastbutton != VUMETER_HELP_PRE)
|
|
|
|
break;
|
|
|
|
#endif
|
2004-03-01 09:52:24 +00:00
|
|
|
rb->lcd_clear_display();
|
2008-03-23 08:26:42 +00:00
|
|
|
rb->lcd_puts(0, 0, LABEL_QUIT ": Exit");
|
|
|
|
rb->lcd_puts(0, 1, LABEL_MENU ": Settings");
|
|
|
|
rb->lcd_puts(0, 2, LABEL_VOLUME ": Volume");
|
2004-08-21 23:22:05 +00:00
|
|
|
rb->lcd_update();
|
|
|
|
rb->sleep(HZ*3);
|
2004-03-01 09:52:24 +00:00
|
|
|
break;
|
|
|
|
|
2004-10-22 00:22:07 +00:00
|
|
|
case VUMETER_MENU:
|
2007-06-14 20:02:27 +00:00
|
|
|
|
|
|
|
#ifdef VUMETER_MENU2
|
|
|
|
case VUMETER_MENU2:
|
|
|
|
#endif
|
|
|
|
|
2004-10-22 00:22:07 +00:00
|
|
|
#ifdef VUMETER_MENU_PRE
|
|
|
|
if (lastbutton != VUMETER_MENU_PRE)
|
|
|
|
break;
|
|
|
|
#endif
|
2007-06-14 20:02:27 +00:00
|
|
|
if(vu_meter_menu())
|
|
|
|
return PLUGIN_OK;
|
2004-03-19 22:15:52 +00:00
|
|
|
break;
|
|
|
|
|
2006-03-05 19:34:54 +00:00
|
|
|
case VUMETER_UP:
|
|
|
|
case VUMETER_UP | BUTTON_REPEAT:
|
2004-08-21 23:22:05 +00:00
|
|
|
change_volume(1);
|
2004-03-19 22:15:52 +00:00
|
|
|
break;
|
|
|
|
|
2006-03-05 19:34:54 +00:00
|
|
|
case VUMETER_DOWN:
|
|
|
|
case VUMETER_DOWN | BUTTON_REPEAT:
|
2004-08-21 23:22:05 +00:00
|
|
|
change_volume(-1);
|
2004-03-01 09:52:24 +00:00
|
|
|
break;
|
|
|
|
|
2004-08-21 23:29:55 +00:00
|
|
|
default:
|
|
|
|
if(rb->default_event_handler(button) == SYS_USB_CONNECTED)
|
|
|
|
return PLUGIN_USB_CONNECTED;
|
2004-03-01 09:52:24 +00:00
|
|
|
break;
|
2003-11-04 00:19:51 +00:00
|
|
|
}
|
2011-05-01 14:44:20 +00:00
|
|
|
#if defined(VUMETER_HELP_PRE) || defined(VUMETER_MENU_PRE)
|
2004-10-22 00:22:07 +00:00
|
|
|
if (button != BUTTON_NONE)
|
|
|
|
lastbutton = button;
|
2011-05-01 14:44:20 +00:00
|
|
|
#endif
|
2003-11-04 00:19:51 +00:00
|
|
|
}
|
|
|
|
}
|