Example #1
0
 void record (short aRefNum)
{
        MidiEvPtr e;
        
        while (e = MidiGetEv(aRefNum)) {
                MidiSendIm(aRefNum, MidiCopyEv(e)); // Remove this line if you don't want to thru events
                MidiAddSeq(ourSequence,e);
        }
}
Example #2
0
 void play (long time, short refnum, long nextEv, long unused1, long unused2)
{
        MidiEvPtr       e = (MidiEvPtr) nextEv;
        long            date = Date(e);
        
        if (!stopFlag) {
                while (e && Date(e) == date) {                  // play all the events at the same date
                        MidiSendIm(refnum, MidiCopyEv(e));
                        e = e->link;
                }
                if (e)                                                                  // still events to play?
                        MidiCall(play, time + Date(e) - date, refnum, (long)e, 0, 0);
        }
}
Example #3
0
MSALARMAPI void     PlayTask (long date, short r, TSequencer * s, MidiEvPtr e, long d)
{
        d = Date(e);
        while (e && (Date(e) == d)) {
                MidiSendAt(r, MidiCopyEv(e), date+10);
                e = Link(e);
        }
        if (e) {
                s->playtask = MidiTask((TaskPtr)PlayTask, date+Date(e)-d, r, (long)s, (long)e, 0);
        } else {
                s->playtask = 0;
                s->state = idle;
        }
}
Example #4
0
void SendMultipleNotes (long n, long pitch, long delay)
{
        long            i;
        MidiEvPtr       e = MidiNewEv(typeNote);
        long            dt = MidiGetTime();
        
        if (e) {
                Chan(e) = 0;
                Port(e) = 0;
                MidiSetField(e, 0, pitch);      // the pitch
                MidiSetField(e, 1, 80);         // the velocity
                MidiSetField(e, 2, delay-1);    // the duration
                
                for (i=0; i<n; i++) MidiSendAt(ourRefNum, MidiCopyEv(e), dt + i*delay);
                MidiFreeEv(e);
        }
}
/* --------------------------------------------------------
Real time echo management task
-------------------------------------------------------- */
void MSALARMAPI EchoTask( long d,short ref,long el,long a2, long a3)
{
    MidiEvPtr e;
    short v,p;

    e= (MidiEvPtr)el;
    v = Vel(e)+MSParam[kVel];
    p = Pitch(e)+MSParam[kPitch];
    if ( ((v>0)&&(v<128)) && ((p>=0)&&(p<128)) ) {
        Vel(e) = v;
        Pitch(e) = p;
        MidiSendAt(ref, MidiCopyEv(e), d);
        if( !MidiTask(EchoTask, d+MSParam[kDelay], ref, el, 0, 0))
            MidiFreeEv(e);
    }
    else MidiFreeEv(e);
}
Example #6
0
static pascal void keyOnProcess(long d, short refNum, long delay, long model, long a3)
{
  MidiSendAt(refNum, MidiCopyEv((MidiEvPtr)model), d + 7);
  MidiTask (keyOnProcess, d + delay, refNum, delay, model, a3);
}