de.jreality.scene
Class AudioSource
java.lang.Object
de.jreality.scene.SceneGraphNode
de.jreality.scene.AudioSource
public abstract class AudioSource
- extends SceneGraphNode
The core of audio for jReality. The basic idea is that a scene graph component can have an audio source
attached to it. An audio source writes a mono signal into a ring buffer upon request, and audio renderers
request readers for the ring buffer, one for each occurrence of the source in the scene graph. An audio
source keeps track of time in terms of the number of samples requested so far. Readers can read samples
concurrently, and sample requests are queued and managed so that an audio source only writes as many samples
as the fastest renderer requests.
Samples are floats in the range from -1 to 1.
- Author:
- brinkman
AudioSource
public AudioSource(String name)
getSampleRate
public int getSampleRate()
createReader
public RingBuffer.Reader createReader()
getState
public AudioSource.State getState()
setState
public void setState(AudioSource.State state)
- set the state of the node.
- Parameters:
state
- set the state of the audio source
readSamples
public int readSamples(RingBuffer.Reader reader,
float[] buffer,
int initialIndex,
int nSamples)
start
public void start()
stop
public void stop()
pause
public void pause()
accept
public void accept(SceneGraphVisitor v)
- Description copied from class:
SceneGraphNode
- The accept method for a SceneGraphVisitor.
- Overrides:
accept
in class SceneGraphNode
addAudioListener
public void addAudioListener(AudioListener listener)
removeAudioListener
public void removeAudioListener(AudioListener listener)