Skip to content
Permalink
Browse files

Update JingleNote to 1.14.2 instruments

  • Loading branch information...
me4502 committed Jun 9, 2019
1 parent fe6826f commit 6554efa463634299463b0e79498e9ca470fb146d
@@ -2,35 +2,33 @@

public enum Instrument {

/*
0 = BLOCK_NOTE_HARP = PIANO
1 = BLOCK_NOTE_BASS = BASS
2 = BLOCK_NOTE_SNARE = SNARE_DRUM
3 = BLOCK_NOTE_HAT = STICKS
4 = BLOCK_NOTE_BASEDRUM = BASS_DRUM
5 = BLOCK_NOTE_GUITAR = GUITAR
6 = BLOCK_NOTE_BELL = BELL
7 = BLOCK_NOTE_CHIME = CHIME
8 = BLOCK_NOTE_FLUTE = FLUTE
9 = BLOCK_NOTE_XYLOPHONE = XYLOPHONE
10 = BLOCK_NOTE_PLING = PLING
*/

PIANO, BASS, SNARE_DRUM, STICKS, BASS_DRUM, GUITAR,
BELL, CHIME, FLUTE, XYLOPHONE, PLING;
BANJO,
BASEDRUM,
BASS,
BELL,
BIT,
CHIME,
COW_BELL,
DIDGERIDOO,
FLUTE,
GUITAR,
HARP,
HAT,
IRON_XYLOPHONE,
PLING,
SNARE,
XYLOPHONE;

public static Instrument toMCSound(byte instrument) {
switch (instrument) {
case 0:
return Instrument.PIANO;
case 1:
return Instrument.BASS;
case 2:
return Instrument.SNARE_DRUM;
return Instrument.SNARE;
case 3:
return Instrument.STICKS;
return Instrument.HAT;
case 4:
return Instrument.BASS_DRUM;
return Instrument.BASEDRUM;
case 5:
return Instrument.GUITAR;
case 6:
@@ -43,8 +41,19 @@ public static Instrument toMCSound(byte instrument) {
return Instrument.XYLOPHONE;
case 10:
return Instrument.PLING;
case 11:
return Instrument.BANJO;
case 12:
return Instrument.BIT;
case 13:
return Instrument.COW_BELL;
case 14:
return Instrument.DIDGERIDOO;
case 15:
return Instrument.IRON_XYLOPHONE;
case 0:
default:
return Instrument.PIANO;
return Instrument.HARP;
}
}
}
@@ -28,34 +28,34 @@
*/
public final class MidiJingleSequencer implements JingleSequencer {

private static final int[] instruments = {
0, 0, 0, 0, 0, 0, 0, 5, // 8
9, 9, 9, 9, 9, 6, 0, 9, // 16
9, 0, 0, 0, 0, 0, 0, 5, // 24
5, 5, 5, 5, 5, 5, 5, 1, // 32
1, 1, 1, 1, 1, 1, 1, 5, // 40
1, 5, 5, 5, 5, 5, 5, 5, // 48
10,5, 5, 8, 8, 8, 8, 8, // 56
8, 8, 8, 8, 8, 8, 8, 8, // 64
8, 8, 8, 8, 8, 8, 8, 8, // 72
8, 8, 8, 8, 8, 8, 8, 8, // 80
0, 0, 0, 0, 0, 0, 0, 0, // 88
0, 0, 0, 0, 0, 0, 0, 0, // 96
0, 0, 0, 0, 0, 0, 0, 5, // 104
5, 5, 5, 9, 8, 5, 8, 6, // 112
6, 3, 3, 2, 2, 2, 6, 5, // 120
1, 1, 1, 6, 1, 2, 4, 7, // 128
private static final byte[] instruments = {
0, 0, 0, 0, 0, 0, 0,11, // 0-7
6, 6, 6, 6, 9, 9,15,11, // 8-15
10,5, 5,10,10,10,10,10, // 16-23
5, 5, 5, 5, 5, 5, 5, 5, // 24-31
1, 1, 1, 1, 1, 1, 1, 1, // 32-39
0,10,10, 1, 0, 0, 0, 4, // 40-47
0, 0, 0, 0, 8, 8, 8,12, // 48-55
8,14,14,14,14,14, 8, 8, // 56-63
8, 8, 8,14,14, 8, 8, 8, // 64-71
8, 8, 8, 8,14, 8, 8, 8, // 72-79
8,14, 8, 8, 5, 8,12, 1, // 80-87
1, 0, 0, 8, 0, 0, 0, 0, // 88-95
0, 0, 7, 0, 0, 0, 0,12, // 96-103
11,11,3, 3, 3,14,10, 6, // 104-111
6, 3, 3, 2, 2, 2, 6, 5, // 112-119
1, 1, 1,13,13, 2, 4, 7, // 120-127
};


private static final int[] percussion = {
9, 6, 4, 4, 3, 2, 3, 2, //40 - Electric Snare
2, 2, 2, 2, 2, 2, 2, 2, //48 - Hi Mid Tom
7, 2, 7, 7, 6, 3, 7, 6, //56 - Cowbell
7, 3, 7, 2, 2, 3, 3, 3, //64 - Low Conga
2, 2, 6, 6, 2, 2, 0, 0, //72 - Long Whistle
3, 3, 3, 3, 3, 3, 5, 5, //80 - Open Cuica
10, 10, //82 - Open Triangle
private static final byte[] percussion = {
9, 6, 4, 4, 3, 2, 3, 2, //40 - Electric Snare
2, 2, 2, 2, 2, 2, 2, 2, //48 - Hi Mid Tom
7, 2, 7, 7, 6, 3, 7, 6, //56 - Cowbell
7, 3, 7, 2, 2, 3, 3, 3, //64 - Low Conga
2, 2, 6, 6, 2, 2, 0, 0, //72 - Long Whistle
3, 3, 3, 3, 3, 3, 5, 5, //80 - Open Cuica
15, 15, //82 - Open Triangle
};

private Sequencer sequencer;
@@ -88,7 +88,7 @@ public void run() throws InterruptedException {
}

if (skip) {
musicKeys.add(new Note(Instrument.PIANO, (byte) 0, 0));
musicKeys.add(new Note(Instrument.HARP, (byte) 0, 0));
} else {
if (octave < 2) octave = 2;

@@ -37,30 +37,78 @@ public boolean isPlaying() {

}

private static Sound BANJO;
private static Sound BIT;
private static Sound COWBELL;
private static Sound DIDGERIDOO;
private static Sound IRON_XYLOPHONE;

static {
try {
for (Sound sound : Sound.class.getEnumConstants()) {
switch (sound.name()) {
case "BLOCK_NOTE_BLOCK_BANJO":
BANJO = sound;
break;
case "BLOCK_NOTE_BLOCK_BIT":
BIT = sound;
break;
case "BLOCK_NOTE_BLOCK_COW_BELL":
COWBELL = sound;
break;
case "BLOCK_NOTE_BLOCK_DIDGERIDOO":
DIDGERIDOO = sound;
break;
case "BLOCK_NOTE_BLOCK_IRON_XYLOPHONE":
IRON_XYLOPHONE = sound;
break;
}
}
if (BANJO == null) {
throw new RuntimeException();
}
} catch (Throwable t) {
BANJO = Sound.BLOCK_NOTE_BLOCK_GUITAR;
BIT = Sound.BLOCK_NOTE_BLOCK_PLING;
COWBELL = Sound.BLOCK_NOTE_BLOCK_BELL;
DIDGERIDOO = Sound.BLOCK_NOTE_BLOCK_BASS;
IRON_XYLOPHONE = Sound.BLOCK_NOTE_BLOCK_XYLOPHONE;
}
}

private static Sound toSound(Instrument instrument) {
switch(instrument) {
case PIANO:
return Sound.BLOCK_NOTE_BLOCK_HARP;
case BASS:
return Sound.BLOCK_NOTE_BLOCK_BASS;
case SNARE_DRUM:
case SNARE:
return Sound.BLOCK_NOTE_BLOCK_SNARE;
case STICKS:
case HAT:
return Sound.BLOCK_NOTE_BLOCK_HAT;
case BASS_DRUM:
case BANJO:
return BANJO;
case BASEDRUM:
return Sound.BLOCK_NOTE_BLOCK_BASEDRUM;
case BELL:
return Sound.BLOCK_NOTE_BLOCK_BELL;
case BIT:
return BIT;
case CHIME:
return Sound.BLOCK_NOTE_BLOCK_CHIME;
case COW_BELL:
return COWBELL;
case DIDGERIDOO:
return DIDGERIDOO;
case FLUTE:
return Sound.BLOCK_NOTE_BLOCK_FLUTE;
case XYLOPHONE:
return Sound.BLOCK_NOTE_BLOCK_XYLOPHONE;
case IRON_XYLOPHONE:
return IRON_XYLOPHONE;
case PLING:
return Sound.BLOCK_NOTE_BLOCK_PLING;
case GUITAR:
return Sound.BLOCK_NOTE_BLOCK_GUITAR;
case HARP:
default:
return Sound.BLOCK_NOTE_BLOCK_HARP;
}

0 comments on commit 6554efa

Please sign in to comment.
You can’t perform that action at this time.