Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > ed1483a4d9709d82850bb84cf25535e7 > files > 65

sfml-1.5-1mdv2010.0.i586.rpm

<!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&nbsp;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&nbsp;List</span></a></li>
    </ul>
  </div>
<h1>Listener.cpp</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="l00026"></a>00026 <span class="comment">// Headers</span>
<a name="l00028"></a>00028 <span class="comment"></span><span class="preprocessor">#include &lt;SFML/Audio/Listener.hpp&gt;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &lt;SFML/Audio/OpenAL.hpp&gt;</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="keyword">namespace </span>sf
<a name="l00033"></a>00033 {
<a name="l00037"></a><a class="code" href="classsf_1_1Listener.htm#0f8f05ffede8dd5f075fa120c41bec84">00037</a> <span class="keywordtype">void</span> <a class="code" href="classsf_1_1Listener.htm#0f8f05ffede8dd5f075fa120c41bec84" title="Change the global volume of all the sounds.">Listener::SetGlobalVolume</a>(<span class="keywordtype">float</span> Volume)
<a name="l00038"></a>00038 {
<a name="l00039"></a>00039     ALCheck(alListenerf(AL_GAIN, Volume * 0.01f));
<a name="l00040"></a>00040 }
<a name="l00041"></a>00041 
<a name="l00042"></a>00042 
<a name="l00046"></a><a class="code" href="classsf_1_1Listener.htm#eaffa5db15e6e790a4c20e014a8cfa19">00046</a> <span class="keywordtype">float</span> <a class="code" href="classsf_1_1Listener.htm#eaffa5db15e6e790a4c20e014a8cfa19" title="Get the current value of the global volume of all the sounds.">Listener::GetGlobalVolume</a>()
<a name="l00047"></a>00047 {
<a name="l00048"></a>00048     <span class="keywordtype">float</span> Volume = 0.f;
<a name="l00049"></a>00049     ALCheck(alGetListenerf(AL_GAIN, &amp;Volume));
<a name="l00050"></a>00050 
<a name="l00051"></a>00051     <span class="keywordflow">return</span> Volume;
<a name="l00052"></a>00052 }
<a name="l00053"></a>00053 
<a name="l00054"></a>00054 
<a name="l00058"></a><a class="code" href="classsf_1_1Listener.htm#c54f7441ee2511079df71c1107242b48">00058</a> <span class="keywordtype">void</span> <a class="code" href="classsf_1_1Listener.htm#c54f7441ee2511079df71c1107242b48" title="Change the position of the listener (take 3 values).">Listener::SetPosition</a>(<span class="keywordtype">float</span> X, <span class="keywordtype">float</span> Y, <span class="keywordtype">float</span> Z)
<a name="l00059"></a>00059 {
<a name="l00060"></a>00060     ALCheck(alListener3f(AL_POSITION, X, Y, Z));
<a name="l00061"></a>00061 }
<a name="l00062"></a>00062 
<a name="l00063"></a>00063 
<a name="l00067"></a><a class="code" href="classsf_1_1Listener.htm#e461aa59bf5aa43eb3e1fcf7cb2dbfd0">00067</a> <span class="keywordtype">void</span> <a class="code" href="classsf_1_1Listener.htm#c54f7441ee2511079df71c1107242b48" title="Change the position of the listener (take 3 values).">Listener::SetPosition</a>(<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>&amp; Position)
<a name="l00068"></a>00068 {
<a name="l00069"></a>00069     <a class="code" href="classsf_1_1Listener.htm#c54f7441ee2511079df71c1107242b48" title="Change the position of the listener (take 3 values).">SetPosition</a>(Position.<a class="code" href="classsf_1_1Vector3.htm#3cb0c769390bc37c346bb1a69e510d16" title="X coordinate of the vector.">x</a>, Position.<a class="code" href="classsf_1_1Vector3.htm#6590d50ccb862c5efc5512e974e9b794" title="Y coordinate of the vector.">y</a>, Position.<a class="code" href="classsf_1_1Vector3.htm#2f36ab4b552c028e3a9734c1ad4df7d1" title="Z coordinate of the vector.">z</a>);
<a name="l00070"></a>00070 }
<a name="l00071"></a>00071 
<a name="l00072"></a>00072 
<a name="l00076"></a><a class="code" href="classsf_1_1Listener.htm#c36493661fa0784df73e6efc429bb251">00076</a> <a class="code" href="classsf_1_1Vector3.htm" title="Vector3 is an utility class for manipulating 3 dimensional vectors.">Vector3f</a> <a class="code" href="classsf_1_1Listener.htm#c36493661fa0784df73e6efc429bb251" title="Get the current position of the listener.">Listener::GetPosition</a>()
<a name="l00077"></a>00077 {
<a name="l00078"></a>00078     <a class="code" href="classsf_1_1Vector3.htm" title="Vector3 is an utility class for manipulating 3 dimensional vectors.">Vector3f</a> Position;
<a name="l00079"></a>00079     ALCheck(alGetListener3f(AL_POSITION, &amp;Position.<a class="code" href="classsf_1_1Vector3.htm#3cb0c769390bc37c346bb1a69e510d16" title="X coordinate of the vector.">x</a>, &amp;Position.<a class="code" href="classsf_1_1Vector3.htm#6590d50ccb862c5efc5512e974e9b794" title="Y coordinate of the vector.">y</a>, &amp;Position.<a class="code" href="classsf_1_1Vector3.htm#2f36ab4b552c028e3a9734c1ad4df7d1" title="Z coordinate of the vector.">z</a>));
<a name="l00080"></a>00080 
<a name="l00081"></a>00081     <span class="keywordflow">return</span> Position;
<a name="l00082"></a>00082 }
<a name="l00083"></a>00083 
<a name="l00084"></a>00084 
<a name="l00089"></a><a class="code" href="classsf_1_1Listener.htm#4638a9c80c9a2027e93b44acdc48a8bf">00089</a> <span class="keywordtype">void</span> <a class="code" href="classsf_1_1Listener.htm#4638a9c80c9a2027e93b44acdc48a8bf" title="Change the orientation of the listener (the point he must look at) (take 3 values)...">Listener::SetTarget</a>(<span class="keywordtype">float</span> X, <span class="keywordtype">float</span> Y, <span class="keywordtype">float</span> Z)
<a name="l00090"></a>00090 {
<a name="l00091"></a>00091     <span class="keywordtype">float</span> Orientation[] = {X, Y, Z, 0.f, 1.f, 0.f};
<a name="l00092"></a>00092     ALCheck(alListenerfv(AL_ORIENTATION, Orientation));
<a name="l00093"></a>00093 }
<a name="l00094"></a>00094 
<a name="l00095"></a>00095 
<a name="l00100"></a><a class="code" href="classsf_1_1Listener.htm#e8191c90eb8d96e8d3cc578850c91b02">00100</a> <span class="keywordtype">void</span> <a class="code" href="classsf_1_1Listener.htm#4638a9c80c9a2027e93b44acdc48a8bf" title="Change the orientation of the listener (the point he must look at) (take 3 values)...">Listener::SetTarget</a>(<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>&amp; Target)
<a name="l00101"></a>00101 {
<a name="l00102"></a>00102     <a class="code" href="classsf_1_1Listener.htm#4638a9c80c9a2027e93b44acdc48a8bf" title="Change the orientation of the listener (the point he must look at) (take 3 values)...">SetTarget</a>(Target.<a class="code" href="classsf_1_1Vector3.htm#3cb0c769390bc37c346bb1a69e510d16" title="X coordinate of the vector.">x</a>, Target.<a class="code" href="classsf_1_1Vector3.htm#6590d50ccb862c5efc5512e974e9b794" title="Y coordinate of the vector.">y</a>, Target.<a class="code" href="classsf_1_1Vector3.htm#2f36ab4b552c028e3a9734c1ad4df7d1" title="Z coordinate of the vector.">z</a>);
<a name="l00103"></a>00103 }
<a name="l00104"></a>00104 
<a name="l00105"></a>00105 
<a name="l00110"></a><a class="code" href="classsf_1_1Listener.htm#322a2f7a68893559c40e3ab2a324293a">00110</a> <a class="code" href="classsf_1_1Vector3.htm" title="Vector3 is an utility class for manipulating 3 dimensional vectors.">Vector3f</a> <a class="code" href="classsf_1_1Listener.htm#322a2f7a68893559c40e3ab2a324293a" title="Get the current orientation of the listener (the point he&amp;#39;s looking at).">Listener::GetTarget</a>()
<a name="l00111"></a>00111 {
<a name="l00112"></a>00112     <span class="keywordtype">float</span> Orientation[6];
<a name="l00113"></a>00113     ALCheck(alGetListenerfv(AL_ORIENTATION, Orientation));
<a name="l00114"></a>00114 
<a name="l00115"></a>00115     <span class="keywordflow">return</span> <a class="code" href="classsf_1_1Vector3.htm" title="Vector3 is an utility class for manipulating 3 dimensional vectors.">Vector3f</a>(Orientation[0], Orientation[1], Orientation[2]);
<a name="l00116"></a>00116 }
<a name="l00117"></a>00117 
<a name="l00118"></a>00118 } <span class="comment">// namespace sf</span>
</pre></div></div>

        <p id="footer">
            &nbsp;::&nbsp; Copyright &copy; 2007-2008 Laurent Gomila, all rights reserved &nbsp;::&nbsp;
            Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen 1.5.2</a> &nbsp;::&nbsp;
        </p>

    </body>
</html>