danger.audio
Class Meta

java.lang.Object
  extended by danger.audio.Meta


public class Meta
extends Object

The Danger OS has a system of UI related audio cues. These cues are connected to various application events, and fire when used.

The Meta class can be used to replace those cues with your own custom audio.

The audio cues defined in this class are used with play(int) and the various variants. For example:

    Meta.play(Meta.BEEP_COMMAND_ACCEPTED);
will play the BEEP_COMMAND_ACCEPTED audio cue.

You can use the Meta class to create your own sounds and replace any Meta cue. This is how Themes are done.

In this example the method useNewSwish() replaces the default Meta.LID_OPEN, and Meta.LID_CLOSE. This is global, and will stay until a reboot, or a call to useOldSwish().

    void useNewSwish()
    {
        byte[] newOpen  = sOpenSound; //* bytes of formatted audio data
        byte[] newClose = sCloseSound; //* bytes of formatted audio data
        Tone   open;
        Tone   close;

        if ((newOpen != null) && (newClose != null))
        {
            sSwishChanged     = true;

            open = new Tone(newOpen, ToneGallery.generateResourceID(), false,
                    false, 100, 90, ToneFilter.SOUND, ToneClass.SYSTEM,
                    "open!", "##UI");

            if (open != null)
            {
                open.setRoute(Route.EXTERNAL);

                sMetaOpenID = Meta.getToneFromID(Meta.LID_OPEN);
                Meta.setToneToID(open, Meta.LID_OPEN);
            }
            else
            {
                // failed
            }

            close = new Tone(newClose, ToneGallery.generateResourceID(), false,
                    false, 100, 90, ToneFilter.SOUND, ToneClass.SYSTEM,
                    "open!", "##UI");

            if (close != null)
            {
                close.setRoute(Route.EXTERNAL);

                sMetaCloseID = Meta.getToneFromID(Meta.LID_CLOSE);
                Meta.setToneToID(close, Meta.LID_CLOSE);
            }
            else
            {
                // failed
            }
        }
    }

    void useOldSwish()
    {
        if (sSwishChanged)
        {
            Meta.setToneToID(sMetaOpenID, Meta.LID_OPEN);
            Meta.setToneToID(sMetaCloseID, Meta.LID_CLOSE);
            sMetaOpenID = null;
            sMetaCloseID = null;
        }
        sSwishChanged = false;
    }


Field Summary
static int APP_CALENDAR_EVENT
          Audio cue for calendar alert.
static int APP_EMAIL_RECEIVED
          Audio cue for receiving an email.
static int APP_MMS_RECEIVED
          Audio cue for receiving an MMS.
static int APP_PHONE_NEW_VOICE_MAIL
          Audio cue for when the new voice mail arrives.
static int APP_PHONE_RING
          Audio cue for when the phone rings.
static int APP_SMS_RECEIVED
          Audio cue for receiving an SMS.
static int APP_WAP_DONE
          Audio cue for a wap page being done.
static int APP_WEB_DONE
          Audio cue for a web page being done.
static int BATTERY_COVER_REMOVED
          Audio cue for battery cover being removed.
static int BATTERY_FAILURE_IMMINENT
          Deprecated.  
static int BEEP_ACTION_FAIL
          Audio cue denotes action failed.
static int BEEP_ACTION_SUCCESS
          Audio cue denotes action succeeds.
static int BEEP_COMMAND_ACCEPTED
          Audio cue denotes command accepted.
static int BEEP_COMMAND_REJECTED
          Audio cue denotes command reject.
static int CALL_BUSY
          Audio cue for phone busy tone.
static int CALL_DROPPED
          Audio cue for phone call dropped tone.
static int CALL_ENDED
          Audio cue for phone call ended tone.
static int CALL_REORDER
          Audio cue for phone call reordered tone.
static int CALL_WAITING
          Audio cue for phone call waiting tone.
static int CHARGER_CONNECTED
          Audio cue when a device connects to a charger.
static int CHARGER_DISCONNECTED
          Audio cue when a device disconnects from a charger.
static int DEFAULT_BACKGROUND
          Audio cue for default background tone.
static int DEFAULT_FOREGROUND
          Audio cue for default foreground tone.
static int DELETE_ITEM
          Audio cue for a item being deleted.
static int DELETE_TRASH
          Audio cue for a trash being deleted.
static int DIALOG_OPEN
          Audio cue for a dialog being opened.
static int ENTER_KEYGUARD
          Audio cue for device entering keyguard.
static int ENTER_SUB_CHOOSER
          Audio cue for opening a folder in chooser.
static int FEEDBACK_AUTO_CAP
          Audio cue for when the caps key is pressed twice, to denote auto cap on.
static int FEEDBACK_AUTO_REPLACE
          Audio cue for when a autotext event replaces text.
static int FEEDBACK_BACK_BUTTON
          Deprecated. Use FEEDBACK_DONE_BUTTON instead.
static int FEEDBACK_CANCEL_BUTTON
          Audio cue for cancel being pressed.
static int FEEDBACK_DELETE_KEY_ONCE
          Audio cue for keyboard delete key being pressed.
static int FEEDBACK_DELETE_KEY_REPEAT
          Audio cue for keyboard delete key being repeated.
