Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.newdawn.slick.openal
Class OpenALStreamPlayer

    java.lang.Object
      org.newdawn.slick.openal.OpenALStreamPlayer

    public class OpenALStreamPlayer

extends java.lang.Object

A generic tool to work on a supplied stream, pulling out PCM data and buffered it to OpenAL as required.

Author:
  Kevin Glass, Nathan Sweet , Rockstar play and setPosition cleanup

Field Summary
`static int` | `BUFFER_COUNT` The number of buffers to maintain

Constructor Summary
`OpenALStreamPlayer(int source, java.lang.String ref)` Create a new player to work on an audio stream
`OpenALStreamPlayer(int source, java.net.URL url)` Create a new player to work on an audio stream

Method Summary
`boolean` | `done()` Check if the playback is complete.
`float` | `getPosition()` Return the current playing position in the sound
`java.lang.String` | `getSource()` Get the source of this stream
`void` | `play(boolean loop)` Start this stream playing
`boolean` | `setPosition(float position)` Seeks to a position in the music.
`void` | `setup(float pitch)` Setup the playback properties
`boolean` | `stream(int bufferId)` Stream some data from the audio stream to the buffer indicates by the ID
`void` | `update()` Poll the bufferNames - check if we need to fill the bufferNames with another section.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### BUFFER_COUNT

    public static final int BUFFER_COUNT

  The number of buffers to maintain

  See Also:
    Constant Field Values

Constructor Detail

### OpenALStreamPlayer

    public OpenALStreamPlayer(int source,
                              java.lang.String ref)

  Create a new player to work on an audio stream

  Parameters:
    `source` - The source on which we'll play the audio
    `ref` - A reference to the audio file to stream

### OpenALStreamPlayer

    public OpenALStreamPlayer(int source,
                              java.net.URL url)

  Create a new player to work on an audio stream

  Parameters:
    `source` - The source on which we'll play the audio
    `url` - A reference to the audio file to stream

Method Detail

### getSource

    public java.lang.String getSource()

  Get the source of this stream

  Returns:
    The name of the source of string

### play

    public void play(boolean loop)
              throws java.io.IOException

  Start this stream playing

  Parameters:
    `loop` - True if the stream should loop
  Throws:
    `java.io.IOException` - Indicates a failure to read from the stream

### setup

    public void setup(float pitch)

  Setup the playback properties

  Parameters:
    `pitch` - The pitch to play back at

### done

    public boolean done()

  Check if the playback is complete. Note this will never return true if we're looping

  Returns:
    True if we're looping

### update

    public void update()

  Poll the bufferNames - check if we need to fill the bufferNames with another section. Most of the time this should be reasonably quick

### stream

    public boolean stream(int bufferId)

  Stream some data from the audio stream to the buffer indicates by the ID

  Parameters:
    `bufferId` - The ID of the buffer to fill
  Returns:
    True if another section was available

### setPosition

    public boolean setPosition(float position)

  Seeks to a position in the music.

  Parameters:
    `position` - Position in seconds.
  Returns:
    True if the setting of the position was successful

### getPosition

    public float getPosition()

  Return the current playing position in the sound

  Returns:
    The current position in seconds.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 New Dawn Software. All Rights Reserved.