OSDN Git Service

チケット #35358 に対応するためのブランチの作成。
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / directsound / CaptureCapabilities.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 <dsound.h>\r
24 \r
25 #include "CaptureCapabilities.h"\r
26 \r
27 namespace SlimDX\r
28 {\r
29 namespace DirectSound\r
30 {\r
31         CaptureCapabilities::CaptureCapabilities( const DSCCAPS &caps )\r
32         {\r
33                 Channels = caps.dwChannels;\r
34 \r
35                 Certified = ( caps.dwFlags & DSCCAPS_CERTIFIED ) != 0;\r
36                 EmulatedDriver = ( caps.dwFlags & DSCCAPS_EMULDRIVER ) != 0;\r
37                 MultipleCapture = ( caps.dwFlags & DSCCAPS_MULTIPLECAPTURE ) != 0;\r
38                 Format11KhzMono16Bit = ( caps.dwFormats & WAVE_FORMAT_1M16 ) != 0;\r
39                 Format11KhzMono8Bit = ( caps.dwFormats & WAVE_FORMAT_1M08 ) != 0;\r
40                 Format11KhzStereo16Bit = ( caps.dwFormats & WAVE_FORMAT_1S16 ) != 0;\r
41                 Format11KhzStereo8Bit = ( caps.dwFormats & WAVE_FORMAT_1S08 ) != 0;\r
42                 Format22KhzMono16Bit = ( caps.dwFormats & WAVE_FORMAT_2M16 ) != 0;\r
43                 Format22KhzMono8Bit = ( caps.dwFormats & WAVE_FORMAT_2M08 ) != 0;\r
44                 Format22KhzStereo16Bit = ( caps.dwFormats & WAVE_FORMAT_2S16 ) != 0;\r
45                 Format22KhzStereo8Bit = ( caps.dwFormats & WAVE_FORMAT_2S08 ) != 0;\r
46                 Format44KhzMono16Bit = ( caps.dwFormats & WAVE_FORMAT_4M16 ) != 0;\r
47                 Format44KhzMono8Bit = ( caps.dwFormats & WAVE_FORMAT_4M08 ) != 0;\r
48                 Format44KhzStereo16Bit = ( caps.dwFormats & WAVE_FORMAT_4S16 ) != 0;\r
49                 Format44KhzStereo8Bit = ( caps.dwFormats & WAVE_FORMAT_4S08 ) != 0;\r
50                 Format48KhzMono16Bit = ( caps.dwFormats & WAVE_FORMAT_48M16 ) != 0;\r
51                 Format48KhzMono8Bit = ( caps.dwFormats & WAVE_FORMAT_48M08 ) != 0;\r
52                 Format48KhzStereo16Bit = ( caps.dwFormats & WAVE_FORMAT_48S16 ) != 0;\r
53                 Format48KhzStereo8Bit = ( caps.dwFormats & WAVE_FORMAT_48S08 ) != 0;\r
54                 Format96KhzMono16Bit = ( caps.dwFormats & WAVE_FORMAT_96M16 ) != 0;\r
55                 Format96KhzMono8Bit = ( caps.dwFormats & WAVE_FORMAT_96M08 ) != 0;\r
56                 Format96KhzStereo16Bit = ( caps.dwFormats & WAVE_FORMAT_96S16 ) != 0;\r
57                 Format96KhzStereo8Bit = ( caps.dwFormats & WAVE_FORMAT_96S08 ) != 0;\r
58         }\r
59 \r
60         bool CaptureCapabilities::operator == ( CaptureCapabilities left, CaptureCapabilities right )\r
61         {\r
62                 return CaptureCapabilities::Equals( left, right );\r
63         }\r
64 \r
65         bool CaptureCapabilities::operator != ( CaptureCapabilities left, CaptureCapabilities right )\r
66         {\r
67                 return !CaptureCapabilities::Equals( left, right );\r
68         }\r
69 \r
70         int CaptureCapabilities::GetHashCode()\r
71         {\r
72                 return MultipleCapture.GetHashCode() + Format96KhzStereo8Bit.GetHashCode() + Format96KhzStereo16Bit.GetHashCode() + Format96KhzMono8Bit.GetHashCode() + \r
73                         Format96KhzMono16Bit.GetHashCode() + Format48KhzStereo8Bit.GetHashCode() + Format48KhzStereo16Bit.GetHashCode() + Format48KhzMono8Bit.GetHashCode() + \r
74                         Format48KhzMono16Bit.GetHashCode() + Format44KhzStereo8Bit.GetHashCode() + Format44KhzStereo16Bit.GetHashCode() + Format44KhzMono8Bit.GetHashCode() + \r
75                         Format44KhzMono16Bit.GetHashCode() + Format22KhzStereo8Bit.GetHashCode() + Format22KhzStereo16Bit.GetHashCode() + Format22KhzMono8Bit.GetHashCode() + \r
76                         Format22KhzMono16Bit.GetHashCode() + Format11KhzStereo8Bit.GetHashCode() + Format11KhzStereo16Bit.GetHashCode() + Format11KhzMono8Bit.GetHashCode() + \r
77                         Format11KhzMono16Bit.GetHashCode() + EmulatedDriver.GetHashCode() + Channels.GetHashCode() + Certified.GetHashCode();\r
78         }\r
79 \r
80         bool CaptureCapabilities::Equals( Object^ value )\r
81         {\r
82                 if( value == nullptr )\r
83                         return false;\r
84 \r
85                 if( value->GetType() != GetType() )\r
86                         return false;\r
87 \r
88                 return Equals( safe_cast<CaptureCapabilities>( value ) );\r
89         }\r
90 \r
91         bool CaptureCapabilities::Equals( CaptureCapabilities value )\r
92         {\r
93                 return ( MultipleCapture == value.MultipleCapture && Format96KhzStereo8Bit == value.Format96KhzStereo8Bit && Format96KhzStereo16Bit == value.Format96KhzStereo16Bit \r
94                         && Format96KhzMono8Bit == value.Format96KhzMono8Bit && Format96KhzMono16Bit == value.Format96KhzMono16Bit && Format48KhzStereo8Bit == value.Format48KhzStereo8Bit && \r
95                         Format48KhzStereo16Bit == value.Format48KhzStereo16Bit && Format48KhzMono8Bit == value.Format48KhzMono8Bit && Format48KhzMono16Bit == value.Format48KhzMono16Bit && \r
96                         Format44KhzStereo8Bit == value.Format44KhzStereo8Bit && Format44KhzStereo16Bit == value.Format44KhzStereo16Bit && Format44KhzMono8Bit == value.Format44KhzMono8Bit && \r
97                         Format44KhzMono16Bit == value.Format44KhzMono16Bit && Format22KhzStereo8Bit == value.Format22KhzStereo8Bit && Format22KhzStereo16Bit == value.Format22KhzStereo16Bit && \r
98                         Format22KhzMono8Bit == value.Format22KhzMono8Bit && Format22KhzMono16Bit == value.Format22KhzMono16Bit && Format11KhzStereo8Bit == value.Format11KhzStereo8Bit && \r
99                         Format11KhzStereo16Bit == value.Format11KhzStereo16Bit && Format11KhzMono8Bit == value.Format11KhzMono8Bit && Format11KhzMono16Bit == value.Format11KhzMono16Bit && \r
100                         EmulatedDriver == value.EmulatedDriver && Channels == value.Channels && Certified == value.Certified );\r
101         }\r
102 \r
103         bool CaptureCapabilities::Equals( CaptureCapabilities% value1, CaptureCapabilities% value2 )\r
104         {\r
105                 return value1.Equals( value2 );\r
106         }\r
107 }\r
108 }