Android
android.media
public class

android.media.ToneGenerator

java.lang.Object
android.media.ToneGenerator

This class provides methods to play DTMF tones (ITU-T Recommendation Q.23), call supervisory tones (3GPP TS 22.001, CEPT) and proprietary tones (3GPP TS 31.111). Depending on call state and routing options, tones are mixed to the downlink audio or output to the speaker phone or headset. This API is not for generating tones over the uplink audio path.

Summary

Constants

      Value  
int  MAX_VOLUME  Maximum volume, for use with ToneGenerator(int, int)   100  0x00000064 
int  MIN_VOLUME  Minimum volume setting, for use with ToneGenerator(int, int)   0x00000000 
int  TONE_DTMF_0  DTMF tone for key 0: 1336Hz, 941Hz, continuous

 
0x00000000 
int  TONE_DTMF_1  DTMF tone for key 1: 1209Hz, 697Hz, continuous  0x00000001 
int  TONE_DTMF_2  DTMF tone for key 2: 1336Hz, 697Hz, continuous  0x00000002 
int  TONE_DTMF_3  DTMF tone for key 3: 1477Hz, 697Hz, continuous  0x00000003 
int  TONE_DTMF_4  DTMF tone for key 4: 1209Hz, 770Hz, continuous  0x00000004 
int  TONE_DTMF_5  DTMF tone for key 5: 1336Hz, 770Hz, continuous  0x00000005 
int  TONE_DTMF_6  DTMF tone for key 6: 1209Hz, 697Hz, continuous  0x00000006 
int  TONE_DTMF_7  DTMF tone for key 7: 1209Hz, 852Hz, continuous  0x00000007 
int  TONE_DTMF_8  DTMF tone for key 8: 1336Hz, 852Hz, continuous  0x00000008 
int  TONE_DTMF_9  DTMF tone for key 9: 1477Hz, 852Hz, continuous  0x00000009 
int  TONE_DTMF_A  DTMF tone for key A: 1633Hz, 697Hz, continuous  12  0x0000000c 
int  TONE_DTMF_B  DTMF tone for key B: 1633Hz, 770Hz, continuous  13  0x0000000d 
int  TONE_DTMF_C  DTMF tone for key C: 1633Hz, 852Hz, continuous  14  0x0000000e 
int  TONE_DTMF_D  DTMF tone for key D: 1209Hz, 697Hz, continuous  15  0x0000000f 
int  TONE_DTMF_P  DTMF tone for key #: 1477Hz, 941Hz, continuous  11  0x0000000b 
int  TONE_DTMF_S  DTMF tone for key *: 1209Hz, 941Hz, continuous  10  0x0000000a 
int  TONE_PROP_ACK  Proprietary tone, positive acknowlegement: 1200Hz, 100ms ON, 100ms OFF 2 bursts  25  0x00000019 
int  TONE_PROP_BEEP  Proprietary tone, general beep: 400Hz+1200Hz, 35ms ON  24  0x00000018 
int  TONE_PROP_NACK  Proprietary tone, negative acknowlegement: 300Hz+400Hz+500Hz, 400ms ON  26  0x0000001a 
int  TONE_PROP_PROMPT  Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON  27  0x0000001b 
int  TONE_SUP_BUSY  Call supervisory tone, Busy: 425Hz, 500ms ON, 500ms OFF...  17  0x00000011 
int  TONE_SUP_CALL_WAITING  Call supervisory tone, Call Waiting: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF...  22  0x00000016 
int  TONE_SUP_CONGESTION  Call supervisory tone, Congestion: 425Hz, 200ms ON, 200ms OFF...  18  0x00000012 
int  TONE_SUP_DIAL  Call supervisory tone, Dial tone: 425Hz, continuous  16  0x00000010 
int  TONE_SUP_ERROR  Call supervisory tone, Error/Special info: 950Hz+1400Hz+1800Hz, 330ms ON, 1s OFF...  21  0x00000015 
int  TONE_SUP_RADIO_ACK  Call supervisory tone, Radio path acknowlegment : 425Hz, 200ms ON  19  0x00000013 
int  TONE_SUP_RADIO_NOTAVAIL  Call supervisory tone, Radio path not available: 425Hz, 200ms ON, 200 OFF 3 bursts  20  0x00000014 
int  TONE_SUP_RINGTONE  Call supervisory tone, Ring Tone: 425Hz, 1s ON, 4s OFF...  23  0x00000017 

Public Constructors

            ToneGenerator(int streamType, int volume)
ToneGenerator class contructor specifying output stream type and volume.

Public Methods

          void  release()
Releases resources associated with this ToneGenerator object.
          boolean  startTone(int toneType)
This method starts the playback of a tone of the specified type.
          void  stopTone()
This method stops the tone currently playing playback.

Protected Methods

          void  finalize()
Called by the virtual machine when there are no longer any (non-weak) references to the receiver.
Methods inherited from class java.lang.Object

Details

Constants

public static final int MAX_VOLUME

Maximum volume, for use with ToneGenerator(int, int)
Constant Value: 100 (0x00000064)

public static final int MIN_VOLUME

Minimum volume setting, for use with ToneGenerator(int, int)
Constant Value: 0 (0x00000000)

public static final int TONE_DTMF_0

DTMF tone for key 0: 1336Hz, 941Hz, continuous

Constant Value: 0 (0x00000000)

