1/* 2 * Copyright (c) 1998-2014 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#include <AvailabilityMacros.h> 27 28#ifndef IOAUDIOFAMILY_SELF_BUILD 29#include <IOKit/audio/IOAudioControl.h> 30#else 31#include "IOAudioControl.h" 32#endif 33 34class OSArray; 35 36/*! 37 * @class IOAudioLevelControl 38 * @abstract 39 * @discussion 40 */ 41 42class IOAudioLevelControl : public IOAudioControl 43{ 44 OSDeclareDefaultStructors(IOAudioLevelControl) 45 46protected: 47 SInt32 minValue; 48 SInt32 maxValue; 49 IOFixed minDB; 50 IOFixed maxDB; 51 52 OSArray *ranges; 53 54protected: 55 struct ExpansionData { }; 56 57 ExpansionData *reserved; 58 59public: 60 static IOAudioLevelControl *createPassThruVolumeControl (SInt32 initialValue, 61 SInt32 minValue, 62 SInt32 maxValue, 63 IOFixed minDB, 64 IOFixed maxDB, 65 UInt32 channelID, 66 const char *channelName, 67 UInt32 cntrlID) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 68 69 // OSMetaClassDefineReservedUnused(IOAudioLevelControl, 0); 70 /*! 71 * @function setLinearScale 72 * @abstract This function tells CoreAudio if it should apply a curve to the scaler representation of the volume. 73 * @param useLinearScale TRUE instructs CoreAudio to not apply a curve to the scaler representation of the volume, 74 * FALSE instructs CoreAudio to apply a curve, which is CoreAudio's default behavior. 75 */ 76 virtual void setLinearScale(bool useLinearScale) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 77 78private: 79 OSMetaClassDeclareReservedUsed(IOAudioLevelControl, 0); 80 81 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 1); 82 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 2); 83 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 3); 84 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 4); 85 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 5); 86 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 6); 87 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 7); 88 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 8); 89 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 9); 90 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 10); 91 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 11); 92 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 12); 93 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 13); 94 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 14); 95 OSMetaClassDeclareReservedUnused(IOAudioLevelControl, 15); 96 97public: 98 /*! 99 * @function create 100 * @abstract Allocates a new level control with the given attributes 101 * @param initialValue The initial value of the control 102 * @param minValue The lowest possible value the control may have 103 * @param maxValue The highest possible value the control may have 104 * @param minDB A fixed point representation of the db value matching minValue 105 * @param maxDB A fixed point representation of the db value matching maxValue 106 * @param channelID The ID of the channel(s) that the control acts on. Common IDs are located in IOAudioTypes.h. 107 * @param channelName An optional name for the channel. Common names are located in IOAudioTypes.h. 108 * @param cntrlID An optional ID for the control that can be used to uniquely identify controls. 109 * @result Returns a newly allocted and initialized level IOAudioControl 110 */ 111 static IOAudioLevelControl *create(SInt32 initialValue, 112 SInt32 minValue, 113 SInt32 maxValue, 114 IOFixed minDB, 115 IOFixed maxDB, 116 UInt32 channelID, 117 const char *channelName = 0, 118 UInt32 cntrlID = 0, 119 UInt32 subType = 0, 120 UInt32 usage = 0) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 121 122 static IOAudioLevelControl *createVolumeControl(SInt32 initialValue, 123 SInt32 minValue, 124 SInt32 maxValue, 125 IOFixed minDB, 126 IOFixed maxDB, 127 UInt32 channelID, 128 const char *channelName = 0, 129 UInt32 cntrlID = 0, 130 UInt32 usage = 0) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 131 132 /*! 133 * @function init 134 * @abstract Initializes a newly allocated IOAudioLevelControl with the given attributes 135 * @param initialValue The initial value of the control 136 * @param minValue The lowest possible value the control may have 137 * @param maxValue The highest possible value the control may have 138 * @param minDB A fixed point representation of the db value matching minValue 139 * @param maxDB A fixed point representation of the db value matching maxValue 140 * @param channelID The ID of the channel(s) that the control acts on. Common IDs are located in IOAudioTypes.h. 141 * @param channelName An optional name for the channel. Common names are located in IOAudioTypes.h. 142 * @param cntrlID An optional ID for the control that can be used to uniquely identify controls. 143 * @param properties Standard property list passed to the init() function of any new IOService. This dictionary 144 * gets stored in the registry entry for this service. 145 * @result Returns true on success 146 */ 147 virtual bool init(SInt32 initialValue, 148 SInt32 minValue, 149 SInt32 maxValue, 150 IOFixed minDB, 151 IOFixed maxDB, 152 UInt32 channelID, 153 const char *channelName = 0, 154 UInt32 cntrlID = 0, 155 UInt32 subType = 0, 156 UInt32 usage = 0, 157 OSDictionary *properties = 0) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 158 159 virtual void free() AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 160 161 /*! 162 * @function setMinValue 163 * @abstract Sets the minimum value the control may have 164 * @param minValue The minimum value for the control 165 */ 166 virtual void setMinValue(SInt32 minValue) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 167 168 virtual SInt32 getMinValue() AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 169 170 /*! 171 * @function setMaxValue 172 * @abstract Sets the maximum value the control may have 173 * @param maxValue The maximum value for the control 174 */ 175 virtual void setMaxValue(SInt32 maxValue) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 176 177 virtual SInt32 getMaxValue() AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 178 179 /*! 180 * @function setMinDB 181 * @abstract Sets the minimum value in db that the control may have 182 * @discussion This value is represented as an IOFixed value which is a fixed point number. The IOFixed 183 * type is a 16.16 fixed point value. 184 * @param minDB The minimum value in db for the control 185 */ 186 virtual void setMinDB(IOFixed minDB) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 187 188 virtual IOFixed getMinDB() AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 189 190 /*! 191 * @function setMaxDB 192 * @abstract Sets the maximum value in db that the control may have 193 * @discussion This value is represented as an IOFixed value which is a fixed point number. The IOFixed 194 * type is a 16.16 fixed point value. 195 * @param maxDB The maximum value in db for the control 196 */ 197 virtual void setMaxDB(IOFixed maxDB) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 198 199 virtual IOFixed getMaxDB() AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 200 201 virtual IOReturn addRange(SInt32 minValue, SInt32 maxValue, IOFixed minDB, IOFixed maxDB) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 202 virtual IOReturn addNegativeInfinity(SInt32 negativeInfinityValue) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 203 204 virtual IOReturn validateValue(OSObject *newValue) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_10; 205}; 206 207#endif /* _IOKIT_IOAUDIOLEVELCONTROL_H */ 208