📄 mysoundplayer.java
字号:
import java.io.*;
import com.nokia.mid.sound.*;
public class MySoundPlayer implements SoundPlayer{
public void turnOff(){
turn = false;
}
public void turnOn(){
turn = true;
}
public void playStart(){
play( dataStart );
}
public void playCross(){
System.out.println( "play change girl" );
play( dataCross );
}
public void playGoldEaten(){
System.out.println( "play change face" );
play( dataGoldEaten );
}
public void playTimeAlarm(){
play( dataTimeAlarm );
}
public void playDead(){
play( dataDead );
}
public void playComplete(){
play( dataComplete );
}
public void playGameOver(){
play( dataAllDead );
}
public void playLogo(){
if( !turn ) return;
try{
if( S60 ){
soundLogo = new Sound( dataLogo, Sound.FORMAT_TONE );
soundLogo.play( 1 );
}
}
catch( Exception e ){
S60 = false;
}
}
public void stopLogo(){
if( S60 ){
while( !soundLogoOK ){
if( soundLogo != null ){
soundLogo.stop();
soundLogo = null;
soundLogoOK = true;
}
}
}
}
private void play( byte[] name ){
if( !turn ) return;
if( S60 ){
Sound sound = new Sound( name, Sound.FORMAT_TONE );
sound.play( 1 );
}
}
byte[] dataStart = {
(byte)0x02, (byte)0x4a, (byte)0x3a, (byte)0x40,
(byte)0x04, (byte)0x00, (byte)0x13, (byte)0x1c,
(byte)0x83, (byte)0x10, (byte)0x20, (byte)0xc3,
(byte)0x10, (byte)0x27, (byte)0x03, (byte)0x10,
(byte)0x39, (byte)0x03, (byte)0x88, (byte)0x00,
};
byte[] dataDead = {
(byte)0x02, (byte)0x4a, (byte)0x3a, (byte)0x40,
(byte)0x04, (byte)0x00, (byte)0x23, (byte)0x16,
(byte)0x82, (byte)0x70, (byte)0x49, (byte)0x38,
(byte)0x13, (byte)0x82, (byte)0x09, (byte)0xc1,
(byte)0x24, (byte)0xe0, (byte)0x4e, (byte)0x04,
(byte)0xd8, (byte)0x46, (byte)0x08, (byte)0x38,
(byte)0xc2, (byte)0xf0, (byte)0x30, (byte)0xd0,
(byte)0x00
};
byte[] dataComplete = {
(byte)0x02, (byte)0x4a, (byte)0x3a, (byte)0x40,
(byte)0x04, (byte)0x00, (byte)0x0b, (byte)0x20,
(byte)0x56, (byte)0x08, (byte)0x39, (byte)0x02,
(byte)0xac, (byte)0x00
};
byte[] dataAllDead = {
(byte)0x02, (byte)0x4a, (byte)0x3a, (byte)0x40,
(byte)0x04, (byte)0x00, (byte)0x0f, (byte)0x1c,
(byte)0x45, (byte)0xa8, (byte)0x31, (byte)0x03,
(byte)0x6d, (byte)0x49, (byte)0x16, (byte)0x80,
(byte)0x00
};
byte[] dataGoldEaten = {
(byte)0x02, (byte)0x4a, (byte)0x3a, (byte)0x40,
(byte)0x04, (byte)0x00, (byte)0x35, (byte)0x20,
(byte)0x82, (byte)0x2c, (byte)0x21, (byte)0x04,
(byte)0x91, (byte)0x82, (byte)0x0d, (byte)0xb5,
(byte)0x24, (byte)0x60, (byte)0x83, (byte)0x4d,
(byte)0x49, (byte)0x18, (byte)0x20, (byte)0xc3,
(byte)0x52, (byte)0x46, (byte)0x08, (byte)0x2c,
(byte)0xc2, (byte)0x10, (byte)0x2c, (byte)0xc2,
(byte)0x0c, (byte)0x2d, (byte)0x04, (byte)0x96,
(byte)0x40, (byte)0x00
};
byte[] dataTimeAlarm = {
(byte)0x02, (byte)0x4a, (byte)0x3a, (byte)0x40,
(byte)0x04, (byte)0x00, (byte)0x0d, (byte)0x20,
(byte)0x83, (byte)0x90, (byte)0x2b, (byte)0x03,
(byte)0x90, (byte)0x2a, (byte)0xd0, (byte)0x00,
};
byte[] dataCross = {
(byte)0x02, (byte)0x4a, (byte)0x3a, (byte)0x40,
(byte)0x04, (byte)0x00, (byte)0x35, (byte)0x20,
(byte)0x82, (byte)0x30, (byte)0x20, (byte)0xc2,
(byte)0x30, (byte)0x2d, (byte)0x02, (byte)0x0c,
(byte)0x2d, (byte)0x03, (byte)0x50, (byte)0x20,
(byte)0xc3, (byte)0x50, (byte)0x37, (byte)0x02,
(byte)0x0c, (byte)0x37, (byte)0x04, (byte)0x91,
(byte)0x81, (byte)0x06, (byte)0x13, (byte)0x69,
(byte)0x08, (byte)0x11, (byte)0x82, (byte)0x0d,
(byte)0xa0, (byte)0xab, (byte)0x0c, (byte)0x34,
(byte)0x84, (byte)0x0b, (byte)0x20, (byte)0x00
};
byte[] dataLogo = {
(byte)0x02, (byte)0x4a, (byte)0x3a, (byte)0x40,
(byte)0x04, (byte)0x00, (byte)0x47, (byte)0x22,
(byte)0x83, (byte)0x4c, (byte)0x38, (byte)0x83,
(byte)0x4c, (byte)0x49, (byte)0x38, (byte)0x10,
(byte)0x81, (byte)0x38, (byte)0x10, (byte)0x81,
(byte)0x34, (byte)0x20, (byte)0xd3, (byte)0x0e,
(byte)0x20, (byte)0xd3, (byte)0x0b, (byte)0xc0,
(byte)0x84, (byte)0x0b, (byte)0xc0, (byte)0x84,
(byte)0x0b, (byte)0xa0, (byte)0xac, (byte)0x08,
(byte)0x30, (byte)0x84, (byte)0x0a, (byte)0xb4,
(byte)0x84, (byte)0x0d, (byte)0x30, (byte)0x83,
(byte)0x0d, (byte)0x20, (byte)0x9b, (byte)0x48,
(byte)0x40, (byte)0xac, (byte)0x0b, (byte)0xc0,
(byte)0xd4, (byte)0x12, (byte)0x4d, (byte)0x00,
(byte)0x00
};
private boolean turn = true;
private boolean soundLogoOK = false;
private Sound soundLogo;
private boolean S60 = true;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -