예제 #1
0
void Testmode_ProcessNext(void)
{
	byte i;
	MIDI_NoteOn(test_seq[test_pos]);  //fire note
	test_pos++;  //increment pos
	if (test_pos>=SEQLEN)
	{            
		//if hit end of seq
		test_pos=0;  //reset pos
		for (i=0;i<SEQLEN;i++)
		{
			//turn all notes off
			MIDI_NoteOff(test_seq[i]);
		}
	}
	testmode_nexttick += 1000;  //set tick for next trigger
}
예제 #2
0
//----------------------------------------------------------------------------
//Called from process/Replacing to dispatch the appropriate MIDI events for the 'pos'
//frame in the current audio buffer.
//----------------------------------------------------------------------------
void AmplitudeImposer::processMIDI(long pos)
{
	int data1, data2;
	int status, ch, delta;
	int note;
	int i, j;

	for(i=0;i<NumPendingEvents;i++)
	{
		if((MIDIEvent[EventNumArray[i]]->deltaFrames%Frames) == pos)
		{
			//--pass on/act on event--
			delta = 0; //because we're at pos frames into the buffer...
			ch = (MIDIEvent[EventNumArray[i]]->midiData[0] & 0x0F);
			status = (MIDIEvent[EventNumArray[i]]->midiData[0] & 0xF0);
			data1 = (MIDIEvent[EventNumArray[i]]->midiData[1] & 0x7F);
			data2 = (MIDIEvent[EventNumArray[i]]->midiData[2] & 0x7F);
			delta = MIDIEvent[EventNumArray[i]]->deltaFrames;	//huh?

			note = data1;

			switch(status)
			{
				case 0x90:
					if(data2 > 0)
					{
						MIDI_NoteOn(ch, data1, data2, delta);
					}
					else
					{
						MIDI_NoteOff(ch, data1, data2, delta);
					}
					break;
				case 0x80:
					MIDI_NoteOff(ch, data1, data2, delta);
					break;
				case 0xA0:
					MIDI_PolyAftertouch(ch, data1, data2, delta);
					break;
				case 0xB0:
					MIDI_CC(ch, data1, data2, delta);
					break;
				case 0xC0:
					MIDI_ProgramChange(ch, data1, delta);
					break;
				case 0xD0:
					MIDI_ChannelAftertouch(ch, data1, delta);
					break;
				case 0xE0:
					MIDI_PitchBend(ch, data1, data2, delta);
					break;
			}
			MIDIEvent[EventNumArray[i]]->deltaFrames = -99;
			--NumEvents;

			//--reset EventNumArray--
			for(j=(i+1);j<NumPendingEvents;j++)
			{
				EventNumArray[(j-1)] = EventNumArray[j];
			}
			--NumPendingEvents;
			//break;
		}
	}
}