GF4J 0.9.4 Beta

gameframe.engines.jdk11x
Class CSoundEngine

java.lang.Object
  |
  +--gameframe.engines.jdk11x.CSoundEngine
All Implemented Interfaces:
Finalizable, SoundEngine

class CSoundEngine
extends java.lang.Object
implements SoundEngine, Finalizable

Java 1.1 implementation of the sound engine. Uses the well known "hack" to play samples on plain vanilla Java 1.1 platforms without Java Media Framework. Loads mono/stereo Microsoft PCM RIFF WAVE files.

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

Inner Class Summary
(package private)  class CSoundEngine.CJava11Sound
          Implementation of Sample that implements the sound playing in an "hacked" Java 1.1 way.
 
Field Summary
private  java.util.Vector m_createdSounds
          All the sounds created through this sound engine.
private  java.lang.String m_strDataDirectory
          Name of the directory that contains loaded sounds.
 
Constructor Summary
CSoundEngine()
          Constructs a JDK 1.1.x sound engine.
 
Method Summary
 void finalize()
          Finalises all sounds.
 java.lang.String getDataDirectory()
          Returns the data directory wherefrom the sounds are loaded.
 java.lang.String getDescription()
          Returns the (possibly multiline) description of the implementation.
 java.lang.String getName()
          Returns the short name (max 8 characters) of the implementation "Java11".
 Music loadMusic(java.lang.String fileName)
          First tries to load a music file as streamed Microsoft RIFF WAV file, if no such file is found from the current data directory, tries to load a music file in MIDI format.
 Sample loadSample(java.lang.String strFileName)
          Loads an mono 8-bit 11025 bytes/sec AU formatted sample from the given file name and return an abstract reference for the loaded sound.
 void setDataDirectory(java.lang.String strDirectoryName)
          Sets the data directory wherefrom the sounds are loaded.
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

m_createdSounds

private java.util.Vector m_createdSounds
All the sounds created through this sound engine.

m_strDataDirectory

private java.lang.String m_strDataDirectory
Name of the directory that contains loaded sounds.
Constructor Detail

CSoundEngine

public CSoundEngine()
Constructs a JDK 1.1.x sound engine.
Method Detail

loadSample

public Sample loadSample(java.lang.String strFileName)
                  throws java.io.FileNotFoundException,
                         GameFrameException
Loads an mono 8-bit 11025 bytes/sec AU formatted sample from the given file name and return an abstract reference for the loaded sound. This implementation is limited in sample lenght to the maximum positive value of integer...
Specified by:
loadSample in interface SoundEngine
Parameters:
strFileName - The name of the file to be loaded (without the file extension)
Returns:
An unique Sample object that specifies the loaded sample

loadMusic

public Music loadMusic(java.lang.String fileName)
                throws java.io.FileNotFoundException,
                       GameFrameException
First tries to load a music file as streamed Microsoft RIFF WAV file, if no such file is found from the current data directory, tries to load a music file in MIDI format. When suitable file is found returns a control object for the music file if no suitable file is found returns NullSound object. Music files are loaded by default from the current directory, the directory that is used to load the samples can be set with the setDataDirectory() method.
Specified by:
loadMusic in interface SoundEngine
Parameters:
fileName - The name of the file to be loaded (without the file extension)
Returns:
An unique Sample object that represents the loaded sample
Since:
GameFrame for Java 0.9.2
See Also:
setDataDirectory(java.lang.String)

setDataDirectory

public void setDataDirectory(java.lang.String strDirectoryName)
                      throws java.io.FileNotFoundException
Sets the data directory wherefrom the sounds are loaded. Defaults to the current directory. Do not add the last directory separator.
Specified by:
setDataDirectory in interface SoundEngine
Parameters:
strDirectoryName - The name of the directory that contains the sounds.

getDataDirectory

public java.lang.String getDataDirectory()
Returns the data directory wherefrom the sounds are loaded. The source directory defaults to the current directory. Note: The returned path will have the path separator as the last character.
Specified by:
getDataDirectory in interface SoundEngine
Returns:
The name of the directory that wherefrom the sounds are loaded.
Since:
GameFrame for Java 0.9.3
See Also:
loadSample(java.lang.String), loadMusic(java.lang.String)

finalize

public void finalize()
Finalises all sounds.
Specified by:
finalize in interface Finalizable
Overrides:
finalize in class java.lang.Object

getName

public java.lang.String getName()
Returns the short name (max 8 characters) of the implementation "Java11".
Specified by:
getName in interface SoundEngine
Returns:
The short name of the graphics engine.
Since:
GameFrame for Java 0.9.3

getDescription

public java.lang.String getDescription()
Returns the (possibly multiline) description of the implementation.
Specified by:
getDescription in interface SoundEngine
Returns:
A description of the graphics engine.
Since:
GameFrame for Java 0.9.3

GF4J 0.9.4 Beta