Exemple #1
0
void pressureChange(u8 value)
{
	u8 newvalue = value;
	
	// Clamp
	if(newvalue > 127) newvalue = 127;
	
	dsmi_write(0xB0+channel, 0, newvalue);
}
Exemple #2
0
void pitchChange(s16 value)
{
	s16 newvalue = value;
	
	// Clamp to [-64, 64]
	if(newvalue < -64) newvalue = -64;
	if(newvalue > 63) newvalue = 63;
	
	// Make positive
	newvalue += 64;
	
	// Scale to interval [0,2^14]
	u16 uvalue = newvalue * 128;
	
	// Split into lower and higher 7 bit
	u8 ls7b = uvalue & 0x7F;
	uvalue >>= 7;
	u8 ms7b = uvalue & 0x7F;
	
	dsmi_write(0xE0+channel, ls7b, ms7b);
}
Exemple #3
0
void stop(u8 note)
{
	dsmi_write(0x80 | channel, note+12*baseOctave, 0);
}
Exemple #4
0
void play(u8 note)
{
	dsmi_write(0x90 | channel, note+12*baseOctave, 127);
}
Exemple #5
0
void MidiModule::send_note_off(int channel, int note)
{
   channel--;
   dsmi_write(0x80 | channel, note, 0);
}
Exemple #6
0
void MidiModule::send_note_on(int channel, int note, int velocity)
{
   channel--;
   dsmi_write(0x90 | channel, note, velocity);
}
Exemple #7
0
void MidiModule::send(u8 message, u8 data1, u8 data2)
{
   dsmi_write(message,data1,data2);
}