com.threerings.openal
Class URLStream

java.lang.Object
  extended by com.threerings.openal.Stream
      extended by com.threerings.openal.URLStream
Direct Known Subclasses:
FileStream, ResourceStream

public class URLStream
extends Stream

An audio stream read from one or more URLs.


Nested Class Summary
protected  class URLStream.QueuedURL
          A URL queued for play.
 
Nested classes/interfaces inherited from class com.threerings.openal.Stream
Stream.FadeMode
 
Field Summary
protected  StreamDecoder _decoder
          The stream decoder for the current URL.
protected  ArrayList<URLStream.QueuedURL> _queue
          The queue of URLs to play after the current one.
protected  URLStream.QueuedURL _url
          The URL currently being played.
 
Fields inherited from class com.threerings.openal.Stream
_abuf, _buffers, _fadeElapsed, _fadeInterval, _fadeMode, _gain, _nbuf, _qidx, _qlen, _soundmgr, _source, _state
 
Constructor Summary
URLStream(SoundManager soundmgr, URL url, boolean loop)
          Creates a new stream for the specified URL.
 
Method Summary
protected  int getFormat()
          Returns the OpenAL audio format of the stream.
protected  int getFrequency()
          Returns the stream's playback frequency in samples per second.
protected  int populateBuffer(ByteBuffer buf)
          Populates the given buffer with audio data.
 void queueURL(URL url, boolean loop)
          Adds an element to the queue of URLs to play.
 
Methods inherited from class com.threerings.openal.Stream
dispose, fadeIn, fadeOut, getBufferSize, getNumBuffers, getSource, isPlaying, pause, play, populateBuffer, queueBuffers, setGain, stop, update, updateFade
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_url

protected URLStream.QueuedURL _url
The URL currently being played.


_decoder

protected StreamDecoder _decoder
The stream decoder for the current URL.


_queue

protected ArrayList<URLStream.QueuedURL> _queue
The queue of URLs to play after the current one.

Constructor Detail

URLStream

public URLStream(SoundManager soundmgr,
                 URL url,
                 boolean loop)
          throws IOException
Creates a new stream for the specified URL.

Parameters:
loop - whether or not to play the file in a continuous loop if there's nothing on the queue
Throws:
IOException
Method Detail

queueURL

public void queueURL(URL url,
                     boolean loop)
Adds an element to the queue of URLs to play.

Parameters:
loop - if true, play this file in a loop if there's nothing else on the queue

getFormat

protected int getFormat()
Description copied from class: Stream
Returns the OpenAL audio format of the stream.

Specified by:
getFormat in class Stream

getFrequency

protected int getFrequency()
Description copied from class: Stream
Returns the stream's playback frequency in samples per second.

Specified by:
getFrequency in class Stream

populateBuffer

protected int populateBuffer(ByteBuffer buf)
                      throws IOException
Description copied from class: Stream
Populates the given buffer with audio data.

Specified by:
populateBuffer in class Stream
Returns:
the total number of bytes read into the buffer, or -1 if the end of the stream has been reached
Throws:
IOException