forked from len0rd/rockbox
MRobe100, HD200, Gigabeat F/X (anything with wm8750 or wm8751). Properly prescale bass and treble controls to avoid clipping.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25940 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
7d21e5ab32
commit
8ce5b01ec7
3 changed files with 21 additions and 8 deletions
|
|
@ -61,6 +61,8 @@ const struct sound_settings_info audiohw_settings[] = {
|
|||
/* We use linear treble control with 4 kHz cutoff */
|
||||
#define TREBCTRL_BITS (TREBCTRL_TC)
|
||||
|
||||
static int prescaler = 0;
|
||||
|
||||
/* convert tenth of dB volume (-730..60) to master volume register value */
|
||||
int tenthdb2master(int db)
|
||||
{
|
||||
|
|
@ -173,6 +175,10 @@ void audiohw_postinit(void)
|
|||
PWRMGMT2_ROUT2);
|
||||
#endif
|
||||
|
||||
/* Full -0dB on the DACS */
|
||||
wmcodec_write(LEFTGAIN, 0xff);
|
||||
wmcodec_write(RIGHTGAIN, RIGHTGAIN_RDVU | 0xff);
|
||||
|
||||
wmcodec_write(ADDITIONAL1, ADDITIONAL1_TSDEN | ADDITIONAL1_TOEN |
|
||||
ADDITIONAL1_DMONOMIX_LLRR | ADDITIONAL1_VSEL_DEFAULT);
|
||||
|
||||
|
|
@ -249,6 +255,14 @@ void audiohw_set_treble(int value)
|
|||
TREBCTRL_TREB(tone_tenthdb2hw(value)));
|
||||
}
|
||||
|
||||
void audiohw_set_prescaler(int value)
|
||||
{
|
||||
prescaler = 2 * value;
|
||||
wmcodec_write(LEFTGAIN, 0xff - (prescaler & LEFTGAIN_LDACVOL));
|
||||
wmcodec_write(RIGHTGAIN, RIGHTGAIN_RDVU |
|
||||
(0xff - (prescaler & RIGHTGAIN_RDACVOL)));
|
||||
}
|
||||
|
||||
/* Nice shutdown of WM8751 codec */
|
||||
void audiohw_close(void)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue