forked from len0rd/rockbox
sonynwz: add api and debug entries for "acoustic" and "cue/rev" mode
We don't really know what those are supposed to do. They seem to change the volume curve but it is not very clear what is the intended purpose. Change-Id: I65f5d18aba139844c23df092277ba17ee8518f96
This commit is contained in:
parent
26d18fd348
commit
afbae177a1
3 changed files with 77 additions and 14 deletions
|
@ -277,6 +277,29 @@ static void hw_close(void)
|
||||||
close(fd_hw);
|
close(fd_hw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Acoustic and Cue/Rev control how the volume curve, but it is not clear
|
||||||
|
* what the intention of these modes are and the OF does not seem to use
|
||||||
|
* them by default */
|
||||||
|
bool audiohw_acoustic_enabled(void)
|
||||||
|
{
|
||||||
|
return alsa_controls_get_bool("CODEC Acoustic Switch");
|
||||||
|
}
|
||||||
|
|
||||||
|
void audiohw_enable_acoustic(bool en)
|
||||||
|
{
|
||||||
|
alsa_controls_set_bool("CODEC Acoustic Switch", en);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool audiohw_cuerev_enabled(void)
|
||||||
|
{
|
||||||
|
return alsa_controls_get_bool("CODEC Cue/Rev Switch");
|
||||||
|
}
|
||||||
|
|
||||||
|
void audiohw_enable_cuerev(bool en)
|
||||||
|
{
|
||||||
|
alsa_controls_set_bool("CODEC Cue/Rev Switch", en);
|
||||||
|
}
|
||||||
|
|
||||||
void audiohw_preinit(void)
|
void audiohw_preinit(void)
|
||||||
{
|
{
|
||||||
alsa_controls_init();
|
alsa_controls_init();
|
||||||
|
@ -287,8 +310,8 @@ void audiohw_preinit(void)
|
||||||
/* Acoustic and Cue/Rev control how the volume curve, but it is not clear
|
/* Acoustic and Cue/Rev control how the volume curve, but it is not clear
|
||||||
* what the intention of these modes are and the OF does not seem to use
|
* what the intention of these modes are and the OF does not seem to use
|
||||||
* them by default */
|
* them by default */
|
||||||
alsa_controls_set_bool("CODEC Acoustic Switch", false);
|
audiohw_enable_acoustic(false);
|
||||||
alsa_controls_set_bool("CODEC Cue/Rev Switch", false);
|
audiohw_enable_cuerev(false);
|
||||||
/* not sure exactly what it means */
|
/* not sure exactly what it means */
|
||||||
alsa_controls_set_enum("Playback Src Switch", "Music");
|
alsa_controls_set_enum("Playback Src Switch", "Music");
|
||||||
/* use headphone output */
|
/* use headphone output */
|
||||||
|
|
|
@ -26,4 +26,11 @@
|
||||||
/* Ranges from -100dB to 4dB */
|
/* Ranges from -100dB to 4dB */
|
||||||
AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -100, 4, -10)
|
AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -100, 4, -10)
|
||||||
|
|
||||||
|
/* enable/disable Sony's "acoustic" mode */
|
||||||
|
bool audiohw_acoustic_enabled(void);
|
||||||
|
void audiohw_enable_acoustic(bool en);
|
||||||
|
/* enable/disable Sony's "cuerev" mode */
|
||||||
|
bool audiohw_cuerev_enabled(void);
|
||||||
|
void audiohw_enable_cuerev(bool en);
|
||||||
|
|
||||||
#endif /* __NWZLINUX_CODEC_H__ */
|
#endif /* __NWZLINUX_CODEC_H__ */
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include "nwzlinux_codec.h"
|
||||||
|
|
||||||
/* NOTE: some targets with touchscreen don't have the usual keypad, on those
|
/* NOTE: some targets with touchscreen don't have the usual keypad, on those
|
||||||
* we use a mixture of rewind/forward/volume+/- to emulate it */
|
* we use a mixture of rewind/forward/volume+/- to emulate it */
|
||||||
|
@ -44,6 +45,8 @@
|
||||||
#define ACT_OK 2
|
#define ACT_OK 2
|
||||||
#define ACT_PREV 3
|
#define ACT_PREV 3
|
||||||
#define ACT_NEXT 4
|
#define ACT_NEXT 4
|
||||||
|
#define ACT_DEC 5
|
||||||
|
#define ACT_INC 6
|
||||||
#define ACT_REPEAT 0x1000
|
#define ACT_REPEAT 0x1000
|
||||||
|
|
||||||
int xlate_button(int btn)
|
int xlate_button(int btn)
|
||||||
|
@ -58,13 +61,21 @@ int xlate_button(int btn)
|
||||||
case BUTTON_PLAY:
|
case BUTTON_PLAY:
|
||||||
return ACT_OK;
|
return ACT_OK;
|
||||||
case BUTTON_UP:
|
case BUTTON_UP:
|
||||||
case BUTTON_LEFT:
|
#ifdef BUTTON_FF
|
||||||
case BUTTON_VOL_UP:
|
case BUTTON_FF:
|
||||||
|
#endif
|
||||||
return ACT_PREV;
|
return ACT_PREV;
|
||||||
case BUTTON_DOWN:
|
|
||||||
case BUTTON_RIGHT:
|
case BUTTON_RIGHT:
|
||||||
case BUTTON_VOL_DOWN:
|
case BUTTON_VOL_UP:
|
||||||
|
return ACT_INC;
|
||||||
|
case BUTTON_DOWN:
|
||||||
|
#ifdef BUTTON_FF
|
||||||
|
case BUTTON_REW:
|
||||||
|
#endif
|
||||||
return ACT_NEXT;
|
return ACT_NEXT;
|
||||||
|
case BUTTON_LEFT:
|
||||||
|
case BUTTON_VOL_DOWN:
|
||||||
|
return ACT_DEC;
|
||||||
default:
|
default:
|
||||||
return ACT_NONE;
|
return ACT_NONE;
|
||||||
}
|
}
|
||||||
|
@ -96,8 +107,6 @@ bool dbg_hw_info_adc(void)
|
||||||
int button = my_get_action(HZ / 25);
|
int button = my_get_action(HZ / 25);
|
||||||
switch(button)
|
switch(button)
|
||||||
{
|
{
|
||||||
case ACT_NEXT:
|
|
||||||
case ACT_PREV:
|
|
||||||
case ACT_OK:
|
case ACT_OK:
|
||||||
lcd_setfont(FONT_UI);
|
lcd_setfont(FONT_UI);
|
||||||
return true;
|
return true;
|
||||||
|
@ -166,8 +175,6 @@ bool dbg_hw_info_power(void)
|
||||||
int button = my_get_action(HZ / 25);
|
int button = my_get_action(HZ / 25);
|
||||||
switch(button)
|
switch(button)
|
||||||
{
|
{
|
||||||
case ACT_NEXT:
|
|
||||||
case ACT_PREV:
|
|
||||||
case ACT_OK:
|
case ACT_OK:
|
||||||
lcd_setfont(FONT_UI);
|
lcd_setfont(FONT_UI);
|
||||||
return true;
|
return true;
|
||||||
|
@ -335,6 +342,7 @@ bool dbg_hw_info_audio(void)
|
||||||
{
|
{
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
int vol = 0;
|
int vol = 0;
|
||||||
|
enum { VOL, ACOUSTIC, CUEREV, NR_SETTINGS } setting = VOL;
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
@ -342,12 +350,10 @@ bool dbg_hw_info_audio(void)
|
||||||
switch(btn)
|
switch(btn)
|
||||||
{
|
{
|
||||||
case ACT_PREV:
|
case ACT_PREV:
|
||||||
vol--;
|
setting = (setting + NR_SETTINGS - 1) % NR_SETTINGS;
|
||||||
pcm_alsa_set_digital_volume(vol);
|
|
||||||
break;
|
break;
|
||||||
case ACT_NEXT:
|
case ACT_NEXT:
|
||||||
vol++;
|
setting = (setting + 1) % NR_SETTINGS;
|
||||||
pcm_alsa_set_digital_volume(vol);
|
|
||||||
break;
|
break;
|
||||||
case ACT_OK:
|
case ACT_OK:
|
||||||
lcd_setfont(FONT_UI);
|
lcd_setfont(FONT_UI);
|
||||||
|
@ -356,11 +362,38 @@ bool dbg_hw_info_audio(void)
|
||||||
lcd_setfont(FONT_UI);
|
lcd_setfont(FONT_UI);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if(btn == ACT_INC || btn == ACT_DEC)
|
||||||
|
{
|
||||||
|
bool inc = (btn == ACT_INC);
|
||||||
|
switch(setting)
|
||||||
|
{
|
||||||
|
case VOL:
|
||||||
|
vol += inc ? 1 : -1;
|
||||||
|
pcm_alsa_set_digital_volume(vol);
|
||||||
|
break;
|
||||||
|
case ACOUSTIC:
|
||||||
|
audiohw_enable_acoustic(!audiohw_acoustic_enabled());
|
||||||
|
break;
|
||||||
|
case CUEREV:
|
||||||
|
audiohw_enable_cuerev(!audiohw_cuerev_enabled());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
int line = 0;
|
int line = 0;
|
||||||
|
#define SEL_COL(item) lcd_set_foreground(item == setting ? LCD_RGBPACK(255, 0, 0) : LCD_WHITE);
|
||||||
|
|
||||||
|
SEL_COL(VOL)
|
||||||
lcd_putsf(0, line++, "vol: %d dB", vol);
|
lcd_putsf(0, line++, "vol: %d dB", vol);
|
||||||
|
SEL_COL(ACOUSTIC)
|
||||||
|
lcd_putsf(0, line++, "acoustic: %s", audiohw_acoustic_enabled() ? "on" : "off");
|
||||||
|
SEL_COL(CUEREV)
|
||||||
|
lcd_putsf(0, line++, "cue/rev: %s", audiohw_cuerev_enabled() ? "on" : "off");
|
||||||
|
lcd_set_foreground(LCD_WHITE);
|
||||||
|
#undef SEL_COL
|
||||||
|
|
||||||
lcd_update();
|
lcd_update();
|
||||||
yield();
|
yield();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue