Esempio n. 1
0
//_________________________________________________________
static void SendSysEx(SlotPtr slot, MidiEvPtr e)
{
	slot->remaining = (EvType(e) == typeSysEx) ? (MidiCountFields(e)+2) : MidiCountFields(e);
	
	// Write event to be sent
	MidiStreamPutEvent (&slot->outsysex, e);
	SendSysExAux(slot);
}
Esempio n. 2
0
//_______________________________________________________________________
static void KeyOffTask (long date, short refNum, long a1,long a2,long a3)
{
	MidiEvPtr e = (MidiEvPtr)a1;
	DrvMemPtr mem = (DrvMemPtr)a2;
	Ev2StreamPtr f = &mem->outFifo;
	Byte c;

	MidiStreamPutEvent (f, e);
	while (MidiStreamGetByte (f, &c)) {
		write (mem->devId, &c, 1);
	}
}
Esempio n. 3
0
//_______________________________________________________________________
static Boolean GetByte (SCCPtr scc, Byte *c)
{
	if (MidiStreamGetByte(&scc->xmt, c))
		return true;
	else {
		MidiEvPtr e = Pop(&scc->seq);
		if (e) {
			e = MidiStreamPutEvent	(&scc->xmt, e);
			if (e) MidiTask (KeyOffTask, Date(e), 0, (long)scc, (long)e, 0);
			return MidiStreamGetByte(&scc->xmt, c);
		}
	}
	return false;
}
Esempio n. 4
0
//_______________________________________________________________________
static void RcvAlarm (short refNum)
{
	DrvMemPtr mem = GetData ();
	Ev2StreamPtr f = &mem->outFifo;
	MidiEvPtr off, e = MidiGetEv (refNum);
	Byte c;
	
	while (e) {
		off = MidiStreamPutEvent (f, e);
		while (MidiStreamGetByte (f, &c)) {
			write (mem->devId, &c, 1);
		}
		if (off) MidiTask (KeyOffTask, Date(off), refNum, (long)off, (long)mem, 0);
		e = MidiGetEv (refNum);
	}
}
Esempio n. 5
0
//_________________________________________________________
static void SendSmallEv(SlotPtr slot, MidiEvPtr e, sendState* state)
{ 
	MIDIPacketList* pktlist = (MIDIPacketList*)state->packetBuffer;
	MIDIPacket* packet = MIDIPacketListInit(pktlist);
	unsigned char * ptr = state->evBuffer;
	OSErr err;
	int n = 0;
  	 
	e = MidiStreamPutEvent (&state->outsmall, e);
	if (e) MidiTask (KOffTask, Date(e), gRefNum, (long)e, (long)slot, 0); // typeNote
	
	while (MidiStreamGetByte (&state->outsmall, ptr++)) {n++;}
	
	MIDIPacketListAdd(pktlist,sizeof(state->packetBuffer),packet,MIDIGetCurrentHostTime(),n,state->evBuffer);
	err = MIDISend(slot->port,slot->dest,pktlist);
	if (err != noErr) fprintf(stderr, "MIDISend : error %ld\n", err);
}