MusicKit  0.0.0
SndStreamManager.h
00001 
00002 //
00003 //  $Id$
00004 //
00005 //  Description:
00006 //    See headerdoc description below.
00007 //
00008 //  Original Author: SKoT McDonald, <skot@tomandandy.com>
00009 //
00010 //  Copyright (c) 2001, The MusicKit Project.  All rights reserved.
00011 //
00012 //  Permission is granted to use and modify this code for commercial and 
00013 //  non-commercial purposes so long as the author attribution and copyright 
00014 //  messages remain intact and accompany all relevant code.
00015 //
00017 
00018 #ifndef __SNDSTREAMMANAGER_H__
00019 #define __SNDSTREAMMANAGER_H__
00020 
00021 #import <Foundation/Foundation.h>
00022 #import "SndFormat.h"
00023 
00024 @class SndAudioBuffer;
00025 @class SndStreamClient;
00026 @class SndStreamMixer;
00027 
00031 @protocol SndDelegateMessagePassing
00035 - (void) _sendDelegateInvocation:(in unsigned long) mesg;
00036 @end 
00037 
00048 @interface SndStreamManager : NSObject <SndDelegateMessagePassing>
00049 { 
00051     SndStreamMixer *mixer;
00053     BOOL            active;
00055     BOOL            bg_active;
00057     SndFormat       outputFormat;
00059     SndFormat       inputFormat;    
00061     double          nowTime;
00063     char            bg_sem;
00065     char            bgdm_sem;
00068     NSConditionLock *bg_threadLock;
00070     NSConditionLock *bgdm_threadLock;
00071 
00072     NSLock          *delegateMessageArrayLock;
00073     NSMutableArray  *delegateMessageArray;
00074     NSConnection    *threadConnection;
00075 
00076     BOOL             bDelegateMessagingEnabled;
00078     BOOL             isStopping;
00079 }
00080 
00087 + (void) initialize;
00088 
00096 + (SndStreamManager *) defaultStreamManager;
00097 
00106 + streamManagerOnDeviceForInput: (NSString *) inputDeviceName 
00107                 deviceForOutput: (NSString *) outputDeviceName;
00108 
00115 + (NSArray *) driverNamesForOutput: (BOOL) forOutputDevices;
00116 
00122 - init;
00123 
00132 - initOnDeviceForInput: (NSString *) inputDeviceName deviceForOutput: (NSString *) outputDeviceName;
00133 
00138 - (int) assignedDriverIndexForOutput: (BOOL) forOutputDevices;
00139 
00146 - (BOOL) setAssignedDriverToIndex: (unsigned int) driverIndex forOutput: (BOOL) forOutputDevices;
00147 
00152 - (NSString *) assignedDriverNameForOutput: (BOOL) forOutputDevices;
00153 
00163 - (BOOL) setHardwareBufferSize: (unsigned int) frames;
00164 
00169 - (long) inputBufferSize;
00170 
00175 - (long) outputBufferSize;
00176 
00186 - (float) inputLatency;
00187 
00197 - (float) outputLatency;
00198 
00203 - (NSString *) description;
00204 
00211 - (void) startStreaming;
00212 
00219 - (void) stopStreaming;
00220 
00231 - (BOOL) addClient: (SndStreamClient *) client;
00232 
00241 - (BOOL) removeClient: (SndStreamClient *) client;
00242 
00249 - (BOOL) removeAllClients;
00250 
00255 - (NSArray *) clients;
00256 
00266 - (void) processStreamAtTime: (double) bufferTime
00267                        input: (SndAudioBuffer *) inB
00268                       output: (SndAudioBuffer *) outB;
00269 
00274 - (SndFormat) format;
00275 
00285 - (double) nowTime;
00286 
00291 - (SndStreamMixer *) mixer;
00292 
00299 - (BOOL) isActive;
00300 
00304 - (double) samplingRate;
00305 
00312 - (void) resetTime: (double) originTimeInSeconds;
00313 
00332 - (void) sendMessageInMainThreadToTarget: (id) target sel: (SEL) sel arg1: (id) arg1 arg2: (id) arg2;
00333 
00334 @end
00335 
00337 
00338 #endif