static int FEEDBACK_DONE_BUTTON
          Audio cue for back/done being pressed.
static int FEEDBACK_END_BUTTON
          Audio cue for phone end being pressed.
static int FEEDBACK_HEADSET_BUTTON
          Audio cue for headset button being pressed.
static int FEEDBACK_JUMP_BUTTON
          Audio cue for jump being pressed.
static int FEEDBACK_KEY_ONCE
          Audio cue for keyboard keys being pressed.
static int FEEDBACK_KEY_REPEAT
          Audio cue for keyboard keys being repeated.
static int FEEDBACK_LEFT_SHOULDER_BUTTON
          Audio cue for left shoulder being pressed.
static int FEEDBACK_MENU_BUTTON
          Audio cue for menu being pressed.
static int FEEDBACK_NETWORK_1
          Audio cue for network connection at one dot.
static int FEEDBACK_NETWORK_2
          Audio cue for network connection at two dots.
static int FEEDBACK_NETWORK_3
          Audio cue for network connection at three dots.
static int FEEDBACK_NETWORK_G
          Audio cue for network connection at G (connected).
static int FEEDBACK_NETWORK_PHONEONLY
          Audio cue for network connection at phone only.
static int FEEDBACK_NETWORK_X
          Audio cue for network connection at X.
static int FEEDBACK_PAGE_DOWN
          Audio cue for page down being pressed.
static int FEEDBACK_PAGE_UP
          Audio cue for page up being pressed.
static int FEEDBACK_POWER_SWITCH_BUTTON
          Audio cue for power being pressed.
static int FEEDBACK_PROFILE_VOL
          Audio cue for when the Profile UI changes profiles.
static int FEEDBACK_RETURN_KEY_ONCE
          Audio cue for keyboard return key being pressed.
static int FEEDBACK_RETURN_KEY_REPEAT
          Audio cue for keyboard return key being repeated.
static int FEEDBACK_RIGHT_SHOULDER_BUTTON
          Audio cue for right shoulder being pressed.
static int FEEDBACK_SEND_BUTTON
          Audio cue for phone send being pressed.
static int FEEDBACK_SPACE_KEY_ONCE
          Audio cue for keyboard space key being pressed.
static int FEEDBACK_SPACE_KEY_REPEAT
          Audio cue for keyboard space key being repeated.
static int FEEDBACK_WHEEL_BUTTON
          Audio cue for wheel/trackball being pressed.
static int INVALID
          Invalid meta ID.
static int JUMP_SHORTCUT
          Audio cue for activating a new application via a shortcut.
static int JUMP_TO_CHOOSER
          Audio cue for closing a folder in chooser.
static int LID_CLOSE
          Audio cue for device screen close.
static int LID_OPEN
          Audio cue for device screen open.
static int LOW_BATTERY
          Audio cue for low power.
static int LOW_BATTERY_ON_PHONE
          Audio cue for low power, but only plays while on phone.
static int MENU_ACTIVATION
          Audio cue for a menu being displayed.
static int MENU_DISMISS
          Audio cue for a menu being closed.
static int MENU_SHORTCUT
          Audio cue for a menu keyboard shortcut being used.
static int SCROLL_LIMIT
          Audio cue denotes scroll limits.
static int SCROLL_WHEEL_DOWN
          Audio cue for scroll wheel down.
static int SCROLL_WHEEL_UP
          Audio cue for scroll wheel up.
static int SYSTEM_BACKGROUND
          Audio cue for default background tone.
static int SYSTEM_FOREGROUND
          Audio cue for default foreground tone.
static int ZOOM_IN
          Not used, but reserved.
static int ZOOM_OUT
          Not used, but reserved.
static int ZOOM_OUT_FURTHER
          Not used, but reserved.
 
Method Summary
static int createDefaultToneID(int klass)
          Create a default toneID from a ToneClass.
static int getDefaultVolume(int id)
          Given a meta or tone ID, return its default volume.
static int getDefaultVolume(RingToneObject ring)
          Given a ringtone object, return its default volume.
static int getIDFromResourceID(int metaID)
          Get a ToneGallery ID, from a Meta ID.
static Tone getToneFromID(int metaID)
          Get a Tone from a Meta ID.
static Tone getToneFromID(RingToneObject ring)
          Get a Tone from a RingToneObject.
static int getVolume(int id)
          Given a meta or tone ID, return its volume.
static int getVolume(RingToneObject ring)
          Given a ringtone object, return its volume.
static boolean isDone(int id)
          Get status of doneness of a Meta ID or ToneGallery ID.
static boolean isIDMuted(int metaID)
          Return mute status of a metaID.
static boolean isInitialized()
          Returns true if Meta system is initialized.
static boolean isInstalled(int id)
          Check to see if a particular ID is installed.
static boolean isInstalled(RingToneObject ring)
          Check to see if a particular RingToneObject is installed.
static boolean isMetaID(int metaID)
          Is the ID a meta cue, or a ToneGallery ID.
static void muteID(int metaID)
          Mute a particular Meta ID.
static void play(int id)
          Load and play the toneID passed in.
static void play(int id, int volume)
          Load and play the toneID passed in.
static void play(int id, int volume, int playbackFilters)
          Load and play the toneID passed in.
static void play(int id, int volume, int playbackFilters, int playbackClass, boolean sync)
          Load and play the toneID passed in.
