Java Code Examples for javax.sound.midi.InvalidMidiDataException#printStackTrace()
The following examples show how to use
javax.sound.midi.InvalidMidiDataException#printStackTrace() .
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: MidiMessageFactory.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public static MidiMessage noteOffGM(int channel,int note,int velocity){ try { ShortMessage shortMessage = new ShortMessage(); shortMessage.setMessage(ShortMessage.NOTE_OFF, channel, fixValue(note), fixValue(velocity)); return shortMessage; } catch (InvalidMidiDataException e) { e.printStackTrace(); } return null; }
Example 2
Source File: MidiMessageUtils.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public static MidiMessage tempoInUSQ(int usq){ try { MetaMessage message = new MetaMessage(); message.setMessage(0x51, new byte[]{ (byte)((usq >> 16) & 0x00FF),(byte)((usq >> 8) & 0x00FF),(byte)((usq) & 0x00FF) }, 3); return message; } catch (InvalidMidiDataException e) { e.printStackTrace(); } return null; }
Example 3
Source File: MidiMessageUtils.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public static MidiMessage systemReset(){ try { ShortMessage message = new ShortMessage(); message.setMessage(ShortMessage.SYSTEM_RESET); return message; } catch (InvalidMidiDataException e) { e.printStackTrace(); } return null; }
Example 4
Source File: MidiMessageUtils.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public static MidiMessage timeSignature(TGTimeSignature ts){ try { MetaMessage message = new MetaMessage(); message.setMessage(0x58, new byte[]{ (byte)ts.getNumerator(),(byte)ts.getDenominator().getIndex(),(byte)(96 / ts.getDenominator().getValue()),8 }, 4); return message; } catch (InvalidMidiDataException e) { e.printStackTrace(); } return null; }
Example 5
Source File: MidiMessageFactory.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public static MidiMessage noteOn(int channel,int note,int velocity, int voice, boolean bendMode){ try { return new MidiNoteOnMessage(channel, fixValue(note), fixValue(velocity), voice, bendMode); } catch (InvalidMidiDataException e) { e.printStackTrace(); } return null; }
Example 6
Source File: MidiMessageFactory.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public static MidiMessage programChangeGM(int channel,int instrument){ try { ShortMessage shortMessage = new ShortMessage(); shortMessage.setMessage(ShortMessage.PROGRAM_CHANGE, channel, fixValue(instrument), 0); return shortMessage; } catch (InvalidMidiDataException e) { e.printStackTrace(); } return null; }
Example 7
Source File: MidiMessageUtils.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public static MidiMessage noteOff(int channel,int note,int velocity){ try { ShortMessage message = new ShortMessage(); message.setMessage(ShortMessage.NOTE_OFF, fixChannel(channel), fixValue(note), fixValue(velocity)); return message; } catch (InvalidMidiDataException e) { e.printStackTrace(); } return null; }
Example 8
Source File: JavaSoundAudioClip.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private boolean createSequencer(BufferedInputStream in) throws IOException { if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.createSequencer()"); // get the sequencer try { sequencer = MidiSystem.getSequencer( ); } catch(MidiUnavailableException me) { if (DEBUG || Printer.err)me.printStackTrace(); return false; } if (sequencer==null) { return false; } try { sequence = MidiSystem.getSequence(in); if (sequence == null) { return false; } } catch (InvalidMidiDataException e) { if (DEBUG || Printer.err)e.printStackTrace(); return false; } if (DEBUG || Printer.debug)Printer.debug("Created Sequencer."); return true; }
Example 9
Source File: MidiMessageFactory.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public static MidiMessage systemResetGM(){ try { ShortMessage shortMessage = new ShortMessage(); shortMessage.setMessage(ShortMessage.SYSTEM_RESET); return shortMessage; } catch (InvalidMidiDataException e) { e.printStackTrace(); } return null; }
Example 10
Source File: MidiSequenceBuilder.java From mpcmaid with GNU Lesser General Public License v2.1 | 5 votes |
public MidiSequenceBuilder(final int ppq) { try { sequence = new Sequence(Sequence.PPQ, ppq); } catch (InvalidMidiDataException e) { e.printStackTrace(); } }
Example 11
Source File: MidiMessageFactory.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public static MidiMessage programChangeGM(int channel,int instrument){ try { ShortMessage shortMessage = new ShortMessage(); shortMessage.setMessage(ShortMessage.PROGRAM_CHANGE, channel, fixValue(instrument), 0); return shortMessage; } catch (InvalidMidiDataException e) { e.printStackTrace(); } return null; }
Example 12
Source File: JavaSoundAudioClip.java From hottub with GNU General Public License v2.0 | 5 votes |
private boolean createSequencer(BufferedInputStream in) throws IOException { if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.createSequencer()"); // get the sequencer try { sequencer = MidiSystem.getSequencer( ); } catch(MidiUnavailableException me) { if (DEBUG || Printer.err)me.printStackTrace(); return false; } if (sequencer==null) { return false; } try { sequence = MidiSystem.getSequence(in); if (sequence == null) { return false; } } catch (InvalidMidiDataException e) { if (DEBUG || Printer.err)e.printStackTrace(); return false; } if (DEBUG || Printer.debug)Printer.debug("Created Sequencer."); return true; }
Example 13
Source File: MidiMessageFactory.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public static MidiMessage pitchBendGM(int channel,int value){ try { ShortMessage shortMessage = new ShortMessage(); shortMessage.setMessage(ShortMessage.PITCH_BEND, channel, 0, fixValue(value)); return shortMessage; } catch (InvalidMidiDataException e) { e.printStackTrace(); } return null; }
Example 14
Source File: MidiMessageFactory.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public static MidiMessage noteOn(int channel,int note,int velocity, int voice, boolean bendMode){ try { return new MidiNoteOnMessage(channel, fixValue(note), fixValue(velocity), voice, bendMode); } catch (InvalidMidiDataException e) { e.printStackTrace(); } return null; }
Example 15
Source File: MidiMessageFactory.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public static MidiMessage noteOffGM(int channel,int note,int velocity){ try { ShortMessage shortMessage = new ShortMessage(); shortMessage.setMessage(ShortMessage.NOTE_OFF, channel, fixValue(note), fixValue(velocity)); return shortMessage; } catch (InvalidMidiDataException e) { e.printStackTrace(); } return null; }
Example 16
Source File: MidiMessageFactory.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public static MidiMessage controlChangeGM(int channel,int controller,int value){ try { ShortMessage shortMessage = new ShortMessage(); shortMessage.setMessage(ShortMessage.CONTROL_CHANGE,channel, fixValue(controller), fixValue(value)); return shortMessage; } catch (InvalidMidiDataException e) { e.printStackTrace(); } return null; }
Example 17
Source File: JavaSoundAudioClip.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private boolean createSequencer(BufferedInputStream in) throws IOException { if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.createSequencer()"); // get the sequencer try { sequencer = MidiSystem.getSequencer( ); } catch(MidiUnavailableException me) { if (DEBUG || Printer.err)me.printStackTrace(); return false; } if (sequencer==null) { return false; } try { sequence = MidiSystem.getSequence(in); if (sequence == null) { return false; } } catch (InvalidMidiDataException e) { if (DEBUG || Printer.err)e.printStackTrace(); return false; } if (DEBUG || Printer.debug)Printer.debug("Created Sequencer."); return true; }
Example 18
Source File: MidiMessageFactory.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public static MidiMessage controlChangeGM(int channel,int controller,int value){ try { ShortMessage shortMessage = new ShortMessage(); shortMessage.setMessage(ShortMessage.CONTROL_CHANGE,channel, fixValue(controller), fixValue(value)); return shortMessage; } catch (InvalidMidiDataException e) { e.printStackTrace(); } return null; }
Example 19
Source File: JavaSoundAudioClip.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private boolean createSequencer(BufferedInputStream in) throws IOException { if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.createSequencer()"); // get the sequencer try { sequencer = MidiSystem.getSequencer( ); } catch(MidiUnavailableException me) { if (DEBUG || Printer.err)me.printStackTrace(); return false; } if (sequencer==null) { return false; } try { sequence = MidiSystem.getSequence(in); if (sequence == null) { return false; } } catch (InvalidMidiDataException e) { if (DEBUG || Printer.err)e.printStackTrace(); return false; } if (DEBUG || Printer.debug)Printer.debug("Created Sequencer."); return true; }
Example 20
Source File: MidiSequenceBuilder.java From mpcmaid with GNU Lesser General Public License v2.1 | 5 votes |
public void addNote(Track track, int channel, int startTick, int tickLength, int key, int velocity) { try { final ShortMessage on = new ShortMessage(); on.setMessage(ShortMessage.NOTE_ON, channel, key, velocity); final ShortMessage off = new ShortMessage(); off.setMessage(ShortMessage.NOTE_OFF, channel, key, velocity); track.add(new MidiEvent(on, startTick)); track.add(new MidiEvent(off, startTick + tickLength)); } catch (InvalidMidiDataException e) { e.printStackTrace(); } }