MusicKit
0.0.0
|
00001 /* 00002 $Id$ 00003 Defined In: The MusicKit 00004 00005 Description: 00006 Defines MIDI input and output structures, constants and functions. 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 Stanford University 00013 Portions Copyright (c) 1999-2004 The MusicKit Project. 00014 */ 00015 /* 00016 Modification history prior to CVS commit: 00017 00018 daj/04/23/90 - Created from _musickit.h 00019 */ 00020 #ifndef __MK__midi_H___ 00021 #define __MK__midi_H___ 00022 00023 #define _MK_MIDIIN_MULTIPLE_VOICES_ON_SAME_KEYNUM 0 00024 00025 typedef struct __MKMidiInStruct { /* This is the midi input structure. */ 00026 double timeTag; /* Current time */ 00027 int _noteTags[MIDI_NUMCHANS]; /* Base for each channel */ 00028 unsigned short _on[MIDI_NUMKEYS]; /* Bit vectors, one per key */ 00029 short chan; /* Channel of note, or _MK_MIDISYS. */ 00030 /* The following is the midi parse state. */ 00031 unsigned char _dataByte1,_dataByte2,_statusByte,_runningStatus; 00032 BOOL _firstDataByteSeen; 00033 short _dataBytes; 00034 id _note; /* The note owned by the midi input. */ 00035 int _sysExSize; /* For collecting system exclusive bytes. */ 00036 unsigned char * _sysExBuf; 00037 unsigned char *_endOfSysExBuf; 00038 unsigned char *_sysExP; 00039 # ifdef _MK_MIDIIN_MULTIPLE_VOICES_ON_SAME_KEYNUM 00040 unsigned short _defTagOffSent[MIDI_NUMKEYS]; 00041 void *_tagLists[MIDI_NUMCHANS];/* One list per chan */ 00042 # endif 00043 } _MKMidiInStruct; 00044 00045 typedef struct __MKMidiOutStruct { /* Midi output structure */ 00046 id _owner; /* Object owning this struct */ 00047 double _timeTag; /* Current timeTag. */ 00048 void (*_putSysMidi)(struct __MKMidiOutStruct *ptr); 00049 void (*_putChanMidi)(struct __MKMidiOutStruct *ptr); 00050 void (*_putSysExcl)(struct __MKMidiOutStruct *ptr,NSString *sysExclStr); 00051 void (*_sendBufferedData)(struct __MKMidiOutStruct *ptr); 00052 unsigned char _bytes[3]; 00053 short _outBytes; 00054 unsigned char _maxCount[MIDI_NUMCHANS][MIDI_NUMKEYS]; 00055 unsigned char _curCount[MIDI_NUMCHANS][MIDI_NUMKEYS]; 00056 /* Used to stack noteOns against noteOffs. */ 00057 NSMapTable *_map[MIDI_NUMCHANS]; 00058 /* Implements conversion from music kit to MIDI semantics. */ 00059 unsigned char _runningStatus; 00060 void *_midiFileStruct; 00061 } _MKMidiOutStruct; 00062 00063 // see _scorefile.h for the scorefile extension definitions 00064 #define _MK_MIDIFILEEXT @"midi" 00065 00066 /* Midi parts */ 00067 #define _MK_MIDINOTEPORTS MIDI_NUMCHANS + 1 00068 #define _MK_MIDISYS 0 00069 00070 /* Functions for MIDI->MK semantic conversion. */ 00071 extern _MKMidiInStruct *_MKInitMidiIn(void); 00072 extern MKNote *_MKMidiToMusicKit(_MKMidiInStruct *ptr, unsigned statusByte); 00073 extern _MKMidiInStruct *_MKFinishMidiIn(_MKMidiInStruct *ptr); 00074 00075 /* Functions for MK->MIDI semantic conversion. */ 00076 extern _MKMidiOutStruct *_MKInitMidiOut(void); 00077 extern _MKMidiOutStruct *_MKFinishMidiOut(_MKMidiOutStruct *ptr); 00078 extern void _MKWriteMidiOut(MKNote *aNote, double timeTag, unsigned chan, _MKMidiOutStruct *ptr, MKNoteReceiver *noteReceiver); 00079 extern unsigned char _MKGetSysExByte(const char **strP); 00080 00081 /* Useful for sending allNotesOff */ 00082 extern NSMutableArray *_MKGetNoteOns(_MKMidiOutStruct *ptr, int chan); 00083 00084 00085 #endif