# StreamSound (Slick - The 2D Library)
Date: 2013-06-03

## org.newdawn.slick.openal
Class StreamSound

    java.lang.Object
      org.newdawn.slick.openal.AudioImpl
          org.newdawn.slick.openal.StreamSound

All Implemented Interfaces:
  Audio

    public class StreamSound

extends AudioImpl

A sound implementation wrapped round a player which reads (and potentially) rereads a stream. This supplies streaming audio

Author:
  kevin, Nathan Sweet <misc@n4te.com>, Rockstar playAsMusic cleanup

Constructor Summary
`StreamSound(OpenALStreamPlayer player)` Create a new sound wrapped round a stream

Method Summary
`float` `getPosition()` Return the current playing position in the sound
`boolean` `isPlaying()` Check if the sound is playing as sound fx
`int` `playAsMusic(float pitch, float gain, boolean loop)` Play this sound as music
`int` `playAsSoundEffect(float pitch, float gain, boolean loop)` Play this sound as a sound effect
`int` `playAsSoundEffect(float pitch, float gain, boolean loop, float x, float y, float z)` Play this sound as a sound effect
`boolean` `setPosition(float position)` Seeks to a position in the music.
`void` `stop()` Stop the sound effect

Methods inherited from class org.newdawn.slick.openal.AudioImpl
`getBufferID, pauseMusic, restartMusic`

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

Constructor Detail

### StreamSound

    public StreamSound(OpenALStreamPlayer player)

  Create a new sound wrapped round a stream

  Parameters:
    `player` - The stream player we'll use to access the stream

Method Detail

### isPlaying

    public boolean isPlaying()

  Description copied from interface: `Audio`
  Check if the sound is playing as sound fx

  Specified by:
    `isPlaying` in interface `Audio`
  Overrides:
    `isPlaying` in class `AudioImpl`
  Returns:
    True if the sound is playing
  See Also:
    `AudioImpl.isPlaying()`

### playAsMusic

    public int playAsMusic(float pitch,
                           float gain,
                           boolean loop)

  Description copied from interface: `Audio`
  Play this sound as music

  Specified by:
    `playAsMusic` in interface `Audio`
  Overrides:
    `playAsMusic` in class `AudioImpl`
  Parameters:
    `pitch` - The pitch of the play back
    `gain` - The gain of the play back
    `loop` - True if we should loop
  Returns:
    The ID of the source playing the sound
  See Also:
    `AudioImpl.playAsMusic(float, float, boolean)`

### playAsSoundEffect

    public int playAsSoundEffect(float pitch,
                                 float gain,
                                 boolean loop,
                                 float x,
                                 float y,
                                 float z)

  Description copied from interface: `Audio`
  Play this sound as a sound effect

  Specified by:
    `playAsSoundEffect` in interface `Audio`
  Overrides:
    `playAsSoundEffect` in class `AudioImpl`
  Parameters:
    `pitch` - The pitch of the play back
    `gain` - The gain of the play back
    `loop` - True if we should loop
    `x` - The x position of the sound
    `y` - The y position of the sound
    `z` - The z position of the sound
  Returns:
    The ID of the source playing the sound
  See Also:
    `AudioImpl.playAsSoundEffect(float, float, boolean, float, float, float)`

### playAsSoundEffect

    public int playAsSoundEffect(float pitch,
                                 float gain,
                                 boolean loop)

  Description copied from interface: `Audio`
  Play this sound as a sound effect

  Specified by:
    `playAsSoundEffect` in interface `Audio`
  Overrides:
    `playAsSoundEffect` in class `AudioImpl`
  Parameters:
    `pitch` - The pitch of the play back
    `gain` - The gain of the play back
    `loop` - True if we should loop
  Returns:
    The ID of the source playing the sound
  See Also:
    `AudioImpl.playAsSoundEffect(float, float, boolean)`

### stop

    public void stop()

  Description copied from interface: `Audio`
  Stop the sound effect

  Specified by:
    `stop` in interface `Audio`
  Overrides:
    `stop` in class `AudioImpl`
  See Also:
    `AudioImpl.stop()`

### setPosition

    public boolean setPosition(float position)

  Description copied from interface: `Audio`
  Seeks to a position in the music.

  Specified by:
    `setPosition` in interface `Audio`
  Overrides:
    `setPosition` in class `AudioImpl`
  Parameters:
    `position` - Position in seconds.
  Returns:
    True if the setting of the position was successful
  See Also:
    `AudioImpl.setPosition(float)`

### getPosition

    public float getPosition()

  Description copied from interface: `Audio`
  Return the current playing position in the sound

  Specified by:
    `getPosition` in interface `Audio`
  Overrides:
    `getPosition` in class `AudioImpl`
  Returns:
    The current position in seconds.
  See Also:
    `AudioImpl.getPosition()`

Copyright © 2006 New Dawn Software. All Rights Reserved.