History

audio_out.c : Be more explicit about setting the audio output format.

Erik de Castro Lopo committed 20 years ago

Commit 8a650e61 parent 6bda4b02 files · +11 −6Browse files

Unified · Split

2 files
  1. ChangeLog +5 −0
  2. examples/audio_out.c +6 −6
ChangeLog+5−0
@@ -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+
16 2006-06-06 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
27
38 * src/samplerate.c src/src_linear.c src/src_sinc.c
examples/audio_out.c+6−6
@@ -63,7 +63,7 @@ static void linux_close (AUDIO_OUT *audio_out) ; · 62 unmodified lines
6363 static AUDIO_OUT *
6464 linux_open (int channels, int samplerate)
6565 { LINUX_AUDIO_OUT *linux_out ;
66− int stereo, temp, error ;
66+ int stereo, fmt, error ;
6767
6868 if ((linux_out = malloc (sizeof (LINUX_AUDIO_OUT))) == NULL)
6969 { perror ("linux_open : malloc ") ;
@@ -90,11 +90,11 @@ linux_open (int channels, int samplerate) · 20 unmodified lines
9090 exit (1) ;
9191 } ;
9292
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+ } ;
9898
9999 if ((error = ioctl (linux_out->fd, SOUND_PCM_WRITE_CHANNELS, &channels)) != 0)
100100 { perror ("linux_open : channels ") ;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t