Java Code Examples for javax.sound.midi.ShortMessage#CONTROL_CHANGE
The following examples show how to use
javax.sound.midi.ShortMessage#CONTROL_CHANGE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MiPort.java From tuxguitar with GNU Lesser General Public License v2.1 | 6 votes |
public void send(MidiMessage inMessage, long inTimeStamp) { if(inMessage instanceof ShortMessage) { ShortMessage mm = (ShortMessage)inMessage; switch(mm.getCommand()) { case ShortMessage.NOTE_ON: case ShortMessage.NOTE_OFF: MiProvider.instance().noteReceived(mm, inTimeStamp); break; case ShortMessage.CONTROL_CHANGE: //System.err.println("Control change"); break; } } }
Example 2
Source File: MidiReceiverImpl.java From tuxguitar with GNU Lesser General Public License v2.1 | 6 votes |
private void parseMessage(MidiMessage message) throws MidiPlayerException{ byte[] data = message.getMessage(); if( data.length > 0 ){ //NOTE ON if(((data[0] & 0xFF) & 0xF0) == ShortMessage.NOTE_ON){ parseNoteOn(data, findChannel(message), findVoice(message), findBendMode(message)); } //NOTE OFF else if(((data[0] & 0xFF) & 0xF0) == ShortMessage.NOTE_OFF){ parseNoteOff(data, findChannel(message), findVoice(message), findBendMode(message)); } //PITCH BEND else if(((data[0] & 0xFF) & 0xF0) == ShortMessage.PITCH_BEND){ parsePitchBend(data, findChannel(message), findVoice(message), findBendMode(message)); } //PROGRAM CHANGE else if(((data[0] & 0xFF) & 0xF0) == ShortMessage.PROGRAM_CHANGE){ parseProgramChange(data, findChannel(message)); } //CONTROL CHANGE else if(((data[0] & 0xFF) & 0xF0) == ShortMessage.CONTROL_CHANGE){ parseControlChange(data, findChannel(message)); } } }
Example 3
Source File: SoftMainMixer.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void processMessage(int ch, int cmd, int data1, int data2) { synchronized (synth.control_mutex) { activity(); } if (cmd == 0xF0) { int status = cmd | ch; switch (status) { case ShortMessage.ACTIVE_SENSING: synchronized (synth.control_mutex) { active_sensing_on = true; } break; default: break; } return; } SoftChannel[] channels = synth.channels; if (ch >= channels.length) return; SoftChannel softchannel = channels[ch]; switch (cmd) { case ShortMessage.NOTE_ON: if(delay_midievent != 0) softchannel.noteOn(data1, data2, delay_midievent); else softchannel.noteOn(data1, data2); break; case ShortMessage.NOTE_OFF: softchannel.noteOff(data1, data2); break; case ShortMessage.POLY_PRESSURE: softchannel.setPolyPressure(data1, data2); break; case ShortMessage.CONTROL_CHANGE: softchannel.controlChange(data1, data2); break; case ShortMessage.PROGRAM_CHANGE: softchannel.programChange(data1); break; case ShortMessage.CHANNEL_PRESSURE: softchannel.setChannelPressure(data1); break; case ShortMessage.PITCH_BEND: softchannel.setPitchBend(data1 + data2 * 128); break; default: break; } }
Example 4
Source File: SoftMainMixer.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public void processMessage(int ch, int cmd, int data1, int data2) { synchronized (synth.control_mutex) { activity(); } if (cmd == 0xF0) { int status = cmd | ch; switch (status) { case ShortMessage.ACTIVE_SENSING: synchronized (synth.control_mutex) { active_sensing_on = true; } break; default: break; } return; } SoftChannel[] channels = synth.channels; if (ch >= channels.length) return; SoftChannel softchannel = channels[ch]; switch (cmd) { case ShortMessage.NOTE_ON: if(delay_midievent != 0) softchannel.noteOn(data1, data2, delay_midievent); else softchannel.noteOn(data1, data2); break; case ShortMessage.NOTE_OFF: softchannel.noteOff(data1, data2); break; case ShortMessage.POLY_PRESSURE: softchannel.setPolyPressure(data1, data2); break; case ShortMessage.CONTROL_CHANGE: softchannel.controlChange(data1, data2); break; case ShortMessage.PROGRAM_CHANGE: softchannel.programChange(data1); break; case ShortMessage.CHANNEL_PRESSURE: softchannel.setChannelPressure(data1); break; case ShortMessage.PITCH_BEND: softchannel.setPitchBend(data1 + data2 * 128); break; default: break; } }
Example 5
Source File: SoftMainMixer.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void processMessage(int ch, int cmd, int data1, int data2) { synchronized (synth.control_mutex) { activity(); } if (cmd == 0xF0) { int status = cmd | ch; switch (status) { case ShortMessage.ACTIVE_SENSING: synchronized (synth.control_mutex) { active_sensing_on = true; } break; default: break; } return; } SoftChannel[] channels = synth.channels; if (ch >= channels.length) return; SoftChannel softchannel = channels[ch]; switch (cmd) { case ShortMessage.NOTE_ON: if(delay_midievent != 0) softchannel.noteOn(data1, data2, delay_midievent); else softchannel.noteOn(data1, data2); break; case ShortMessage.NOTE_OFF: softchannel.noteOff(data1, data2); break; case ShortMessage.POLY_PRESSURE: softchannel.setPolyPressure(data1, data2); break; case ShortMessage.CONTROL_CHANGE: softchannel.controlChange(data1, data2); break; case ShortMessage.PROGRAM_CHANGE: softchannel.programChange(data1); break; case ShortMessage.CHANNEL_PRESSURE: softchannel.setChannelPressure(data1); break; case ShortMessage.PITCH_BEND: softchannel.setPitchBend(data1 + data2 * 128); break; default: break; } }
Example 6
Source File: SoftMainMixer.java From tuxguitar with GNU Lesser General Public License v2.1 | 4 votes |
public void processMessage(int ch, int cmd, int data1, int data2) { synchronized (synth.control_mutex) { activity(); } if (cmd == 0xF0) { int status = cmd | ch; switch (status) { case ShortMessage.ACTIVE_SENSING: synchronized (synth.control_mutex) { active_sensing_on = true; } break; default: break; } return; } SoftChannel[] channels = synth.channels; if (ch >= channels.length) return; SoftChannel softchannel = channels[ch]; switch (cmd) { case ShortMessage.NOTE_ON: softchannel.noteOn(data1, data2); break; case ShortMessage.NOTE_OFF: softchannel.noteOff(data1, data2); break; case ShortMessage.POLY_PRESSURE: softchannel.setPolyPressure(data1, data2); break; case ShortMessage.CONTROL_CHANGE: softchannel.controlChange(data1, data2); break; case ShortMessage.PROGRAM_CHANGE: softchannel.programChange(data1); break; case ShortMessage.CHANNEL_PRESSURE: softchannel.setChannelPressure(data1); break; case ShortMessage.PITCH_BEND: softchannel.setPitchBend(data1 + data2 * 128); break; default: break; } }
Example 7
Source File: MidiToAudioWriter.java From tuxguitar with GNU Lesser General Public License v2.1 | 4 votes |
private static List<Patch> getPatchs(List<MidiEvent> events){ Patch[] channels = new Patch[16]; Iterator<MidiEvent> it = events.iterator(); while(it.hasNext()){ MidiEvent event = (MidiEvent)it.next(); MidiMessage msg = event.getMessage(); if( msg instanceof ShortMessage ){ ShortMessage shortMessage = (ShortMessage)msg; int channel = shortMessage.getChannel(); if( channel >= 0 && channel < channels.length ){ int command = shortMessage.getCommand(); int data1 = shortMessage.getData1(); int data2 = shortMessage.getData2(); int bank = (command == ShortMessage.CONTROL_CHANGE && data1 == MidiControllers.BANK_SELECT ? data2 : -1); int program = (command == ShortMessage.PROGRAM_CHANGE ? data1 : -1); if( bank >= 0 || program >= 0 ){ if( bank < 0 ){ bank = (channels[channel] != null ? channels[channel].getBank() : 0); } if( program < 0 ){ program = (channels[channel] != null ? channels[channel].getProgram() : 0); } channels[channel] = new Patch(bank, program); } } } } List<Patch> patchs = new ArrayList<Patch>(); for( int i = 0 ; i < channels.length ; i ++ ){ if( channels[i] != null ){ boolean patchExists = false; Iterator<Patch> patchIt = patchs.iterator(); while( patchIt.hasNext() ){ Patch patch = (Patch) patchIt.next(); if( patch.getBank() == channels[i].getBank() && patch.getProgram() == channels[i].getProgram() ){ patchExists = true; } } if(!patchExists ){ patchs.add(channels[i]); } } } patchs.add(new Patch(128, 0)); return patchs; }
Example 8
Source File: SoftMainMixer.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public void processMessage(int ch, int cmd, int data1, int data2) { synchronized (synth.control_mutex) { activity(); } if (cmd == 0xF0) { int status = cmd | ch; switch (status) { case ShortMessage.ACTIVE_SENSING: synchronized (synth.control_mutex) { active_sensing_on = true; } break; default: break; } return; } SoftChannel[] channels = synth.channels; if (ch >= channels.length) return; SoftChannel softchannel = channels[ch]; switch (cmd) { case ShortMessage.NOTE_ON: if(delay_midievent != 0) softchannel.noteOn(data1, data2, delay_midievent); else softchannel.noteOn(data1, data2); break; case ShortMessage.NOTE_OFF: softchannel.noteOff(data1, data2); break; case ShortMessage.POLY_PRESSURE: softchannel.setPolyPressure(data1, data2); break; case ShortMessage.CONTROL_CHANGE: softchannel.controlChange(data1, data2); break; case ShortMessage.PROGRAM_CHANGE: softchannel.programChange(data1); break; case ShortMessage.CHANNEL_PRESSURE: softchannel.setChannelPressure(data1); break; case ShortMessage.PITCH_BEND: softchannel.setPitchBend(data1 + data2 * 128); break; default: break; } }
Example 9
Source File: SoftMainMixer.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void processMessage(int ch, int cmd, int data1, int data2) { synchronized (synth.control_mutex) { activity(); } if (cmd == 0xF0) { int status = cmd | ch; switch (status) { case ShortMessage.ACTIVE_SENSING: synchronized (synth.control_mutex) { active_sensing_on = true; } break; default: break; } return; } SoftChannel[] channels = synth.channels; if (ch >= channels.length) return; SoftChannel softchannel = channels[ch]; switch (cmd) { case ShortMessage.NOTE_ON: if(delay_midievent != 0) softchannel.noteOn(data1, data2, delay_midievent); else softchannel.noteOn(data1, data2); break; case ShortMessage.NOTE_OFF: softchannel.noteOff(data1, data2); break; case ShortMessage.POLY_PRESSURE: softchannel.setPolyPressure(data1, data2); break; case ShortMessage.CONTROL_CHANGE: softchannel.controlChange(data1, data2); break; case ShortMessage.PROGRAM_CHANGE: softchannel.programChange(data1); break; case ShortMessage.CHANNEL_PRESSURE: softchannel.setChannelPressure(data1); break; case ShortMessage.PITCH_BEND: softchannel.setPitchBend(data1 + data2 * 128); break; default: break; } }
Example 10
Source File: SoftMainMixer.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public void processMessage(int ch, int cmd, int data1, int data2) { synchronized (synth.control_mutex) { activity(); } if (cmd == 0xF0) { int status = cmd | ch; switch (status) { case ShortMessage.ACTIVE_SENSING: synchronized (synth.control_mutex) { active_sensing_on = true; } break; default: break; } return; } SoftChannel[] channels = synth.channels; if (ch >= channels.length) return; SoftChannel softchannel = channels[ch]; switch (cmd) { case ShortMessage.NOTE_ON: if(delay_midievent != 0) softchannel.noteOn(data1, data2, delay_midievent); else softchannel.noteOn(data1, data2); break; case ShortMessage.NOTE_OFF: softchannel.noteOff(data1, data2); break; case ShortMessage.POLY_PRESSURE: softchannel.setPolyPressure(data1, data2); break; case ShortMessage.CONTROL_CHANGE: softchannel.controlChange(data1, data2); break; case ShortMessage.PROGRAM_CHANGE: softchannel.programChange(data1); break; case ShortMessage.CHANNEL_PRESSURE: softchannel.setChannelPressure(data1); break; case ShortMessage.PITCH_BEND: softchannel.setPitchBend(data1 + data2 * 128); break; default: break; } }
Example 11
Source File: SoftMainMixer.java From hottub with GNU General Public License v2.0 | 4 votes |
public void processMessage(int ch, int cmd, int data1, int data2) { synchronized (synth.control_mutex) { activity(); } if (cmd == 0xF0) { int status = cmd | ch; switch (status) { case ShortMessage.ACTIVE_SENSING: synchronized (synth.control_mutex) { active_sensing_on = true; } break; default: break; } return; } SoftChannel[] channels = synth.channels; if (ch >= channels.length) return; SoftChannel softchannel = channels[ch]; switch (cmd) { case ShortMessage.NOTE_ON: if(delay_midievent != 0) softchannel.noteOn(data1, data2, delay_midievent); else softchannel.noteOn(data1, data2); break; case ShortMessage.NOTE_OFF: softchannel.noteOff(data1, data2); break; case ShortMessage.POLY_PRESSURE: softchannel.setPolyPressure(data1, data2); break; case ShortMessage.CONTROL_CHANGE: softchannel.controlChange(data1, data2); break; case ShortMessage.PROGRAM_CHANGE: softchannel.programChange(data1); break; case ShortMessage.CHANNEL_PRESSURE: softchannel.setChannelPressure(data1); break; case ShortMessage.PITCH_BEND: softchannel.setPitchBend(data1 + data2 * 128); break; default: break; } }
Example 12
Source File: SoftMainMixer.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void processMessage(int ch, int cmd, int data1, int data2) { synchronized (synth.control_mutex) { activity(); } if (cmd == 0xF0) { int status = cmd | ch; switch (status) { case ShortMessage.ACTIVE_SENSING: synchronized (synth.control_mutex) { active_sensing_on = true; } break; default: break; } return; } SoftChannel[] channels = synth.channels; if (ch >= channels.length) return; SoftChannel softchannel = channels[ch]; switch (cmd) { case ShortMessage.NOTE_ON: if(delay_midievent != 0) softchannel.noteOn(data1, data2, delay_midievent); else softchannel.noteOn(data1, data2); break; case ShortMessage.NOTE_OFF: softchannel.noteOff(data1, data2); break; case ShortMessage.POLY_PRESSURE: softchannel.setPolyPressure(data1, data2); break; case ShortMessage.CONTROL_CHANGE: softchannel.controlChange(data1, data2); break; case ShortMessage.PROGRAM_CHANGE: softchannel.programChange(data1); break; case ShortMessage.CHANNEL_PRESSURE: softchannel.setChannelPressure(data1); break; case ShortMessage.PITCH_BEND: softchannel.setPitchBend(data1 + data2 * 128); break; default: break; } }
Example 13
Source File: SoftMainMixer.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void processMessage(int ch, int cmd, int data1, int data2) { synchronized (synth.control_mutex) { activity(); } if (cmd == 0xF0) { int status = cmd | ch; switch (status) { case ShortMessage.ACTIVE_SENSING: synchronized (synth.control_mutex) { active_sensing_on = true; } break; default: break; } return; } SoftChannel[] channels = synth.channels; if (ch >= channels.length) return; SoftChannel softchannel = channels[ch]; switch (cmd) { case ShortMessage.NOTE_ON: if(delay_midievent != 0) softchannel.noteOn(data1, data2, delay_midievent); else softchannel.noteOn(data1, data2); break; case ShortMessage.NOTE_OFF: softchannel.noteOff(data1, data2); break; case ShortMessage.POLY_PRESSURE: softchannel.setPolyPressure(data1, data2); break; case ShortMessage.CONTROL_CHANGE: softchannel.controlChange(data1, data2); break; case ShortMessage.PROGRAM_CHANGE: softchannel.programChange(data1); break; case ShortMessage.CHANNEL_PRESSURE: softchannel.setChannelPressure(data1); break; case ShortMessage.PITCH_BEND: softchannel.setPitchBend(data1 + data2 * 128); break; default: break; } }
Example 14
Source File: SoftMainMixer.java From Bytecoder with Apache License 2.0 | 4 votes |
public void processMessage(int ch, int cmd, int data1, int data2) { synchronized (synth.control_mutex) { activity(); } if (cmd == 0xF0) { int status = cmd | ch; switch (status) { case ShortMessage.ACTIVE_SENSING: synchronized (synth.control_mutex) { active_sensing_on = true; } break; default: break; } return; } SoftChannel[] channels = synth.channels; if (ch >= channels.length) return; SoftChannel softchannel = channels[ch]; switch (cmd) { case ShortMessage.NOTE_ON: if(delay_midievent != 0) softchannel.noteOn(data1, data2, delay_midievent); else softchannel.noteOn(data1, data2); break; case ShortMessage.NOTE_OFF: softchannel.noteOff(data1, data2); break; case ShortMessage.POLY_PRESSURE: softchannel.setPolyPressure(data1, data2); break; case ShortMessage.CONTROL_CHANGE: softchannel.controlChange(data1, data2); break; case ShortMessage.PROGRAM_CHANGE: softchannel.programChange(data1); break; case ShortMessage.CHANNEL_PRESSURE: softchannel.setChannelPressure(data1); break; case ShortMessage.PITCH_BEND: softchannel.setPitchBend(data1 + data2 * 128); break; default: break; } }
Example 15
Source File: SoftMainMixer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public void processMessage(int ch, int cmd, int data1, int data2) { synchronized (synth.control_mutex) { activity(); } if (cmd == 0xF0) { int status = cmd | ch; switch (status) { case ShortMessage.ACTIVE_SENSING: synchronized (synth.control_mutex) { active_sensing_on = true; } break; default: break; } return; } SoftChannel[] channels = synth.channels; if (ch >= channels.length) return; SoftChannel softchannel = channels[ch]; switch (cmd) { case ShortMessage.NOTE_ON: if(delay_midievent != 0) softchannel.noteOn(data1, data2, delay_midievent); else softchannel.noteOn(data1, data2); break; case ShortMessage.NOTE_OFF: softchannel.noteOff(data1, data2); break; case ShortMessage.POLY_PRESSURE: softchannel.setPolyPressure(data1, data2); break; case ShortMessage.CONTROL_CHANGE: softchannel.controlChange(data1, data2); break; case ShortMessage.PROGRAM_CHANGE: softchannel.programChange(data1); break; case ShortMessage.CHANNEL_PRESSURE: softchannel.setChannelPressure(data1); break; case ShortMessage.PITCH_BEND: softchannel.setPitchBend(data1 + data2 * 128); break; default: break; } }
Example 16
Source File: SoftMainMixer.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void processMessage(int ch, int cmd, int data1, int data2) { synchronized (synth.control_mutex) { activity(); } if (cmd == 0xF0) { int status = cmd | ch; switch (status) { case ShortMessage.ACTIVE_SENSING: synchronized (synth.control_mutex) { active_sensing_on = true; } break; default: break; } return; } SoftChannel[] channels = synth.channels; if (ch >= channels.length) return; SoftChannel softchannel = channels[ch]; switch (cmd) { case ShortMessage.NOTE_ON: if(delay_midievent != 0) softchannel.noteOn(data1, data2, delay_midievent); else softchannel.noteOn(data1, data2); break; case ShortMessage.NOTE_OFF: softchannel.noteOff(data1, data2); break; case ShortMessage.POLY_PRESSURE: softchannel.setPolyPressure(data1, data2); break; case ShortMessage.CONTROL_CHANGE: softchannel.controlChange(data1, data2); break; case ShortMessage.PROGRAM_CHANGE: softchannel.programChange(data1); break; case ShortMessage.CHANNEL_PRESSURE: softchannel.setChannelPressure(data1); break; case ShortMessage.PITCH_BEND: softchannel.setPitchBend(data1 + data2 * 128); break; default: break; } }
Example 17
Source File: SoftMainMixer.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public void processMessage(int ch, int cmd, int data1, int data2) { synchronized (synth.control_mutex) { activity(); } if (cmd == 0xF0) { int status = cmd | ch; switch (status) { case ShortMessage.ACTIVE_SENSING: synchronized (synth.control_mutex) { active_sensing_on = true; } break; default: break; } return; } SoftChannel[] channels = synth.channels; if (ch >= channels.length) return; SoftChannel softchannel = channels[ch]; switch (cmd) { case ShortMessage.NOTE_ON: if(delay_midievent != 0) softchannel.noteOn(data1, data2, delay_midievent); else softchannel.noteOn(data1, data2); break; case ShortMessage.NOTE_OFF: softchannel.noteOff(data1, data2); break; case ShortMessage.POLY_PRESSURE: softchannel.setPolyPressure(data1, data2); break; case ShortMessage.CONTROL_CHANGE: softchannel.controlChange(data1, data2); break; case ShortMessage.PROGRAM_CHANGE: softchannel.programChange(data1); break; case ShortMessage.CHANNEL_PRESSURE: softchannel.setChannelPressure(data1); break; case ShortMessage.PITCH_BEND: softchannel.setPitchBend(data1 + data2 * 128); break; default: break; } }
Example 18
Source File: SoftMainMixer.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void processMessage(int ch, int cmd, int data1, int data2) { synchronized (synth.control_mutex) { activity(); } if (cmd == 0xF0) { int status = cmd | ch; switch (status) { case ShortMessage.ACTIVE_SENSING: synchronized (synth.control_mutex) { active_sensing_on = true; } break; default: break; } return; } SoftChannel[] channels = synth.channels; if (ch >= channels.length) return; SoftChannel softchannel = channels[ch]; switch (cmd) { case ShortMessage.NOTE_ON: if(delay_midievent != 0) softchannel.noteOn(data1, data2, delay_midievent); else softchannel.noteOn(data1, data2); break; case ShortMessage.NOTE_OFF: softchannel.noteOff(data1, data2); break; case ShortMessage.POLY_PRESSURE: softchannel.setPolyPressure(data1, data2); break; case ShortMessage.CONTROL_CHANGE: softchannel.controlChange(data1, data2); break; case ShortMessage.PROGRAM_CHANGE: softchannel.programChange(data1); break; case ShortMessage.CHANNEL_PRESSURE: softchannel.setChannelPressure(data1); break; case ShortMessage.PITCH_BEND: softchannel.setPitchBend(data1 + data2 * 128); break; default: break; } }