This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#6814 - Mpegplayer volume changer
Attached to Project:
Rockbox
Opened by Jacob Gardner (cmptrgy412) - Wednesday, 14 March 2007, 01:28 GMT+2
Opened by Jacob Gardner (cmptrgy412) - Wednesday, 14 March 2007, 01:28 GMT+2
|
DetailsThe mpegplayer plugin did not have the functionality for volume changing. I fixed that by putting the following code in the button switch(...):
case BUTTON_SCROLL_UP: case BUTTON_SCROLL_DOWN: vol = rb->global_settings->volume; minvol = rb->sound_min(SOUND_VOLUME); maxvol = rb->sound_max(SOUND_VOLUME); if(button == BUTTON_SCROLL_UP) vol -= vol_interval; // This seems backwards, but it works... could someone explain. else vol += vol_interval; if( vol > maxvol ) vol = maxvol; else if( vol < minvol ) vol = minvol; if( vol != rb->global_settings->volume ) { rb->sound_set( SOUND_VOLUME, vol ); rb->global_settings->volume = vol; } break; |
This task depends upon
Closed by Dave Chapman (linuxstb)
Sunday, 18 March 2007, 18:07 GMT+2
Reason for closing: Accepted
Additional comments about closing: A modified version of mpegplayer-volume_control-02.diff committed - thanks to both Jacob and Pascal.
Sunday, 18 March 2007, 18:07 GMT+2
Reason for closing: Accepted
Additional comments about closing: A modified version of mpegplayer-volume_control-02.diff committed - thanks to both Jacob and Pascal.
I don't know if that's different from the patch program in cygwin. If so, I can create one in there, it just seemed easier at them time to use tortoise.
vol -= vol_interval;
else
vol += vol_interval;
Shouldnt it be like that:?
vol += vol_interval;
else
vol -= vol_interval;
On the Sansa E200 series it worked the other way, thus the comment of mine about it being backwards. When I get home on Sunday, I'll try to add compatibility for more devices.
nls: Yes, sorry, my first patch, I'll use the patch program in cygwin next time instead of tortoise svn.
[code]/* button definitions */
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
#define MPEG_MENU BUTTON_MODE
#define MPEG_STOP BUTTON_OFF
#define MPEG_PAUSE BUTTON_ON
#define MPEG_VOL_DOWN BUTTON_DOWN
#define MPEG_VOL_UP BUTTON_UP
#elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD)
#define MPEG_MENU BUTTON_MENU
#define MPEG_PAUSE (BUTTON_PLAY | BUTTON_REL)
#define MPEG_STOP (BUTTON_PLAY | BUTTON_REPEAT)
//#define MPEG_VOL_DOWN BUTTON_DOWN
//#define MPEG_VOL_UP BUTTON_UP
#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
#define MPEG_MENU (BUTTON_REC | BUTTON_REL)
#define MPEG_STOP BUTTON_POWER
#define MPEG_PAUSE BUTTON_PLAY
#define MPEG_VOL_DOWN BUTTON_DOWN
#define MPEG_VOL_UP BUTTON_UP
#elif CONFIG_KEYPAD == GIGABEAT_PAD
#define MPEG_MENU BUTTON_MENU
#define MPEG_STOP BUTTON_A
#define MPEG_PAUSE BUTTON_SELECT
#define MPEG_VOL_DOWN BUTTON_DOWN
#define MPEG_VOL_UP BUTTON_UP
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
#define MPEG_MENU (BUTTON_REW | BUTTON_REL)
#define MPEG_STOP BUTTON_POWER
#define MPEG_PAUSE BUTTON_PLAY
#define MPEG_VOL_DOWN BUTTON_SCROLL_DOWN
#define MPEG_VOL_UP BUTTON_SCROLL_UP
#elif CONFIG_KEYPAD == SANSA_E200_PAD
#define MPEG_MENU BUTTON_SELECT
#define MPEG_STOP BUTTON_POWER
#define MPEG_PAUSE BUTTON_UP
#define MPEG_VOL_DOWN BUTTON_SCROLL_UP
#define MPEG_VOL_UP BUTTON_SCROLL_DOWN
#else
#error MPEGPLAYER: Unsupported keypad
#endif[/code]
[...]
[code] switch (button)
{
#if defined(MPEG_VOL_UP) && defined(MPEG_VOL_DOWN)
case MPEG_VOL_UP:
case MPEG_VOL_DOWN:
vol = rb->global_settings->volume;
minvol = rb->sound_min(SOUND_VOLUME);
maxvol = rb->sound_max(SOUND_VOLUME);
if (button == MPEG_VOL_DOWN)
vol -= vol_interval;
else
vol += vol_interval;
if ( vol > maxvol )
vol = maxvol;
else if( vol < minvol )
vol = minvol;
if ( vol != rb->global_settings->volume ) {
rb->sound_set( SOUND_VOLUME, vol );
rb->global_settings->volume = vol;
}
break;
#endif
case MPEG_MENU:
[/code]
Hepdog: It's my first patch.
The keymapping for the other players should work, but for the IPOD_3G_PAD and IPOD_4G_PAD I have no idea.
If the keymapping is ready the "#if defined(MPEG_VOL_UP) && defined(MPEG_VOL_DOWN)" can be removed.
IAUDIO_X5_PAD changed to IAUDIO_X5M5_PAD
svn diff apps/plugins/mpegplayer/mpegplayer.c > mpegplayer-volcontrol.diff
and then attach that .diff file to a comment.
For more information, see: http://www.rockbox.org/twiki/bin/view/Main/WorkingWithPatches
1) Does it not work for ipods? The appropriate key mappings should be BUTTON_SCROLL_FWD to increase the volume, and BUTTON_SCROLL_BACK to decrease it (see the WPS definitions in keymap-ipod.c)
2) The patch doesn't appear to handle repeat events - it should check for MPEG_VOL_UP|BUTTON_REPEAT as a well as simply MPEG_VOL_UP
3) Looking at keymap-gigabeat.c, there are two sets of buttons mapped to volume changing in the WPS screen (which is what I think mpegplayer should mimic) - the normal UP/DOWN buttons, plus the dedicated VOL_UP and VOL_DOWN buttons.
I only have an iAudio x5, so please test.