static void play(RingToneObject ring)
          Load and play the RingToneObject passed in.
static void play(RingToneObject ring, int volume)
          Load and play the RingToneObject passed in.
static void play(RingToneObject ring, int volume, int playbackClass)
          Load and play the RingToneObject passed in.
static void play(RingToneObject ring, int volume, int playbackFilters, int playbackClass)
          Load and play the RingToneObject passed in.
static void playSync(int id)
          Load and play the toneID passed in.
static void playSync(int id, int volume)
          Load and play the toneID passed in.
static void playSync(int id, int volume, int playbackFilters)
          Load and play the toneID passed in.
static void playSync(RingToneObject ring)
          Load and play the RingToneObject passed in.
static void playSync(RingToneObject ring, int volume)
          Load and play the RingToneObject passed in.
static void playSync(RingToneObject ring, int volume, int playbackClass)
          Load and play the RingToneObject passed in.
static void playSync(RingToneObject ring, int volume, int playbackFilters, int playbackClass)
          Load and play the RingToneObject passed in.
static void playSyncAsBackground(int id)
          Load and play the toneID passed in.
static void restoreIDToDefault(int metaID)
          Given a valid Meta ID cue, restore the original ToneGallery ID.
static void setDoneCallbackEvent(int id, Event done)
          Set the event that is called when this meta audio is finished.
static void setLoop(int id, boolean on)
          Set looping on/off for a given Meta or ToneGallery ID.
static void setLoop(RingToneObject ring, boolean on)
          Set looping on/off for a given RingToneObject.
static void setStoppedCallbackEvent(int id, Event stopped)
          Set the event that is called when this meta audio is stopped by stop().
static boolean setToneToID(Tone tone, int metaID)
          Change which Tone is called when a Meta ID is called with play(int, int, int, int, boolean).
static void setVolume(int id, int volume)
          Given a meta or tone ID and a volume set it.
static void setVolume(RingToneObject ring, int volume)
          Given a ringtone object and a volume set it.
static void stop(int id)
          Stop a Meta or ToneGallery ID.
static void stop(RingToneObject ring)
          Stop a RingToneObject.
static void unmuteID(int metaID)
          Unmute a particular Meta ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID

public static final int INVALID
Invalid meta ID. Can be returned from createDefaultToneID(int)

See Also:
Constant Field Values

BEEP_COMMAND_ACCEPTED

public static final int BEEP_COMMAND_ACCEPTED
Audio cue denotes command accepted. For example an password entry UI.

See Also:
Constant Field Values

BEEP_COMMAND_REJECTED

public static final int BEEP_COMMAND_REJECTED
Audio cue denotes command reject. For example an password entry UI.

See Also:
Constant Field Values

BEEP_ACTION_SUCCESS

public static final int BEEP_ACTION_SUCCESS
Audio cue denotes action succeeds. For example encoding a long task completed.

See Also:
Constant Field Values

BEEP_ACTION_FAIL

public static final int BEEP_ACTION_FAIL
Audio cue denotes action failed. For example encoding a long task failed.

See Also:
Constant Field Values

SCROLL_LIMIT

public static final int SCROLL_LIMIT
Audio cue denotes scroll limits. For example scrolling through a buddy list.

See Also:
Constant Field Values

SCROLL_WHEEL_UP

public static final int SCROLL_WHEEL_UP
Audio cue for scroll wheel up.

See Also:
Constant Field Values

SCROLL_WHEEL_DOWN

public static final int SCROLL_WHEEL_DOWN
Audio cue for scroll wheel down.

See Also:
Constant Field Values

FEEDBACK_WHEEL_BUTTON

public static final int FEEDBACK_WHEEL_BUTTON
Audio cue for wheel/trackball being pressed.

See Also:
Constant Field Values

FEEDBACK_MENU_BUTTON

public static final int FEEDBACK_MENU_BUTTON
Audio cue for menu being pressed.

See Also:
Constant Field Values

FEEDBACK_JUMP_BUTTON

public static final int FEEDBACK_JUMP_BUTTON
Audio cue for jump being pressed.

See Also:
Constant Field Values

FEEDBACK_BACK_BUTTON

public static final int FEEDBACK_BACK_BUTTON
Deprecated. Use FEEDBACK_DONE_BUTTON instead.
Audio cue for back being pressed.

See Also:
Constant Field Values

FEEDBACK_KEY_ONCE

public static final int FEEDBACK_KEY_ONCE
Audio cue for keyboard keys being pressed.

See Also:
Constant Field Values

FEEDBACK_KEY_REPEAT

public static final int FEEDBACK_KEY_REPEAT
Audio cue for keyboard keys being repeated.

See Also:
Constant Field Values

FEEDBACK_DELETE_KEY_ONCE

public static final int FEEDBACK_DELETE_KEY_ONCE
Audio cue for keyboard delete key being pressed.

See Also:
Constant Field Values

FEEDBACK_DELETE_KEY_REPEAT

public static final int FEEDBACK_DELETE_KEY_REPEAT
Audio cue for keyboard delete key being repeated.

See Also:
Constant Field Values

FEEDBACK_RETURN_KEY_ONCE

public static final int FEEDBACK_RETURN_KEY_ONCE
Audio cue for keyboard return key being pressed.

