A sequence name event (from the Midi File 1.0 specification). This event cannot be sent to external Midi devices.
typeSeqName events have a variable number of character fields.
Creates a typeSeqName event from a character string and returns a pointer to the event or NIL if there is not enough memory space.
MidiEvPtr SeqName ( long date, char *s, short chan, short port) { MidiEvPtr e; long c=0; if ( e = MidiNewEv( typeSeqName ) ) /* Allocate a new event. Check not NIL */ { Date(e) = date; /* These information are common to all */ Chan(e) = chan; /* kind of events */ Port(e) = port; for (c=0; *s; s++, c++) /* Build the event while counting the */ MidiAddField(e ,*s);/* characters of the original string */ if (c != MidiCountFields(e)) { /* Check the length of the event */ MidiFreeEv(e); /* if we run out of memory : free the */ return 0; /* event and return NIL */ } } return e; }
Convert a typeSeqName event into a character string. Assume s big enough.
void GetText (MidiEvPtr e, char *s) { short c=0, i=0; c = MidiCountFields(e); while (i<c) *s++ = MidiGetField(e, i++); *s = 0; }