com.jme.sound.openAL
Class SoundSystem

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

public class SoundSystem
extends java.lang.Object


Field Summary
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
           
 
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 float 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 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
static void setSampleVolume(int sample, float 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 setStreamLooping(int streamName, boolean loop)
          Make a stream loop
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

OUTPUT_DEFAULT

public static final int OUTPUT_DEFAULT
See Also:
Constant Field Values

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

setStreamLooping

public static void setStreamLooping(int streamName,
                                    boolean loop)
Make a stream loop

Parameters:
streamName -

getStreamLength

public static float 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

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 -

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 -

setRolloffFactor

public static void setRolloffFactor(float rolloff)

setSampleVolume

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

Parameters:
sample -
volume -