Method SDL.open_audio()
- Method
open_audio
voidopen_audio(intfrequency,intformat,intchannels,intbufsize)- Description
Initializes the audio API.
Throws an exception if audio can't be initialized.
- Parameter
frequency Output sampling frequency, measured in samples per second (Hz). A value of
44100provides CD-quality playback. A less CPU-intensive value for games is22050.- Parameter
format Output sample format. One of the following constants:
- SDL.AUDIO_U8
Unsigned 8-bit samples.
- SDL.AUDIO_S8
Signed 8-bit samples.
- SDL.AUDIO_U16LSB
Unsigned 16-bit samples in little-endian byte order.
- SDL.AUDIO_S16LSB
Signed 16-bit samples in little-endian byte order.
- SDL.AUDIO_U16MSB
Unsigned 16-bit samples in big-endian byte order.
- SDL.AUDIO_S16MSB
Signed 16-bit samples in big-endian byte order.
- SDL.AUDIO_U16
Same as SDL.AUDIO_U16LSB.
- SDL.AUDIO_S16
Same as SDL.AUDIO_S16LSB.
- SDL.AUDIO_U16SYS
Unsigned 16-bit samples in system byte order.
- SDL.AUDIO_S16SYS
Signed 16-bit samples in system byte order. If in doubt, try this one first.
- Parameter
channels Number of sound channels in output:
1for mono,2for stereo.- Parameter
bufsize How many bytes to use per output sample.
1024is a typical value for games. If just playing music you might set this to4096or higher.