Unified · Split
| @@ -1,3 +1,8 @@ | ||
| 1 | +2006-07-12 Erik de Castro Lopo <erikd AT mega-nerd DOT com> | |
| 2 | + | |
| 3 | + * examples/audio_out.c | |
| 4 | + Be more explicit about setting the audio output format. | |
| 5 | + | |
| 1 | 6 | 2006-06-06 Erik de Castro Lopo <erikd AT mega-nerd DOT com> |
| 2 | 7 | |
| 3 | 8 | * src/samplerate.c src/src_linear.c src/src_sinc.c |
| @@ -63,7 +63,7 @@ static void linux_close (AUDIO_OUT *audio_out) ; · 62 unmodified lines | ||
| 63 | 63 | static AUDIO_OUT * |
| 64 | 64 | linux_open (int channels, int samplerate) |
| 65 | 65 | { LINUX_AUDIO_OUT *linux_out ; |
| 66 | − int stereo, temp, error ; | |
| 66 | + int stereo, fmt, error ; | |
| 67 | 67 | |
| 68 | 68 | if ((linux_out = malloc (sizeof (LINUX_AUDIO_OUT))) == NULL) |
| 69 | 69 | { perror ("linux_open : malloc ") ; |
| @@ -90,11 +90,11 @@ linux_open (int channels, int samplerate) · 20 unmodified lines | ||
| 90 | 90 | exit (1) ; |
| 91 | 91 | } ; |
| 92 | 92 | |
| 93 | − temp = 16 ; | |
| 94 | − if ((error = ioctl (linux_out->fd, SOUND_PCM_WRITE_BITS, &temp)) != 0) | |
| 95 | − { perror ("linux_open : bitwidth ") ; | |
| 96 | − exit (1) ; | |
| 97 | − } ; | |
| 93 | + fmt = CPU_IS_BIG_ENDIAN ? AFMT_S16_BE : AFMT_S16_LE ; | |
| 94 | + if (ioctl (fd, SOUND_PCM_SETFMT, &fmt) != 0) | |
| 95 | + { perror ("linux_open_dsp_device : set format ") ; | |
| 96 | + exit (1) ; | |
| 97 | + } ; | |
| 98 | 98 | |
| 99 | 99 | if ((error = ioctl (linux_out->fd, SOUND_PCM_WRITE_CHANNELS, &channels)) != 0) |
| 100 | 100 | { perror ("linux_open : channels ") ; |