Loading src/main/java/ch15/BeatBox.java +9 −9 Changes for src/main/java/ch15/BeatBox.java: 9 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ public class BeatBox { frame.setVisible(true); } public void setUpMidi() { private void setUpMidi() { try { sequencer = MidiSystem.getSequencer(); sequencer.open(); Loading @@ -97,7 +97,7 @@ public class BeatBox { } } public void buildTrackAndStart() { private void buildTrackAndStart() { int[] trackList; sequence.deleteTrack(track); Loading @@ -118,17 +118,22 @@ public class BeatBox { track.add(makeEvent(CONTROL_CHANGE, 1, 127, 0, 16)); } track.add(makeEvent(192, 9, 1, 0, 15)); track.add(makeEvent(PROGRAM_CHANGE, 9, 1, 0, 15)); try { sequencer.setSequence(sequence); sequencer.setLoopCount(sequencer.LOOP_CONTINUOUSLY); sequencer.start(); sequencer.setTempoInBPM(120); sequencer.start(); } catch (Exception e) { e.printStackTrace(); } } private void changeTempo(float tempoMultiplier) { float tempoFactor = sequencer.getTempoFactor(); sequencer.setTempoFactor(tempoFactor * tempoMultiplier); } private void makeTracks(int[] list) { for (int i = 0; i < 16; i++) { int key = list[i]; Loading @@ -140,11 +145,6 @@ public class BeatBox { } } private void changeTempo(float tempoMultiplier) { float tempoFactor = sequencer.getTempoFactor(); sequencer.setTempoFactor(tempoFactor * tempoMultiplier); } public static MidiEvent makeEvent(int cmd, int chnl, int one, int two, int tick) { MidiEvent event = null; try { Loading Loading
src/main/java/ch15/BeatBox.java +9 −9 Changes for src/main/java/ch15/BeatBox.java: 9 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ public class BeatBox { frame.setVisible(true); } public void setUpMidi() { private void setUpMidi() { try { sequencer = MidiSystem.getSequencer(); sequencer.open(); Loading @@ -97,7 +97,7 @@ public class BeatBox { } } public void buildTrackAndStart() { private void buildTrackAndStart() { int[] trackList; sequence.deleteTrack(track); Loading @@ -118,17 +118,22 @@ public class BeatBox { track.add(makeEvent(CONTROL_CHANGE, 1, 127, 0, 16)); } track.add(makeEvent(192, 9, 1, 0, 15)); track.add(makeEvent(PROGRAM_CHANGE, 9, 1, 0, 15)); try { sequencer.setSequence(sequence); sequencer.setLoopCount(sequencer.LOOP_CONTINUOUSLY); sequencer.start(); sequencer.setTempoInBPM(120); sequencer.start(); } catch (Exception e) { e.printStackTrace(); } } private void changeTempo(float tempoMultiplier) { float tempoFactor = sequencer.getTempoFactor(); sequencer.setTempoFactor(tempoFactor * tempoMultiplier); } private void makeTracks(int[] list) { for (int i = 0; i < 16; i++) { int key = list[i]; Loading @@ -140,11 +145,6 @@ public class BeatBox { } } private void changeTempo(float tempoMultiplier) { float tempoFactor = sequencer.getTempoFactor(); sequencer.setTempoFactor(tempoFactor * tempoMultiplier); } public static MidiEvent makeEvent(int cmd, int chnl, int one, int two, int tick) { MidiEvent event = null; try { Loading