示例#1
0
void handleProgramChange(uint32_t tics, int channel, int program) {

    logger(LOG_INFO, "Program Change at: %d for Channel: %d, Program: %d\n", tics, channel, program);

    waitForTicCount(tics);
    programChange(0, channel, program);
}
示例#2
0
void VPiano::slotProgChanged(const int index)
{
    if (index < 0) return;
    int bankIdx = m_comboBank->currentIndex();
    int bank = m_comboBank->itemData(bankIdx).toInt();
    if (bank >= 0)
        bankChange(bank);
    int pgm = m_comboProg->itemData(index).toInt();
    if (pgm >= 0)
        programChange(pgm);
}
示例#3
0
文件: midi.cpp 项目: gauthiier/Plank
void MMidi::midiHandler() {
	
    //midiTime = millis();
    uint8_t midiChannel = (midiBuffer[0] & 0x0F);
    
	
	switch(midiBuffer[0] & 0xF0) { // bit mask with &0xF0 ?
        case 0x80:
			noteOff			(midiBuffer[0] & 0x0F,     // midi channel 0-16
							 midiBuffer[1] & 0x7F,   // note value 0-127
							 midiBuffer[2] & 0x7F);  // note velocity 0-127
			break;
			
        case 0x90:
			noteOn			(midiBuffer[0] & 0x0F,     // midi channel 0-16
							 midiBuffer[1] & 0x7F,   // note value 0-127
							 midiBuffer[2] & 0x7F);  // note velocity 0-127
			break;
			
        case 0xA0:
			aftertouch		(midiBuffer[0] & 0x0F,   // midi channel 0-16
							 midiBuffer[1] & 0x7F, // note value 0-127
							 midiBuffer[2] & 0x7F);// note velocity 0-127
			break;
			
        case 0xB0:
			controller		(midiBuffer[0] & 0x0F,   // midi channel 0-16
							 midiBuffer[1] & 0x7F, // controller number 0-127
							 midiBuffer[2] & 0x7F);// controller value 0-127
			break;
			
        case 0xC0:
			programChange	(midiBuffer[0]  & 0x0F,    // midi channel 0-16
							 midiBuffer[1] & 0x7F);  // program number 0-127
			break;
			
        case 0xD0:
			channelPressure	(midiBuffer[0]  & 0x0F,    // midi channel 0-16
							 midiBuffer[1] & 0x7F);  // pressure amount 0-127
			break;
			
        case 0xE0:
			pitchWheel		(midiBuffer[0] & 0x0F,   // midi channel 0-16
							 midiBuffer[1] & 0x7F, // higher bits 0-6
							 midiBuffer[2] & 0x7F);// lower bits 7-13
			break;
			
        default:
			break;
	}
}
示例#4
0
void handleMIDIMessage(uint8_t ctrlByte, uint8_t msgByte1, uint8_t msgByte2)
{
	uint8_t control = ctrlByte & 0xf0;

	//uint8_t channel = ctrlByte & 0x0f;
	
	
	//lcd_clear_line(1);
	//dip204_printf_string("control: %u",ctrlByte);
	//lcd_clear_line(2);
	//dip204_printf_string("note: %u", msgByte1);

	switch(control)
	{
		case 144:
			if (msgByte2)
			{
				addNote(msgByte1,msgByte2);
			}
			//to deal with note-offs represented as a note-on with zero velocity
			else
			{
				removeNote(msgByte1);
			}
			noteOut();
			midiVol();
			break;
		case 128:
			removeNote(msgByte1);
			noteOut();
			midiVol();
			break;
		// control change
		case 176:
			controlChange(msgByte1,msgByte2);
			//LED_On(LED2);
			//midiVol();
			break;
		// program change	
		case 192:
			programChange(msgByte1);
			break;
		default:
			break;
	}
}