com.jme.sound.fmod
Class SoundSystem

java.lang.Object
  extended bycom.jme.sound.fmod.SoundSystem

public class SoundSystem
extends java.lang.Object

Author:
Arman

Field Summary
static int DEFAULT_RENDER_METOD
           
static int FREE_NODE_INDEX
           
static int OUTPUT_ALSA
           
static int OUTPUT_ASIO
           
static int OUTPUT_DEFAULT
           
static int OUTPUT_DSOUND
           
static int OUTPUT_ESD
           
static int OUTPUT_MAC
           
static int OUTPUT_OSS
           
static int OUTPUT_WINMM
           
static int RENDER_MEHOD_MUTE
           
static int RENDER_MEHOD_PAUSE
           
static int RENDER_MEHOD_STOP
           
 
Constructor Summary
SoundSystem()
           
 
Method Summary
static void addSampleToNode(int sample, int destNode)
          Adds a sample to the given node identifier
static void bindEventToSample(int sample, int event)
          Binds an event to the given sample.
static int create3DSample(java.lang.String file)
          Creates a 3D sample and returns an identifier for it
static int createSoundNode()
          Creates a node ans return an integer as it's identifier.
static int createStream(java.lang.String file, boolean loadIntoMemory)
          Creates a Music stream and returns an identifier for it
static void draw()
          Draws all nodes in the scene
static void draw(int nodeName)
          Draws the given node in the scene
static int getStreamLength(int streamName)
          Get the length of the given stream in milliseconds
static void init(Camera cam, int outputMethod)
          init the sound system by setting it's listener's position to the cameras position
static boolean isStreamOpened(int streamName)
          Checks if a stream is opened.
static void onEvent(int eventName)
          Fires an event on all nodes
static void onEvent(int nodeName, int eventName)
           
static boolean pauseStream(int streamName)
           
static boolean playStream(int streamName)
           
static void setRenderMethod(int method)
          Sets the default 3D sample rendering method.
static void setRolloffFactor(float rolloff)
           
static void setSampleConfig(int sample, Configuration conf)
          Set the FX configuration of the given sample
static void setSampleMaxAudibleDistance(int sample, int dist)
          Sets the units from which the sample will stop playing
static void setSampleMinAudibleDistance(int sample, int dist)
           
static void setSamplePosition(int sample, float x, float y, float z)
          Sets the spatial position of a given sample
static void setSampleVelocity(int sample, float x, float y, float z)
          Sets the velocity of a given sample
 void setSampleVolume(int sample, int volume)
          Set the volume of the given sample
static void setStreamConfig(int streamName, Configuration conf)
          Set the FX configuration of the given stream
static void stopStream(int streamName)
           
static void update(float time)
          Updates the geometric states of all nodes in the scene
static void update(int nodeName, float time)
          Updates the geometric states of the given node in the scene
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FREE_NODE_INDEX

public static final int FREE_NODE_INDEX
See Also:
Constant Field Values

RENDER_MEHOD_PAUSE

public static final int RENDER_MEHOD_PAUSE
See Also:
Constant Field Values

RENDER_MEHOD_STOP

public static final int RENDER_MEHOD_STOP
See Also:
Constant Field Values

RENDER_MEHOD_MUTE

public static final int RENDER_MEHOD_MUTE
See Also:
Constant Field Values

OUTPUT_DEFAULT

public static final int OUTPUT_DEFAULT
See Also:
Constant Field Values

DEFAULT_RENDER_METOD

public static int DEFAULT_RENDER_METOD

OUTPUT_DSOUND

public static final int OUTPUT_DSOUND
See Also:
Constant Field Values

OUTPUT_WINMM

public static final int OUTPUT_WINMM
See Also:
Constant Field Values

OUTPUT_ASIO

public static final int OUTPUT_ASIO
See Also:
Constant Field Values

OUTPUT_OSS

public static final int OUTPUT_OSS
See Also:
Constant Field Values

OUTPUT_ESD

public static final int OUTPUT_ESD
See Also:
Constant Field Values

OUTPUT_ALSA

public static final int OUTPUT_ALSA
See Also:
Constant Field Values

OUTPUT_MAC

public static final int OUTPUT_MAC
See Also:
Constant Field Values
Constructor Detail

SoundSystem

public SoundSystem()
Method Detail

init

public static void init(Camera cam,
                        int outputMethod)