See Also:
Constant Field Values

FEEDBACK_RETURN_KEY_REPEAT

public static final int FEEDBACK_RETURN_KEY_REPEAT
Audio cue for keyboard return key being repeated.

See Also:
Constant Field Values

FEEDBACK_SPACE_KEY_ONCE

public static final int FEEDBACK_SPACE_KEY_ONCE
Audio cue for keyboard space key being pressed.

See Also:
Constant Field Values

FEEDBACK_SPACE_KEY_REPEAT

public static final int FEEDBACK_SPACE_KEY_REPEAT
Audio cue for keyboard space key being repeated.

See Also:
Constant Field Values

FEEDBACK_DONE_BUTTON

public static final int FEEDBACK_DONE_BUTTON
Audio cue for back/done being pressed.

See Also:
Constant Field Values

FEEDBACK_CANCEL_BUTTON

public static final int FEEDBACK_CANCEL_BUTTON
Audio cue for cancel being pressed.

See Also:
Constant Field Values

FEEDBACK_PAGE_UP

public static final int FEEDBACK_PAGE_UP
Audio cue for page up being pressed.

See Also:
Constant Field Values

FEEDBACK_PAGE_DOWN

public static final int FEEDBACK_PAGE_DOWN
Audio cue for page down being pressed.

See Also:
Constant Field Values

FEEDBACK_AUTO_REPLACE

public static final int FEEDBACK_AUTO_REPLACE
Audio cue for when a autotext event replaces text.

See Also:
Constant Field Values

FEEDBACK_AUTO_CAP

public static final int FEEDBACK_AUTO_CAP
Audio cue for when the caps key is pressed twice, to denote auto cap on.

See Also:
Constant Field Values

FEEDBACK_PROFILE_VOL

public static final int FEEDBACK_PROFILE_VOL
Audio cue for when the Profile UI changes profiles.

See Also:
Constant Field Values

FEEDBACK_SEND_BUTTON

public static final int FEEDBACK_SEND_BUTTON
Audio cue for phone send being pressed.

See Also:
Constant Field Values

FEEDBACK_END_BUTTON

public static final int FEEDBACK_END_BUTTON
Audio cue for phone end being pressed.

See Also:
Constant Field Values

FEEDBACK_LEFT_SHOULDER_BUTTON

public static final int FEEDBACK_LEFT_SHOULDER_BUTTON
Audio cue for left shoulder being pressed.

See Also:
Constant Field Values

FEEDBACK_RIGHT_SHOULDER_BUTTON

public static final int FEEDBACK_RIGHT_SHOULDER_BUTTON
Audio cue for right shoulder being pressed.

See Also:
Constant Field Values

FEEDBACK_POWER_SWITCH_BUTTON

public static final int FEEDBACK_POWER_SWITCH_BUTTON
Audio cue for power being pressed.

See Also:
Constant Field Values

FEEDBACK_HEADSET_BUTTON

public static final int FEEDBACK_HEADSET_BUTTON
Audio cue for headset button being pressed.

See Also:
Constant Field Values

ZOOM_IN

public static final int ZOOM_IN
Not used, but reserved.

See Also:
Constant Field Values

ZOOM_OUT

public static final int ZOOM_OUT
Not used, but reserved.

See Also:
Constant Field Values

ZOOM_OUT_FURTHER

public static final int ZOOM_OUT_FURTHER
Not used, but reserved.

See Also:
Constant Field Values

ENTER_SUB_CHOOSER

public static final int ENTER_SUB_CHOOSER
Audio cue for opening a folder in chooser.

Since:
4.0
See Also:
Constant Field Values

JUMP_TO_CHOOSER

public static final int JUMP_TO_CHOOSER
Audio cue for closing a folder in chooser.

Since:
4.0
See Also:
Constant Field Values

JUMP_SHORTCUT

public static final int JUMP_SHORTCUT
Audio cue for activating a new application via a shortcut.

See Also:
Constant Field Values

CHARGER_CONNECTED

public static final int CHARGER_CONNECTED
Audio cue when a device connects to a charger.

See Also:
Constant Field Values

CHARGER_DISCONNECTED

public static final int CHARGER_DISCONNECTED
Audio cue when a device disconnects from a charger.

See Also:
Constant Field Values

LOW_BATTERY

public static final int LOW_BATTERY
Audio cue for low power. Will repeat every 5 to 10 minutes.

See Also:
Constant Field Values

BATTERY_FAILURE_IMMINENT

public static final int BATTERY_FAILURE_IMMINENT
Deprecated. 
See Also:
Constant Field Values

LOW_BATTERY_ON_PHONE

public static final int LOW_BATTERY_ON_PHONE
Audio cue for low power, but only plays while on phone. Very subtle.

See Also:
Constant Field Values

BATTERY_COVER_REMOVED

public static final int BATTERY_COVER_REMOVED
Audio cue for battery cover being removed.

See Also:
Constant Field Values

ENTER_KEYGUARD

public static final int ENTER_KEYGUARD
Audio cue for device entering keyguard.

Since:
4.0
See Also:
Constant Field Values

LID_OPEN

public static final int LID_OPEN
Audio cue for device screen open.

See Also:
Constant Field Values

LID_CLOSE

