00001 /* 00002 $Id: PerformMIDI.h 178 2000-01-03 20:38:38Z leigh $ 00003 Description: 00004 MusicKit DirectMusic access routines. 00005 00006 These routines emulate the functions of the MusicKit Mach MIDI driver. 00007 This is intended to hide all the Windows evil behind a banal C function interface. 00008 However, it is intended that developers will use the higher level 00009 Objective C MusicKit interface rather this one...do yourself a favour, 00010 learn ObjC - it's simple, its fun, its better than Java... 00011 00012 Despite this being an emulation of a device driver, the access routines are a 00013 pretty high-level interface which gives you an idea of how right the NeXT engineers 00014 got it, way back in 1989, considering the NeXT MIDI device driver was a 00015 network transparent device driver that didn't require god-awful CLSIDs. 00016 00017 "The problem with Microsoft is they just have no taste" (S. Jobs) 00018 00019 Why this library even exists at all: 00020 00021 1. It seems that only the DirectMusic, not DirectMusicPort and DirectMusicBuffer 00022 interfaces have been registered, so it does not seem possible to use COM via the 00023 OpenStep ActiveX.framework (assuming it works) to talk to the _core_ DirectMusic layer. 00024 Even if did, it would require any other system (such as mi_d) to use this library would 00025 need to use the Apple frameworks, which is nearly as bad as having to use MS API, but 00026 twice as bad if you have to have both development systems to compile this! 00027 00028 2. It remains to be determined if Apple's ActiveX.framework has been stress tested 00029 dealing with 200ms duration MIDI buffers. 00030 00031 3. We only export C function names (not C++) to allow linking against gcc as 00032 name mangling - "decorating" in MS jargon - differs between the compilers. 00033 00034 Original Author: Leigh M. Smith, tomandandy <leigh@tomandandy.com> 00035 00036 30 July 1999, Copyright (c) 1999 tomandandy. 00037 00038 Permission is granted to use and modify this code for commercial and non-commercial 00039 purposes so long as the author attribution and this copyright message remains intact 00040 and accompanies all derived code. 00041 00042 Just to cover my ass: DirectMusic and DirectX are registered trademarks 00043 of Microsoft Corp and they can have them. 00044 */ 00045 /* 00046 $Log$ 00047 Revision 1.2 2000/01/03 20:38:38 leigh 00048 comments improved 00049 00050 Revision 1.1.1.1 1999/11/17 17:57:14 leigh 00051 Initial working version 00052 00053 */ 00054 // #define FUNCLOG 1 // define this to log function calls to a text file. 00055 00056 #ifdef FUNCLOG 00057 #include <stdio.h> // for fprintf and debug 00058 #endif 00059 00060 #ifdef __cplusplus 00061 extern "C" { 00062 #endif 00063 00064 int PMinitialise(void); 00065 00066 int PMGetAvailableQueueSize(int *size); 00067 00068 int PMPackMessageForPlay(REFERENCE_TIME time, unsigned char *channelMessage, int msgLength); 00069 00070 REFERENCE_TIME PMGetCurrentTime(); 00071 00072 BOOL PMSetMIDIPortNum(int portNum); 00073 00074 BOOL PMSetMIDIPort(char *newPortDescription); 00075 00076 BOOL PMReleaseMIDIPortNum(int portNum); 00077 00078 int PMactivate(void); 00079 00080 int PMdeactivate(void); 00081 00082 int PMPlayBuffer(void); 00083 00084 int PMterminate(void); 00085 00086 int PMDownloadDLSInstruments(unsigned int *patchesToDownload, int patchesUsed); 00087 00088 const char **PMGetAvailableMIDIPorts(unsigned int *selectedPortIndexPtr); 00089 00090 #ifdef __cplusplus 00091 } 00092 #endif