--- audio_oss.c.orig Fri May 30 14:26:17 2003 +++ audio_oss.c Tue Feb 21 04:43:52 2006 @@ -52,6 +52,16 @@ # endif # endif +# if defined(AFMT_S24_LE) && defined(AFMT_S24_BE) +# if !defined(AFMT_S24_NE) +# if defined(WORDS_BIGENDIAN) +# define AFMT_S24_NE AFMT_S24_BE +# else +# define AFMT_S24_NE AFMT_S24_LE +# endif +# endif +# endif + # if !defined(AFMT_S16_NE) # if defined(WORDS_BIGENDIAN) # define AFMT_S16_NE AFMT_S16_BE @@ -67,6 +77,13 @@ # undef AUDIO_TRY32BITS # endif +# if (defined(AFMT_S24_LE) && AFMT_S24_NE == AFMT_S24_LE) || \ + (defined(AFMT_S24_BE) && AFMT_S24_NE == AFMT_S24_BE) +# define AUDIO_TRY24BITS +# else +# undef AUDIO_TRY24BITS +# endif + # if !defined(SNDCTL_DSP_CHANNELS) && defined(SOUND_PCM_WRITE_CHANNELS) # define SNDCTL_DSP_CHANNELS SOUND_PCM_WRITE_CHANNELS # endif @@ -106,6 +123,9 @@ # if defined(AUDIO_TRY32BITS) if (bitdepth == 0 || bitdepth > 32) bitdepth = 32; +# elif defined(AUDIO_TRY24BITS) + if (bitdepth == 0 || bitdepth > 24) + bitdepth = 24; # else if (bitdepth == 0 || bitdepth > 16) bitdepth = 16; @@ -125,9 +145,17 @@ format = AFMT_S16_NE; break; +# if defined(AUDIO_TRY24BITS) + case 24: + format = AFMT_S24_NE; + break; +#endif + # if defined(AUDIO_TRY32BITS) +# if !defined(AUDIO_TRY24BITS) case 24: bitdepth = 32; +# endif case 32: format = AFMT_S32_NE; break; @@ -135,12 +163,16 @@ } while (ioctl(sfd, SNDCTL_DSP_SETFMT, &format) == -1) { -# if defined(AUDIO_TRY32BITS) +# if defined(AUDIO_TRY32BITS) || defined(AUDIO_TRY24BITS) /* * Some audio drivers may return an error instead of indicating a * supported format when 32-bit format is requested but not available. */ - if (bitdepth == 32) { + if (bitdepth == 32 +# if defined(AUDIO_TRY24BITS) + || bitdepth == 24 +# endif + ) { bitdepth = 16; format = AFMT_S16_NE; continue; @@ -163,6 +195,20 @@ case AFMT_S32_BE: audio_pcm = audio_pcm_s32be; bitdepth = 32; + break; +# endif + +# if defined(AFMT_S24_LE) + case AFMT_S24_LE: + audio_pcm = audio_pcm_s24le; + bitdepth = 24; + break; +# endif + +# if defined(AFMT_S24_BE) + case AFMT_S24_BE: + audio_pcm = audio_pcm_s24be; + bitdepth = 24; break; # endif