org.xith3d.sound
Class SoundDriver

java.lang.Object
  extended by org.xith3d.sound.SoundDriver
Direct Known Subclasses:
SoundDriverImpl, SoundDriverImpl, SoundDriverImpl

public abstract class SoundDriver
extends java.lang.Object

Implementations of a sound driver must implement this interface. This represents the various capabilities of the sound system.


Field Summary
protected  java.util.ArrayList<SoundSource> availableSources
           
protected  java.util.ArrayList<SoundBuffer> buffers
           
protected  java.util.ArrayList<SoundSource> sources
           
 
Constructor Summary
protected SoundDriver()
           
 
Method Summary
abstract  SoundBuffer allocateSoundBuffer()
           
 SoundSource allocateSoundSource()
           
protected abstract  SoundSource createSoundSource()
           
 boolean delete(SoundBuffer buffer)
           
 boolean delete(SoundSource source)
           
 float getDopplerFactor()
           
 float getDopplerVelocity()
           
 float getListenerVolume()
           
 int getNumActiveSources()
           
 int getNumAvailableSources()
           
 int getNumSources()
           
protected abstract  void initSoundDevice()
           
 boolean isOnline()
           
abstract  void newFrameAsync()
          Call this method once a frame to check and possibly load the next buffer from all the streaming sources, as well as dequeue all processed buffers.
abstract  void newFrameSync()
          Call this method once a frame to check and possibly load the next buffer from all the streaming sources, as well as dequeue all processed buffers.
 void setDopplerFactor(float factor)
           
 void setDopplerVelocity(float velocity)
           
 void setListenerOrientation(org.openmali.vecmath2.Tuple3f direction, org.openmali.vecmath2.Tuple3f up)
           
 void setListenerPosition(org.openmali.vecmath2.Tuple3f position)
           
 void setListenerVelocity(org.openmali.vecmath2.Tuple3f velocity)
           
 void setListenerVolume(float gain)
           
protected  void setOnline(boolean online)
           
 void shutdown()
           
protected abstract  void shutdownImpl()
           
 void start()
           
protected abstract  void startImpl()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sources

protected final java.util.ArrayList<SoundSource> sources

availableSources

protected final java.util.ArrayList<SoundSource> availableSources

buffers

protected final java.util.ArrayList<SoundBuffer> buffers
Constructor Detail

SoundDriver

protected SoundDriver()
Method Detail

setOnline

protected void setOnline(boolean online)

isOnline

public final boolean isOnline()

startImpl

protected abstract void startImpl()

start

public final void start()

newFrameSync

public abstract void newFrameSync()
Call this method once a frame to check and possibly load the next buffer from all the streaming sources, as well as dequeue all processed buffers. This will operate synchronously, so it will not return until the work is complete.


newFrameAsync

public abstract void newFrameAsync()
Call this method once a frame to check and possibly load the next buffer from all the streaming sources, as well as dequeue all processed buffers. This will operate asynchronously and will return immediately. If it is already processing from the last frame then it will skip this frame. The thread used is a high priority thread so that it can complete its task in as little time as possible while still reducing frame stutter. This is because this is mostly I/O bound and will enter wait states, thus freeing CPU for rendering.


setListenerVelocity

public void setListenerVelocity(org.openmali.vecmath2.Tuple3f velocity)
Parameters:
velocity -

setListenerPosition

public void setListenerPosition(org.openmali.vecmath2.Tuple3f position)
Parameters:
position -

setListenerOrientation

public void setListenerOrientation(org.openmali.vecmath2.Tuple3f direction,
                                   org.openmali.vecmath2.Tuple3f up)
Parameters:
direction -
up -

setListenerVolume

public void setListenerVolume(float gain)

getListenerVolume

public final float getListenerVolume()

setDopplerVelocity

public void setDopplerVelocity(float velocity)

getDopplerVelocity

public final float getDopplerVelocity()

setDopplerFactor

public void setDopplerFactor(float factor)

getDopplerFactor

public final float getDopplerFactor()

createSoundSource

protected abstract SoundSource createSoundSource()

allocateSoundSource

public SoundSource allocateSoundSource()
                                throws SoundException
Throws:
SoundException

allocateSoundBuffer

public abstract SoundBuffer allocateSoundBuffer()

delete

public boolean delete(SoundSource source)
Parameters:
source -
Returns:
true, if the source was part of this driver, false otherwise.

delete

public boolean delete(SoundBuffer buffer)
Parameters:
buffer -
Returns:
true, if the buffer was part of this driver, false otherwise.

getNumAvailableSources

public final int getNumAvailableSources()

getNumActiveSources

public final int getNumActiveSources()

getNumSources

public final int getNumSources()

shutdownImpl

protected abstract void shutdownImpl()

shutdown

public final void shutdown()

initSoundDevice

protected abstract void initSoundDevice()