com.leafdigital.audio.api
Interface Audio

All Superinterfaces:
Singleton

public interface Audio
extends Singleton

Singleton service for playing audio clips.


Method Summary
 java.lang.String[] getSounds()
          Obtains a list of all available sounds in system/user folders.
 void play(java.io.File ogg)
          Plays the given audio file, which must be in .ogg format.
 void play(java.io.InputStream oggStream)
          Plays audio from the given InputStream, which must be in .ogg format.
 void play(java.lang.String oggName)
          Plays an audio file from the system or user 'sounds' folder, which must be in .ogg format.
 boolean soundExists(java.lang.String name)
          Returns true if a sound with the given name currently exists.
 

Method Detail

play

void play(java.lang.String oggName)
          throws AudioSetupException,
                 GeneralException
Plays an audio file from the system or user 'sounds' folder, which must be in .ogg format.

Parameters:
oggName - File to play (name only, e.g. "frogs" if you want to play "frogs.ogg" in one of those folders)
Throws:
AudioSetupException - Current system doesn't support audio playback
GeneralException - Any error

play

void play(java.io.File ogg)
          throws AudioSetupException,
                 GeneralException
Plays the given audio file, which must be in .ogg format.

Parameters:
ogg - File to play
Throws:
AudioSetupException - Current system doesn't support audio playback
GeneralException - Any error

play

void play(java.io.InputStream oggStream)
          throws AudioSetupException,
                 GeneralException
Plays audio from the given InputStream, which must be in .ogg format.

Parameters:
oggStream - Stream to play
Throws:
AudioSetupException - Current system doesn't support audio playback
GeneralException - Any error

getSounds

java.lang.String[] getSounds()
                             throws GeneralException
Obtains a list of all available sounds in system/user folders.

Returns:
List of sound names suitable for calling play(String)
Throws:
GeneralException - Any error

soundExists

boolean soundExists(java.lang.String name)
Returns true if a sound with the given name currently exists.

Parameters:
name - Name
Returns:
True if it exists


Copyright © 2011 Samuel Marshall. All rights reserved.