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 @@
12006-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
12006-06-06 Erik de Castro Lopo <erikd AT mega-nerd DOT com>62006-06-06 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
2 7
3 * src/samplerate.c src/src_linear.c src/src_sinc.c8 * 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
63static AUDIO_OUT *63static AUDIO_OUT *
64linux_open (int channels, int samplerate)64linux_open (int channels, int samplerate)
65{ LINUX_AUDIO_OUT *linux_out ;65{ LINUX_AUDIO_OUT *linux_out ;
66 int stereo, temp, error ;66 int stereo, fmt, error ;
67 67
68 if ((linux_out = malloc (sizeof (LINUX_AUDIO_OUT))) == NULL)68 if ((linux_out = malloc (sizeof (LINUX_AUDIO_OUT))) == NULL)
69 { perror ("linux_open : malloc ") ;69 { perror ("linux_open : malloc ") ;
@@ -90,11 +90,11 @@ linux_open (int channels, int samplerate) · 20 unmodified lines
90 exit (1) ;90 exit (1) ;
91 } ;91 } ;
92 92
93 temp = 16 ;93 fmt = CPU_IS_BIG_ENDIAN ? AFMT_S16_BE : AFMT_S16_LE ;
94 if ((error = ioctl (linux_out->fd, SOUND_PCM_WRITE_BITS, &temp)) != 0)94 if (ioctl (fd, SOUND_PCM_SETFMT, &fmt) != 0)
95 { perror ("linux_open : bitwidth ") ;95 { perror ("linux_open_dsp_device : set format ") ;
96 exit (1) ;96 exit (1) ;
97 } ;97 } ;
98 98
99 if ((error = ioctl (linux_out->fd, SOUND_PCM_WRITE_CHANNELS, &channels)) != 0)99 if ((error = ioctl (linux_out->fd, SOUND_PCM_WRITE_CHANNELS, &channels)) != 0)
100 { perror ("linux_open : channels ") ;100 { 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