com.crickettechnology.audio
Class Bank

java.lang.Object
  extended by com.crickettechnology.audio.Bank

public final class Bank
extends java.lang.Object

A bank of memory-resident sounds.


Method Summary
 void destroy()
          Destroy this object.
static Bank find(java.lang.String name)
          Find a loaded bank by name.
 java.lang.String getName()
          Returns the name of the bank.
 int getNumSounds()
          Returns the number of sounds in the bank.
 java.lang.String getSoundName(int index)
          Returns the name of a sound in this bank.
 boolean isFailed()
          Returns true if an asynchronously loaded bank had an error during loading.
 boolean isLoaded()
          Returns true when an asynchronously loaded bank has finished loading.
static Bank newBank(java.lang.String filename)
          Loads a bank from an asset in the .apk.
static Bank newBank(java.lang.String filename, PathType pathType)
          Loads a bank.
static Bank newBankAsync(java.lang.String filename)
          Loads a bank asynchronously from an asset in the .apk.
static Bank newBankAsync(java.lang.String filename, PathType pathType)
          Loads a bank asynchronously.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isLoaded

public boolean isLoaded()
Returns true when an asynchronously loaded bank has finished loading.


isFailed

public boolean isFailed()
Returns true if an asynchronously loaded bank had an error during loading.


getName

public java.lang.String getName()
Returns the name of the bank.


getNumSounds

public int getNumSounds()
Returns the number of sounds in the bank.


getSoundName

public java.lang.String getSoundName(int index)
Returns the name of a sound in this bank. The name will be 31 characters or less.


newBank

public static Bank newBank(java.lang.String filename,
                           PathType pathType)
Loads a bank.

Parameters:
filename - Path to the bank file (.ckb).
pathType - Indicates how the path is to be interpreted.
Returns:
The bank, or null if it could not be loaded

newBank

public static Bank newBank(java.lang.String filename)
Loads a bank from an asset in the .apk. Equivalent to load(filename, PathType.Asset).

Parameters:
filename - Path to the bank file (.ckb).
Returns:
The bank, or null if it could not be loaded

newBankAsync

public static Bank newBankAsync(java.lang.String filename,
                                PathType pathType)
Loads a bank asynchronously.

Parameters:
filename - Path to the bank file (.ckb).
pathType - Indicates how the path is to be interpreted.
Returns:
The bank, or null if it could not be loaded

newBankAsync

public static Bank newBankAsync(java.lang.String filename)
Loads a bank asynchronously from an asset in the .apk. Equivalent to newBankAsync(filename, PathType.Asset).

Parameters:
filename - Path to the bank file (.ckb).
Returns:
The bank, or null if it could not be loaded

find

public static Bank find(java.lang.String name)
Find a loaded bank by name.

Parameters:
name - The bank name; should be 31 characters or less
Returns:
The bank, or null if none with that name

destroy

public void destroy()
Destroy this object. This is called when the object is finalized by the garbage collector; however, it is better to call it explicitly, so the object is destroyed predictably.