Annotation of XNU/iokit/IOKit/audio/IOAudioManager.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1998-2000 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 _IOAUDIOMANAGER_H
                     24: #define _IOAUDIOMANAGER_H
                     25: 
                     26: /*!
                     27:  * @header AudioManager
                     28:  * Central location for handling frequently used audio values
                     29:  */
                     30: #include <IOKit/IOService.h>
                     31: 
                     32: #include <IOKit/audio/IOAudioController.h>
                     33: #include <IOKit/IONotifier.h>
                     34: #include <IOKit/IOLocks.h>
                     35: #include <libkern/c++/OSArray.h>
                     36: 
                     37: /*! @defined MASTER_VOLUME_MIN */
                     38: #define MASTER_VOLUME_MIN      0
                     39: 
                     40: /*! @defined MASTER_VOLUME_MAX */
                     41: #define MASTER_VOLUME_MAX      65535
                     42: 
                     43: /*! @defined kMasterVolumeLeft */
                     44: #define kMasterVolumeLeft      "MasterVolumeLeft"
                     45: 
                     46: /*! @defined kMasterVolumeRight */
                     47: #define kMasterVolumeRight     "MasterVolumeRight"
                     48: 
                     49: /*! @defined kMasterMute */
                     50: #define kMasterMute            "MasterMute"
                     51: 
                     52: /*! @defined kMasterVolumeIncrement */
                     53: #define kMasterVolumeIncrement "MasterVolumeIncrement"
                     54: 
                     55: /*!
                     56:  * @class IOAudioManager
                     57:  * Object for handling getting and setting of common audio properties and registering
                     58:  * interest in changes to these.
                     59:  */
                     60: class IOAudioManager : public IOService
                     61: {
                     62:     OSDeclareDefaultStructors(IOAudioManager);
                     63: 
                     64: private:
                     65:     UInt16             masterVolumeLeft;
                     66:     UInt16             masterVolumeRight;
                     67:     bool               masterMute;
                     68:     UInt16             masterVolumeIncrement;
                     69: 
                     70:     OSArray *          audioControllers;
                     71:     IONotifier *       publishNotify;
                     72:     IOLock *           driverLock;
                     73:     
                     74: public:
                     75:    /*!
                     76:     * @function sharedInstance
                     77:     * @result IOAudioManager
                     78:     */
                     79:     static IOAudioManager *sharedInstance();
                     80: 
                     81:     /*!
                     82:      * @function init
                     83:      * @abstract Set default values and initialize the Audio Manager
                     84:      * @param properties Passed to inherited init method
                     85:      * @result bool TRUE is successful, false otherwise
                     86:      */
                     87:     virtual bool init(OSDictionary *properties);
                     88: 
                     89:     /*!
                     90:      * @function free
                     91:      * @abstract Release resources allocated and break notify connections
                     92:      * @result void
                     93:      */
                     94:     virtual void free();
                     95: 
                     96:     /*!
                     97:      * @function start
                     98:      * @param provider
                     99:      * @result bool TRUE if successful, FALSE otherwise
                    100:      */
                    101:     virtual bool start(IOService *provider);
                    102: 
                    103:     /*!
                    104:      * @function setProperties
                    105:      * @param properties
                    106:      * @result IOReturn kIOReturnSuccess if successful, kIOReturnBadArgument otherwise
                    107:      */
                    108:     virtual IOReturn setProperties(OSObject *properties);
                    109: 
                    110:     /*!
                    111:      * @function getMasterVolumeLeft
                    112:      * @result UInt16 left master volume
                    113:      */   
                    114:     virtual UInt16 getMasterVolumeLeft();
                    115:     
                    116:     /*!
                    117:      * @function getMasterVolumeRight
                    118:      * @result UInt16 right master volume
                    119:      */
                    120:     virtual UInt16 getMasterVolumeRight();
                    121: 
                    122:     /*!
                    123:      * @function setMasterVolumeLeft
                    124:      * @param newMasterVolumeLeft
                    125:      * @result UInt16 previous value
                    126:      */
                    127:     virtual UInt16 setMasterVolumeLeft(UInt16 newMasterVolumeLeft);
                    128: 
                    129:     /*!
                    130:      * @function setMasterVolumeRight
                    131:      * @param newMasterVolumeRight
                    132:      * @result UInt16 previous value
                    133:      */
                    134:     virtual UInt16 setMasterVolumeRight(UInt16 newMasterVolumeRight);
                    135: 
                    136:     /*!
                    137:      * @function getMasterMute
                    138:      * @result bool master mute
                    139:      */
                    140:     virtual bool getMasterMute();
                    141: 
                    142:     /*!
                    143:      * @function setMasterMute
                    144:      * @param newMasterMute
                    145:      * @result bool previous value
                    146:      */
                    147:     virtual bool setMasterMute(bool newMasterMute);
                    148: 
                    149:     /*!
                    150:      * @function getMasterVolumeIncrement
                    151:      * @result UInt16 master volume increment
                    152:      */
                    153:     virtual UInt16 getMasterVolumeIncrement();
                    154: 
                    155:     /*!
                    156:      * @function setMasterVolumeIncrement
                    157:      * @param newMasterVolumeIncrement
                    158:      * @result UInt16 previous value
                    159:      */
                    160:     virtual UInt16 setMasterVolumeIncrement(UInt16 newMasterVolumeIncrement);
                    161: 
                    162:     /*!
                    163:      * @function incrementMasterVolume
                    164:      * @abstract Increment master right and master left volume by master volume increment value
                    165:      * @result UInt16 The larger of master volume right and master volume left
                    166:      */
                    167:     virtual UInt16 incrementMasterVolume();
                    168: 
                    169:     /*!
                    170:      * @function decrementMasterVolume
                    171:      * @abstract Decrement master right and master left volume by master volume increment value
                    172:      * @result UInt16 The larger of master volume right and master volume left
                    173:      */
                    174:     virtual UInt16 decrementMasterVolume();
                    175: 
                    176:     /*!
                    177:      * @function toggleMasterMute
                    178:      * @abstract If muted, unmute, and vice versa
                    179:      * @result bool New value of mute
                    180:      */
                    181:     virtual bool toggleMasterMute();
                    182: 
                    183: private:
                    184:     static bool audioPublishNotificationHandler(IOAudioManager *self,
                    185:                                                 void *ref,
                    186:                                                 IOService *newService);
                    187:     virtual bool registerAudioController(IOAudioController *controller);
                    188: 
                    189: };
                    190: 
                    191: #endif /* _IOAUDIOMANAGER_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.