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.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | MAX_VOLUME | Maximum volume, for use with ToneGenerator(int, int) | |||||||||
int | MIN_VOLUME | Minimum volume setting, for use with ToneGenerator(int, int) | |||||||||
int | TONE_DTMF_0 | DTMF tone for key 0: 1336Hz, 941Hz, continuous | |||||||||
int | TONE_DTMF_1 | DTMF tone for key 1: 1209Hz, 697Hz, continuous | |||||||||
int | TONE_DTMF_2 | DTMF tone for key 2: 1336Hz, 697Hz, continuous | |||||||||
int | TONE_DTMF_3 | DTMF tone for key 3: 1477Hz, 697Hz, continuous | |||||||||
int | TONE_DTMF_4 | DTMF tone for key 4: 1209Hz, 770Hz, continuous | |||||||||
int | TONE_DTMF_5 | DTMF tone for key 5: 1336Hz, 770Hz, continuous | |||||||||
int | TONE_DTMF_6 | DTMF tone for key 6: 1477Hz, 770Hz, continuous | |||||||||
int | TONE_DTMF_7 | DTMF tone for key 7: 1209Hz, 852Hz, continuous | |||||||||
int | TONE_DTMF_8 | DTMF tone for key 8: 1336Hz, 852Hz, continuous | |||||||||
int | TONE_DTMF_9 | DTMF tone for key 9: 1477Hz, 852Hz, continuous | |||||||||
int | TONE_DTMF_A | DTMF tone for key A: 1633Hz, 697Hz, continuous | |||||||||
int | TONE_DTMF_B | DTMF tone for key B: 1633Hz, 770Hz, continuous | |||||||||
int | TONE_DTMF_C | DTMF tone for key C: 1633Hz, 852Hz, continuous | |||||||||
int | TONE_DTMF_D | DTMF tone for key D: 1633Hz, 941Hz, continuous | |||||||||
int | TONE_DTMF_P | DTMF tone for key #: 1477Hz, 941Hz, continuous | |||||||||
int | TONE_DTMF_S | DTMF tone for key *: 1209Hz, 941Hz, continuous | |||||||||
int | TONE_PROP_ACK | Proprietary tone, positive acknowlegement: 1200Hz, 100ms ON, 100ms OFF 2 bursts | |||||||||
int | TONE_PROP_BEEP | Proprietary tone, general beep: 400Hz+1200Hz, 35ms ON | |||||||||
int | TONE_PROP_BEEP2 | Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON | |||||||||
int | TONE_PROP_NACK | Proprietary tone, negative acknowlegement: 300Hz+400Hz+500Hz, 400ms ON | |||||||||
int | TONE_PROP_PROMPT | Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON | |||||||||
int | TONE_SUP_BUSY | Call supervisory tone, Busy: 425Hz, 500ms ON, 500ms OFF... | |||||||||
int | TONE_SUP_CALL_WAITING | Call supervisory tone, Call Waiting: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF... | |||||||||
int | TONE_SUP_CONGESTION | Call supervisory tone, Congestion: 425Hz, 200ms ON, 200ms OFF... | |||||||||
int | TONE_SUP_DIAL | Call supervisory tone, Dial tone: 425Hz, continuous | |||||||||
int | TONE_SUP_ERROR | Call supervisory tone, Error/Special info: 950Hz+1400Hz+1800Hz, 330ms ON, 1s OFF... | |||||||||
int | TONE_SUP_RADIO_ACK | Call supervisory tone, Radio path acknowlegment : 425Hz, 200ms ON | |||||||||
int | TONE_SUP_RADIO_NOTAVAIL | Call supervisory tone, Radio path not available: 425Hz, 200ms ON, 200 OFF 3 bursts | |||||||||
int | TONE_SUP_RINGTONE | Call supervisory tone, Ring Tone: 425Hz, 1s ON, 4s OFF... |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ToneGenerator class contructor specifying output stream type and volume.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Releases resources associated with this ToneGenerator object.
| |||||||||||
This method starts the playback of a tone of the specified type.
| |||||||||||
This method stops the tone currently playing playback.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Is called before the object's memory is being reclaimed by the VM.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
Maximum volume, for use with ToneGenerator(int, int)
Minimum volume setting, for use with ToneGenerator(int, int)
DTMF tone for key 0: 1336Hz, 941Hz, continuous
DTMF tone for key 1: 1209Hz, 697Hz, continuous
DTMF tone for key 2: 1336Hz, 697Hz, continuous
DTMF tone for key 3: 1477Hz, 697Hz, continuous
DTMF tone for key 4: 1209Hz, 770Hz, continuous
DTMF tone for key 5: 1336Hz, 770Hz, continuous
DTMF tone for key 6: 1477Hz, 770Hz, continuous
DTMF tone for key 7: 1209Hz, 852Hz, continuous
DTMF tone for key 8: 1336Hz, 852Hz, continuous
DTMF tone for key 9: 1477Hz, 852Hz, continuous
DTMF tone for key A: 1633Hz, 697Hz, continuous
DTMF tone for key B: 1633Hz, 770Hz, continuous
DTMF tone for key C: 1633Hz, 852Hz, continuous
DTMF tone for key D: 1633Hz, 941Hz, continuous
DTMF tone for key #: 1477Hz, 941Hz, continuous
DTMF tone for key *: 1209Hz, 941Hz, continuous
Proprietary tone, positive acknowlegement: 1200Hz, 100ms ON, 100ms OFF 2 bursts
Proprietary tone, general beep: 400Hz+1200Hz, 35ms ON
Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON
Proprietary tone, negative acknowlegement: 300Hz+400Hz+500Hz, 400ms ON
Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON
Call supervisory tone, Busy: 425Hz, 500ms ON, 500ms OFF...
Call supervisory tone, Call Waiting: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF...
Call supervisory tone, Congestion: 425Hz, 200ms ON, 200ms OFF...
Call supervisory tone, Dial tone: 425Hz, continuous
Call supervisory tone, Error/Special info: 950Hz+1400Hz+1800Hz, 330ms ON, 1s OFF...
Call supervisory tone, Radio path acknowlegment : 425Hz, 200ms ON
Call supervisory tone, Radio path not available: 425Hz, 200ms ON, 200 OFF 3 bursts
Call supervisory tone, Ring Tone: 425Hz, 1s ON, 4s OFF...
ToneGenerator class contructor specifying output stream type and volume.
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). |
Releases resources associated with this ToneGenerator object. It is good practice to call this method when you're done using the ToneGenerator.
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.
toneType | The type of tone generate chosen from the following list:
|
---|
This method stops the tone currently playing playback.
Is called before the object's memory is being reclaimed by the VM. This can only happen once the VM has detected, during a run of the garbage collector, that the object is no longer reachable by any thread of the running application.
The method can be used to free system resources or perform other cleanup
before the object is garbage collected. The default implementation of the
method is empty, which is also expected by the VM, but subclasses can
override finalize()
as required. Uncaught exceptions which are
thrown during the execution of this method cause it to terminate
immediately but are otherwise ignored.
Note that the VM does guarantee that finalize()
is called at most
once for any object, but it doesn't guarantee when (if at all) finalize()
will be called. For example, object B's finalize()
can delay the execution of object A's finalize()
method and
therefore it can delay the reclamation of A's memory. To be safe, use a
ReferenceQueue, because it provides more control
over the way the VM deals with references during garbage collection.