Chameleon

Chameleon Svn Source Tree

Root/branches/mozodojo/i386/include/IOKit/audio/IOAudioLevelControl.h

1/*
2 * Copyright (c) 1998-2010 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23#ifndef _IOKIT_IOAUDIOLEVELCONTROL_H
24#define _IOKIT_IOAUDIOLEVELCONTROL_H
25
26#ifndef IOAUDIOFAMILY_SELF_BUILD
27#include <IOKit/audio/IOAudioControl.h>
28#else
29#include "IOAudioControl.h"
30#endif
31
32class OSArray;
33
34/*!
35 * @class IOAudioLevelControl
36 * @abstract
37 * @discussion
38 */
39
40class IOAudioLevelControl : public IOAudioControl
41{
42 OSDeclareDefaultStructors(IOAudioLevelControl)
43
44protected:
45 SInt32minValue;
46 SInt32maxValue;
47 IOFixedminDB;
48 IOFixedmaxDB;
49
50 OSArray *ranges;
51
52protected:
53 struct ExpansionData { };
54
55 ExpansionData *reserved;
56
57public:
58static IOAudioLevelControl *createPassThruVolumeControl (SInt32 initialValue,
59 SInt32 minValue,
60 SInt32 maxValue,
61 IOFixed minDB,
62 IOFixed maxDB,
63 UInt32 channelID,
64 const char *channelName,
65 UInt32 cntrlID);
66
67// OSMetaClassDefineReservedUnused(IOAudioLevelControl, 0);
68 /*!
69 * @function setLinearScale
70 * @abstract This function tells CoreAudio if it should apply a curve to the scaler representation of the volume.
71 * @param useLinearScale TRUE instructs CoreAudio to not apply a curve to the scaler representation of the volume,
72 * FALSE instructs CoreAudio to apply a curve, which is CoreAudio's default behavior.
73 */
74virtual void setLinearScale(bool useLinearScale);
75
76private:
77 OSMetaClassDeclareReservedUsed(IOAudioLevelControl, 0);
78
79 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 1);
80 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 2);
81 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 3);
82 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 4);
83 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 5);
84 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 6);
85 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 7);
86 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 8);
87 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 9);
88 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 10);
89 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 11);
90 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 12);
91 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 13);
92 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 14);
93 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 15);
94
95public:
96 /*!
97 * @function create
98 * @abstract Allocates a new level control with the given attributes
99 * @param initialValue The initial value of the control
100 * @param minValue The lowest possible value the control may have
101 * @param maxValue The highest possible value the control may have
102 * @param minDB A fixed point representation of the db value matching minValue
103 * @param maxDB A fixed point representation of the db value matching maxValue
104 * @param channelID The ID of the channel(s) that the control acts on. Common IDs are located in IOAudioTypes.h.
105 * @param channelName An optional name for the channel. Common names are located in IOAudioTypes.h.
106 * @param cntrlID An optional ID for the control that can be used to uniquely identify controls.
107 * @result Returns a newly allocted and initialized level IOAudioControl
108 */
109 static IOAudioLevelControl *create(SInt32 initialValue,
110 SInt32 minValue,
111 SInt32 maxValue,
112 IOFixed minDB,
113 IOFixed maxDB,
114 UInt32 channelID,
115 const char *channelName = 0,
116 UInt32 cntrlID = 0,
117 UInt32 subType = 0,
118 UInt32 usage = 0);
119
120 static IOAudioLevelControl *createVolumeControl(SInt32 initialValue,
121 SInt32 minValue,
122 SInt32 maxValue,
123 IOFixed minDB,
124 IOFixed maxDB,
125 UInt32 channelID,
126 const char *channelName = 0,
127 UInt32 cntrlID = 0,
128 UInt32 usage = 0);
129
130 /*!
131 * @function init
132 * @abstract Initializes a newly allocated IOAudioLevelControl with the given attributes
133 * @param initialValue The initial value of the control
134 * @param minValue The lowest possible value the control may have
135 * @param maxValue The highest possible value the control may have
136 * @param minDB A fixed point representation of the db value matching minValue
137 * @param maxDB A fixed point representation of the db value matching maxValue
138 * @param channelID The ID of the channel(s) that the control acts on. Common IDs are located in IOAudioTypes.h.
139 * @param channelName An optional name for the channel. Common names are located in IOAudioTypes.h.
140 * @param cntrlID An optional ID for the control that can be used to uniquely identify controls.
141 * @param properties Standard property list passed to the init() function of any new IOService. This dictionary
142 * gets stored in the registry entry for this service.
143 * @result Returns true on success
144 */
145 virtual bool init(SInt32 initialValue,
146 SInt32 minValue,
147 SInt32 maxValue,
148 IOFixed minDB,
149 IOFixed maxDB,
150 UInt32 channelID,
151 const char *channelName = 0,
152 UInt32 cntrlID = 0,
153 UInt32 subType = 0,
154 UInt32 usage = 0,
155 OSDictionary *properties = 0);
156
157 virtual void free();
158
159 /*!
160 * @function setMinValue
161 * @abstract Sets the minimum value the control may have
162 * @param minValue The minimum value for the control
163 */
164 virtual void setMinValue(SInt32 minValue);
165
166 virtual SInt32 getMinValue();
167
168 /*!
169 * @function setMaxValue
170 * @abstract Sets the maximum value the control may have
171 * @param maxValue The maximum value for the control
172 */
173 virtual void setMaxValue(SInt32 maxValue);
174
175 virtual SInt32 getMaxValue();
176
177 /*!
178 * @function setMinDB
179 * @abstract Sets the minimum value in db that the control may have
180 * @discussion This value is represented as an IOFixed value which is a fixed point number. The IOFixed
181 * type is a 16.16 fixed point value.
182 * @param minDB The minimum value in db for the control
183 */
184 virtual void setMinDB(IOFixed minDB);
185
186 virtual IOFixed getMinDB();
187
188 /*!
189 * @function setMaxDB
190 * @abstract Sets the maximum value in db that the control may have
191 * @discussion This value is represented as an IOFixed value which is a fixed point number. The IOFixed
192 * type is a 16.16 fixed point value.
193 * @param maxDB The maximum value in db for the control
194 */
195 virtual void setMaxDB(IOFixed maxDB);
196
197 virtual IOFixed getMaxDB();
198
199 virtual IOReturn addRange(SInt32 minValue, SInt32 maxValue, IOFixed minDB, IOFixed maxDB);
200 virtual IOReturn addNegativeInfinity(SInt32 negativeInfinityValue);
201
202 virtual IOReturn validateValue(OSObject *newValue);
203};
204
205#endif /* _IOKIT_IOAUDIOLEVELCONTROL_H */
206

Archive Download this file

Revision: 1232