3 <h3 id="TOP">Index</h3>
5 <ul><li><a href="#NAME">NAME</a></li>
6 <li><a href="#CATEGORY">CATEGORY</a></li>
7 <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
8 <li><a href="#DESCIPTION">DESCIPTION</a></li>
9 <li><a href="#METHODS">METHODS</a>
10 <ul><li><a href="#freq">freq</a></li>
11 <li><a href="#format">format</a></li>
12 <li><a href="#channels">channels</a></li>
13 <li><a href="#samples">samples</a></li>
14 <li><a href="#callback">callback</a>
21 <h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
22 <div id="NAME_CONTENT">
23 <p>SDL::AudioSpec -- SDL Bindings for structure SDL::AudioSpec</p>
26 <h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p>
27 <div id="CATEGORY_CONTENT">
28 <p>Core, Audio, Structure</p>
31 <h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
32 <div id="SYNOPSIS_CONTENT">
36 SDL::init(SDL_INIT_AUDIO);
38 my $audio_spec = SDL::AudioSpec->new();
40 $audio_spec->freq(22050); # 22050Hz - FM Radio quality
41 $audio_spec->format(AUDIO_S16SYS); # 16-bit signed audio
42 $audio_spec->samples(8192); # Large audio buffer reduces risk of dropouts but increases response time
43 $audio_spec->channels(1); # Mono
44 $audio_spec->callback('main::callback');
54 <h1 id="DESCIPTION">DESCIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
55 <div id="DESCIPTION_CONTENT">
56 <p>The <code>SDL::AudioSpec</code> structure is used to describe the format of some audio data. This structure is used by <code>SDL::Audio::open_audio</code>
57 and <code>SDL::Audio::load_wav</code>.
58 While all fields are used by <code>SDL::Audio::open_audio</code>, only <code>freq</code>, <code>format</code>, <code>samples</code> and <code>channels</code> are used by <code>SDL::Audio::load_wav</code>.
59 We will detail these common members here.</p>
62 <h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
63 <div id="METHODS_CONTENT">
66 <h2 id="freq">freq</h2>
67 <div id="freq_CONTENT">
68 <p>The number of samples sent to the sound device every second. Common values are 11025, 22050 and 44100. The higher the better.</p>
71 <h2 id="format">format</h2>
72 <div id="format_CONTENT">
73 <p>Specifies the size and type of each sample element. Values it can take are:</p>
77 <p>Unsigned 8-bit samples.</p>
81 <p>Signed 8-bit samples.</p>
83 <dt>AUDIO_U16 or AUDIO_U16LSB</dt>
85 <p>not supported by all hardware (unsigned 16-bit little-endian)</p>
87 <dt>AUDIO_S16 or AUDIO_S16LSB</dt>
89 <p>not supported by all hardware (signed 16-bit little-endian)</p>
93 <p>not supported by all hardware (unsigned 16-bit big-endian)</p>
97 <p>not supported by all hardware (signed 16-bit big-endian)</p>
101 <p>Either AUDIO_U16LSB or AUDIO_U16MSB depending on hardware CPU endianness</p>
103 <dt>AUDIO_S16SYS</dt>
105 <p>Either AUDIO_S16LSB or AUDIO_S16MSB depending on hardware CPU endianness</p>
110 <h2 id="channels">channels</h2>
111 <div id="channels_CONTENT">
112 <p>The number of separate sound channels. 1 is mono (single channel), 2 is stereo (dual channel).</p>
115 <h2 id="samples">samples</h2>
116 <div id="samples_CONTENT">
117 <p>When used with <code>SDL::Audio::open_audio</code> this refers to the size of the audio buffer in samples. A sample is a chunk of audio data of the
118 size specified in format multiplied by the number of channels. When the <code>SDL::AudioSpec</code> is used with <code>SDL::Audio::load_wav</code> samples is
122 <h2 id="callback">callback</h2>
123 <div id="callback_CONTENT">
124 <p>To be documented.</p>