/* Functions for writing a Midi file. Copyright (C) 1994 by R.Harmsen */ #ifndef RITEMIDI_H #define RITEMIDI_H #include #include "midiutil.h" /******************************************************************** Writes a midi-file type-1 header. *******************************************************************/ int ritemidi_head (FILE *midi_fp, int number_of_tracks, int ticks_per_sixteenth); /******************************************************************** Rewrites a midi-file type-1 header, at the file-position previously written to by rite_midi_head. This can be useful when the number of tracks is not definitively known in advance. *******************************************************************/ int reritemidi_head (FILE *midi_fp, int number_of_tracks, int ticks_per_sixteenth); /******************************************************************** Writes a track header to the midi-file. *******************************************************************/ int ritemidi_opentrack ( FILE *midi_fp, int sixteenth_per_minute, int channel, int program_change); /******************************************************************** Updates the length count in the track written so far. *******************************************************************/ int ritemidi_clostrack (FILE *midi_fp); /******************************************************************** Writes a note-on or note_off message for the specified channel and note. *******************************************************************/ enum RITEMIDI_ONOFF { RITEMIDI_NOTE_ON = 1, RITEMIDI_NOTE_OFF = 0, }; void ritemidi_note_on_off ( enum RITEMIDI_ONOFF onoff, FILE *midi_fp, int channel, int note); /******************************************************************** Pass some time. Typically used between a note_on and note_off, to specify the note's duration, or in case of a chord, used between a group of "note_on"s and a group of corresponding "note_off"s. *******************************************************************/ void ritemidi_pass_time (long delta_time); /******************************************************************** Write a key signature. Negative sharps are flats. Minor = 1 for minor keys, 1 for major keys. *******************************************************************/ void ritemidi_key_signature (FILE *midi_fp, int sharps, int minor); /******************************************************************** Write a time signature. *******************************************************************/ void ritemidi_time_signature (FILE *midi_fp, int numerator, int denominator); #endif