public static final int LID_CLOSE
Audio cue for device screen close.

See Also:
Constant Field Values

CALL_BUSY

public static final int CALL_BUSY
Audio cue for phone busy tone.

See Also:
Constant Field Values

CALL_WAITING

public static final int CALL_WAITING
Audio cue for phone call waiting tone.

See Also:
Constant Field Values

CALL_ENDED

public static final int CALL_ENDED
Audio cue for phone call ended tone.

See Also:
Constant Field Values

CALL_DROPPED

public static final int CALL_DROPPED
Audio cue for phone call dropped tone.

See Also:
Constant Field Values

CALL_REORDER

public static final int CALL_REORDER
Audio cue for phone call reordered tone.

See Also:
Constant Field Values

MENU_ACTIVATION

public static final int MENU_ACTIVATION
Audio cue for a menu being displayed.

See Also:
Constant Field Values

MENU_DISMISS

public static final int MENU_DISMISS
Audio cue for a menu being closed.

See Also:
Constant Field Values

MENU_SHORTCUT

public static final int MENU_SHORTCUT
Audio cue for a menu keyboard shortcut being used.

See Also:
Constant Field Values

DIALOG_OPEN

public static final int DIALOG_OPEN
Audio cue for a dialog being opened.

See Also:
Constant Field Values

DELETE_ITEM

public static final int DELETE_ITEM
Audio cue for a item being deleted. Like a single email being deleted.

See Also:
Constant Field Values

DELETE_TRASH

public static final int DELETE_TRASH
Audio cue for a trash being deleted. Like empty trash in email.

See Also:
Constant Field Values

FEEDBACK_NETWORK_X

public static final int FEEDBACK_NETWORK_X
Audio cue for network connection at X.

See Also:
Constant Field Values

FEEDBACK_NETWORK_PHONEONLY

public static final int FEEDBACK_NETWORK_PHONEONLY
Audio cue for network connection at phone only.

See Also:
Constant Field Values

FEEDBACK_NETWORK_1

public static final int FEEDBACK_NETWORK_1
Audio cue for network connection at one dot.

See Also:
Constant Field Values

FEEDBACK_NETWORK_2

public static final int FEEDBACK_NETWORK_2
Audio cue for network connection at two dots.

See Also:
Constant Field Values

FEEDBACK_NETWORK_3

public static final int FEEDBACK_NETWORK_3
Audio cue for network connection at three dots.

See Also:
Constant Field Values

FEEDBACK_NETWORK_G

public static final int FEEDBACK_NETWORK_G
Audio cue for network connection at G (connected).

See Also:
Constant Field Values

DEFAULT_FOREGROUND

public static final int DEFAULT_FOREGROUND
Audio cue for default foreground tone.

See Also:
Constant Field Values

DEFAULT_BACKGROUND

public static final int DEFAULT_BACKGROUND
Audio cue for default background tone.

See Also:
Constant Field Values

SYSTEM_FOREGROUND

public static final int SYSTEM_FOREGROUND
Audio cue for default foreground tone.

See Also:
Constant Field Values

SYSTEM_BACKGROUND

public static final int SYSTEM_BACKGROUND
Audio cue for default background tone.

See Also:
Constant Field Values

APP_SMS_RECEIVED

public static final int APP_SMS_RECEIVED
Audio cue for receiving an SMS.

See Also:
Constant Field Values

APP_PHONE_RING

public static final int APP_PHONE_RING
Audio cue for when the phone rings.

See Also:
Constant Field Values

APP_PHONE_NEW_VOICE_MAIL

public static final int APP_PHONE_NEW_VOICE_MAIL
Audio cue for when the new voice mail arrives. Carrier configurable.

See Also:
Constant Field Values

APP_MMS_RECEIVED

public static final int APP_MMS_RECEIVED
Audio cue for receiving an MMS.

See Also:
Constant Field Values

APP_WEB_DONE

public static final int APP_WEB_DONE
Audio cue for a web page being done.

See Also:
Constant Field Values

APP_WAP_DONE

public static final int APP_WAP_DONE
Audio cue for a wap page being done.

See Also:
Constant Field Values

APP_EMAIL_RECEIVED

public static final int APP_EMAIL_RECEIVED
Audio cue for receiving an email.

See Also:
Constant Field Values

APP_CALENDAR_EVENT

public static final int APP_CALENDAR_EVENT
Audio cue for calendar alert.

See Also:
Constant Field Values
Method Detail

isInitialized

public static boolean isInitialized()
Returns true if Meta system is initialized.


play

public static void play(int id,
                        int volume,
                        int playbackFilters,
                        int playbackClass,
                        boolean sync)
Load and play the toneID passed in.

Parameters:
playbackFilters - one or combined bits of ToneFilter
playbackClass - one of ToneClass
sync - if true then this method is synchronous, otherwise asynchronous.
volume - 0 to 100, or Tone.USE_DEFAULT_VOLUME for default
id - can be a Meta ID cue, or a ToneGallery ID. If id is a Meta ID, then the associated cue will be loaded and played. If id is not a Meta, then a search of the ToneGallery will be loaded and played. If id is not in the Meta tone list then nothing will happen. If id is not in the ToneGallery, then a default sound will be played.

createDefaultToneID

