📄 cmidithread.java
字号:
package chiidanceapp;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class CMidiThread implements Runnable{
private int MusicIndex;
private boolean isLoop = false;
private boolean canPlay = false;
private Thread aThread;
CMidiPlayer MidiPlayer;
//////////////////////////////////////////////////////////////////////////////
public CMidiThread( int MusicIndex,boolean isLoop ) {
this.MusicIndex = MusicIndex;
this.isLoop = isLoop;
MidiPlayer = new CMidiPlayer();
MidiPlayer.InitSequence( MusicIndex );
aThread = new Thread( this );
aThread.start();
}
public CMidiThread( int MusicIndex,boolean isLoop,boolean canPlay ) {
this.MusicIndex = MusicIndex;
this.isLoop = isLoop;
this.canPlay = canPlay;
MidiPlayer = new CMidiPlayer();
MidiPlayer.InitSequence( this.MusicIndex );
if( canPlay )
{
aThread = new Thread(this);
aThread.start();
}
}
//////////////////////////////////////////////////////////////////////////////
public void setIsLoop( boolean isLoop )
{
this.isLoop = isLoop;
}
public void stopMidiThread()
{
MidiPlayer.stop();
aThread = null;
}
public void closeMidiThread()
{
MidiPlayer.close();
}
public void startMidiThread()
{
if( aThread == null )
{
aThread = new Thread( this );
aThread.start();
}
}
public void play()
{
MidiPlayer.play( this.isLoop );
}
public void restartMidiThread()
{
MidiPlayer.InitSequence( this.MusicIndex );
aThread = new Thread( this );
aThread.start();
}
public void run()
{
play();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -