Commit | Line | Data |
b82df135 |
1 | <div class="pod"> |
2 | <!-- INDEX START --> |
3 | <h3 id="TOP">Index</h3> |
4 | |
5 | <ul><li><a href="#NAME">NAME</a></li> |
8758037a |
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> |
14 | </li> |
15 | </ul> |
b82df135 |
16 | </li> |
17 | </ul><hr /> |
18 | <!-- INDEX END --> |
19 | |
20 | <h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p> |
21 | <div id="NAME_CONTENT"> |
8758037a |
22 | <p>SDL::AudioSpec -- SDL Bindings for structure SDL::AudioSpec</p> |
b82df135 |
23 | |
24 | </div> |
25 | <h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p> |
26 | <div id="CATEGORY_CONTENT"> |
8758037a |
27 | <p>Core, Audio, Structure</p> |
28 | |
29 | </div> |
30 | <h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p> |
31 | <div id="SYNOPSIS_CONTENT"> |
32 | <pre> use SDL; |
33 | use SDL::AudioSpec; |
34 | |
35 | SDL::init(SDL_INIT_AUDIO); |
36 | |
37 | my $audio_spec = SDL::AudioSpec->new(); |
38 | |
39 | $audio_spec->freq(22050); # 22050Hz - FM Radio quality |
40 | $audio_spec->format(AUDIO_S16SYS); # 16-bit signed audio |
41 | $audio_spec->samples(8192); # Large audio buffer reduces risk of dropouts but increases response time |
42 | $audio_spec->channels(1); # Mono |
43 | |
44 | </pre> |
45 | |
46 | </div> |
47 | <h1 id="DESCIPTION">DESCIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p> |
48 | <div id="DESCIPTION_CONTENT"> |
49 | <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> |
50 | and <code>SDL::Audio::load_wav</code>. |
51 | 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>. |
52 | We will detail these common members here.</p> |
53 | |
54 | </div> |
55 | <h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p> |
56 | <div id="METHODS_CONTENT"> |
57 | |
58 | </div> |
59 | <h2 id="freq">freq</h2> |
60 | <div id="freq_CONTENT"> |
61 | <p>The number of samples sent to the sound device every second. Common values are 11025, 22050 and 44100. The higher the better.</p> |
62 | |
63 | </div> |
64 | <h2 id="format">format</h2> |
65 | <div id="format_CONTENT"> |
66 | <p>Specifies the size and type of each sample element. Values it can take are:</p> |
67 | <dl> |
68 | <dt>AUDIO_U8</dt> |
69 | <dd> |
70 | <p>Unsigned 8-bit samples.</p> |
71 | </dd> |
72 | <dt>AUDIO_S8</dt> |
73 | <dd> |
74 | <p>Signed 8-bit samples.</p> |
75 | </dd> |
76 | <dt>AUDIO_U16 or AUDIO_U16LSB</dt> |
77 | <dd> |
78 | <p>not supported by all hardware (unsigned 16-bit little-endian)</p> |
79 | </dd> |
80 | <dt>AUDIO_S16 or AUDIO_S16LSB</dt> |
81 | <dd> |
82 | <p>not supported by all hardware (signed 16-bit little-endian)</p> |
83 | </dd> |
84 | <dt>AUDIO_U16MSB</dt> |
85 | <dd> |
86 | <p>not supported by all hardware (unsigned 16-bit big-endian)</p> |
87 | </dd> |
88 | <dt>AUDIO_S16MSB</dt> |
89 | <dd> |
90 | <p>not supported by all hardware (signed 16-bit big-endian)</p> |
91 | </dd> |
92 | <dt>AUDIO_U16SYS</dt> |
93 | <dd> |
94 | <p>Either AUDIO_U16LSB or AUDIO_U16MSB depending on hardware CPU endianness</p> |
95 | </dd> |
96 | <dt>AUDIO_S16SYS</dt> |
97 | <dd> |
98 | <p>Either AUDIO_S16LSB or AUDIO_S16MSB depending on hardware CPU endianness</p> |
99 | </dd> |
100 | </dl> |
101 | |
102 | </div> |
103 | <h2 id="channels">channels</h2> |
104 | <div id="channels_CONTENT"> |
105 | <p>The number of separate sound channels. 1 is mono (single channel), 2 is stereo (dual channel).</p> |
106 | |
107 | </div> |
108 | <h2 id="samples">samples</h2> |
109 | <div id="samples_CONTENT"> |
110 | <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 |
111 | 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 |
112 | set to 4096.</p> |
b82df135 |
113 | |
114 | </div> |
115 | </div> |