]> git.saurik.com Git - apple/xnu.git/blame - iokit/Families/IOCDStorage/IOCDAudioControl.cpp
xnu-124.13.tar.gz
[apple/xnu.git] / iokit / Families / IOCDStorage / IOCDAudioControl.cpp
CommitLineData
1c79356b
A
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#include <IOKit/storage/IOCDAudioControl.h>
24#include <IOKit/storage/IOCDAudioControlUserClient.h>
25#include <IOKit/storage/IOCDBlockStorageDriver.h>
26
27#define super IOService
28OSDefineMetaClassAndStructors(IOCDAudioControl, IOService)
29
30IOCDBlockStorageDriver *
31IOCDAudioControl::getProvider() const
32{
33 return (IOCDBlockStorageDriver *) IOService::getProvider();
34}
35
36IOReturn
37IOCDAudioControl::getStatus(CDAudioStatus *status)
38{
39 return(getProvider()->getAudioStatus(status));
40}
41
42CDTOC *
43IOCDAudioControl::getTOC(void)
44{
45 return(getProvider()->getTOC());
46}
47
48IOReturn
49IOCDAudioControl::getVolume(UInt8 *left,UInt8 *right)
50{
51 return(getProvider()->getAudioVolume(left,right));
52}
53
54IOReturn
55IOCDAudioControl::newUserClient(task_t task,
56 void * /* security */,
57 UInt32 /* type */,
58 IOUserClient ** object )
59
60{
61 IOReturn err = kIOReturnSuccess;
62 IOCDAudioControlUserClient * client;
63
64 client = IOCDAudioControlUserClient::withTask(task);
65
66 if( !client || (false == client->attach( this )) ||
67 (false == client->start( this )) ) {
68 if(client) {
69 client->detach( this );
70 client->release();
71 }
72 err = kIOReturnNoMemory;
73 }
74
75 *object = client;
76 return( err );
77}
78
79IOReturn
80IOCDAudioControl::pause(bool pause)
81{
82 return(getProvider()->audioPause(pause));
83}
84
85IOReturn
86IOCDAudioControl::play(CDMSF timeStart,CDMSF timeStop)
87{
88 return(getProvider()->audioPlay(timeStart,timeStop));
89}
90
91IOReturn
92IOCDAudioControl::scan(CDMSF timeStart,bool reverse)
93{
94 return(getProvider()->audioScan(timeStart,reverse));
95}
96
97IOReturn
98IOCDAudioControl::stop()
99{
100 return(getProvider()->audioStop());
101}
102
103IOReturn
104IOCDAudioControl::setVolume(UInt8 left,UInt8 right)
105{
106 return(getProvider()->setAudioVolume(left,right));
107}
108
109OSMetaClassDefineReservedUnused(IOCDAudioControl, 0);
110OSMetaClassDefineReservedUnused(IOCDAudioControl, 1);
111OSMetaClassDefineReservedUnused(IOCDAudioControl, 2);
112OSMetaClassDefineReservedUnused(IOCDAudioControl, 3);
113OSMetaClassDefineReservedUnused(IOCDAudioControl, 4);
114OSMetaClassDefineReservedUnused(IOCDAudioControl, 5);
115OSMetaClassDefineReservedUnused(IOCDAudioControl, 6);
116OSMetaClassDefineReservedUnused(IOCDAudioControl, 7);