updated docs
[sdlgit/SDL-Site.git] / pages / SDL-AudioCVT.html-inc
CommitLineData
bb5f3b83 1<div class="pod">
2<!-- INDEX START -->
3<h3 id="TOP">Index</h3>
4
5<ul><li><a href="#NAME">NAME</a></li>
e3282ccf 6<li><a href="#CATEGORY">CATEGORY</a></li>
7<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
8<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
9<li><a href="#METHODS">METHODS</a>
10<ul><li><a href="#new">new</a></li>
11<li><a href="#build">build</a></li>
12<li><a href="#needed">needed</a></li>
13<li><a href="#src_format">src_format</a></li>
14<li><a href="#dest_format">dest_format</a></li>
15<li><a href="#rate_incr">rate_incr</a></li>
16<li><a href="#len">len</a></li>
17<li><a href="#len_cvt">len_cvt</a></li>
18<li><a href="#len_mult">len_mult</a></li>
19<li><a href="#len_ratio">len_ratio</a></li>
20</ul>
21</li>
d5943b68 22<li><a href="#AUTHORS">AUTHORS</a>
bb5f3b83 23</li>
24</ul><hr />
25<!-- INDEX END -->
26
27<h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
28<div id="NAME_CONTENT">
e3282ccf 29<p>SDL::AudioCVT -- Audio Conversion Structure</p>
bb5f3b83 30
31</div>
32<h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p>
33<div id="CATEGORY_CONTENT">
e3282ccf 34<p>Core, Audio, Structure</p>
35
36</div>
37<h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
38<div id="SYNOPSIS_CONTENT">
39
40</div>
41<h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
42<div id="DESCRIPTION_CONTENT">
43<p>The <code>SDL::AudioCVT</code> is used to convert audio data between different formats. A <code>SDL::AudioCVT</code> structure is created with the
44<code>SDL::AudioCVT-</code>build&gt; function, while the actual conversion is done by the <code>SDL::Audio::convert_audio</code> function. </p>
45
46</div>
47<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
48<div id="METHODS_CONTENT">
49
50</div>
51<h2 id="new">new</h2>
52<div id="new_CONTENT">
53<p>This constructor returns an empty <code>SDL::AudioCVT</code> structure.</p>
54
55</div>
56<h2 id="build">build</h2>
57<div id="build_CONTENT">
58<pre> $cvt = SDL::AudioCVT-&gt;build( $src_format, $src_channels, $src_rate
59 $dst_format, $dst_channels, $dst_rate );
60
61</pre>
62<p>Before an <code>SDL::AudioCVT</code> structure can be used to convert audio data it must be initialized with source and destination information.</p>
63<p><code>src_format</code> and <code>dst_format</code> are the source and destination format of the conversion. (For information on audio formats see
64<code>SDL::AudioSpec</code>). <code>src_channels</code> and <code>dst_channels</code> are the number of channels in the source and destination formats.
65Finally, <code>src_rate</code> and <code>dst_rate</code> are the frequency or samples-per-second of the source and destination formats. Once again,
66see <code>SDL::AudioSpec</code>.</p>
67<p>Currently (SDL-1.2.11) only rate conversions of 2x and (1/2)x with x &gt; 0 are done, nearing the requested rate conversion. </p>
68<p>See <code>SDL::Audio::convert_audio</code>.</p>
69
70</div>
71<h2 id="needed">needed</h2>
72<div id="needed_CONTENT">
73<p>Set to one if the conversion is possible</p>
74
75</div>
76<h2 id="src_format">src_format</h2>
77<div id="src_format_CONTENT">
78<p>Audio format of the source</p>
79
80</div>
81<h2 id="dest_format">dest_format</h2>
82<div id="dest_format_CONTENT">
83<p>Audio format of the destination</p>
84
85</div>
86<h2 id="rate_incr">rate_incr</h2>
87<div id="rate_incr_CONTENT">
88<p>Rate conversion increment</p>
89
90</div>
91<h2 id="len">len</h2>
92<div id="len_CONTENT">
93<p>Length of the original audio buffer in bytes</p>
94
95</div>
96<h2 id="len_cvt">len_cvt</h2>
97<div id="len_cvt_CONTENT">
98<p>Length of converted audio buffer in bytes (calculated)</p>
99
100</div>
101<h2 id="len_mult">len_mult</h2>
102<div id="len_mult_CONTENT">
103<p><code>buf</code> must be <code>len*len_mult</code> bytes in size (calculated)</p>
104
105</div>
106<h2 id="len_ratio">len_ratio</h2>
107<div id="len_ratio_CONTENT">
108<p>Final audio size is <code>len*len_ratio</code></p>
109
110</div>
d5943b68 111<h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p>
112<div id="AUTHORS_CONTENT">
113<p>See <b>AUTHORS</b> in <cite>SDL</cite>.</p>
bb5f3b83 114
115</div>
116</div>