MusicKit  0.0.0
MKMTCPerformer.h
00001 /*
00002   $Id$
00003   Defined In: The MusicKit
00004 
00005   Description:
00006     See discussion below.
00007 
00008   Original Author: David A. Jaffe
00009 
00010   Copyright (c) 1988-1992, NeXT Computer, Inc.
00011   Portions Copyright (c) 1994 NeXT Computer, Inc. and reproduced under license from NeXT
00012   Portions Copyright (c) 1994 CCRMA, Stanford University.
00013   Portions (Time code extensions) Copyright (c) 1993 Pinnacle Research.
00014   Portions Copyright (c) 1999-2005, The MusicKit Project.
00015 */
00163 #ifndef __MK_MTCPerformer_H___
00164 #define __MK_MTCPerformer_H___
00165 #import "MKPerformer.h"
00166 
00176 #define MK_MTC_FORMAT_24      0   
00177 
00178 #define MK_MTC_FORMAT_25      1
00179 
00180 #define MK_MTC_FORMAT_DROP_30 2
00181 
00182 #define MK_MTC_FORMAT_30      3
00183 
00185 #define MK_MTC_REVERSE (-1)
00186 
00187 #define MK_MTC_FORWARD 1
00188 
00189 /* These functions do not compensate for deltaT.  They're just straight translation  
00190  */
00191 extern double MKConvertMTCToSeconds(short format,
00192                                     short hours,
00193                                     short minutes,
00194                                     short seconds,
00195                                     short frames);
00196 
00197 extern void MKConvertSecondsToMTC(double seconds, 
00198                                   short format,
00199                                   short *hoursPtr,
00200                                   short *minutesPtr,
00201                                   short *secondsPtr,
00202                                   short *framesPtr);
00203 
00204 @interface MKMTCPerformer: MKPerformer
00205 {
00206     double firstTimeTag;   
00207     double lastTimeTag;    
00208     int direction;         
00209     short format;          
00210     id noteSender;  // TODO MKNoteSender *
00211     id aNote; // TODO MKNote *
00212     BOOL frozen;
00213 
00214 @private
00215     int _cmpStat;
00216     /* This is the stopping point, in delta-t-adjusted time */
00217     short _lastHours;
00218     short _lastMinutes;
00219     short _lastSeconds;
00220     short _lastFrames;
00221     short _frameQuarter;     /* Which quarter-frame we're on */
00222 
00223     /* These are the time in delta-t adjusted units.  Use
00224      * the access methods to get their value in MKConductor's time
00225      * base.
00226      */
00227     short _hours;
00228     short _minutes;
00229     short _seconds;
00230     short _frames;
00231 }
00232 
00233 
00242 - init;
00243 
00261 - setFirstTimeTag: (double) firstTimeTag;
00262 
00273 - setLastTimeTag: (double) lastTimeTag;
00274 
00286 - setFirstTimeTagMTCHours: (short) h minutes: (short) m seconds: (short) s frames: (short) f;
00287 
00299 - setLastTimeTagMTCHours: (short) h minutes: (short) m seconds: (short) s frames: (short) f;
00300 
00312 - setTimeShiftMTCHours: (short) h minutes: (short) m seconds: (short) s frames: (short) f;
00313 
00319 - (double) firstTimeTag;
00320 
00326 - (double) lastTimeTag;
00327 
00338 -setFormat:(int)fmt;
00339 
00346 -(double)timeTag;
00347 
00359 -getMTCHours:(short *)h minutes:(short *)m seconds:(short *)s frames:(short *)f;
00360 
00370 -setDirection:(int)newDirection;
00371 
00381 -sendUserBits:(unsigned int)userBits groupFlagBits:(unsigned char)groupFlagBits;
00382 
00391 -freezeTimeCode;  
00392 
00399 -thawTimeCode;
00400 
00408 -sendFullMTCMessage; 
00409 
00414 -activateSelf;    
00415 
00423 - (void)deactivate;
00424 
00433 -pause;           /* Sends NAK SYSEX, then pauses.  */
00434 
00442 -resume;          /* Resumes time code. Sends a Full message */
00443 
00444 -perform;
00445 
00446 @end
00447 
00448 #endif