GF4J 0.9.4 Beta

gameframe.engines.jdk11x
Class CSoundEngine.CJava11Sound

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

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

Implementation of Sample that implements the sound playing in an "hacked" Java 1.1 way.


Field Summary
(package private)  boolean m_fPlaying
           
(package private)  CLoopingSoundStream m_loopedStream
           
(package private)  float m_pan
           
private  CSoundStream m_soundStream
           
(package private)  float m_volume
           
 
Constructor Summary
(package private) CSoundEngine.CJava11Sound(CSoundStream soundStream)
           
 
Method Summary
 void finalize()
          Upon finalization stop everything (just in case).
 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 sound should be playing at the moment
 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_soundStream

private CSoundStream m_soundStream

m_loopedStream

CLoopingSoundStream m_loopedStream

m_fPlaying

boolean m_fPlaying

m_pan

float m_pan

m_volume

float m_volume
Constructor Detail

CSoundEngine.CJava11Sound

CSoundEngine.CJava11Sound(CSoundStream soundStream)
Method Detail

playOnce

public void playOnce()
Plays this sample once and then stops
Specified by:
playOnce in interface Sound

playLooped

public void playLooped()
Plays the given sample over and over again (looping).
Specified by:
playLooped in interface Sound

stop

public void stop()
Stops playing the given sample
Specified by:
stop in interface 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()
Upon finalization stop everything (just in case).
Specified by:
finalize in interface Sound
Overrides:
finalize in class java.lang.Object

isPlaying

public boolean isPlaying()
Returns true if sound should be playing at the moment
Specified by:
isPlaying 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.
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.
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.

GF4J 0.9.4 Beta