MusicKit
0.0.0
|
00001 /* 00002 $Id$ 00003 Defined In: The MusicKit 00004 00005 Description: 00006 Private MusicKit include file. 00007 This file contains everything used by the MusicKit privately. 00008 00009 Original Author: David A. Jaffe 00010 00011 Copyright (c) 1988-1992, NeXT Computer, Inc. 00012 Portions Copyright (c) 1994 NeXT Computer, Inc. and reproduced under license from NeXT 00013 Portions Copyright (c) 1994 Stanford University 00014 Portions Copyright (c) 1999-2000 The MusicKit Project 00015 */ 00016 /* 00017 Modification history before commital to CVS repository: 00018 00019 09/15/89/daj - Added caching of Note class. (_MKClassNote()) 00020 09/22/89/daj - Moved _MKNameTable functions to _MKNameTable.h. 00021 10/08/89/daj - Changed types for new _MKNameTable implementation. 00022 11/10/89/daj - Added caching of MKPartials class. (_MKClassPartials()) 00023 11/26/89/daj - Added _MKBeginUGBlock() and _MKEndUGBlock(). 00024 11/27/89/daj - Removed arg from _MKCurSample. 00025 12/3/89/daj - Added seed and ranSeed tokens. 00026 12/22/89/daj - Removed uPlus 00027 01/08/90/daj - Added name arg to _MKNewScoreInStruct(). 00028 02/26/90/daj - Changes to accomodate new way of doing midiFiles. 00029 Added midifile sys excl support. 00030 03/05/90/daj - Added macros for escape characters. 00031 3/06/90/daj - Added _MK_repeat to token list. 00032 3/13/90/daj - Removed _privatemsgs.h because it doesn't work with the new 00033 compiler. Changed all classes to use catagories instead. 00034 Moved many declarations from this file to individual private 00035 .h files. 00036 4/21/90/daj - Added macro _MK_MAKECOMPILERHAPPY to surpress warnings 00037 that are unnecessary. 00038 4/23/90/daj - Moved much of this file to individual .h files and renamed 00039 the file _utilities.h 00040 The way you now use it is this: 00041 First import _musickit.h. This imports musickit.h. 00042 Then import any special _*.h files you need. 00043 7/24/90/daj - Added _MKDisableErrorStream to protect multi-threaded 00044 performance. 00045 9/26/90/daj - Changed *cvtToId to objc_getClassWithoutWarning 00046 11/9/92/daj - Added MidiClass 00047 */ 00048 #ifndef __MK__musickit_H___ 00049 #define __MK__musickit_H___ 00050 00051 //sb: for NSData etc 00052 #import <Foundation/Foundation.h> 00053 00054 #ifndef _MKUTILITIES_H 00055 #define _MKUTILITIES_H 00056 00057 //sb: for _MK_maxPrivPar etc... 00058 #import "_MKParameter.h" 00059 //sb: for MK_freq 00060 #import "params.h" 00061 00062 #import <stdarg.h> 00063 #import "midi_spec.h" 00064 #import "MusicKit.h" 00065 00066 /* These are used to see if a class is loaded */ 00067 /* These are used to avoid going through the findClass hash every time */ 00068 /* MOD stephen@pyrusmalus.com, 11/05/2001 00069 * changed from "id aClass" to Class aClass to avoid compiler warnings. 00070 */ 00071 typedef struct __MKClassLoaded { 00072 Class aClass; 00073 BOOL alreadyChecked; 00074 } _MKClassLoaded; 00075 00076 #define _MK_GLOBAL 00077 00078 extern _MK_GLOBAL _MKClassLoaded _MKNoteClass; 00079 extern _MK_GLOBAL _MKClassLoaded _MKMidiClass; 00080 extern _MK_GLOBAL _MKClassLoaded _MKOrchestraClass; 00081 extern _MK_GLOBAL _MKClassLoaded _MKWaveTableClass; 00082 extern _MK_GLOBAL _MKClassLoaded _MKEnvelopeClass; 00083 extern _MK_GLOBAL _MKClassLoaded _MKSamplesClass; 00084 extern _MK_GLOBAL _MKClassLoaded _MKPartialsClass; 00085 extern _MK_GLOBAL _MKClassLoaded _MKConductorClass; 00086 00087 extern Class _MKCheckClassNote() ; 00088 extern Class _MKCheckClassMidi() ; 00089 extern Class _MKCheckClassOrchestra() ; 00090 extern Class _MKCheckClassWaveTable() ; 00091 extern Class _MKCheckClassEnvelope() ; 00092 extern Class _MKCheckClassSamples(); 00093 extern Class _MKCheckClassPartials(); 00094 extern Class _MKCheckClassConductor(); 00095 00096 #define _MKClassNote() \ 00097 ((_MKNoteClass.alreadyChecked) ? _MKNoteClass.aClass : \ 00098 _MKCheckClassNote()) 00099 00100 #define _MKClassMidi() \ 00101 ((_MKMidiClass.alreadyChecked) ? _MKMidiClass.aClass : \ 00102 _MKCheckClassMidi()) 00103 00104 #define _MKClassOrchestra() \ 00105 ((_MKOrchestraClass.alreadyChecked) ? _MKOrchestraClass.aClass : \ 00106 _MKCheckClassOrchestra()) 00107 00108 #define _MKClassWaveTable() \ 00109 ((_MKWaveTableClass.alreadyChecked) ? _MKWaveTableClass.aClass : \ 00110 _MKCheckClassWaveTable()) 00111 00112 #define _MKClassEnvelope() \ 00113 ((_MKEnvelopeClass.alreadyChecked) ? _MKEnvelopeClass.aClass : \ 00114 _MKCheckClassEnvelope()) 00115 00116 #define _MKClassSamples() \ 00117 ((_MKSamplesClass.alreadyChecked) ? _MKSamplesClass.aClass : \ 00118 _MKCheckClassSamples()) 00119 00120 #define _MKClassPartials() \ 00121 ((_MKPartialsClass.alreadyChecked) ? _MKPartialsClass.aClass : \ 00122 _MKCheckClassPartials()) 00123 00124 #define _MKClassConductor() \ 00125 ((_MKConductorClass.alreadyChecked) ? _MKConductorClass.aClass : \ 00126 _MKCheckClassConductor()) 00127 00128 extern void _MKLinkUnreferencedClasses(); 00129 extern BOOL _MKInheritsFrom(id aFactObj,id superObj); 00130 00131 #define BACKSLASH '\\' 00132 #define BACKSPACE '\b' 00133 #define FORMFEED '\f' 00134 #define CR '\r' 00135 #define TAB '\t' 00136 #define NEWLINE '\n' 00137 #define QUOTE '\'' 00138 #define VT '\v' 00139 00140 #define _MK_TINYTIME ((double)1.0e-05) /* Must be less than 1/2 a tick. */ 00141 00142 #define _MK_LINEBREAKS 0 /* No line breaks within envelopes or notes. */ 00143 00144 #define _MK_PERMS 0664 /* RW for owner and group. R for others */ 00145 00146 #define _MK_DPSPRIORITY NSDefaultRunLoopMode /* sb: or is it NSEventTrackingRunLoopMode? originally: 30 */ 00147 /* Almost maximum. Display Postscript priority */ 00148 00157 #define MK_SCOREMAGIC ((int)0x2e706c61) // ".pla" 00158 00159 /* Initialization of musickit */ 00160 extern void _MKCheckInit(); 00161 00162 /* The following finds the class or nil if its not there. */ 00163 /*sb: this is the proper OpenStep way, as far as I know */ 00164 #define _MK_FINDCLASS(_x) NSClassFromString(_x) 00165 /* Might want to change this to the following: */ 00166 // #define _MK_FINDCLASS(_x) ([Object findClass:_x]) 00167 00168 /* String functions */ 00169 char *_MKMakeStr(); 00170 char *_MKMakeStrcat(); 00171 char *_MKMakeSubstr(); 00172 char *_MKMakeStrRealloc(); 00173 00174 /* Conversion */ 00175 extern double _MKStringToDouble(NSString * sVal); 00176 extern int _MKStringToInt(NSString * sVal); 00177 extern NSString * _MKDoubleToString(double dVal); 00178 extern NSString * _MKIntToString(int iVal); 00179 extern NSString * _MKDoubleToStringNoCopy(double dVal); 00180 extern NSString * _MKIntToStringNoCopy(int iVal); 00181 /* See /usr/include/dsp/dsp.h, imported by musickit.h */ 00182 extern DSPFix24 _MKDoubleToFix24(double dval); 00183 extern double _MKFix24ToDouble(DSPFix24 ival); 00184 extern int _MKFix24ToInt(DSPFix24 ival); 00185 extern void _MKDoubleToFix24Array (double *doubleArr, DSPDatum *fix24Arr, int len); 00186 extern void _MKFix24ToDoubleArray (DSPDatum *fix24Arr, double *doubleArr, int len); 00187 00188 // array duplication 00189 NSMutableArray *_MKLightweightArrayCopy(NSMutableArray *oldArray); 00190 NSMutableArray *_MKDeepMutableArrayCopy(NSMutableArray *oldArray); 00191 00192 /* Files */ 00193 /* 00194 extern NSMutableData *_MKOpenFileStream(char * fileName,int *fd,int readOrWrite, 00195 char *defaultExtension,BOOL raiseError); 00196 */ 00197 extern NSData *_MKOpenFileStreamForReading(NSString * fileName, 00198 NSString *defaultExtension,BOOL errorMsg); 00199 extern BOOL _MKOpenFileStreamForWriting(NSString * fileName, 00200 NSString *defaultExtension,NSMutableData *theData,BOOL errorMsg); 00201 00202 extern int _MKFindAppWrapperFile(NSString *fileName,NSString **returnNameBuffer); 00203 00204 /* Floating point resoulution */ 00205 #define _MK_VARRESOLUTION (((double)1.0/(double)44000.0)/(double)2.0) 00206 00207 /* For debugging */ 00208 extern void _MKOrchTrace(MKOrchestra *orch, int typeOfInfo, NSString * fmt, ...); 00209 extern unsigned _MKTraceFlag; 00210 #define _MKTrace() _MKTraceFlag 00211 00212 /* Memory alloc. These will be replaced with NeXT equiv */ 00213 extern void * _MKMalloc(unsigned size); 00214 extern char * _MKCalloc(unsigned nelem, unsigned elsize); 00215 extern char * _MKRealloc(void *ptr, unsigned size); 00216 #define _MK_MALLOC( VAR, TYPE, NUM ) \ 00217 ((VAR) = (TYPE *) _MKMalloc( (unsigned)(NUM)*sizeof(TYPE) )) 00218 #define _MK_REALLOC( VAR, TYPE, NUM ) \ 00219 ((VAR) = (TYPE *) _MKRealloc((char *)(VAR), (unsigned)(NUM)*sizeof(TYPE))) 00220 #define _MK_CALLOC( VAR, TYPE, NUM ) \ 00221 ((VAR) = (TYPE *) _MKCalloc( (unsigned)(NUM),sizeof(TYPE) )) 00222 00223 /* For multi-threaded MK performance. */ 00224 extern void _MKDisableErrorStream(void); 00225 extern void _MKEnableErrorStream(void); 00226 00227 #import <Foundation/NSBundle.h> 00228 extern NSBundle *_MKErrorBundle(void); 00229 extern NSString *_MKErrorStringFile(void); 00230 #define _MK_ERRTAB _MKErrorStringFile() 00231 00232 #endif /* _MKUTILITIES_H */ 00233 00234 00235 00236 #endif