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

## org.newdawn.slick.openal
Interface Audio

All Known Implementing Classes:
  AudioImpl, DeferredSound, MODSound, NullAudio, StreamSound

    public interface Audio

The description of of audio data loaded by the AudioLoader

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

Method Summary
`int` `getBufferID()` Get the ID of the OpenAL buffer holding this data (if any).
`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

Method Detail

### stop

    void stop()

  Stop the sound effect

### getBufferID

    int getBufferID()

  Get the ID of the OpenAL buffer holding this data (if any). This method is not valid with streaming resources.

  Returns:
    The ID of the OpenAL buffer holding this data

### isPlaying

    boolean isPlaying()

  Check if the sound is playing as sound fx

  Returns:
    True if the sound is playing

### playAsSoundEffect

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

  Play this sound as a sound effect

  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

### playAsSoundEffect

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

  Play this sound as a sound effect

  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

### playAsMusic

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

  Play this sound as music

  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

### setPosition

    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

    float getPosition()

  Return the current playing position in the sound

  Returns:
    The current position in seconds.

Copyright © 2006 New Dawn Software. All Rights Reserved.