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 SoundStore

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

    public class SoundStore

extends java.lang.Object

Responsible for holding and playing the sounds used in the game.

Author:
  Kevin Glass, Rockstar setVolume cleanup

Method Summary
`void` | `clear()` Clear out the sound store contents
`void` | `disable()` Disable use of the Sound Store
`static SoundStore` | `get()` Get the single instance of this class
`Audio` | `getAIF(java.io.InputStream in)` Get the Sound based on a specified AIF file
`Audio` | `getAIF(java.lang.String ref)` Get the Sound based on a specified AIF file
`Audio` | `getAIF(java.lang.String ref, java.io.InputStream in)` Get the Sound based on a specified AIF file
`float` | `getCurrentMusicVolume()` Get the volume scalar of the music that is currently playing.
`Audio` | `getMOD(java.io.InputStream in)` Get a MOD sound (mod/xm etc)
`Audio` | `getMOD(java.lang.String ref)` Get a MOD sound (mod/xm etc)
`Audio` | `getMOD(java.lang.String ref, java.io.InputStream in)` Get a MOD sound (mod/xm etc)
`float` | `getMusicVolume()` Get the volume for music
`Audio` | `getOgg(java.io.InputStream in)` Get the Sound based on a specified OGG file
`Audio` | `getOgg(java.lang.String ref)` Get the Sound based on a specified OGG file
`Audio` | `getOgg(java.lang.String ref, java.io.InputStream in)` Get the Sound based on a specified OGG file
`Audio` | `getOggStream(java.lang.String ref)` Get the Sound based on a specified OGG file
`Audio` | `getOggStream(java.net.URL ref)` Get the Sound based on a specified OGG file
`float` | `getSoundVolume()` Get the volume for sounds
`int` | `getSource(int index)` Get the ID of a given source
`int` | `getSourceCount()` Retrieve the number of OpenAL sound sources that have been determined at initialisation.
`Audio` | `getWAV(java.io.InputStream in)` Get the Sound based on a specified WAV file
`Audio` | `getWAV(java.lang.String ref)` Get the Sound based on a specified WAV file
`Audio` | `getWAV(java.lang.String ref, java.io.InputStream in)` Get the Sound based on a specified WAV file
`void` | `init()` Initialise the sound effects stored.
`boolean` | `isDeferredLoading()` Check if we're using deferred loading
`boolean` | `isMusicOn()` Check if music should currently be playing
`boolean` | `isMusicPlaying()` Check if the music is currently playing
`boolean` | `musicOn()` Check if music is currently enabled
`void` | `pauseLoop()` Pause the music loop that is currently playing
`void` | `poll(int delta)` Poll the streaming system
`void` | `restartLoop()` Restart the music loop that is currently paused
`void` | `setCurrentMusicVolume(float volume)` Set the music volume of the current playing music.
`void` | `setDeferredLoading(boolean deferred)` True if we should only record the request to load in the intention of loading the sound later
`void` | `setMaxSources(int max)` Set the maximum number of concurrent sound effects that will be attempted
`void` | `setMusicOn(boolean music)` Inidicate whether music should be playing
`void` | `setMusicPitch(float pitch)` Set the pitch at which the current music is being played
`void` | `setMusicVolume(float volume)` Set the music volume
`void` | `setSoundsOn(boolean sounds)` Indicate whether sound effects should be played
`void` | `setSoundVolume(float volume)` Set the sound volume
`boolean` | `soundsOn()` Check if sound effects are currently enabled
`boolean` | `soundWorks()` Check if sound works at all
`void` | `stopSoundEffect(int id)` Stop a playing sound identified by the ID returned from playing.

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

Method Detail

### clear

    public void clear()

  Clear out the sound store contents

### disable

    public void disable()

  Disable use of the Sound Store

### setDeferredLoading

    public void setDeferredLoading(boolean deferred)

  True if we should only record the request to load in the intention of loading the sound later

  Parameters:
    `deferred` - True if the we should load a token

### isDeferredLoading

    public boolean isDeferredLoading()

  Check if we're using deferred loading

  Returns:
    True if we're loading deferred sounds

