lagu


import java.io.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.microedition.media.*;
import javax.microedition.media.control.*;

public class lagu extends MIDlet implements CommandListener {
private final static String Laguku = “Satu Nusa Satu Bangsa”;
private final static String kQuandoMenVo = “Syukur”;
private final static String kTwinkle = “Halo Halo Bandung”;

private Display mDisplay;
private List mMainScreen;

public void startApp() {
mDisplay = Display.getDisplay(this);

if (mMainScreen == null) {
mMainScreen = new List(“AudioMIDlet”, List.IMPLICIT);

mMainScreen.append(Laguku, null);
mMainScreen.append(kQuandoMenVo, null);
mMainScreen.append(kTwinkle, null);
mMainScreen.addCommand(new Command(“Exit”, Command.EXIT, 0));
mMainScreen.addCommand(new Command(“Play”, Command.SCREEN, 0));
mMainScreen.setCommandListener(this);
}

mDisplay.setCurrent(mMainScreen);
}

public void pauseApp() {}

public void destroyApp(boolean unconditional) {}

public void commandAction(Command c, Displayable s) {
if (c.getCommandType() == Command.EXIT) notifyDestroyed();
else run();
}

public void run() {
String selection = mMainScreen.getString(
mMainScreen.getSelectedIndex());

byte[] sequence = null;
if (selection.equals(Laguku)) {
sequence = new byte[] {
ToneControl.VERSION, 1,
// Satu nusa satu bangsa
60,32,60,16,60,16,62,16,60,16,56,32,
66,32,66,16,66,16,68,16,70,16,62,32,
60,32,66,16,68,16,70,32,66,32,
68,32,70,32,68,64,

60,32,60,16,60,16,62,16,60,16,56,32,
66,32,66,16,66,16,68,16,66,16,62,32,
60,32,66,16,68,16,70,32,68,32,
68,32,64,32,66,64,

68,32,70,16,70,16,68,32,66,32,
64,32,62,32,60,64,
72,32,72,16,72,16,70,32,70,32,
72,32,70,32,68,64,

60,32,60,16,60,16,62,16,60,16,56,32,
66,32,66,16,66,16,68,16,66,16,62,32,
60,32,66,16,68,16,70,32,68,32,
68,32,64,32,66,64,

//        52, 32, // 6
//      54, 32, // 7
//        56, 32, // 1
//      58, 32, // 2
//      60, 32, // 3
//        62, 32, // 4
//        64, 32, // 5
//        66, 32, // 6
//        68, 32, // 7
//        70, 32, // 1
//        72, 32, // 2
//        74, 32, // 3
//        76, 32, // 4
//        78, 32, // 5
52,32,
62,96,60,16,56,16,
60,32,68,32,68,16,52,16,54,16,56,16,
58,32,56,32,54,32,52,32,
56,96,52,32,

64,96,62,16,60,16,
63,32,60,64,60,16,58,16,
56,32,60,32,66,32,68,32,
62,96,52,32,

62,96,60,16,56,16,
58,32,56,32,56,16,52,16,54,16,56,16,
58,32,62,32,64,32,62,32,
54,96,54,16,56,16,

58,32,58,16,56,16,60,16,58,16,56,16,54,16,
52,16,48,16,52,16,58,16,62,32,62,16,64,16,
62,32,60,16,60,16,54,32,56,32,
58,108,

};
}
else if (selection.equals(kQuandoMenVo)) {
sequence = new byte[] {
ToneControl.VERSION, 1,
52,32,52,16,52,16,52,32,52,32,
56,32,54,16,54,16,52,32,
60,32,60,16,60,16,60,32,58,16,56,16,
54,32,58,16,56,16,54,32,54,32,

52,32,52,32,60,32,58,16,56,16,
54,32,54,16,54,16,52,32,
66,32,66,16,66,16,66,32,68,10,66,12,64,10,
64,32,60,16,60,16,58,32,58,32,

64,32,64,32,64,32,66,10,64,12,62,10,
60,32,58,16,58,16,56,32,56,32,
54,32,54,16,54,16,60,32,58,16,56,16,
54,32,54,16,58,8,54,8,54,32,56,16,

60,32,58,16,56,16,54,32,54,16,56,16,
52,32,52,32,52,32,
};
}
else if (selection.equals(kTwinkle)) {
sequence = new byte[] {
ToneControl.VERSION, 1,
ToneControl.TEMPO, 66,
ToneControl.BLOCK_START, 0,
52,32,
62,96,60,16,56,16,
60,32,68,48,52,16,54,16,56,16,
58,32,56,32,54,32,52,32,
56,96,52,32,

64,96,62,16,60,16,
63,32,60,64,60,16,58,16,
56,32,60,32,66,32,68,32,
62,96,52,32,

62,96,60,16,56,16,
58,32,56,32,56,16,52,16,54,16,56,16,
58,32,62,32,64,32,62,32,
54,96,54,16,56,16,

58,32,58,16,56,16,60,16,58,16,56,16,54,16,
52,16,48,16,52,16,58,16,62,32,62,16,64,16,
62,32,60,16,60,16,54,32,56,32,
58,108,

ToneControl.SILENCE, 16,
ToneControl.BLOCK_END, 0,

ToneControl.SET_VOLUME, 100, ToneControl.PLAY_BLOCK, 0,
ToneControl.SET_VOLUME,  50, ToneControl.PLAY_BLOCK, 0,
ToneControl.SET_VOLUME, 100, ToneControl.PLAY_BLOCK, 0,
};
}
try {
Player player = Manager.createPlayer(Manager.TONE_DEVICE_LOCATOR);
player.realize();
ToneControl tc = (ToneControl)player.getControl(“ToneControl”);
tc.setSequence(sequence);
player.start();
}
catch (Exception e) {
Alert a = new Alert(“Exception”, e.toString(), null, null);
a.setTimeout(Alert.FOREVER);
mDisplay.setCurrent(a, mMainScreen);
}
}
}

2 thoughts on “lagu

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s