Hi,
I have downloaded the mad 0.13.0b. I'm trying to use it to play mp3 on my ARM720T CPU. But I only have an 8-bits dsp sound decoder, so in the normal way, the mad product terrible sounds (I used --downsample and --mono). I have changed the default requested format to AFMT_U8 in audio_oss.c. After rebuilding the mad, I run the command "./madplay -v --downsample --mono --output=raw:/dev/dsp 03.mp3". But I still get terrible sounds. I also try the command "./madplay -v --downsample --mono --output=wav:03.wav 03.mp3". And then I use my PC to play the 03.wav. I found that the sound is good, while using the command "cat 03.wav > /dev/dsp" on ARM, I got bad sound. So I think that the format may not changed to AFMT_U8. Can anyone check the code for me? I only made three changes( I marked them 1,2,3).
The following begin at line 96 in audio_oss.c
/* 1 */
/*
# if defined(AUDIO_TRY32BITS)
format = AFMT_S32_NE;
# else
format = AFMT_S16_NE;
# endif
*/
format=AFMT_U8; /* I added this line, and commented the last lines. */
if (ioctl(sfd, SNDCTL_DSP_SETFMT, &format) == -1) {
# if defined(AUDIO_TRY32BITS)
/*
* Some audio drivers may return an error instead of indicating a
* supported format when 32-bit format is requested but not available.
*/
/* 2 */
format =AFMT_U8; /* I changed the AFMT_S16_NE to AFMT_U8 */
if (ioctl(sfd, SNDCTL_DSP_SETFMT, &format) == -1) {
# endif
audio_error = ":ioctl(SNDCTL_DSP_SETFMT)";
return -1;
# if defined(AUDIO_TRY32BITS)
}
# endif
}
switch (format) {
/* 3 */
/* I also commented the following lines */
/*
# if defined(AFMT_S32_LE)
case AFMT_S32_LE:
audio_pcm = audio_pcm_s32le;
break;
# endif
# if defined(AFMT_S32_BE)
case AFMT_S32_BE:
audio_pcm = audio_pcm_s32be;
break;
# endif
case AFMT_S16_LE:
audio_pcm = audio_pcm_s16le;
break;
case AFMT_S16_BE:
audio_pcm = audio_pcm_s16be;
break;
*/
case AFMT_U8:
audio_pcm = audio_pcm_u8;
break;
case AFMT_MU_LAW:
audio_pcm = audio_pcm_mulaw;
break;
default:
audio_error = _("no supported audio format available");
return -1;
}