This function is an iteration. It allows an application apply a function to all the events of a sequence.
![]()
pascal void MidiApplySeq (MidiSeqPtr s, ApplyProcPtr MyProc);
![]()
s- a MidiSeqPtr, is a pointer to the sequence to be browsed;
MyProc- a ApplyProcPtr is the address of the function to apply to each event of the sequence.
![]()
pascal void MyProc (MidiEvPtr e);
![]()
e- a MidiEvPtr, is a pointer to the current event in the sequence.
Transpose a sequence by one octave.
MidiSeqPtr s;
void TransposeOctave (MidiEvPtr e)
{
if ( EvType(e) == typeNote ||
EvType(e) == typeKeyOn ||
EvType(e) == typeKeyOff ||
EvType(e) == typeKeyPress )
{
Pitch(e) += 12; /* normally one must check boundaries */
}
}
....
MidiApplySeq(s, TransposeOctave);
MidiShare was originally developed in Pascal on the Macintosh. Therefore, in C, all functions passed as arguments of a MidiShare function must be declared as Pascal. In the previous example, TransposeOctave should be declared as :
pascal void TransposeOctave (MidiEvPtr e);