com.objectxp.msg.ems
Class EMSSound

java.lang.Object
  extended by com.objectxp.msg.ems.EMSElement
      extended by com.objectxp.msg.ems.EMSSound
All Implemented Interfaces:
java.io.Serializable

public class EMSSound
extends EMSElement

This class represents a EMS Sound element. Multiple sounds and melodies can be inserted in one message, and also in combination with pictures and animations. The sound or melody is played when the user selects its icon in the display; this is referred to as putting it into focus.
There are two different types of sounds that are supported by EMS:

Since:
jSMS 1.7
See Also:
EMSMessage, Serialized Form

Field Summary
static EMSSound CHIMES_HIGH
          Predefined Sound: Chimes High
static EMSSound CHIMES_LOW
          Predefined Sound: Chimes Low
static EMSSound CHORD_HIGH
          Predefined Sound: Chord High
static EMSSound CHORD_LOW
          Predefined Sound: Chord Low
static EMSSound CLAPS
          Predefined Sound: Claps
static EMSSound DING
          Predefined Sound: Ding
static EMSSound DRUM
          Predefined Sound: Drum
static EMSSound FANFAR
          Predefined Sound: FanFar
static EMSSound NOTIFY
          Predefined Sound: Notify
static EMSSound TADA
          Predefined Sound: TaDa
 
Constructor Summary
EMSSound(int number)
          Construct a predefined EMS Sound element.
EMSSound(java.lang.String iMelody)
          Construct a new user-defined EMS Sound element.
 
Method Summary
 int getPredefinedSound()
          Gets the number of the predefined sound.
 java.lang.String getUserDefinedSound()
          Gets user defined sound as iMelody.
static EMSSound[] splitMelody(java.lang.String iMelody)
          Splits a iMelody in multiple parts if the length of the melody doesn't fit in a single EMSSound element.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CHIMES_HIGH

public static final EMSSound CHIMES_HIGH
Predefined Sound: Chimes High


CHIMES_LOW

public static final EMSSound CHIMES_LOW
Predefined Sound: Chimes Low


DING

public static final EMSSound DING
Predefined Sound: Ding


TADA

public static final EMSSound TADA
Predefined Sound: TaDa


NOTIFY

public static final EMSSound NOTIFY
Predefined Sound: Notify


DRUM

public static final EMSSound DRUM
Predefined Sound: Drum


CLAPS

public static final EMSSound CLAPS
Predefined Sound: Claps


FANFAR

public static final EMSSound FANFAR
Predefined Sound: FanFar


CHORD_HIGH

public static final EMSSound CHORD_HIGH
Predefined Sound: Chord High


CHORD_LOW

public static final EMSSound CHORD_LOW
Predefined Sound: Chord Low

Constructor Detail

EMSSound

public EMSSound(java.lang.String iMelody)
         throws java.lang.IllegalArgumentException
Construct a new user-defined EMS Sound element. The sound must be specified in the iMelody format. The maximum length of the sound definition is 128 characters. The iMelody specification can be found here.

Example:

 String myMelody = "BEGIN:IMELODY\n"+
                   "VERSION:1.2\n"+
                   "FORMAT:CLASS1.0\n"+
                   "BEAT:120\n"+
                   "MELODY:*5#d5*5#f5*5b2*6c3*5#d5*5a5*5b2*6#d3*4b5*5g5*6e1r4\n"+
                   "END:IMELODY";
 EMSSound sound = new EMSSound(myMelody);
 

Parameters:
iMelody - the sound data coded according to the iMelody format.
Throws:
java.lang.IllegalArgumentException - if the sound is null or exceeds 128 bytes.

EMSSound

public EMSSound(int number)
Construct a predefined EMS Sound element.

Parameters:
number - the number of the predefined sound.
Method Detail

splitMelody

public static EMSSound[] splitMelody(java.lang.String iMelody)
                              throws java.lang.IllegalArgumentException
Splits a iMelody in multiple parts if the length of the melody doesn't fit in a single EMSSound element.

Parameters:
iMelody - the iMelody
Returns:
an array of EMSSound object containing at least one element
Throws:
java.lang.IllegalArgumentException - if the iMelody cannot be parsed
java.lang.IllegalArgumentException - if the header and footer parameters exceed 126 bytes

getPredefinedSound

public int getPredefinedSound()
Gets the number of the predefined sound.

Returns:
the predefined sound number or -1 when this object represents an user defined sound

getUserDefinedSound

public java.lang.String getUserDefinedSound()
Gets user defined sound as iMelody.

Returns:
the iMelody or null when this object represents an predefined defined sound

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


object XP, Inc. © 2000-2008. All rights reserved object XP