<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>SFML - Simple and Fast Multimedia Library</title> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="tabs.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="logo"> <img src="./logo.jpg" width="770" height="200" title="SFML home" alt="SFML logo" /> </div> <!-- Generated by Doxygen 1.5.8 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.htm"><span>Main Page</span></a></li> <li><a href="namespaces.htm"><span>Namespaces</span></a></li> <li><a href="annotated.htm"><span>Classes</span></a></li> <li class="current"><a href="files.htm"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.htm"><span>File List</span></a></li> </ul> </div> <h1>Sound.hpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <a name="l00002"></a>00002 <span class="comment">//</span> <a name="l00003"></a>00003 <span class="comment">// SFML - Simple and Fast Multimedia Library</span> <a name="l00004"></a>00004 <span class="comment">// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)</span> <a name="l00005"></a>00005 <span class="comment">//</span> <a name="l00006"></a>00006 <span class="comment">// This software is provided 'as-is', without any express or implied warranty.</span> <a name="l00007"></a>00007 <span class="comment">// In no event will the authors be held liable for any damages arising from the use of this software.</span> <a name="l00008"></a>00008 <span class="comment">//</span> <a name="l00009"></a>00009 <span class="comment">// Permission is granted to anyone to use this software for any purpose,</span> <a name="l00010"></a>00010 <span class="comment">// including commercial applications, and to alter it and redistribute it freely,</span> <a name="l00011"></a>00011 <span class="comment">// subject to the following restrictions:</span> <a name="l00012"></a>00012 <span class="comment">//</span> <a name="l00013"></a>00013 <span class="comment">// 1. The origin of this software must not be misrepresented;</span> <a name="l00014"></a>00014 <span class="comment">// you must not claim that you wrote the original software.</span> <a name="l00015"></a>00015 <span class="comment">// If you use this software in a product, an acknowledgment</span> <a name="l00016"></a>00016 <span class="comment">// in the product documentation would be appreciated but is not required.</span> <a name="l00017"></a>00017 <span class="comment">//</span> <a name="l00018"></a>00018 <span class="comment">// 2. Altered source versions must be plainly marked as such,</span> <a name="l00019"></a>00019 <span class="comment">// and must not be misrepresented as being the original software.</span> <a name="l00020"></a>00020 <span class="comment">//</span> <a name="l00021"></a>00021 <span class="comment">// 3. This notice may not be removed or altered from any source distribution.</span> <a name="l00022"></a>00022 <span class="comment">//</span> <a name="l00024"></a>00024 <span class="comment"></span> <a name="l00025"></a>00025 <span class="preprocessor">#ifndef SFML_SOUND_HPP</span> <a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#define SFML_SOUND_HPP</span> <a name="l00027"></a>00027 <span class="preprocessor"></span> <a name="l00029"></a>00029 <span class="comment">// Headers</span> <a name="l00031"></a>00031 <span class="comment"></span><span class="preprocessor">#include <SFML/System/Resource.hpp></span> <a name="l00032"></a>00032 <span class="preprocessor">#include <SFML/System/Vector3.hpp></span> <a name="l00033"></a>00033 <span class="preprocessor">#include <SFML/Audio/AudioResource.hpp></span> <a name="l00034"></a>00034 <span class="preprocessor">#include <cstdlib></span> <a name="l00035"></a>00035 <a name="l00036"></a>00036 <a name="l00037"></a>00037 <span class="keyword">namespace </span>sf <a name="l00038"></a>00038 { <a name="l00039"></a>00039 <span class="keyword">class </span>SoundBuffer; <a name="l00040"></a>00040 <a name="l00045"></a><a class="code" href="classsf_1_1Sound.htm">00045</a> <span class="keyword">class </span>SFML_API <a class="code" href="classsf_1_1Sound.htm" title="Sound defines the properties of a sound such as position, volume, pitch, etc.">Sound</a> : <span class="keyword">public</span> <a class="code" href="classsf_1_1AudioResource.htm" title="Abstract base class for every class that owns a device-dependant resource -- allow...">AudioResource</a> <a name="l00046"></a>00046 { <a name="l00047"></a>00047 <span class="keyword">public</span> : <a name="l00048"></a>00048 <a name="l00052"></a><a class="code" href="classsf_1_1Sound.htm#28ad2186cde78fed2c79c867b9622195">00052</a> <span class="keyword">enum</span> <a class="code" href="classsf_1_1Sound.htm#28ad2186cde78fed2c79c867b9622195" title="Enumeration of the sound states.">Status</a> <a name="l00053"></a>00053 { <a name="l00054"></a><a class="code" href="classsf_1_1Sound.htm#28ad2186cde78fed2c79c867b962219539fd53aa83db9189ca2fff82e0553cf9">00054</a> Stopped, <a name="l00055"></a><a class="code" href="classsf_1_1Sound.htm#28ad2186cde78fed2c79c867b9622195c9fedbd48103548431e7851d16be5f4f">00055</a> Paused, <a name="l00056"></a><a class="code" href="classsf_1_1Sound.htm#28ad2186cde78fed2c79c867b962219516657b221888cf11e2a076f5b2783288">00056</a> Playing <a name="l00057"></a>00057 }; <a name="l00058"></a>00058 <a name="l00063"></a>00063 <a class="code" href="classsf_1_1Sound.htm" title="Sound defines the properties of a sound such as position, volume, pitch, etc.">Sound</a>(); <a name="l00064"></a>00064 <a name="l00075"></a>00075 <a class="code" href="classsf_1_1Sound.htm" title="Sound defines the properties of a sound such as position, volume, pitch, etc.">Sound</a>(<span class="keyword">const</span> <a class="code" href="classsf_1_1SoundBuffer.htm" title="SoundBuffer is the low-level for loading and manipulating sound buffers.">SoundBuffer</a>& Buffer, <span class="keywordtype">bool</span> Loop = <span class="keyword">false</span>, <span class="keywordtype">float</span> Pitch = 1.f, <span class="keywordtype">float</span> Volume = 100.f, <span class="keyword">const</span> <a class="code" href="classsf_1_1Vector3.htm" title="Vector3 is an utility class for manipulating 3 dimensional vectors.">Vector3f</a>& Position = <a class="code" href="classsf_1_1Vector3.htm" title="Vector3 is an utility class for manipulating 3 dimensional vectors.">Vector3f</a>(0, 0, 0)); <a name="l00076"></a>00076 <a name="l00083"></a>00083 <a class="code" href="classsf_1_1Sound.htm" title="Sound defines the properties of a sound such as position, volume, pitch, etc.">Sound</a>(<span class="keyword">const</span> <a class="code" href="classsf_1_1Sound.htm" title="Sound defines the properties of a sound such as position, volume, pitch, etc.">Sound</a>& Copy); <a name="l00084"></a>00084 <a name="l00089"></a>00089 ~<a class="code" href="classsf_1_1Sound.htm" title="Sound defines the properties of a sound such as position, volume, pitch, etc.">Sound</a>(); <a name="l00090"></a>00090 <a name="l00095"></a>00095 <span class="keywordtype">void</span> Play(); <a name="l00096"></a>00096 <a name="l00101"></a>00101 <span class="keywordtype">void</span> Pause(); <a name="l00102"></a>00102 <a name="l00107"></a>00107 <span class="keywordtype">void</span> Stop(); <a name="l00108"></a>00108 <a name="l00115"></a>00115 <span class="keywordtype">void</span> SetBuffer(<span class="keyword">const</span> <a class="code" href="classsf_1_1SoundBuffer.htm" title="SoundBuffer is the low-level for loading and manipulating sound buffers.">SoundBuffer</a>& Buffer); <a name="l00116"></a>00116 <a name="l00124"></a>00124 <span class="keywordtype">void</span> SetLoop(<span class="keywordtype">bool</span> Loop); <a name="l00125"></a>00125 <a name="l00133"></a>00133 <span class="keywordtype">void</span> SetPitch(<span class="keywordtype">float</span> Pitch); <a name="l00134"></a>00134 <a name="l00142"></a>00142 <span class="keywordtype">void</span> SetVolume(<span class="keywordtype">float</span> Volume); <a name="l00143"></a>00143 <a name="l00151"></a>00151 <span class="keywordtype">void</span> SetPosition(<span class="keywordtype">float</span> X, <span class="keywordtype">float</span> Y, <span class="keywordtype">float</span> Z); <a name="l00152"></a>00152 <a name="l00160"></a>00160 <span class="keywordtype">void</span> SetPosition(<span class="keyword">const</span> <a class="code" href="classsf_1_1Vector3.htm" title="Vector3 is an utility class for manipulating 3 dimensional vectors.">Vector3f</a>& Position); <a name="l00161"></a>00161 <a name="l00170"></a>00170 <span class="keywordtype">void</span> SetRelativeToListener(<span class="keywordtype">bool</span> Relative); <a name="l00171"></a>00171 <a name="l00180"></a>00180 <span class="keywordtype">void</span> SetMinDistance(<span class="keywordtype">float</span> MinDistance); <a name="l00181"></a>00181 <a name="l00190"></a>00190 <span class="keywordtype">void</span> SetAttenuation(<span class="keywordtype">float</span> Attenuation); <a name="l00191"></a>00191 <a name="l00198"></a>00198 <span class="keywordtype">void</span> SetPlayingOffset(<span class="keywordtype">float</span> TimeOffset); <a name="l00199"></a>00199 <a name="l00206"></a>00206 <span class="keyword">const</span> <a class="code" href="classsf_1_1SoundBuffer.htm" title="SoundBuffer is the low-level for loading and manipulating sound buffers.">SoundBuffer</a>* GetBuffer() <span class="keyword">const</span>; <a name="l00207"></a>00207 <a name="l00214"></a>00214 <span class="keywordtype">bool</span> GetLoop() <span class="keyword">const</span>; <a name="l00215"></a>00215 <a name="l00222"></a>00222 <span class="keywordtype">float</span> GetPitch() <span class="keyword">const</span>; <a name="l00223"></a>00223 <a name="l00230"></a>00230 <span class="keywordtype">float</span> GetVolume() <span class="keyword">const</span>; <a name="l00231"></a>00231 <a name="l00238"></a>00238 <a class="code" href="classsf_1_1Vector3.htm" title="Vector3 is an utility class for manipulating 3 dimensional vectors.">Vector3f</a> GetPosition() <span class="keyword">const</span>; <a name="l00239"></a>00239 <a name="l00247"></a>00247 <span class="keywordtype">bool</span> IsRelativeToListener() <span class="keyword">const</span>; <a name="l00248"></a>00248 <a name="l00255"></a>00255 <span class="keywordtype">float</span> GetMinDistance() <span class="keyword">const</span>; <a name="l00256"></a>00256 <a name="l00263"></a>00263 <span class="keywordtype">float</span> GetAttenuation() <span class="keyword">const</span>; <a name="l00264"></a>00264 <a name="l00271"></a>00271 Status GetStatus() <span class="keyword">const</span>; <a name="l00272"></a>00272 <a name="l00279"></a>00279 <span class="keywordtype">float</span> GetPlayingOffset() <span class="keyword">const</span>; <a name="l00280"></a>00280 <a name="l00289"></a>00289 <a class="code" href="classsf_1_1Sound.htm" title="Sound defines the properties of a sound such as position, volume, pitch, etc.">Sound</a>& operator =(<span class="keyword">const</span> <a class="code" href="classsf_1_1Sound.htm" title="Sound defines the properties of a sound such as position, volume, pitch, etc.">Sound</a>& Other); <a name="l00290"></a>00290 <a name="l00291"></a>00291 <span class="keyword">private</span> : <a name="l00292"></a>00292 <a name="l00293"></a>00293 <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classsf_1_1SoundStream.htm" title="SoundStream is a streamed sound, ie samples are acquired while the sound is playing...">SoundStream</a>; <a name="l00294"></a>00294 <a name="l00296"></a>00296 <span class="comment">// Member data</span> <a name="l00298"></a>00298 <span class="comment"></span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> mySource; <a name="l00299"></a>00299 <a class="code" href="classsf_1_1ResourcePtr.htm">ResourcePtr<SoundBuffer></a> myBuffer; <a name="l00300"></a>00300 }; <a name="l00301"></a>00301 <a name="l00302"></a>00302 } <span class="comment">// namespace sf</span> <a name="l00303"></a>00303 <a name="l00304"></a>00304 <a name="l00305"></a>00305 <span class="preprocessor">#endif // SFML_SOUND_HPP</span> </pre></div></div> <p id="footer"> :: Copyright © 2007-2008 Laurent Gomila, all rights reserved :: Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen 1.5.2</a> :: </p> </body> </html>