|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.openal.Stream
public abstract class Stream
Represents a streaming source of sound data.
| Nested Class Summary | |
|---|---|
protected static class |
Stream.FadeMode
Fading modes. |
| Field Summary | |
|---|---|
protected ByteBuffer |
_abuf
The buffer used to store audio data temporarily. |
protected Buffer[] |
_buffers
The buffers through which we cycle. |
protected float |
_fadeElapsed
The interval and elapsed time for fading. |
protected float |
_fadeInterval
The interval and elapsed time for fading. |
protected Stream.FadeMode |
_fadeMode
The type of fading being performed. |
protected float |
_gain
The gain of the stream. |
protected IntBuffer |
_nbuf
The buffer used to store names. |
protected int |
_qidx
The starting index and length of the current queue in _buffers. |
protected int |
_qlen
The starting index and length of the current queue in _buffers. |
protected SoundManager |
_soundmgr
The manager to which the stream was added. |
protected Source |
_source
The source through which the stream plays. |
protected int |
_state
The OpenAL state of the stream. |
| Constructor Summary | |
|---|---|
Stream(SoundManager soundmgr)
Creates a new stream. |
|
| Method Summary | |
|---|---|
void |
dispose()
Releases the resources held by this stream and removes it from the manager. |
void |
fadeIn(float interval)
Fades this stream in over the specified interval. |
void |
fadeOut(float interval,
boolean dispose)
Fades this stream out over the specified interval. |
protected int |
getBufferSize()
Returns the size in bytes of the buffers to use. |
protected abstract int |
getFormat()
Returns the OpenAL audio format of the stream. |
protected abstract int |
getFrequency()
Returns the stream's playback frequency in samples per second. |
protected int |
getNumBuffers()
Returns the number of buffers to use. |
Source |
getSource()
Returns a reference to the stream source. |
boolean |
isPlaying()
Determines whether this stream is currently playing. |
void |
pause()
Pauses this stream. |
void |
play()
Starts playing this stream. |
protected boolean |
populateBuffer(Buffer buffer)
Populates the identified buffer with as much data as it can hold. |
protected abstract int |
populateBuffer(ByteBuffer buf)
Populates the given buffer with audio data. |
protected void |
queueBuffers(int buffers)
Queues (up to) the specified number of buffers. |
void |
setGain(float gain)
Sets the base gain of the stream. |
void |
stop()
Stops this stream. |
protected void |
update(float time)
Updates the state of this stream, loading data into buffers and adjusting gain as necessary. |
protected void |
updateFade(float time)
Updates the gain of the stream according to the fade state. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected SoundManager _soundmgr
protected Source _source
protected Buffer[] _buffers
protected int _qidx
_buffers.
protected int _qlen
_buffers.
protected float _gain
protected float _fadeInterval
protected float _fadeElapsed
protected Stream.FadeMode _fadeMode
protected IntBuffer _nbuf
protected ByteBuffer _abuf
protected int _state
| Constructor Detail |
|---|
public Stream(SoundManager soundmgr)
dispose() when finished with the stream.
soundmgr - a reference to the sound manager that will update the stream| Method Detail |
|---|
public void setGain(float gain)
public Source getSource()
public boolean isPlaying()
public void play()
public void pause()
public void stop()
public void fadeIn(float interval)
public void fadeOut(float interval,
boolean dispose)
dispose - if true, dispose of the stream when done fading outpublic void dispose()
protected void update(float time)
SoundManager.
time - the amount of time elapsed since the last updateprotected void updateFade(float time)
protected void queueBuffers(int buffers)
protected boolean populateBuffer(Buffer buffer)
protected abstract int getFormat()
protected abstract int getFrequency()
protected abstract int populateBuffer(ByteBuffer buf)
throws IOException
IOExceptionprotected int getBufferSize()
protected int getNumBuffers()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||