Beispiel #1
0
//_________________________________________________________
static void LMM2MS (SlotPtr slot, MIDIPacket *packet)
{
	MidiEvPtr e; 
	long n = packet->length;
	unsigned char *ptr = packet->data;
	
	while (n--) {
		e = MidiParseByte (&slot->in, *ptr++);
		if (e) {
			Port(e) = (Byte)Slot(slot->refNum);
			MidiSendIm (gRefNum, e);
		}	
	}
}
//_______________________________________________________________________
static void * inputThread (void * ptr)
{
	DrvMemPtr mem = (DrvMemPtr)ptr;
	StreamFifoPtr f = &mem->inFifo;
	signal(SIGDRVQUIT, QuitHandler);
	while (!mem->done) {
		char c;
		ssize_t n = read (mem->devId, &c, 1);
		if (n == 1) {
			MidiEvPtr e = MidiParseByte (f, c);
			if (e) MidiSend (mem->refNum, e);
		} else {
			printf ( "input thread read error");
			mem->done = true;
		}
	}
	return 0;
}
Beispiel #3
0
//_______________________________________________________________________
static void rcvHandler()
{
	SCCPtr scc = GetData ();
	MidiEvPtr e = MidiParseByte (&scc->rcv, *ReadData);
	if (e) Send (e , scc);
}