typeCopyright (code 136)


A copyright event (from the Midi File 1.0 specification). This event cannot be sent to external Midi devices.

typeCopyrigth events have a variable number of character fields.


Creates a typeCopyright event from a character string. Return a pointer to the event or NIL if there is not enough memory space.


MidiEvPtr Copyright ( long date, char *s, short chan, short port)
{
    MidiEvPtr e;
    long    c=0;

    if ( e = MidiNewEv(typeCopyright) )    /* 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 */
            MidiAddField(e ,*s);    /* the 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 typeCopyrigth 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;
}