### setMusicOn

    public void setMusicOn(boolean music)

  Inidicate whether music should be playing

  Parameters:
    `music` - True if music should be played

### isMusicOn

    public boolean isMusicOn()

  Check if music should currently be playing

  Returns:
    True if music is currently playing

### setMusicVolume

    public void setMusicVolume(float volume)

  Set the music volume

  Parameters:
    `volume` - The volume for music

### getCurrentMusicVolume

    public float getCurrentMusicVolume()

  Get the volume scalar of the music that is currently playing.

  Returns:
    The volume of the music currently playing

### setCurrentMusicVolume

    public void setCurrentMusicVolume(float volume)

  Set the music volume of the current playing music. Does NOT affect the global volume

  Parameters:
    `volume` - The volume for the current playing music

### setSoundVolume

    public void setSoundVolume(float volume)

  Set the sound volume

  Parameters:
    `volume` - The volume for sound fx

### soundWorks

    public boolean soundWorks()

  Check if sound works at all

  Returns:
    True if sound works at all

### musicOn

    public boolean musicOn()

  Check if music is currently enabled

  Returns:
    True if music is currently enabled

### getSoundVolume

    public float getSoundVolume()

  Get the volume for sounds

  Returns:
    The volume for sounds

### getMusicVolume

    public float getMusicVolume()

  Get the volume for music

  Returns:
    The volume for music

### getSource

    public int getSource(int index)

  Get the ID of a given source

  Parameters:
    `index` - The ID of a given source
  Returns:
    The ID of the given source

### setSoundsOn

    public void setSoundsOn(boolean sounds)

  Indicate whether sound effects should be played

  Parameters:
    `sounds` - True if sound effects should be played

### soundsOn

    public boolean soundsOn()

  Check if sound effects are currently enabled

  Returns:
    True if sound effects are currently enabled

### setMaxSources

    public void setMaxSources(int max)

  Set the maximum number of concurrent sound effects that will be attempted

  Parameters:
    `max` - The maximum number of sound effects/music to mix

### init

    public void init()

  Initialise the sound effects stored. This must be called before anything else will work

### setMusicPitch

    public void setMusicPitch(float pitch)

  Set the pitch at which the current music is being played

  Parameters:
    `pitch` - The pitch at which the current music is being played

### pauseLoop

    public void pauseLoop()

  Pause the music loop that is currently playing

### restartLoop

    public void restartLoop()

  Restart the music loop that is currently paused

### getMOD

    public Audio getMOD(java.lang.String ref)
                 throws java.io.IOException

  Get a MOD sound (mod/xm etc)

  Parameters:
    `ref` - The refernece to the mod to load
  Returns:
    The sound for play back
  Throws:
    `java.io.IOException` - Indicates a failure to read the data

### getMOD

    public Audio getMOD(java.io.InputStream in)
                 throws java.io.IOException

  Get a MOD sound (mod/xm etc)

  Parameters:
    `in` - The stream to the MOD to load
  Returns:
    The sound for play back
  Throws:
    `java.io.IOException` - Indicates a failure to read the data

### getMOD

    public Audio getMOD(java.lang.String ref,
                        java.io.InputStream in)
                 throws java.io.IOException

  Get a MOD sound (mod/xm etc)

  Parameters:
    `ref` - The stream to the MOD to load
    `in` - The stream to the MOD to load
  Returns:
    The sound for play back
  Throws:
    `java.io.IOException` - Indicates a failure to read the data

### getAIF

    public Audio getAIF(java.lang.String ref)
                 throws java.io.IOException

  Get the Sound based on a specified AIF file

  Parameters:
    `ref` - The reference to the AIF file in the classpath
  Returns:
    The Sound read from the AIF file
  Throws:
    `java.io.IOException` - Indicates a failure to load the AIF

### getAIF

    public Audio getAIF(java.io.InputStream in)
                 throws java.io.IOException

  Get the Sound based on a specified AIF file

  Parameters:
    `in` - The stream to the MOD to load
  Returns:
    The Sound read from the AIF file
  Throws:
    `java.io.IOException` - Indicates a failure to load the AIF

