3 * Copyright (c) 2007-2010 SlimDX Group
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
\r
6 * of this software and associated documentation files (the "Software"), to deal
\r
7 * in the Software without restriction, including without limitation the rights
\r
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
9 * copies of the Software, and to permit persons to whom the Software is
\r
10 * furnished to do so, subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in
\r
13 * all copies or substantial portions of the Software.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
\r
24 #include <windows.h>
\r
25 #include <x3daudio.h>
\r
27 #include "Listener.h"
\r
29 using namespace System;
\r
35 X3DAUDIO_VECTOR Vector3ToX3DAudio( Vector3 value )
\r
37 X3DAUDIO_VECTOR result;
\r
46 X3DAUDIO_LISTENER Listener::ToUnmanaged()
\r
48 X3DAUDIO_LISTENER result;
\r
50 result.OrientFront = Vector3ToX3DAudio( OrientFront );
\r
51 result.OrientTop = Vector3ToX3DAudio( OrientTop );
\r
52 result.Position = Vector3ToX3DAudio( Position );
\r
53 result.Velocity = Vector3ToX3DAudio( Velocity );
\r
58 Listener^ Listener::Clone()
\r
60 Listener^ result = gcnew Listener();
\r
62 result->OrientFront = OrientFront;
\r
63 result->OrientTop = OrientTop;
\r
64 result->Position = Position;
\r
65 result->Velocity = Velocity;
\r
66 result->Cone = Cone;
\r
71 bool Listener::operator == ( Listener^ left, Listener^ right )
\r
73 if( ReferenceEquals( left, nullptr ) )
\r
74 return ReferenceEquals( right, nullptr );
\r
76 return Listener::Equals( left, right );
\r
79 bool Listener::operator != ( Listener^ left, Listener^ right )
\r
81 return !( left == right );
\r
84 int Listener::GetHashCode()
\r
86 return OrientFront.GetHashCode() + OrientTop.GetHashCode() + Position.GetHashCode() +
\r
87 Velocity.GetHashCode() + Cone->GetHashCode();
\r
90 bool Listener::Equals( Object^ value )
\r
92 if( value == nullptr )
\r
95 if( value->GetType() != GetType() )
\r
98 return Equals( safe_cast<Listener^>( value ) );
\r
101 bool Listener::Equals( Listener^ value )
\r
103 if( value == nullptr )
\r
106 if( ReferenceEquals( this, value ) )
\r
109 return ( OrientFront == value->OrientFront && OrientTop == value->OrientTop &&
\r
110 Position == value->Position && Velocity == value->Velocity && Cone == value->Cone );
\r
113 bool Listener::Equals( Listener^ value1, Listener^ value2 )
\r
115 return value1->Equals( value2 );
\r