--- channels/chan_oss.c~ 2005-03-23 02:14:46.000000000 +0000 +++ channels/chan_oss.c 2005-03-23 12:23:16.000000000 +0000 @@ -34,6 +34,7 @@ #include #include #include +#include #ifdef __linux #include #elif defined(__FreeBSD__) @@ -322,7 +323,13 @@ static int setformat(void) int fmt, desired, res, fd = sounddev; static int warnedalready = 0; static int warnedalready2 = 0; + +#if __BYTE_ORDER == __LITTLE_ENDIAN + fmt = AFMT_S16_LE; +#else fmt = AFMT_S16_BE; +#endif + res = ioctl(fd, SNDCTL_DSP_SETFMT, &fmt); if (res < 0) { ast_log(LOG_WARNING, "Unable to set format to 16-bit signed\n"); --- channels/chan_alsa.c~ 2005-03-23 02:14:37.000000000 +0000 +++ channels/chan_alsa.c 2005-03-23 12:21:44.000000000 +0000 @@ -27,6 +27,7 @@ #include #include #include +#include #define ALSA_PCM_NEW_HW_PARAMS_API #define ALSA_PCM_NEW_SW_PARAMS_API @@ -59,7 +60,12 @@ /* Don't switch between read/write modes faster than every 300 ms */ #define MIN_SWITCH_TIME 600 +#if __BYTE_ORDER == __LITTLE_ENDIAN +static snd_pcm_format_t format = SND_PCM_FORMAT_S16_lE; +#else static snd_pcm_format_t format = SND_PCM_FORMAT_S16_BE; +#endif + //static int block = O_NONBLOCK; static char indevname[50] = ALSA_INDEV; static char outdevname[50] = ALSA_OUTDEV;