public static int createDefaultToneID(int klass)
Create a default toneID from a ToneClass.

Parameters:
klass - one of ToneClass
Returns:
int a valid toneID that can be used with play(int)

play

public static void play(int id)
Load and play the toneID passed in. Uses Tone.USE_DEFAULT_VOLUME for volume, ToneFilter.ALL for filter, and Tone.USE_DEFAULT_CLASS for class. This method is asynchronous.

Parameters:
id - can be a Meta ID cue, or a ToneGallery ID. If id is a Meta ID, then the associated cue will be loaded and played. If id is not a Meta, then a search of the ToneGallery will be loaded and played. If id is not in the Meta tone list then nothing will happen. If id is not in the ToneGallery, then a default sound will be played.

play

public static void play(int id,
                        int volume)
Load and play the toneID passed in. Uses ToneFilter.ALL for filter, and Tone.USE_DEFAULT_CLASS for class. This method is asynchronous.

Parameters:
volume - 0 to 100, or Tone.USE_DEFAULT_VOLUME for default
id - can be a Meta ID cue, or a ToneGallery ID. If id is a Meta ID, then the associated cue will be loaded and played. If id is not a Meta, then a search of the ToneGallery will be loaded and played. If id is not in the Meta tone list then nothing will happen. If id is not in the ToneGallery, then a default sound will be played.

play

public static void play(int id,
                        int volume,
                        int playbackFilters)
Load and play the toneID passed in.

Parameters:
playbackFilters - one or combined bits of ToneFilter
volume - 0 to 100, or Tone.USE_DEFAULT_VOLUME for default
id - can be a Meta ID cue, or a ToneGallery ID. If id is a Meta ID, then the associated cue will be loaded and played. If id is not a Meta, then a search of the ToneGallery will be loaded and played. If id is not in the Meta tone list then nothing will happen. If id is not in the ToneGallery, then a default sound will be played.

playSync

public static void playSync(int id)
Load and play the toneID passed in. Uses Tone.USE_DEFAULT_VOLUME for volume, ToneFilter.ALL for filter, and Tone.USE_DEFAULT_CLASS for class. This method is synchronous.

Parameters:
id - can be a Meta ID cue, or a ToneGallery ID. If id is a Meta ID, then the associated cue will be loaded and played. If id is not a Meta, then a search of the ToneGallery will be loaded and played. If id is not in the Meta tone list then nothing will happen. If id is not in the ToneGallery, then a default sound will be played.

playSync

public static void playSync(int id,
                            int volume)
Load and play the toneID passed in. Uses ToneFilter.ALL for filter, and Tone.USE_DEFAULT_CLASS for class. This method is synchronous.

Parameters:
volume - 0 to 100, or Tone.USE_DEFAULT_VOLUME for default
id - can be a Meta ID cue, or a ToneGallery ID. If id is a Meta ID, then the associated cue will be loaded and played. If id is not a Meta, then a search of the ToneGallery will be loaded and played. If id is not in the Meta tone list then nothing will happen. If id is not in the ToneGallery, then a default sound will be played.

playSync

public static void playSync(int id,
                            int volume,
                            int playbackFilters)
Load and play the toneID passed in. Uses ToneFilter.ALL for filter. This method is synchronous.

Parameters:
playbackFilters - one or combined bits of ToneFilter
volume - 0 to 100, or Tone.USE_DEFAULT_VOLUME for default
id - can be a Meta ID cue, or a ToneGallery ID. If id is a Meta ID, then the associated cue will be loaded and played. If id is not a Meta, then a search of the ToneGallery will be loaded and played. If id is not in the Meta tone list then nothing will happen. If id is not in the ToneGallery, then a default sound will be played.
Since:
3.0

playSyncAsBackground

public static void playSyncAsBackground(int id)
Load and play the toneID passed in. Uses ToneFilter.ALL for filter. This method is synchronous. Will play this id as a background tone which basically means that the sound will NOT loop

Parameters:
id - can be a Meta ID cue, or a ToneGallery ID. If id is a Meta ID, then the associated cue will be loaded and played. If id is not a Meta, then a search of the ToneGallery will be loaded and played. If id is not in the Meta tone list then nothing will happen. If id is not in the ToneGallery, then a default sound will be played.
Since:
4.5

play

public static void play(RingToneObject ring)
Load and play the RingToneObject passed in. This will use the RingToneObject filter set with RingToneObject.setFilterFlags(int). Uses Tone.USE_DEFAULT_VOLUME, and Tone.USE_DEFAULT_CLASS for class. This method is asynchronous.

Parameters:
ring - a RingToneObject, which contains an id. This can be a Meta ID cue, or a ToneGallery ID. If id is a Meta ID, then the associated cue will be loaded and played. If id is not a Meta, then a search of the ToneGallery will be loaded and played. If id is not in the Meta tone list then nothing will happen. If id is not in the ToneGallery, then a default sound will be played.
Since:
3.0

play

public static void play(RingToneObject ring,
                        int volume)
Load and play the RingToneObject passed in. This will use the RingToneObject filter set with RingToneObject.setFilterFlags(int). Uses Tone.USE_DEFAULT_CLASS for class. This method is asynchronous.

