OSDN Git Service

DTXMania089リリースに際してのtag付け。
[dtxmania/dtxmania.git] / 110401(DTXMania089) / SlimDXc_Jun2010(VC++2008) / source / directsound / AcousticEchoCancel.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 \r
28 #include "DirectSoundException.h"\r
29 \r
30 #include "Enums.h"\r
31 #include "AcousticEchoCancel.h"\r
32 \r
33 using namespace System;\r
34 \r
35 namespace SlimDX\r
36 {\r
37 namespace DirectSound\r
38 {\r
39         Result AcousticEchoCancel::Reset()\r
40         {\r
41                 HRESULT hr = InternalPointer->Reset();\r
42                 return RECORD_DSOUND( hr );\r
43         }\r
44 \r
45         bool AcousticEchoCancel::Enabled::get()\r
46         {\r
47                 DSCFXAec param;\r
48 \r
49                 HRESULT hr = InternalPointer->GetAllParameters( &param );\r
50                 if( RECORD_DSOUND( hr ).IsFailure )\r
51                         return false;\r
52 \r
53                 return param.fEnable == TRUE;\r
54         }\r
55 \r
56         void AcousticEchoCancel::Enabled::set( bool value )\r
57         {\r
58                 DSCFXAec param;\r
59 \r
60                 HRESULT hr = InternalPointer->GetAllParameters( &param );\r
61                 if( RECORD_DSOUND( hr ).IsFailure )\r
62                         return;\r
63 \r
64                 param.fEnable = value;\r
65                 hr = InternalPointer->SetAllParameters( &param );\r
66                 RECORD_DSOUND( hr );\r
67         }\r
68 \r
69         bool AcousticEchoCancel::NoiseFill::get()\r
70         {\r
71                 DSCFXAec param;\r
72 \r
73                 HRESULT hr = InternalPointer->GetAllParameters( &param );\r
74                 if( RECORD_DSOUND( hr ).IsFailure )\r
75                         return false;\r
76 \r
77                 return param.fNoiseFill == TRUE;\r
78         }\r
79 \r
80         void AcousticEchoCancel::NoiseFill::set( bool value )\r
81         {\r
82                 DSCFXAec param;\r
83 \r
84                 HRESULT hr = InternalPointer->GetAllParameters( &param );\r
85                 if( RECORD_DSOUND( hr ).IsFailure )\r
86                         return;\r
87 \r
88                 param.fNoiseFill = value;\r
89                 hr = InternalPointer->SetAllParameters( &param );\r
90                 RECORD_DSOUND( hr );\r
91         }\r
92 \r
93         AcousticEchoCancelMode AcousticEchoCancel::Mode::get()\r
94         {\r
95                 DSCFXAec param;\r
96 \r
97                 HRESULT hr = InternalPointer->GetAllParameters( &param );\r
98                 if( RECORD_DSOUND( hr ).IsFailure )\r
99                         return AcousticEchoCancelMode::PassThrough;\r
100 \r
101                 return static_cast<AcousticEchoCancelMode>( param.dwMode );\r
102         }\r
103 \r
104         void AcousticEchoCancel::Mode::set( AcousticEchoCancelMode value )\r
105         {\r
106                 DSCFXAec param;\r
107 \r
108                 HRESULT hr = InternalPointer->GetAllParameters( &param );\r
109                 if( RECORD_DSOUND( hr ).IsFailure )\r
110                         return;\r
111 \r
112                 param.dwMode = static_cast<DWORD>( value );\r
113                 hr = InternalPointer->SetAllParameters( &param );\r
114                 RECORD_DSOUND( hr );\r
115         }\r
116 \r
117         bool AcousticEchoCancel::Uninitialized::get()\r
118         {\r
119                 DWORD status = 0;\r
120                 HRESULT hr = InternalPointer->GetStatus( &status );\r
121                 RECORD_DSOUND( hr );\r
122 \r
123                 return ( status & DSCFX_AEC_STATUS_HISTORY_UNINITIALIZED ) != 0;\r
124         }\r
125 \r
126         bool AcousticEchoCancel::ContinuouslyConverged::get()\r
127         {\r
128                 DWORD status = 0;\r
129                 HRESULT hr = InternalPointer->GetStatus( &status );\r
130                 RECORD_DSOUND( hr );\r
131 \r
132                 return ( status & DSCFX_AEC_STATUS_HISTORY_CONTINUOUSLY_CONVERGED ) != 0;\r
133         }\r
134 \r
135         bool AcousticEchoCancel::CurrentlyConverged::get()\r
136         {\r
137                 DWORD status = 0;\r
138                 HRESULT hr = InternalPointer->GetStatus( &status );\r
139                 RECORD_DSOUND( hr );\r
140 \r
141                 return ( status & DSCFX_AEC_STATUS_CURRENTLY_CONVERGED ) != 0;\r
142         }\r
143 \r
144         bool AcousticEchoCancel::PreviouslyDiverged::get()\r
145         {\r
146                 DWORD status = 0;\r
147                 HRESULT hr = InternalPointer->GetStatus( &status );\r
148                 RECORD_DSOUND( hr );\r
149 \r
150                 return ( status & DSCFX_AEC_STATUS_HISTORY_PREVIOUSLY_DIVERGED ) != 0;\r
151         }\r
152 }\r
153 }