GF4J 0.9.4 Beta

gameframe.engines.msjava4x
Class CSoundEngine.CDXSound

java.lang.Object
  |
  +--gameframe.engines.msjava4x.CSoundEngine.CDXSound
All Implemented Interfaces:
Sample, Sound
Enclosing class:
CSoundEngine

class CSoundEngine.CDXSound
extends java.lang.Object
implements Sample

DirectSound implementation of the sound object.


Field Summary
private  gameframe.engines.msjava4x.DirectSoundBuffer m_dsBuffer
          DirectSound buffer that contains the sample data.
private  boolean m_fPlaying
          Flag that indicates if the playing has been started.
private  float m_pan
          The pan of the sound.
private  float m_volume
          The volume of the sound.
 
Constructor Summary
(package private) CSoundEngine.CDXSound(gameframe.engines.msjava4x.DirectSoundBuffer dsBuffer)
          Constructs a DirectSound implementation of the sound object.
 
Method Summary
 void finalize()
          Frees all the resources that are used by the sound representation.
 Sample getCopy()
          Returns a copy of this sound object that is independent from the original sound object.
 float getPan()
          Returns the pan of the sound.
 float getVolume()
          Returns the volume of the sound.
 boolean isPlaying()
          Returns true if start has been invoked and stop hasn't yet been invoked.
 void playLooped()
          Plays the given sample over and over again (looping).
 void playOnce()
          Plays this sample once and then stops.
 void setPan(float pan)
          Sets the pan of the sound.
 void setVolume(float volume)
          Sets the volume of the sound.
 void stop()
          Stops playing the given sample
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

m_dsBuffer

private gameframe.engines.msjava4x.DirectSoundBuffer m_dsBuffer
DirectSound buffer that contains the sample data.

m_fPlaying

private boolean m_fPlaying
Flag that indicates if the playing has been started.

m_pan

private float m_pan
The pan of the sound.

m_volume

private float m_volume
The volume of the sound.
Constructor Detail

CSoundEngine.CDXSound

CSoundEngine.CDXSound(gameframe.engines.msjava4x.DirectSoundBuffer dsBuffer)
Constructs a DirectSound implementation of the sound object.
Parameters:
dsBuffer - DirectSound buffer that contains the sample data.
Method Detail

playOnce

public void playOnce()
Plays this sample once and then stops. If the sample is already playing then it is stopped and restarted.
Specified by:
playOnce in interface Sound

isPlaying

public boolean isPlaying()
Returns true if start has been invoked and stop hasn't yet been invoked.
Specified by:
isPlaying in interface Sound
Returns:
True if the sound should be playing.

playLooped

public void playLooped()
Plays the given sample over and over again (looping). If the sample is already playing then it is stopped and restarted.
Specified by:
playLooped in interface Sound

stop

public void stop()
Stops playing the given sample
Specified by:
stop in interface Sound

setVolume

public void setVolume(float volume)
Sets the volume of the sound. Value of 0.0 means that the sound should be inaudible and value of 1.0 means the sound is played at its normal volume. Values above 1.0 are treated as 1.0 and values below 0.0 are treated as 0.0.
Specified by:
setVolume in interface Sample
Parameters:
volume - The sounds volume.

setPan

public void setPan(float pan)
Sets the pan of the sound. Value of -1.0 means that the sound will be heard only from the left speaker and value of 1.0 means that the sound will be heard only from the right speaker. Value of 0.0 means that the sound is heard with equal volume from both speakers. Values above 1.0 are treated as 1.0 and values below -1.0 are treated as -1.0.
Specified by:
setPan in interface Sample
Parameters:
pan - The pan of the sound.

getVolume

public float getVolume()
Returns the volume of the sound. Value of 0.0 means that the sound should be inaudible and value of 1.0 means the sound is played at its normal volume.
Specified by:
getVolume in interface Sample
Returns:
The sounds volume.

getPan

public float getPan()
Returns the pan of the sound. Value of -1.0 means that the sound will be heard only from the left speaker and value of 1.0 means that the sound will be heard only from the right speaker. Value of 0.0 means that the sound is heard with equal volume from both speakers.
Specified by:
getPan in interface Sample
Returns:
The pan of the sound.

getCopy

public Sample getCopy()
Returns a copy of this sound object that is independent from the original sound object. This new sound object can be started/stopped independently from the original sound object. Using this method to get multiple instances of one sound will save memory on some implementations and is thus preferred way to duplicate sound objects.
Specified by:
getCopy in interface Sample
Returns:
A independent copy of this sound or null if copy fails.

finalize

public void finalize()
Description copied from interface: Sound
Frees all the resources that are used by the sound representation. This method is quite slow to execute and should preferrably be called upon exiting the game or between level changes etc.
Specified by:
finalize in interface Sound
Overrides:
finalize in class java.lang.Object

GF4J 0.9.4 Beta