Printing Music Scores (ports of Siren)

Stephen Travis Pope stp at limbo.create.ucsb.edu
Fri Mar 6 09:36:25 UTC 1998


Richard Smol wrote,

> It would be nice if Siren got ported to other OSes aside from MacOS as 
> well. I would have done a port to Linux and Win32, if only I had 
> sufficient time and knowledge =(

The bulk of Siren is platform-independent. The MIDI driver is being
rewritten for improved portability. I'll support Mac and SGI platforms.
Andreas Raab has expressed some interest in porting to Windows. 

ByTheWay, here's the current header file for the MIDI primitives--comments?

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

/***************************************************************
 * Header File for the Squeak/Siren Interface to Mac MIDI
 *      Stephen T. Pope -- stp at create.ucsb.edu
 *
 *  Version 1.31b -- New Prim Interface -- 1998.02.25
 *
 * Siren supports up to 256 "logical" MIDI channels. These can be routed to any of 16 I/O 
 * connections, which are usually mapped 1:1 onto hardware or software interfaces (e.g., 
 * QuickTime musical instruments and/or a hardware MIDI interface on a serial port).
 * User programs can create these mappings in order to set up arbitrary "orchestras" of
 * "virtual" MIDI instruments.
 *
 * There are a number of queries so that Smalltalk MIDI interface ports can determine
 * the features of a concrete driver (e.g., version, hasBuffer, hasDurations, etc.), and
 * also several formats of output messages (play-byte-array, play-note) to support many
 * kinds of MIDI applications.
 *
 * FYI: My MIDI set-up consists of a Macintosh PowerBook G3 (using QuickTime MIDI
 * instruments), an ancient Yamaha FB-01 tone generator, a Yamaha PF70 electric piano
 * (because of its weighted keyboard), a Peavey PC1600X fader box (16 faders and 16
 * buttons), and a Soundcraft mixer to mix the Piano, Mac, and tone generator.
 *
 * Open Issues:
 *
 * NoteOn/Off are the only MIDI commands that are handled specially. Is there any reason 
 * to extend the interface for sending control messages, programs changes, etc. that's 
 * better than the basic "put" primitives?
 *
 * Reading MIDI always returns a raw ByteArray. Should I put a some MIDI command parser 
 * in the primitives and return MIDICommand objects?
 *
 * Output of continuous controls involves lots of calls to the output functions. Should 
 * we provide the users with primitives to pass down a function object?
 *
 */
 
/***************************************************************
 *
 * External MIDI interface function prototypes (Smalltalk primitives)
 */
int sqHasMIDI(void);                        // Answer whether MIDI driver is loaded (Prim 610)
int sqMIDIVersion(void);                    // Answer the version of the MIDI driver (Prim 611)
int sqMIDIHasBuffer(void);                  // Answer whether the driver has an output buffer (Prim 612)
int sqMIDIHasDurs(void);                    // Answer whether notes can have durations (Prim 613)
                                            // (If yes, you can use the play-note command.)
int sqMIDIAvailEvents(void);                // Answer the number of events in the input Q (Prim 614)

int sqOpenMIDI(int cbSemaphore);            // Open/start the MIDI interface (Prim 615)
                                            // (Answer the number of interfaces found.)
int sqCloseMIDI(void);                      // Close the MIDI interface (Prim 616)
void sqFlushMIDI(int both);                 // Flush the MIDI output queue (Prim 617)
                                            // (both = 0 --> flush output only)
void sqStartMIDIInput(void);                // Start receiving input events (Prim 618)
void sqStopMIDIInput(void);                 // Stop receiving input events (Prim 619)

unsigned long sqGetMIDIClock(void);         // Answer current clock value (msec) (Prim 620)
int sqSetMIDIClock(unsigned long timeValue);    // Set clock (msec) (Prim 621)

int sqTestMIDI(void);                       // Play something (random notes) (Prim 622)
void sqMIDIAllNotesOff(void);               // Stop all notes playing (Prim 623)
void sqStartMIDIEcho(void);                 // Start echoing input events (Prim 624)
void sqStopMIDIEcho(void);                  // Stop echoing input events (Prim 625)

int getInterfaceNames(int names);           // Get the names of the connected interfaces (Prim 626)
                                            // names is interpreted as char **
                                            
                                            // Define a mapping between a logical channel and a concrete
                                            // interface/channel tuple (Prim 626)
int sqMIDIMapLogicalChannel(int logical, int interface, int channel);
int sqMIDIClearLogicalChannel(int logical); // Clear a logical channel mapping (Prim 627)
int sqMIDIClearChannelMap(void);            // Clear all logical channel mappings (Prim 628)

                                            // Send bytes out the default port right now (Prim 630)
int sqMIDIPut(int message, int length);     // message is interpreted as unsigned char *

                                            // Send bytes out the given port at some time (Prim 631)
int sqMIDIPutOnAt(int message, int length, int interface, int time);

                                            // One-call noteOn/Off command (Prim 632)
int sqMIDIPlayNote(int channel, int key, int velocity, int time, int dur);

int sqReadMIDI(int buffer);                 // read input into buffer (Prim 635)

/********************************************
 * END
 */

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

stp


_ Stephen Travis Pope
_ Center for Research in Electronic Art Technology (CREATE)
_ Dept. of Music, Univ. of California, Santa Barbara (UCSB)
_ stp at create.ucsb.edu,  http://www.create.ucsb.edu/~stp/





More information about the Squeak-dev mailing list