public static final int TONE_DTMF_1

DTMF tone for key 1: 1209Hz, 697Hz, continuous
Constant Value: 1 (0x00000001)

public static final int TONE_DTMF_2

DTMF tone for key 2: 1336Hz, 697Hz, continuous
Constant Value: 2 (0x00000002)

public static final int TONE_DTMF_3

DTMF tone for key 3: 1477Hz, 697Hz, continuous
Constant Value: 3 (0x00000003)

public static final int TONE_DTMF_4

DTMF tone for key 4: 1209Hz, 770Hz, continuous
Constant Value: 4 (0x00000004)

public static final int TONE_DTMF_5

DTMF tone for key 5: 1336Hz, 770Hz, continuous
Constant Value: 5 (0x00000005)

public static final int TONE_DTMF_6

DTMF tone for key 6: 1209Hz, 697Hz, continuous
Constant Value: 6 (0x00000006)

public static final int TONE_DTMF_7

DTMF tone for key 7: 1209Hz, 852Hz, continuous
Constant Value: 7 (0x00000007)

public static final int TONE_DTMF_8

DTMF tone for key 8: 1336Hz, 852Hz, continuous
Constant Value: 8 (0x00000008)

public static final int TONE_DTMF_9

DTMF tone for key 9: 1477Hz, 852Hz, continuous
Constant Value: 9 (0x00000009)

public static final int TONE_DTMF_A

DTMF tone for key A: 1633Hz, 697Hz, continuous
Constant Value: 12 (0x0000000c)

public static final int TONE_DTMF_B

DTMF tone for key B: 1633Hz, 770Hz, continuous
Constant Value: 13 (0x0000000d)

public static final int TONE_DTMF_C

DTMF tone for key C: 1633Hz, 852Hz, continuous
Constant Value: 14 (0x0000000e)

public static final int TONE_DTMF_D

DTMF tone for key D: 1209Hz, 697Hz, continuous
Constant Value: 15 (0x0000000f)

public static final int TONE_DTMF_P

DTMF tone for key #: 1477Hz, 941Hz, continuous
Constant Value: 11 (0x0000000b)

public static final int TONE_DTMF_S

DTMF tone for key *: 1209Hz, 941Hz, continuous
Constant Value: 10 (0x0000000a)

public static final int TONE_PROP_ACK

Proprietary tone, positive acknowlegement: 1200Hz, 100ms ON, 100ms OFF 2 bursts
Constant Value: 25 (0x00000019)

public static final int TONE_PROP_BEEP

Proprietary tone, general beep: 400Hz+1200Hz, 35ms ON
Constant Value: 24 (0x00000018)

public static final int TONE_PROP_NACK

Proprietary tone, negative acknowlegement: 300Hz+400Hz+500Hz, 400ms ON
Constant Value: 26 (0x0000001a)

public static final int TONE_PROP_PROMPT

Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON
Constant Value: 27 (0x0000001b)

public static final int TONE_SUP_BUSY

Call supervisory tone, Busy: 425Hz, 500ms ON, 500ms OFF...
Constant Value: 17 (0x00000011)

public static final int TONE_SUP_CALL_WAITING

Call supervisory tone, Call Waiting: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF...
Constant Value: 22 (0x00000016)

public static final int TONE_SUP_CONGESTION

Call supervisory tone, Congestion: 425Hz, 200ms ON, 200ms OFF...
Constant Value: 18 (0x00000012)

public static final int TONE_SUP_DIAL

Call supervisory tone, Dial tone: 425Hz, continuous
Constant Value: 16 (0x00000010)

public static final int TONE_SUP_ERROR

Call supervisory tone, Error/Special info: 950Hz+1400Hz+1800Hz, 330ms ON, 1s OFF...
Constant Value: 21 (0x00000015)

public static final int TONE_SUP_RADIO_ACK

Call supervisory tone, Radio path acknowlegment : 425Hz, 200ms ON
Constant Value: 19 (0x00000013)

public static final int TONE_SUP_RADIO_NOTAVAIL

Call supervisory tone, Radio path not available: 425Hz, 200ms ON, 200 OFF 3 bursts
Constant Value: 20 (0x00000014)

public static final int TONE_SUP_RINGTONE

Call supervisory tone, Ring Tone: 425Hz, 1s ON, 4s OFF...
Constant Value: 23 (0x00000017)

Public Constructors

public ToneGenerator(int streamType, int volume)

ToneGenerator class contructor specifying output stream type and volume.

Parameters

streamType The streame type used for tone playback (e.g. STREAM_MUSIC).
volume The volume of the tone, given in percentage of maximum volume (from 0-100).

Public Methods

public void release()

Releases resources associated with this ToneGenerator object. It is good practice to call this method when you're done using the ToneGenerator.

public boolean startTone(int toneType)

This method starts the playback of a tone of the specified type. only one tone can play at a time: if a tone is playing while this method is called, this tone is stopped and replaced by the one requested.

public void stopTone()

This method stops the tone currently playing playback.

Protected Methods

protected void finalize()

Called by the virtual machine when there are no longer any (non-weak) references to the receiver. Subclasses can use this facility to guarantee that any associated resources are cleaned up before the receiver is garbage collected. Uncaught exceptions which are thrown during the running of the method cause it to terminate immediately, but are otherwise ignored.

Note: The virtual machine assumes that the implementation in class Object is empty.

Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56