OSDN Git Service

#36897 [DTXC] MIDIインポート機能の呼び出し口を、ファイルメニュー内にも配置。
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / directsound / SoundBuffer3D.cpp
1 #include "stdafx.h"\r
2 /*\r
3 * Copyright (c) 2007-2010 SlimDX Group\r
4\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
11\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
14\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
21 * THE SOFTWARE.\r
22 */\r
23 #include <windows.h>\r
24 #include <dsound.h>\r
25 \r
26 #include "../ComObject.h"\r
27 #include "../math/Vector3.h"\r
28 \r
29 #include "DirectSoundException.h"\r
30 \r
31 #include "DirectSound.h"\r
32 #include "SoundBuffer3D.h"\r
33 \r
34 using namespace System;\r
35 \r
36 namespace SlimDX\r
37 {\r
38 namespace DirectSound\r
39 {\r
40         SoundBuffer3D::SoundBuffer3D( SoundBuffer^ soundBuffer )\r
41         {\r
42                 IDirectSound3DBuffer8* buffer;\r
43 \r
44                 HRESULT hr = soundBuffer->InternalPointer->QueryInterface( IID_IDirectSound3DBuffer8, reinterpret_cast<void**>( &buffer ) );\r
45                 if( RECORD_DSOUND( hr ).IsFailure )\r
46                         throw gcnew DirectSoundException( Result::Last );\r
47                 \r
48                 Construct( buffer );\r
49         }\r
50 \r
51         Buffer3DSettings SoundBuffer3D::AllParameters::get()\r
52         {\r
53                 DS3DBUFFER result;\r
54                 result.dwSize = sizeof( DS3DBUFFER );\r
55                 HRESULT hr = InternalPointer->GetAllParameters( &result );\r
56                 RECORD_DSOUND( hr );\r
57 \r
58                 return Buffer3DSettings( result );\r
59         }\r
60 \r
61         void SoundBuffer3D::AllParameters::set( Buffer3DSettings value )\r
62         {\r
63                 DS3DBUFFER result = value.ToUnmanaged();\r
64                 HRESULT hr = InternalPointer->SetAllParameters( &result, Deferred ? DS3D_DEFERRED : DS3D_IMMEDIATE );\r
65                 RECORD_DSOUND( hr );\r
66         }\r
67 \r
68         int SoundBuffer3D::InsideConeAngle::get()\r
69         {\r
70                 DWORD inside = 0;\r
71                 HRESULT hr = InternalPointer->GetConeAngles( &inside, NULL );\r
72                 RECORD_DSOUND( hr );\r
73 \r
74                 return inside; \r
75         }\r
76 \r
77         void SoundBuffer3D::InsideConeAngle::set( int value )\r
78         {\r
79                 HRESULT hr = InternalPointer->SetConeAngles( value, NULL, Deferred ?  DS3D_DEFERRED : DS3D_IMMEDIATE );\r
80                 RECORD_DSOUND( hr );\r
81         }\r
82 \r
83         int SoundBuffer3D::OutsideConeAngle::get()\r
84         {\r
85                 DWORD outside = 0;\r
86                 HRESULT hr = InternalPointer->GetConeAngles( NULL, &outside );\r
87                 RECORD_DSOUND( hr );\r
88 \r
89                 return outside; \r
90         }\r
91 \r
92         void SoundBuffer3D::OutsideConeAngle::set( int value )\r
93         {\r
94                 HRESULT hr = InternalPointer->SetConeAngles( NULL, value, Deferred ?  DS3D_DEFERRED : DS3D_IMMEDIATE );\r
95                 RECORD_DSOUND( hr );\r
96         }\r
97 \r
98         Vector3 SoundBuffer3D::ConeOrientation::get()\r
99         {\r
100                 D3DVECTOR orientation = D3DVECTOR();\r
101                 HRESULT hr = InternalPointer->GetConeOrientation( &orientation );\r
102                 RECORD_DSOUND( hr );\r
103 \r
104                 return Vector3( orientation.x, orientation.y, orientation.z );\r
105         }\r
106 \r
107         void SoundBuffer3D::ConeOrientation::set( Vector3 value )\r
108         {\r
109                 HRESULT hr = InternalPointer->SetConeOrientation( value.X, value.Y, value.Z, Deferred ?  DS3D_DEFERRED : DS3D_IMMEDIATE );\r
110                 RECORD_DSOUND( hr );\r
111         }\r
112 \r
113         int SoundBuffer3D::ConeOutsideVolume::get()\r
114         {\r
115                 LONG volume = 0;\r
116                 HRESULT hr = InternalPointer->GetConeOutsideVolume( &volume );\r
117                 RECORD_DSOUND( hr );\r
118 \r
119                 return static_cast<int>( volume );\r
120         }\r
121 \r
122         void SoundBuffer3D::ConeOutsideVolume::set( int value )\r
123         {\r
124                 HRESULT hr = InternalPointer->SetConeOutsideVolume( static_cast<LONG>( value ), Deferred ?  DS3D_DEFERRED : DS3D_IMMEDIATE );\r
125                 RECORD_DSOUND( hr );\r
126         }\r
127 \r
128         float SoundBuffer3D::MaxDistance::get()\r
129         {\r
130                 float maxDistance = 0.0f;\r
131                 HRESULT hr = InternalPointer->GetMaxDistance( &maxDistance );\r
132                 RECORD_DSOUND( hr );\r
133 \r
134                 return maxDistance;\r
135         }\r
136 \r
137         void SoundBuffer3D::MaxDistance::set( float value )\r
138         {\r
139                 HRESULT hr = InternalPointer->SetMaxDistance( value, Deferred ?  DS3D_DEFERRED : DS3D_IMMEDIATE );\r
140                 RECORD_DSOUND( hr );\r
141         }\r
142 \r
143         float SoundBuffer3D::MinDistance::get()\r
144         {\r
145                 float minDistance = 0.0f;\r
146                 HRESULT hr = InternalPointer->GetMinDistance( &minDistance );\r
147                 RECORD_DSOUND( hr );\r
148 \r
149                 return minDistance;\r
150         }\r
151 \r
152         void SoundBuffer3D::MinDistance::set( float value )\r
153         {\r
154                 HRESULT hr = InternalPointer->SetMinDistance( value, Deferred ?  DS3D_DEFERRED : DS3D_IMMEDIATE );\r
155                 RECORD_DSOUND( hr );\r
156         }\r
157 \r
158         Mode3D SoundBuffer3D::Mode::get()\r
159         {\r
160                 DWORD mode = 0;\r
161                 HRESULT hr = InternalPointer->GetMode( &mode );\r
162                 RECORD_DSOUND( hr );\r
163         \r
164                 return static_cast<Mode3D>( mode );\r
165         }\r
166 \r
167         void SoundBuffer3D::Mode::set( Mode3D value )\r
168         {\r
169                 HRESULT hr = InternalPointer->SetMode( static_cast<DWORD>( value ), Deferred ?  DS3D_DEFERRED : DS3D_IMMEDIATE );\r
170                 RECORD_DSOUND( hr );\r
171         }\r
172 \r
173         Vector3 SoundBuffer3D::Position::get()\r
174         {\r
175                 D3DVECTOR position = D3DVECTOR();\r
176                 HRESULT hr = InternalPointer->GetPosition( &position );\r
177                 RECORD_DSOUND( hr );\r
178 \r
179                 return Vector3( position.x, position.y, position.z );\r
180         }\r
181 \r
182         void SoundBuffer3D::Position::set( Vector3 value )\r
183         {\r
184                 HRESULT hr = InternalPointer->SetPosition( value.X, value.Y, value.Z, Deferred ?  DS3D_DEFERRED : DS3D_IMMEDIATE );\r
185                 RECORD_DSOUND( hr );\r
186         }\r
187 \r
188         Vector3 SoundBuffer3D::Velocity::get()\r
189         {\r
190                 D3DVECTOR velocity = D3DVECTOR();\r
191                 HRESULT hr = InternalPointer->GetVelocity( &velocity );\r
192                 RECORD_DSOUND( hr );\r
193 \r
194                 return Vector3( velocity.x, velocity.y, velocity.z );\r
195         }\r
196 \r
197         void SoundBuffer3D::Velocity::set( Vector3 value )\r
198         {\r
199                 HRESULT hr = InternalPointer->SetVelocity( value.X, value.Y, value.Z, Deferred ?  DS3D_DEFERRED : DS3D_IMMEDIATE );\r
200                 RECORD_DSOUND( hr );\r
201         }\r
202 }\r
203 }