### getAIF

    public Audio getAIF(java.lang.String ref,
                        java.io.InputStream in)
                 throws java.io.IOException

  Get the Sound based on a specified AIF file

  Parameters:
    `ref` - The reference to the AIF file in the classpath
    `in` - The stream to the AIF to load
  Returns:
    The Sound read from the AIF file
  Throws:
    `java.io.IOException` - Indicates a failure to load the AIF

### getWAV

    public Audio getWAV(java.lang.String ref)
                 throws java.io.IOException

  Get the Sound based on a specified WAV file

  Parameters:
    `ref` - The reference to the WAV file in the classpath
  Returns:
    The Sound read from the WAV file
  Throws:
    `java.io.IOException` - Indicates a failure to load the WAV

### getWAV

    public Audio getWAV(java.io.InputStream in)
                 throws java.io.IOException

  Get the Sound based on a specified WAV file

  Parameters:
    `in` - The stream to the WAV to load
  Returns:
    The Sound read from the WAV file
  Throws:
    `java.io.IOException` - Indicates a failure to load the WAV

### getWAV

    public Audio getWAV(java.lang.String ref,
                        java.io.InputStream in)
                 throws java.io.IOException

  Get the Sound based on a specified WAV file

  Parameters:
    `ref` - The reference to the WAV file in the classpath
    `in` - The stream to the WAV to load
  Returns:
    The Sound read from the WAV file
  Throws:
    `java.io.IOException` - Indicates a failure to load the WAV

### getOggStream

    public Audio getOggStream(java.lang.String ref)
                       throws java.io.IOException

  Get the Sound based on a specified OGG file

  Parameters:
    `ref` - The reference to the OGG file in the classpath
  Returns:
    The Sound read from the OGG file
  Throws:
    `java.io.IOException` - Indicates a failure to load the OGG

### getOggStream

    public Audio getOggStream(java.net.URL ref)
                       throws java.io.IOException

  Get the Sound based on a specified OGG file

  Parameters:
    `ref` - The reference to the OGG file in the classpath
  Returns:
    The Sound read from the OGG file
  Throws:
    `java.io.IOException` - Indicates a failure to load the OGG

### getOgg

    public Audio getOgg(java.lang.String ref)
                 throws java.io.IOException

  Get the Sound based on a specified OGG file

  Parameters:
    `ref` - The reference to the OGG file in the classpath
  Returns:
    The Sound read from the OGG file
  Throws:
    `java.io.IOException` - Indicates a failure to load the OGG

### getOgg

    public Audio getOgg(java.io.InputStream in)
                 throws java.io.IOException

  Get the Sound based on a specified OGG file

  Parameters:
    `in` - The stream to the OGG to load
  Returns:
    The Sound read from the OGG file
  Throws:
    `java.io.IOException` - Indicates a failure to load the OGG

### getOgg

    public Audio getOgg(java.lang.String ref,
                        java.io.InputStream in)
                 throws java.io.IOException

  Get the Sound based on a specified OGG file

  Parameters:
    `ref` - The reference to the OGG file in the classpath
    `in` - The stream to the OGG to load
  Returns:
    The Sound read from the OGG file
  Throws:
    `java.io.IOException` - Indicates a failure to load the OGG

### poll

    public void poll(int delta)

  Poll the streaming system

  Parameters:
    `delta` - The amount of time passed since last poll (in milliseconds)

### isMusicPlaying

    public boolean isMusicPlaying()

  Check if the music is currently playing

  Returns:
    True if the music is playing

### get

    public static SoundStore get()

  Get the single instance of this class

  Returns:
    The single instnace of this class

### stopSoundEffect

    public void stopSoundEffect(int id)

  Stop a playing sound identified by the ID returned from playing. This utility method should only be used when needing to stop sound effects that may have been played more than once and need to be explicitly stopped.

  Parameters:
    `id` - The ID of the underlying OpenAL source as returned from playAsSoundEffect

### getSourceCount

    public int getSourceCount()

  Retrieve the number of OpenAL sound sources that have been determined at initialisation.

  Returns:
    The number of sources available

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.