|
GF4J 0.9.4 Beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gameframe.engines.msjava4x.CMidiMusic
A MIDI music clip. Uses Direct/J and Winmm.dll to play the MIDI file via MCI commands.
Field Summary | |
private boolean |
m_fLoopActive
True if the looper thread is running. |
private boolean |
m_fLooped
Flag that indicates if looping is enabled or not. |
private java.awt.Component |
m_focusedComponent
The component that uses the sound engine. |
private boolean |
m_fPlaying
Flag that indicates if stop hasn't been called since playOnce or playLooped has been called. |
private java.lang.Thread |
m_loopThread
The thread that takes care of the looping. |
private CSoundEngine |
m_soundEngine
The sound engine that created this object. |
private java.lang.String |
m_strMidiFile
The MIDI file that this object represents. |
private static CMidiMusic |
mStatic_currentlyPlayingMusic
The currently playing music. |
private int |
mStatic_iDeviceId
The device ID of the MCI MIDI device. |
private static gameframe.engines.msjava4x.MCI_GENERIC_PARMS |
mStatic_mciGenericParms
MCI Stop parameters "structure". |
private static gameframe.engines.msjava4x.MCI_OPEN_PARMS |
mStatic_mciOpenParms
MCI Open parameters "structure". |
private static gameframe.engines.msjava4x.MCI_PLAY_PARMS |
mStatic_mciPlayParms
MCI Play parameters "structure". |
private static gameframe.engines.msjava4x.MCI_STATUS_PARMS |
mStatic_mciStatusParms
MCI Status parameters "structure". |
private static int |
NO_DEVICE_ID
The device id when no device is open. |
Constructor Summary | |
CMidiMusic(java.awt.Component focusedComponent,
java.lang.String strMidiFile,
CSoundEngine soundEngine)
Constructs a MIDI music representation. |
Method Summary | |
private void |
closeMCI()
Deinitialises the MIDI MCI device. |
void |
finalize()
Closes all MCI devices opened by this application. |
private static java.lang.String |
getErrorString(int iError)
Returns the error string that corresponds to the give error code. |
boolean |
isPlaying()
Returns true if play() or playLooped() has been invoked on the sound and the stop() hasn't been called after that. |
private static short |
LOWORD(int iValue)
Mimics the behaviour of Win32 macro LOWORD. |
private static int |
MCI_MAKE_TMSF(byte track,
byte minutes,
byte seconds,
byte frames)
Time in TMSF format is expressed as a doubleword value with the least significant byte containing tracks, the next least significant byte containing minutes, the next least significant byte containing seconds, and the most significant byte containing frames. |
private boolean |
openMCI()
Opens the MCI MIDI device. |
void |
playLooped()
Plays the given MIDI file as looped. |
private boolean |
playMCI()
Plays the MCI MIDI device. |
void |
playOnce()
Plays the music once and then stops. |
void |
run()
The run method for the thread that monitors the loop playing and restarts the music when it has played once. |
void |
stop()
Stops playing of the MIDI file. |
static void |
stopCurrentMusic()
Stops the currently playing music if such exists. |
private void |
stopLoopingAndWait()
Waits until the looping thread has died. |
private void |
stopMCI()
Stops the MCI MIDI device. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static gameframe.engines.msjava4x.MCI_OPEN_PARMS mStatic_mciOpenParms
private static gameframe.engines.msjava4x.MCI_PLAY_PARMS mStatic_mciPlayParms
private static gameframe.engines.msjava4x.MCI_STATUS_PARMS mStatic_mciStatusParms
private static gameframe.engines.msjava4x.MCI_GENERIC_PARMS mStatic_mciGenericParms
private static final int NO_DEVICE_ID
private static CMidiMusic mStatic_currentlyPlayingMusic
private CSoundEngine m_soundEngine
private java.lang.String m_strMidiFile
private int mStatic_iDeviceId
private boolean m_fLoopActive
private boolean m_fPlaying
private boolean m_fLooped
private java.lang.Thread m_loopThread
private java.awt.Component m_focusedComponent
Constructor Detail |
public CMidiMusic(java.awt.Component focusedComponent, java.lang.String strMidiFile, CSoundEngine soundEngine)
focusedComponent
- The component that uses this sound engine.strMidiFile
- The MIDI file that this object represents.soundEngine
- The sound engine that creates this object.Method Detail |
public void playOnce()
playOnce
in interface Sound
public void playLooped()
playLooped
in interface Sound
public void stop()
stop
in interface Sound
public static void stopCurrentMusic()
private void stopLoopingAndWait()
public void run()
run
in interface java.lang.Runnable
private boolean openMCI()
private boolean playMCI()
private void stopMCI()
private void closeMCI()
private static java.lang.String getErrorString(int iError)
iError
- The error code.private static int MCI_MAKE_TMSF(byte track, byte minutes, byte seconds, byte frames)
private static short LOWORD(int iValue)
public boolean isPlaying()
isPlaying
in interface Sound
public void finalize()
finalize
in interface Sound
finalize
in class java.lang.Object
|
GF4J 0.9.4 Beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |