1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "AudioDeviceInfo.h"
8 NS_IMPL_ISUPPORTS(AudioDeviceInfo
, nsIAudioDeviceInfo
)
10 AudioDeviceInfo::AudioDeviceInfo(const nsAString
& aName
,
11 const nsAString
& aGroupId
,
12 const nsAString
& aVendor
,
16 uint16_t aSupportedFormat
,
17 uint16_t aDefaultFormat
,
18 uint32_t aMaxChannels
,
19 uint32_t aDefaultRate
,
29 , mPreferred(aPreferred
)
30 , mSupportedFormat(aSupportedFormat
)
31 , mDefaultFormat(aDefaultFormat
)
32 , mMaxChannels(aMaxChannels
)
33 , mDefaultRate(aDefaultRate
)
36 , mMaxLatency(aMaxLatency
)
37 , mMinLatency(aMinLatency
)
39 MOZ_ASSERT(mType
== TYPE_UNKNOWN
||
40 mType
== TYPE_INPUT
||
41 mType
== TYPE_OUTPUT
, "Wrong type");
42 MOZ_ASSERT(mState
== STATE_DISABLED
||
43 mState
== STATE_UNPLUGGED
||
44 mState
== STATE_ENABLED
, "Wrong state");
45 MOZ_ASSERT(mPreferred
== PREF_NONE
||
46 mPreferred
== PREF_ALL
||
47 mPreferred
& (PREF_MULTIMEDIA
| PREF_VOICE
| PREF_NOTIFICATION
),
48 "Wrong preferred value");
49 MOZ_ASSERT(mSupportedFormat
& (FMT_S16LE
| FMT_S16BE
| FMT_F32LE
| FMT_F32BE
),
50 "Wrong supported format");
51 MOZ_ASSERT(mDefaultFormat
== FMT_S16LE
||
52 mDefaultFormat
== FMT_S16BE
||
53 mDefaultFormat
== FMT_F32LE
||
54 mDefaultFormat
== FMT_F32BE
, "Wrong default format");
57 /* readonly attribute DOMString name; */
59 AudioDeviceInfo::GetName(nsAString
& aName
)
65 /* readonly attribute DOMString groupId; */
67 AudioDeviceInfo::GetGroupId(nsAString
& aGroupId
)
73 /* readonly attribute DOMString vendor; */
75 AudioDeviceInfo::GetVendor(nsAString
& aVendor
)
81 /* readonly attribute unsigned short type; */
83 AudioDeviceInfo::GetType(uint16_t* aType
)
89 /* readonly attribute unsigned short state; */
91 AudioDeviceInfo::GetState(uint16_t* aState
)
97 /* readonly attribute unsigned short preferred; */
99 AudioDeviceInfo::GetPreferred(uint16_t* aPreferred
)
101 *aPreferred
= mPreferred
;
105 /* readonly attribute unsigned short supportedFormat; */
107 AudioDeviceInfo::GetSupportedFormat(uint16_t* aSupportedFormat
)
109 *aSupportedFormat
= mSupportedFormat
;
113 /* readonly attribute unsigned short defaultFormat; */
115 AudioDeviceInfo::GetDefaultFormat(uint16_t* aDefaultFormat
)
117 *aDefaultFormat
= mDefaultFormat
;
121 /* readonly attribute unsigned long maxChannels; */
123 AudioDeviceInfo::GetMaxChannels(uint32_t* aMaxChannels
)
125 *aMaxChannels
= mMaxChannels
;
129 /* readonly attribute unsigned long defaultRate; */
131 AudioDeviceInfo::GetDefaultRate(uint32_t* aDefaultRate
)
133 *aDefaultRate
= mDefaultRate
;
137 /* readonly attribute unsigned long maxRate; */
139 AudioDeviceInfo::GetMaxRate(uint32_t* aMaxRate
)
141 *aMaxRate
= mMaxRate
;
145 /* readonly attribute unsigned long minRate; */
147 AudioDeviceInfo::GetMinRate(uint32_t* aMinRate
)
149 *aMinRate
= mMinRate
;
153 /* readonly attribute unsigned long maxLatency; */
155 AudioDeviceInfo::GetMaxLatency(uint32_t* aMaxLatency
)
157 *aMaxLatency
= mMaxLatency
;
161 /* readonly attribute unsigned long minLatency; */
163 AudioDeviceInfo::GetMinLatency(uint32_t* aMinLatency
)
165 *aMinLatency
= mMinLatency
;