init the sound system by setting it's listener's position to the cameras position

Parameters:
cam -
outputMethod -

update

public static void update(float time)
Updates the geometric states of all nodes in the scene

Parameters:
time - currently not used

update

public static void update(int nodeName,
                          float time)
Updates the geometric states of the given node in the scene

Parameters:
nodeName - the node to update
time - currently not used

draw

public static void draw()
Draws all nodes in the scene


draw

public static void draw(int nodeName)
Draws the given node in the scene

Parameters:
nodeName - the node to update

createSoundNode

public static int createSoundNode()
Creates a node ans return an integer as it's identifier.

Returns:
the node identifier

create3DSample

public static int create3DSample(java.lang.String file)
Creates a 3D sample and returns an identifier for it

Parameters:
file - the sample file name
Returns:
the 3D sample identifier

createStream

public static int createStream(java.lang.String file,
                               boolean loadIntoMemory)
Creates a Music stream and returns an identifier for it

Parameters:
file - streaming file name
loadIntoMemory -
Returns:
the stream identifier

isStreamOpened

public static boolean isStreamOpened(int streamName)
Checks if a stream is opened. If it is, this can be used to know that the file is really a audio file

Parameters:
streamName -
Returns:
true if the stream is opened

getStreamLength

public static int getStreamLength(int streamName)
Get the length of the given stream in milliseconds

Parameters:
streamName -
Returns:
the stream length in millis

playStream

public static boolean playStream(int streamName)

pauseStream

public static boolean pauseStream(int streamName)

stopStream

public static void stopStream(int streamName)

setSamplePosition

public static void setSamplePosition(int sample,
                                     float x,
                                     float y,
                                     float z)
Sets the spatial position of a given sample

Parameters:
sample - the sample identifier
x - the x position of the sample
y - the y position of the sample
z - the z position of the sample

setSampleVelocity

public static void setSampleVelocity(int sample,
                                     float x,
                                     float y,
                                     float z)
Sets the velocity of a given sample

Parameters:
sample - the sample identifier
x - the x velocity of the sample
y - the y velocity of the sample
z - the z velocity of the sample

setSampleConfig

public static void setSampleConfig(int sample,
                                   Configuration conf)
Set the FX configuration of the given sample

Parameters:
sample - sample the sample identifier
conf - the config

setStreamConfig

public static void setStreamConfig(int streamName,
                                   Configuration conf)
Set the FX configuration of the given stream

Parameters:
conf - the config

setSampleMaxAudibleDistance

public static void setSampleMaxAudibleDistance(int sample,
                                               int dist)
Sets the units from which the sample will stop playing

Parameters:
sample - the sample identifier
dist - the distance unit from which the sample will stop playing

setSampleMinAudibleDistance

public static void setSampleMinAudibleDistance(int sample,
                                               int dist)

addSampleToNode

public static void addSampleToNode(int sample,
                                   int destNode)
Adds a sample to the given node identifier

Parameters:
destNode -
sample -

bindEventToSample

public static void bindEventToSample(int sample,
                                     int event)
Binds an event to the given sample. The event number sould be a unique id. Binding an event to sample will make it play only if the event is fired on the container node

Parameters:
sample - the sample to which the event will be bound
event - the unique event number

onEvent

public static void onEvent(int eventName)
Fires an event on all nodes

Parameters:
eventName - the event to fire

onEvent

public static void onEvent(int nodeName,
                           int eventName)
Parameters:
nodeName -
eventName -

setRolloffFactor

public static void setRolloffFactor(float rolloff)

setSampleVolume

public void setSampleVolume(int sample,
                            int volume)
Set the volume of the given sample

Parameters:
sample -
volume -

setRenderMethod

public static void setRenderMethod(int method)
Sets the default 3D sample rendering method. While the 3d sample's max audible distance is set the sound will respect the rendering method specified here. If the pause method is selected the sample will pause if the listener goes out of the max audible distance and continue to play from where it was paused if the user comes into the audible sphere defined with max audible distance. If the stop method is selected the sound will stop and restart If the mute method is selected the sample will continue to play

Parameters:
method - the method to set, by default the method is SoundSystem.RENDER_METHOD_PAUSE possible values are SoundSystem.RENDER_MEHOD_MUTE, SoundSystem.RENDER_MEHOD_STOP and SoundSystem.RENDER_MEHOD_PAUSE