Parameters:
volume - 0 to 100, or Tone.USE_DEFAULT_VOLUME for default
ring - a RingToneObject, which contains an id. This can be a Meta ID cue, or a ToneGallery ID. If id is a Meta ID, then the associated cue will be loaded and played. If id is not a Meta, then a search of the ToneGallery will be loaded and played. If id is not in the Meta tone list then nothing will happen. If id is not in the ToneGallery, then a default sound will be played.

play

public static void play(RingToneObject ring,
                        int volume,
                        int playbackClass)
Load and play the RingToneObject passed in. This will use the RingToneObject filter set with RingToneObject.setFilterFlags(int). This method is asynchronous.

Parameters:
volume - 0 to 100, or Tone.USE_DEFAULT_VOLUME for default
playbackClass - one of ToneClass
ring - a RingToneObject, which contains an id. This can be a Meta ID cue, or a ToneGallery ID. If id is a Meta ID, then the associated cue will be loaded and played. If id is not a Meta, then a search of the ToneGallery will be loaded and played. If id is not in the Meta tone list then nothing will happen. If id is not in the ToneGallery, then a default sound will be played.

play

public static void play(RingToneObject ring,
                        int volume,
                        int playbackFilters,
                        int playbackClass)
Load and play the RingToneObject passed in. Allows you to override the default filter in the RingToneObject. This method is asynchronous.

Parameters:
volume - 0 to 100, or Tone.USE_DEFAULT_VOLUME for default
playbackClass - one of ToneClass
playbackFilters - one or combined bits of ToneFilter
ring - a RingToneObject, which contains an id. This can be a Meta ID cue, or a ToneGallery ID. If id is a Meta ID, then the associated cue will be loaded and played. If id is not a Meta, then a search of the ToneGallery will be loaded and played. If id is not in the Meta tone list then nothing will happen. If id is not in the ToneGallery, then a default sound will be played.

playSync

public static void playSync(RingToneObject ring)
Load and play the RingToneObject passed in. This will use the RingToneObject filter set with RingToneObject.setFilterFlags(int). Uses Tone.USE_DEFAULT_VOLUME, and Tone.USE_DEFAULT_CLASS for class. This method is synchronous.

Parameters:
ring - a RingToneObject, which contains an id. This can be a Meta ID cue, or a ToneGallery ID. If id is a Meta ID, then the associated cue will be loaded and played. If id is not a Meta, then a search of the ToneGallery will be loaded and played. If id is not in the Meta tone list then nothing will happen. If id is not in the ToneGallery, then a default sound will be played.
Since:
3.0

playSync

public static void playSync(RingToneObject ring,
                            int volume)
Load and play the RingToneObject passed in. This will use the RingToneObject filter set with RingToneObject.setFilterFlags(int). Uses Tone.USE_DEFAULT_CLASS for class. This method is asynchronous.

Parameters:
volume - 0 to 100, or Tone.USE_DEFAULT_VOLUME for default
ring - a RingToneObject, which contains an id. This can be a Meta ID cue, or a ToneGallery ID. If id is a Meta ID, then the associated cue will be loaded and played. If id is not a Meta, then a search of the ToneGallery will be loaded and played. If id is not in the Meta tone list then nothing will happen. If id is not in the ToneGallery, then a default sound will be played.
Since:
3.0

playSync

public static void playSync(RingToneObject ring,
                            int volume,
                            int playbackClass)
Load and play the RingToneObject passed in. This will use the RingToneObject filter set with RingToneObject.setFilterFlags(int). This method is asynchronous.

Parameters:
volume - 0 to 100, or Tone.USE_DEFAULT_VOLUME for default
playbackClass - one of ToneClass
ring - a RingToneObject, which contains an id. This can be a Meta ID cue, or a ToneGallery ID. If id is a Meta ID, then the associated cue will be loaded and played. If id is not a Meta, then a search of the ToneGallery will be loaded and played. If id is not in the Meta tone list then nothing will happen. If id is not in the ToneGallery, then a default sound will be played.

playSync

public static void playSync(RingToneObject ring,
                            int volume,
                            int playbackFilters,
                            int playbackClass)
Load and play the RingToneObject passed in. Allows you to override the default filter in the RingToneObject. This method is asynchronous.

Parameters:
volume - 0 to 100, or Tone.USE_DEFAULT_VOLUME for default
playbackClass - one of ToneClass
playbackFilters - one or combined bits of ToneFilter
ring - a RingToneObject, which contains an id. This can be a Meta ID cue, or a ToneGallery ID. If id is a Meta ID, then the associated cue will be loaded and played. If id is not a Meta, then a search of the ToneGallery will be loaded and played. If id is not in the Meta tone list then nothing will happen. If id is not in the ToneGallery, then a default sound will be played.

getVolume

public static int getVolume(int id)
Given a meta or tone ID, return its volume.

Parameters:
id - can be a Meta ID cue, or a ToneGallery ID
Returns:
int volume 0 to 100

getVolume

public static int getVolume(RingToneObject ring)
Given a ringtone object, return its volume.

Parameters:
ring - a RingToneObject, which contains an id. This can be a Meta ID cue, or a ToneGallery ID.
Returns:
int volume 0 to 100

setVolume

public static void setVolume(int id,
                             int volume)
Given a meta or tone ID and a volume set it.

