1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * Copyright (c) 1999 Apple Computer, Inc.  All rights reserved.
25 *
26 * HISTORY
27 *
28 */
29
30#if 0
31
32#include <CoreFoundation/CoreFoundation.h>
33#include <IOKit/IOKitLib.h>
34#include <IOKit/audio/IOAudioLib.h>
35
36/* --------------------------------------------------------- */
37
38kern_return_t
39IOAudioIsOutput( io_service_t service, int *out)
40{
41    kern_return_t	kr;
42    CFDictionaryRef	properties;
43    CFNumberRef		number;
44
45    *out = false;
46    kr = IORegistryEntryCreateCFProperties(service, (CFTypeRef *) &properties,
47                                        kCFAllocatorDefault, kNilOptions);
48    if(kr || !properties)
49        return kr;
50
51    number = (CFNumberRef)
52		CFDictionaryGetValue(properties, CFSTR("Out"));
53
54    if( CFNumberGetTypeID() == CFGetTypeID(number))
55        CFNumberGetValue(number, kCFNumberIntType, out);
56    else
57	kr = kIOReturnInternalError;
58
59    CFRelease(properties);
60
61    return kr;
62}
63
64// Tell driver when last sample will have been played, so sound hardware
65// can be stopped.
66kern_return_t IOAudioFlush(io_connect_t connect, IOAudioStreamPosition *end)
67{
68    mach_msg_type_number_t	len = 0;
69    return io_connect_method_structureI_structureO(connect,
70                                                   kCallFlush,
71                                                   (char *)end,
72                                                   sizeof(IOAudioStreamPosition),
73                                                   NULL,
74                                                   &len);
75
76}
77
78// Set autoerase flag, returns old value
79kern_return_t IOAudioSetErase(io_connect_t connect, int erase, int *oldVal)
80{
81    kern_return_t kr;
82    mach_msg_type_number_t	len = 1;
83    int old;
84
85    kr = io_connect_method_scalarI_scalarO(connect, kCallSetErase,
86                &erase, 1, &old, &len);
87    if(kr == kIOReturnSuccess)
88	*oldVal = !old;
89    return kr;
90}
91
92#endif /* 0 */
93
94