dslinux/linux-2.6.x/arch/arm/mach-nds/arm7 sound.c
amadeus
dslinux_amadeus at user.in-berlin.de
Thu Aug 31 08:07:03 CEST 2006
Update of /cvsroot/dslinux/dslinux/linux-2.6.x/arch/arm/mach-nds/arm7
In directory antilope:/tmp/cvs-serv6945/linux-2.6.x/arch/arm/mach-nds/arm7
Modified Files:
sound.c
Log Message:
let MONO play with the same amplitude as STEREO.
Index: sound.c
===================================================================
RCS file: /cvsroot/dslinux/dslinux/linux-2.6.x/arch/arm/mach-nds/arm7/sound.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- sound.c 16 Aug 2006 13:55:06 -0000 1.4
+++ sound.c 31 Aug 2006 06:07:01 -0000 1.5
@@ -3,6 +3,9 @@
#include "sound.h"
+/* send MONO as a stereo signal, to get the same output power to the speakers */
+#define MONO_AS_STEREO
+
/* some sound defines */
#define SOUND_VOL(n) (n)
/* NOTE: you have to write the timer value calculation THIS way.
@@ -27,7 +30,8 @@
#define SOUND_CR (*(volatile u16*)0x04000500)
#define POWER_CR (*(volatile u16*)0x04000304)
-static u8 s_channels;
+static u32 s_channels;
+static u32 true_channels;
static u32 s_format;
static u32 s_size;
@@ -72,6 +76,10 @@
for (i = 0; i < s_channels; i++)
SCHANNEL_SOURCE(i) = buffer + i * (s_size / s_channels);
+#ifdef MONO_AS_STEREO
+ if (true_channels == 1)
+ SCHANNEL_SOURCE(1) = buffer;
+#endif
}
void sound_set_size(u32 size)
@@ -80,11 +88,16 @@
s_size = size;
for (i = 0; i < s_channels; i++)
- SCHANNEL_LENGTH(i) = (s_size / s_channels) >> 2;
+ SCHANNEL_LENGTH(i) = (s_size / true_channels) >> 2;
}
void sound_set_channels(u8 channels)
{
+ true_channels = channels;
+#ifdef MONO_AS_STEREO
+ if (channels & 1)
+ channels++;
+#endif
s_channels = channels;
}
More information about the dslinux-commit
mailing list