|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24: /*
25: * AudioChannel.h
26: *
27: * Copyright (c) 1991, NeXT Computer, Inc. All rights reserved.
28: *
29: * Audio driver channel object.
30: *
31: * HISTORY
32: * 07/14/92/mtm Original coding.
33: */
34:
35: #import <kern/lock.h>
36: #import "audio_types.h"
37: #import <mach/mach_user_internal.h>
38: #import <mach/mach_interface.h>
39:
40: #import <objc/List.h>
41: #import <machkit/NXLock.h>
42: #import <kernserv/queue.h>
43:
44: /*
45: * DMA descriptor structure.
46: */
47: typedef struct dma_desc {
48: u_int size;
49: vm_address_t mem;
50: queue_chain_t link;
51: } dma_desc_t;
52:
53: @interface AudioChannel: Object
54: {
55: id audioDevice;
56: id streamClass;
57: id streamList;
58: id streamListLock;
59:
60: port_t exclusiveUser;
61: port_t userChannelPort;
62: port_t userSndPort;
63:
64: BOOL _isRead;
65:
66: queue_head_t dmaQueue;
67: queue_head_t freeQueue;
68: #ifdef hppa
69: // These are for the device to handle
70: queue_head_t devQueue;
71: queue_head_t dfreeQueue;
72: #endif
73:
74: u_int enqueueCount;
75:
76: u_int dmaSize;
77: u_int dmaCount;
78: u_int descriptorSize;
79:
80: u_int localChannel;
81: void * channelBuffer;
82:
83: vm_offset_t channelBufferPtr;
84:
85: boolean_t peakEnabled;
86: u_int peakHistory;
87: u_int *peaksLeft;
88: u_int *peaksRight;
89: u_int currentPeak;
90: u_int clipCount;
91: }
92:
93: + addStream:stream;
94: + streamForUserPort:(port_t)port;
95: + streamForOwnerPort:(port_t)port;
96:
97: - initOnDevice: device read: (BOOL)isRead;
98: - free;
99:
100: - (u_int) descriptorSize;
101: - (u_int) setDescriptorSize:(u_int)size;
102:
103: - (u_int) dmaSize;
104: - (void)setDMASize: (u_int)count;
105:
106: - (u_int)dmaCount;
107:
108: - (u_int)enqueueCount;
109:
110: - (BOOL) createChannelBuffer;
111: - (void) destroyChannelBuffer;
112:
113: - (void *) channelBuffer;
114: - (vm_address_t) channelBufferAddress;
115:
116: - (BOOL) enqueueDescriptor: (u_int *) rate
117: dataFormat: (IOAudioDataFormat *) format
118: channelCount: (u_int *) count;
119:
120: - (void) dequeueDescriptor;
121:
122: - (void) freeDescriptors;
123: - (void) setLocalChannel: (u_int) channel;
124: - (u_int) localChannel;
125:
126: - (BOOL) isRead;
127: - setUserChannelPort:(port_t)port;
128: - (port_t)userChannelPort;
129:
130: - setUserSndPort:(port_t)port;
131: - (port_t)userSndPort;
132:
133: - (port_t)streamUserForOwnerPort:(port_t)port;
134: - removeSndStreams;
135:
136: - (void)setExclusiveUser:(port_t)streamPort;
137: - (port_t)exclusiveUser;
138:
139: - (BOOL)checkOwner:(port_t)owner;
140:
141: - (BOOL)addStreamTag:(int)tag user:(port_t *)userPort
142: owner:(port_t)owner type:(u_int)type;
143: - (void)removeStream:stream;
144: - streamClass;
145: - (u_int)streamCount;
146:
147: - (BOOL)isDetectingPeaks;
148: - (void)setDetectPeaks:(BOOL)flag;
149: - (void)getPeakLeft:(u_int *)leftPeak right:(u_int *)rightPeak;
150:
151: - (void)controlStreams:(ACStreamControl)action;
152:
153: - (u_int)clipCount;
154: - incrementClipCount:(u_int)count;
155:
156: - audioDevice;
157: - (void) initializeFreeQueue;
158: #ifdef hppa
159: - (void) initializeDFreeQueue;
160: - (vm_offset_t) getDevDmaAddress;
161: #endif
162:
163: @end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.