MusicKit  0.0.0
SndAudioBufferQueue.h
00001 
00002 //
00003 //  $Id$
00004 //
00005 //  Original Author: SKoT McDonald, <skot@tomandandy.com>
00006 //
00007 //  Copyright (c) 2001, The MusicKit Project.  All rights reserved.
00008 //
00009 //  Permission is granted to use and modify this code for commercial and 
00010 //  non-commercial purposes so long as the author attribution and copyright 
00011 //  messages remain intact and accompany all relevant code.
00012 //
00014 
00015 #ifndef __SNDAUDIOBUFFERQUEUE_H__
00016 #define __SNDAUDIOBUFFERQUEUE_H__
00017 
00018 #import <Foundation/Foundation.h>
00019 
00020 @class SndAudioBuffer;
00021 
00027 typedef enum {
00028   audioBufferQueue_typeInput,
00029   audioBufferQueue_typeOutput
00030 } SndAudioBufferQueueType;
00031 
00038 @interface SndAudioBufferQueue : NSObject 
00039 {
00041     NSMutableArray  *pendingBuffers;
00043     NSMutableArray  *processedBuffers;
00045     NSConditionLock *pendingBuffersLock;
00047     NSConditionLock *processedBuffersLock;
00049     unsigned int numBuffers;
00051     unsigned int maximumPendingBuffers;
00053     unsigned int maximumProcessedBuffers;
00054 }
00055 
00063 + audioBufferQueueWithLength: (int) numberOfBuffers;
00064 
00065 - init;
00066 - (void) dealloc;
00067 - (NSString*) description;
00068 
00079 - initQueueWithLength: (int) numberOfBuffers;
00080 
00093 - (SndAudioBuffer*) popNextPendingBuffer;
00094 
00107 - (SndAudioBuffer*) popNextProcessedBuffer;
00108 
00114 - addPendingBuffer: (SndAudioBuffer*) audioBuffer;
00115 
00121 - addProcessedBuffer: (SndAudioBuffer*) audioBuffer;
00122 
00126 - (void) cancelProcessedBuffers;
00127 
00131 - (int) pendingBuffersCount;
00132 
00136 - (int) processedBuffersCount;
00137 
00142 - freeBuffers;
00143 
00157 - (BOOL) prepareQueueAsType: (SndAudioBufferQueueType) type withBufferPrototype: (SndAudioBuffer*) buff;
00158 
00163 - (int) bufferCount;
00164 
00165 @end
00166 
00167 #endif