updated github link
[sdlgit/SDL-Site.git] / pages / SDLx-Sound.html-inc
CommitLineData
285d0cd2 1<div class="pod">
2<!-- INDEX START -->
3<h3 id="TOP">Index</h3>
4
5<ul><li><a href="#NAME">NAME</a></li>
6<li><a href="#VERSION">VERSION</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="#load">load</a></li>
12<li><a href="#play">play</a></li>
13<li><a href="#loud">loud</a></li>
14<li><a href="#stop">stop</a></li>
15</ul>
16</li>
17<li><a href="#AUTHOR">AUTHOR</a></li>
18<li><a href="#BUGS">BUGS</a></li>
19<li><a href="#SUPPORT">SUPPORT</a></li>
20<li><a href="#ACKNOWLEDGEMENTS">ACKNOWLEDGEMENTS</a></li>
21<li><a href="#LICENSE_AND_COPYRIGHT">LICENSE AND COPYRIGHT</a>
22</li>
23</ul><hr />
24<!-- INDEX END -->
25
26<h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
27<div id="NAME_CONTENT">
28<p>SDLx::Sound</p>
29
30</div>
31<h1 id="VERSION">VERSION</h1><p><a href="#TOP" class="toplink">Top</a></p>
32<div id="VERSION_CONTENT">
33<p>Version 0.01_01</p>
34
35
36
37
38
39</div>
40<h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
41<div id="SYNOPSIS_CONTENT">
42<pre> use SDLx::Sound;
43
44 my $snd = SDLx::Sound-&gt;new();
45
46 # loads and plays a single sound now
47 $snd-&gt;play('myfile.wav');
48
49 # load a single file
50 $snd-&gt;load('theSound.aif');
51
52 # plays it or all loaded files
53 $snd-&gt;play();
54
55 # more sounds
56 my %files = (
57 chanell_01 =&gt; &quot;/my_sound1.wav&quot;,
58 chanell_02 =&gt; &quot;/my_sound2.ogg&quot;
59 );
60
61 # times sounds bangs
62 my %times = (
63 chanell_01 =&gt; 0, # start
64 chanell_01 =&gt; 1256, # miliseconds
65 chanell_02 =&gt; 2345
66 );
67
68 # Load files in channels for realtime play
69 $snd-&gt;load(%files);
70
71 # sets sound channel_01 loudness
72 $snd-&gt;loud('channel_01', 80); # loud at 80%
73 $snd-&gt;play(%times); # play loaded files at times
74 $snd-&gt;play; # play again
75
76 # plays sound channel_01 at 578 miliseconds from now
77 $snd-&gt;play('channel_01', 578);
78
79 # fades sound
80 $snd-&gt;fade('channel_02', 2345, 3456, -20);
81
82 # in a single act do the wole Sound
83 my $snd = SDLx::Sound-&gt;new(
84 files =&gt; (
85 chanell_01 =&gt; &quot;/my_sound1.wav&quot;,
86 chanell_02 =&gt; &quot;/my_sound2.ogg&quot;
87
88 ),
89 loud =&gt; (
90 channel_01 =&gt; 80,
91 channel_02 =&gt; 75
92 ),
93 times =&gt; (
94 chanell_01 =&gt; 0, # start
95 chanell_01 =&gt; 1256, # miliseconds
96 chanell_02 =&gt; 2345
97 ),
98 fade =&gt; (
99 chanell_02 =&gt; [2345, 3456, -20]
100 )
101 )-&gt;play();
102
103</pre>
104
105</div>
106<h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
107<div id="DESCRIPTION_CONTENT">
108
109
110
111
112<p>You can think about the SDLx::Sound at 2 aproaches. </p>
113<dl>
114 <dt>* A simple sound or </dt>
115 <dt>* The sound of your game or app. </dt>
116</dl>
117<p>Your application will say what the best aproach.</p>
118<p>In a taste that resembles to perl and to SDL, our SDLx:Sound hooks at SDL::Audio and SDL::Mixer with a gracefull and simple interface that can offer to monks a modern perlish way to manage sounds.</p>
119<p>An SDLx::Sound object can load sounds from filesystem, play it, adjust this loudness level or stops the sound. </p>
120<p>Each sound will play in the next available channel, so it can be handled isolately.</p>
121
122</div>
123<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
124<div id="METHODS_CONTENT">
125
126</div>
127<h2 id="new">new</h2>
128<div id="new_CONTENT">
129<p>Returns a new instance of SDLx::Sound</p>
130
131</div>
132<h2 id="load">load</h2>
133<div id="load_CONTENT">
134
135</div>
136<h2 id="play">play</h2>
137<div id="play_CONTENT">
138
139</div>
140<h2 id="loud">loud</h2>
141<div id="loud_CONTENT">
142
143</div>
144<h2 id="stop">stop</h2>
145<div id="stop_CONTENT">
146
147</div>
148<h1 id="AUTHOR">AUTHOR</h1><p><a href="#TOP" class="toplink">Top</a></p>
149<div id="AUTHOR_CONTENT">
150<p>Monsenhor, <code>&lt;ricardo.filipo at mitologica.com.br&gt;</code></p>
151
152</div>
153<h1 id="BUGS">BUGS</h1><p><a href="#TOP" class="toplink">Top</a></p>
154<div id="BUGS_CONTENT">
155<p>Please report any bugs or feature requests to <code>bug-sdlx-sound at rt.cpan.org</code>, or through
156the web interface at <a href="http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SDLx-Sound">http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SDLx-Sound</a>. I will be notified, and then you'll
157automatically be notified of progress on your bug as I make changes.</p>
158
159
160
161
162
163
164
165
166
167
168
169</div>
170<h1 id="SUPPORT">SUPPORT</h1><p><a href="#TOP" class="toplink">Top</a></p>
171<div id="SUPPORT_CONTENT">
172<p>You can find documentation for this module with the perldoc command.</p>
173<pre> perldoc SDLx::Sound
174
175
176
177
178</pre>
179<p>You can also look for information at:</p>
180<dl>
181 <dt>* RT: CPAN's request tracker</dt>
182 <dd>
183 <p><a href="http://rt.cpan.org/NoAuth/Bugs.html?Dist=SDLx-Sound">http://rt.cpan.org/NoAuth/Bugs.html?Dist=SDLx-Sound</a></p>
184 </dd>
185 <dt>* AnnoCPAN: Annotated CPAN documentation</dt>
186 <dd>
187 <p><a href="http://annocpan.org/dist/SDLx-Sound">http://annocpan.org/dist/SDLx-Sound</a></p>
188 </dd>
189 <dt>* CPAN Ratings</dt>
190 <dd>
191 <p><a href="http://cpanratings.perl.org/d/SDLx-Sound">http://cpanratings.perl.org/d/SDLx-Sound</a></p>
192 </dd>
193 <dt>* Search CPAN</dt>
194 <dd>
195 <p><a href="http://search.cpan.org/dist/SDLx-Sound/">http://search.cpan.org/dist/SDLx-Sound/</a></p>
196 </dd>
197</dl>
198
199
200
201
202
203</div>
204<h1 id="ACKNOWLEDGEMENTS">ACKNOWLEDGEMENTS</h1><p><a href="#TOP" class="toplink">Top</a></p>
205<div id="ACKNOWLEDGEMENTS_CONTENT">
206
207
208
209
210
211</div>
212<h1 id="LICENSE_AND_COPYRIGHT">LICENSE AND COPYRIGHT</h1><p><a href="#TOP" class="toplink">Top</a></p>
213<div id="LICENSE_AND_COPYRIGHT_CONTENT">
214<p>Copyright 2010 Monsenhor.</p>
215<p>This program is free software; you can redistribute it and/or modify it
216under the terms of either: the GNU General Public License as published
217by the Free Software Foundation; or the Artistic License.</p>
218<p>See http://dev.perl.org/licenses/ for more information.</p>
219
220
221
222
223
224</div>
225</div>