|
|
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: * AudioStream.h ! 26: * ! 27: * Copyright (c) 1991, NeXT Computer, Inc. All rights reserved. ! 28: * ! 29: * Audio driver stream object. ! 30: * ! 31: * HISTORY ! 32: * 07/14/92/mtm Original coding. ! 33: */ ! 34: ! 35: #import <kern/lock.h> ! 36: #import <objc/Object.h> ! 37: #import <mach/mach_types.h> ! 38: #import <bsd/sys/types.h> ! 39: #import <kernserv/queue.h> ! 40: #import <machkit/NXLock.h> ! 41: #import <sys/time.h> ! 42: #import <driverkit/NXSoundParameterTags.h> ! 43: #import "audio_types.h" ! 44: #import "AudioChannel.h" ! 45: ! 46: /* ! 47: * For user message sends. ! 48: */ ! 49: #define STREAM_SEND_OPTIONS (SEND_TIMEOUT|SEND_SWITCH) ! 50: #define STREAM_SEND_TIMEOUT 1000 ! 51: ! 52: /* ! 53: * Timed control thread messages. ! 54: */ ! 55: #define AC_CONTROL_THREAD_MSG 0 ! 56: typedef struct control_msg { ! 57: msg_header_t header; ! 58: msg_type_t args_type; ! 59: id obj; ! 60: ACStreamControl action; ! 61: struct timeval *when; ! 62: } control_msg_t; ! 63: ! 64: /* ! 65: * Playback or record memory region queue structure. ! 66: */ ! 67: typedef struct region_flags { ! 68: u_int started; ! 69: u_int ended; ! 70: u_int split; ! 71: u_int aborted; ! 72: u_int excluded; ! 73: } region_flags_t; ! 74: ! 75: typedef struct region { ! 76: vm_address_t data; ! 77: vm_address_t end; ! 78: vm_address_t enq_ptr; ! 79: vm_address_t record_ptr; ! 80: u_int count; ! 81: int tag; ! 82: u_int messages; ! 83: port_t reply_port; ! 84: dma_desc_t *start_ddp; ! 85: dma_desc_t *end_ddp; ! 86: region_flags_t flags; ! 87: #if 0 ! 88: boolean_t marks_bumped; /* touched water marks */ ! 89: vm_address_t wire_head; /* wire pointer */ ! 90: vm_address_t wire_tail; /* unwire pointer */ ! 91: boolean_t active; /* doing dma */ ! 92: boolean_t underrun; /* overflow/underrun occured */ ! 93: boolean_t low_reached; /* reached low water first time */ ! 94: #endif ! 95: queue_chain_t link; ! 96: } region_t; ! 97: ! 98: @interface AudioStream: Object ! 99: { ! 100: id channel; ! 101: id device; ! 102: port_t userPort; ! 103: port_t kernUserPort; ! 104: port_t ownerPort; ! 105: int tag; ! 106: ASType type; ! 107: u_int bytesProcessed; ! 108: BOOL isPaused; ! 109: id regionQueueLock; ! 110: queue_head_t regionQueue; ! 111: msg_header_t *sndReplyMsg; ! 112: port_t pausePort; ! 113: port_t resumePort; ! 114: port_t abortPort; ! 115: struct timeval pauseTime; ! 116: struct timeval resumeTime; ! 117: struct timeval abortTime; ! 118: port_t userReplyPort; ! 119: ASMsgRequest userReplyMessages; ! 120: u_int samplingRate; ! 121: IOAudioDataFormat dataFormat; ! 122: u_int channelCount; ! 123: char *mixBuffer1; ! 124: char *mixBuffer2; ! 125: } ! 126: ! 127: - initChannel:chan tag:(int)aTag user:(port_t *)user ! 128: owner:(port_t)owner type:(u_int)aType; ! 129: - (port_t)userPort; ! 130: - (port_t)ownerPort; ! 131: - channel; ! 132: - (ASType)type; ! 133: - dmaCompleteDescriptor:(dma_desc_t *)tag transfered:(u_int)count; ! 134: - (BOOL)canConvertRegion:(region_t *)region rate:(u_int)srate ! 135: format:(IOAudioDataFormat)format channelCount:(u_int)chans; ! 136: - clearForMix:(char *)buf size:(u_int)count format:(IOAudioDataFormat)format; ! 137: - (u_int)mixBuffer:(vm_address_t)data maxCount:(u_int)max ! 138: rate:(u_int *)srate format:(IOAudioDataFormat *)format ! 139: channelCount:(u_int *)chans descriptor:(dma_desc_t *)ddp ! 140: virgin:(BOOL)isVirgin streamCount:(u_int)streams; ! 141: ! 142: - (u_int)mixRegion:(region_t *)region descriptor:(dma_desc_t *)ddp ! 143: buffer:(vm_address_t)data maxCount:(u_int)max ! 144: virgin:(BOOL)isVirgin rate:(u_int)srate format:(IOAudioDataFormat)format ! 145: channelCount:(u_int)chans; ! 146: ! 147: - freeRegion:(region_t *)region; ! 148: - (region_t *)newRegion; ! 149: - free; ! 150: - control:(ACStreamControl)action atTime:(struct timeval)when; ! 151: - control:(ACStreamControl)action; ! 152: - returnRecordedData; ! 153: - setOwner:(port_t)newOwner; ! 154: - (BOOL)bytesProcessed:(u_int *)num atTime:(unsigned int *)ts; ! 155: ! 156: - (NXSoundParameterTag)dataEncoding; ! 157: - (void)setDataEncoding:(NXSoundParameterTag)encoding; ! 158: - (u_int)samplingRate; ! 159: - (void)setSamplingRate:(u_int)rate; ! 160: - (u_int)channelCount; ! 161: - (void)setChannelCount:(u_int)count; ! 162: - (u_int)lowWaterMark; ! 163: - (void)setLowWaterMark:(u_int)count; ! 164: - (u_int)highWaterMark; ! 165: - (void)setHighWaterMark:(u_int)count; ! 166: ! 167: @end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.