GF4J 0.9.4 Beta

gameframe.sound
Interface SoundEngine


public interface SoundEngine

Defines an interface to a sound engine that can be thought to be a "sound device". Sample engines are used to load sample data stored in Microsoft RIFF WAV format (8/16-bit, any sample rate, stereo/mono) or music files in MIDI format. The loaded sample or music file is returned as an control object that is then used to play the sample.

Since:
GameFrame for Java 0.9
Version:
GameFrame for Java 0.9.4
Author:
Pasi Keränen 16. May 1999
See Also:
Sample

Method Summary
 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 e.g.
 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 fileName)
          Loads a sample in Microsoft RIFF WAV format and returns the control object for the sample.
 void setDataDirectory(java.lang.String strDirectoryName)
          Sets the data directory wherefrom the sounds are loaded.
 

Method Detail

setDataDirectory

public void setDataDirectory(java.lang.String strDirectoryName)
                      throws java.io.FileNotFoundException

Sets the data directory wherefrom the sounds are loaded. The source directory defaults to the current directory.

Note: Remember to use the java.io.File.separator as the separator of directories.

Parameters:
strDirectoryName - The name of the directory that contains the bitmaps.
Throws:
java.io.FileNotFoundException - Thrown if the directory is not found.
Since:
GameFrame for Java 0.9
See Also:
loadSample(java.lang.String), loadMusic(java.lang.String)

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.
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)

loadSample

public Sample loadSample(java.lang.String fileName)
                  throws java.io.FileNotFoundException,
                         GameFrameException
Loads a sample in Microsoft RIFF WAV format and returns the control object for the sample. Samples are loaded by default from the current directory, the directory that is used to load the samples can be set with the setDataDirectory() method.
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
See Also:
setDataDirectory(java.lang.String)

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.
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)

getName

public java.lang.String getName()
Returns the short name (max 8 characters) of the implementation e.g. "Java11" or "DDraw".
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.
Returns:
A description of the graphics engine.
Since:
GameFrame for Java 0.9.3

GF4J 0.9.4 Beta