Parameters:
id - can be a Meta ID cue, or a ToneGallery ID
volume - 0 to 100, or Tone.USE_DEFAULT_VOLUME for default
Since:
2.3

setVolume

public static void setVolume(RingToneObject ring,
                             int volume)
Given a ringtone object and a volume set it.

Parameters:
ring - a RingToneObject, which contains an id. This can be a Meta ID cue, or a ToneGallery ID.
volume - 0 to 100, or Tone.USE_DEFAULT_VOLUME for default
Since:
2.3

getDefaultVolume

public static int getDefaultVolume(int id)
Given a meta or tone ID, return its default volume.

Parameters:
id - can be a Meta ID cue, or a ToneGallery ID
Returns:
int volume 0 to 100
Since:
2.3

getDefaultVolume

public static int getDefaultVolume(RingToneObject ring)
Given a ringtone object, return its default volume.

Parameters:
ring - a RingToneObject, which contains an id. This can be a Meta ID cue, or a ToneGallery ID.
Returns:
int volume 0 to 100
Since:
2.3

isMetaID

public static boolean isMetaID(int metaID)
Is the ID a meta cue, or a ToneGallery ID.

Parameters:
metaID - can be a Meta ID cue, or a ToneGallery ID
Returns:
boolean true if a Meta ID, or false if a ToneGallery ID

setLoop

public static void setLoop(RingToneObject ring,
                           boolean on)
Set looping on/off for a given RingToneObject.

Parameters:
ring - a RingToneObject, which contains an id. This can be a Meta ID cue, or a ToneGallery ID.
on - true will loop when played, false will play once

setLoop

public static void setLoop(int id,
                           boolean on)
Set looping on/off for a given Meta or ToneGallery ID.

Parameters:
id - This can be a Meta ID cue, or a ToneGallery ID.
on - true will loop when played, false will play once

stop

public static void stop(int id)
Stop a Meta or ToneGallery ID.

Parameters:
id - This can be a Meta ID cue, or a ToneGallery ID.

stop

public static void stop(RingToneObject ring)
Stop a RingToneObject.

Parameters:
ring - a RingToneObject, which contains an id. This can be a Meta ID cue, or a ToneGallery ID.

setDoneCallbackEvent

public static void setDoneCallbackEvent(int id,
                                        Event done)
Set the event that is called when this meta audio is finished.

Parameters:
id - valid Meta ID cue, or a ToneGallery ID
done - Event will be triggered when audio finished playing
Since:
2.5

setStoppedCallbackEvent

public static void setStoppedCallbackEvent(int id,
                                           Event stopped)
Set the event that is called when this meta audio is stopped by stop().

Parameters:
id - valid Meta ID cue, or a ToneGallery ID
stopped - Event will be triggered when stop(int) is called
Since:
2.5

isDone

public static boolean isDone(int id)
Get status of doneness of a Meta ID or ToneGallery ID.

Parameters:
id - This can be a Meta ID cue, or a ToneGallery ID.
Returns:
boolean true is done, or stopped, false is playing

setToneToID

public static boolean setToneToID(Tone tone,
                                  int metaID)
Change which Tone is called when a Meta ID is called with play(int, int, int, int, boolean). Use restoreIDToDefault(int) to return to the original state.

Parameters:
tone - valid Tone
metaID - valid Meta ID cue
Returns:
boolean true if successful, or false if not

restoreIDToDefault

public static void restoreIDToDefault(int metaID)
Given a valid Meta ID cue, restore the original ToneGallery ID. Call this when finished with a custom tone after using setToneToID(danger.audio.Tone, int).

Parameters:
metaID - valid Meta ID

muteID

public static void muteID(int metaID)
Mute a particular Meta ID. System wide.

Parameters:
metaID - valid Meta ID cue

unmuteID

public static void unmuteID(int metaID)
Unmute a particular Meta ID. System wide.

Parameters:
metaID - valid Meta ID cue

isIDMuted

public static boolean isIDMuted(int metaID)
Return mute status of a metaID. Status can be changed via muteID(int).

Parameters:
metaID - valid Meta ID cue
Returns:
boolean true if muted, or false if not

getIDFromResourceID

public static int getIDFromResourceID(int metaID)
Get a ToneGallery ID, from a Meta ID.

Parameters:
metaID - valid Meta ID cue
Returns:
int id returned is from ToneGallery. Not guaranteed to be the same per device or OS. Will return INVALID if metaID is not a valid Meta ID cue

isInstalled

public static boolean isInstalled(RingToneObject ring)
Check to see if a particular RingToneObject is installed.

Parameters:
ring - a valid RingToneObject
Returns:
boolean true if installed, or false if not

isInstalled

public static boolean isInstalled(int id)
Check to see if a particular ID is installed.

Parameters:
id - a valid Meta ID cue, or a ToneGallery ID
Returns:
boolean true if installed, or false if not

getToneFromID

public static Tone getToneFromID(RingToneObject ring)
Get a Tone from a RingToneObject.

Parameters:
ring - a valid RingToneObject
Returns:
Tone a valid Tone or null if not installed

getToneFromID

public static Tone getToneFromID(int metaID)
Get a Tone from a Meta ID.

Parameters:
metaID - an ID that's either a Meta audio cue ID, or a ToneGallery ID
Returns:
Tone a valid Tone or null if not installed