Get the volume controls working on the M:Robe 500 along with some minor code changes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20194 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
1fb8242d96
commit
096eb687a6
6 changed files with 19 additions and 43 deletions
|
@ -29,20 +29,13 @@
|
|||
#include "tsc2100.h"
|
||||
|
||||
const struct sound_settings_info audiohw_settings[] = {
|
||||
[SOUND_VOLUME] = {"dB", 0, 1, -63, 0, -25},
|
||||
#if 0
|
||||
[SOUND_VOLUME] = {"dB", 0, 1, VOLUME_MIN/10, VOLUME_MAX/10, -25},
|
||||
/* HAVE_SW_TONE_CONTROLS */
|
||||
[SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
|
||||
[SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
|
||||
[SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
|
||||
[SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
|
||||
[SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
|
||||
#ifdef HAVE_RECORDING
|
||||
[SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 39, 23},
|
||||
[SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 31, 23},
|
||||
[SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 31, 23},
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
static bool is_muted = false;
|
||||
/* convert tenth of dB volume to master volume register value */
|
||||
|
@ -50,11 +43,11 @@ int tenthdb2master(int db)
|
|||
{
|
||||
/* 0 to -63.0dB in 1dB steps, tsc2100 can goto -63.5 in 0.5dB steps */
|
||||
if (db < VOLUME_MIN) {
|
||||
return 0x0;
|
||||
return 0x7E;
|
||||
} else if (db >= VOLUME_MAX) {
|
||||
return 0x1f;
|
||||
return 0x00;
|
||||
} else {
|
||||
return((db-VOLUME_MIN)/10); /* VOLUME_MIN is negative */
|
||||
return(-((db)/5)); /* VOLUME_MIN is negative */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,15 +88,7 @@ void audiohw_postinit(void)
|
|||
|
||||
void audiohw_set_master_vol(int vol_l, int vol_r)
|
||||
{
|
||||
short vol = (vol_l<<14)|(vol_r);
|
||||
if (is_muted)
|
||||
vol |= (1<<15)|(1<<7);
|
||||
tsc2100_writereg(TSDACGAIN_PAGE, TSDACGAIN_ADDRESS, vol);
|
||||
}
|
||||
|
||||
void audiohw_set_lineout_vol(int vol_l, int vol_r)
|
||||
{
|
||||
audiohw_set_master_vol(vol_l, vol_r);
|
||||
tsc2100_writereg(TSDACGAIN_PAGE, TSDACGAIN_ADDRESS, (short)((vol_l<<8) | vol_r) );
|
||||
}
|
||||
|
||||
void audiohw_mute(bool mute)
|
||||
|
|
|
@ -93,6 +93,9 @@
|
|||
/* Define this if you do software codec */
|
||||
#define CONFIG_CODEC SWCODEC
|
||||
|
||||
/* There is no hardware tone control */
|
||||
#define HAVE_SW_TONE_CONTROLS
|
||||
|
||||
/* define this if you have a real-time clock */
|
||||
#define CONFIG_RTC RTC_RX5X348AB
|
||||
|
||||
|
@ -120,12 +123,6 @@
|
|||
/* The number of bytes reserved for loadable plugins */
|
||||
#define PLUGIN_BUFFER_SIZE 0x100000
|
||||
|
||||
/* Define this if you have the WM8975 audio codec */
|
||||
//#define HAVE_WM8751
|
||||
|
||||
/* Define this if you want to use the adaptive bass capibility of the 8751 */
|
||||
/* #define USE_ADAPTIVE_BASS */
|
||||
|
||||
#define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | \
|
||||
SAMPR_CAP_11)
|
||||
|
||||
|
|
|
@ -134,6 +134,5 @@ void tsc2100_keyclick(void);
|
|||
|
||||
extern int tenthdb2master(int db);
|
||||
extern void audiohw_set_master_vol(int vol_l, int vol_r);
|
||||
extern void audiohw_set_lineout_vol(int vol_l, int vol_r);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -257,8 +257,7 @@ static void set_prescaled_volume(void)
|
|||
|| defined(HAVE_WM8751) || defined(HAVE_AS3514) || defined(HAVE_TSC2100)
|
||||
audiohw_set_master_vol(tenthdb2master(l), tenthdb2master(r));
|
||||
#if defined(HAVE_WM8975) || defined(HAVE_WM8758) \
|
||||
|| (defined(HAVE_WM8751) && !defined(MROBE_100)) \
|
||||
|| defined(HAVE_TSC2100) || defined(HAVE_WM8985)
|
||||
|| (defined(HAVE_WM8751) && !defined(MROBE_100)) || defined(HAVE_WM8985)
|
||||
audiohw_set_lineout_vol(tenthdb2master(0), tenthdb2master(0));
|
||||
#endif
|
||||
|
||||
|
|
|
@ -39,9 +39,6 @@
|
|||
bool __dbg_ports(void)
|
||||
{
|
||||
dsp_init();
|
||||
#ifndef CREATIVE_ZVx
|
||||
tsc2100_writereg(TSDACGAIN_PAGE, TSDACGAIN_ADDRESS, 0x2020/*x0303*/);
|
||||
#endif
|
||||
dsp_wake();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -43,17 +43,6 @@ void main(void) {
|
|||
|
||||
debugf("DSP inited...");
|
||||
|
||||
#ifdef DATA_32_SINE
|
||||
for (i = 0; i < 32; i++) {
|
||||
double ratio = ((double)i)/32.0;
|
||||
double rad = 3.0*3.141592*ratio;
|
||||
double normal = sin(rad);
|
||||
double scaled = 32767.0*(normal);
|
||||
data[2*i + 0] = -(signed short)scaled;
|
||||
data[2*i + 1] = (signed short)scaled;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (;;) {
|
||||
asm(" IDLE 1");
|
||||
asm(" NOP");
|
||||
|
@ -69,6 +58,16 @@ void main(void) {
|
|||
memset((unsigned short *)0x7f80, 0, 0x80);
|
||||
#endif
|
||||
|
||||
#ifdef DATA_32_SINE
|
||||
for (i = 0; i < 32; i++) {
|
||||
double ratio = ((double)i)/32.0;
|
||||
double rad = 3.0*3.141592*ratio;
|
||||
double normal = sin(rad);
|
||||
double scaled = 32767.0*(normal);
|
||||
data[2*i + 0] = -(signed short)scaled;
|
||||
data[2*i + 1] = (signed short)scaled;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MANUAL_TRANSFER
|
||||
register signed short *p;
|
||||
|
|
Loading…
Reference in a new issue