GF4J 0.9.4 Beta

gameframe.sound
Interface Sample

All Superinterfaces:
Sound
All Known Implementing Classes:
CSoundEngine.CDXSound, CSoundEngine.CJava11Sound, CSoundEngine.CJava2Sample, NullSample

public interface Sample
extends Sound

Defines the interface for a representation of a sample. Offers methods for panning, attennuating and controlling the playback of the sample.

Since:
GameFrame for Java 0.9
Version:
GameFrame for Java 0.9.4

Method Summary
 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.
 void setPan(float pan)
          Sets the pan of the sound.
 void setVolume(float volume)
          Sets the volume of the sound.
 
Methods inherited from interface gameframe.sound.Sound
finalize, isPlaying, playLooped, playOnce, stop
 

Method Detail

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.

NOTE: This feature is optional as it can't be supported on all platform implementations, but all implementations offer at least a "do nothing" method.

Parameters:
volume - The sounds volume.
Since:
GameFrame for Java 0.9

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.

NOTE: This feature is optional as it can't be supported on all platform implementations, but all implementations offer at least a "do nothing" method.

Parameters:
pan - The pan of the sound.
Since:
GameFrame for Java 0.9

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.
Returns:
The sounds volume.
Since:
GameFrame for Java 0.9

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.

NOTE: This feature is optional as it can't be supported on all platform implementations, but all implementations offer at least a "do nothing" method.

Returns:
The pan of the sound.
Since:
GameFrame for Java 0.9

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, but it most likely uses the same sample data. Using this method to get multiple instances of one sound will save memory on some implementations and is thus the preferred way to duplicate sound objects.
Returns:
A independent copy of this sound or null if copy fails.
Since:
GameFrame for Java 0.9

GF4J 0.9.4 Beta