Hi John, Dan, Dan, and Sam (et al.)!
With reference to our discussion of a "minimal standard" set of MIDI I/O primtitves for Squeak, here's a revised proposal. I have the driver 90% rewritten to implement this interface.
I'm pretty sure that the "full complement" of Siren primitives can be made to be a proper superset of this.
Your comments are invited...
stp
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
/*********************************************************************************** * Header File for the Squeak Interface to MIDI * Stephen T. Pope -- stp@create.ucsb.edu -- 1998.03.18 * * Version 1.31d -- New "Minimal" Primitive Interface * * This file should be "platform-independent" (yeah, right). * * Note: Most of the primitives fail only under extreme conditions, and return * large positive results for "normal" failure. A return value of 0 means "success" * or "true." */
/*********************************************************************************** * External MIDI interface function prototypes (Smalltalk primitives) */ // Open/start the MIDI interface. (Prim. 610) Answer the // number of interfaces found, or 0 if already open. // 'callbackSemaphore' is the index of the read semaphore // 'readSocket' is the socket to read from; writeSocket will // be 1 greater in value. int sqOpenMIDI(int callbackSemaphore, int readSocket); int sqCloseMIDI(void); // Close the MIDI interface (611)
// Get the name of a MIDI device (612) // 'name' is interpreted as (char *); // 'index' is a 1-based table index. int sqGetMIDIDeviceName(int index, int name);
// Send data out the default port now (613) // 'message' is interpreted as (unsigned char *) // 'interface' is the number of a device. int sqMIDIPlaySizeOn(int message, int length, int interface);
// Read input into a MIDI packet (614) // 'buffer' is interpreted as (MIDIPacket *) // Answer the number of data bytes. int sqReadMIDIPacket(int packet);
// Answer the last-read value of the selected MIDI controller // (assuming controller value caching is turned on). (615) // 0-127 are normal controllers, 128-255 are key pressures // 256-271 are channel pressures, 272 is pitchBend int sqReadMIDIControl(int which);
// General-purpose MIDI driver query/set call (like UNIX // device driver ioctl() calls). See the flag definitions // below. (616) // 'which' selects the operation; // 'onOff' is a flag for query/set/clear operations // Answer the result (true/false, or a number) int sqMIDIioctl(int which, int onOff);
/*********************************************************************************** The Smalltalk side looks like:
(610 primitiveOpenMIDI) (611 primitiveCloseMIDI) (612 primitiveGetMIDIDeviceName) (613 primitivePutMIDIOn) (614 primitiveReadMIDIPacket) (615 primitiveReadMIDIControl) (616 primitiveMIDIioctl)
***********************************************************************************/
/*********************************************************************************** * MIDI Driver ioctl flags */
#define sqMIDIInstalled 1 // Is a MIDI driver installed? #define sqMIDIVersion 2 // What driver version is this? #define sqMIDIHasBuffer 3 // Is there a time-stamped output buffer? #define sqMIDIHasDurs 4 // Is there a 1-call note command? #define sqMIDIHasClock 5 // Does the driver have its own clock? #define sqMIDIUseSemaphore 6 // Should the driver signal a semaphore in input? #define sqMIDIEcho 7 // Should we echo in-coming events in the driver? #define sqMIDIControllerCache 8 // Should we cache controller values for polling? #define sqMIDIEventsAvailable 9 // How many events are in the input Q?
#define sqMIDIQuery 0 // Query about the state of a feature #define sqMIDITurnOn 1 // Turn it on #define sqMIDITurnOff 2 // Turn it off
/*********************************************************************************** * E N D */
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
_ Stephen Travis Pope _ Center for Research in Electronic Art Technology (CREATE) _ Department of Music, Univ. of California, Santa Barbara (UCSB) _ stp@create.ucsb.edu, http://www.create.ucsb.edu/~stp/
squeak-dev@lists.squeakfoundation.org