1 /* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.media; 18 19 20 21 /** 22 * This class provides methods to play DTMF tones (ITU-T Recommendation Q.23), 23 * call supervisory tones (3GPP TS 22.001, CEPT) and proprietary tones (3GPP TS 31.111). 24 * Depending on call state and routing options, tones are mixed to the downlink audio 25 * or output to the speaker phone or headset. 26 * This API is not for generating tones over the uplink audio path. 27 */ 28 public class ToneGenerator 29 { 30 31 /* Values for toneType parameter of ToneGenerator() constructor */ 32 /* 33 * List of all available tones: These constants must be kept consistant with 34 * the enum in ToneGenerator C++ class. */ 35 36 /** 37 * Default value for an unknown or unspecified tone. 38 * @hide 39 */ 40 public static final int TONE_UNKNOWN = -1; 41 42 /** 43 * DTMF tone for key 0: 1336Hz, 941Hz, continuous</p> 44 * 45 * @see #ToneGenerator(int, int) 46 */ 47 public static final int TONE_DTMF_0 = 0; 48 /** 49 * DTMF tone for key 1: 1209Hz, 697Hz, continuous 50 * 51 * @see #ToneGenerator(int, int) 52 */ 53 public static final int TONE_DTMF_1 = 1; 54 /** 55 * DTMF tone for key 2: 1336Hz, 697Hz, continuous 56 * 57 * @see #ToneGenerator(int, int) 58 */ 59 public static final int TONE_DTMF_2 = 2; 60 /** 61 * DTMF tone for key 3: 1477Hz, 697Hz, continuous 62 * 63 * @see #ToneGenerator(int, int) 64 */ 65 public static final int TONE_DTMF_3 = 3; 66 /** 67 * DTMF tone for key 4: 1209Hz, 770Hz, continuous 68 * 69 * @see #ToneGenerator(int, int) 70 */ 71 public static final int TONE_DTMF_4 = 4; 72 /** 73 * DTMF tone for key 5: 1336Hz, 770Hz, continuous 74 * 75 * @see #ToneGenerator(int, int) 76 */ 77 public static final int TONE_DTMF_5 = 5; 78 /** 79 * DTMF tone for key 6: 1477Hz, 770Hz, continuous 80 * 81 * @see #ToneGenerator(int, int) 82 */ 83 public static final int TONE_DTMF_6 = 6; 84 /** 85 * DTMF tone for key 7: 1209Hz, 852Hz, continuous 86 * 87 * @see #ToneGenerator(int, int) 88 */ 89 public static final int TONE_DTMF_7 = 7; 90 /** 91 * DTMF tone for key 8: 1336Hz, 852Hz, continuous 92 * 93 * @see #ToneGenerator(int, int) 94 */ 95 public static final int TONE_DTMF_8 = 8; 96 /** 97 * DTMF tone for key 9: 1477Hz, 852Hz, continuous 98 * 99 * @see #ToneGenerator(int, int) 100 */ 101 public static final int TONE_DTMF_9 = 9; 102 /** 103 * DTMF tone for key *: 1209Hz, 941Hz, continuous 104 * 105 * @see #ToneGenerator(int, int) 106 */ 107 public static final int TONE_DTMF_S = 10; 108 /** 109 * DTMF tone for key #: 1477Hz, 941Hz, continuous 110 * 111 * @see #ToneGenerator(int, int) 112 */ 113 public static final int TONE_DTMF_P = 11; 114 /** 115 * DTMF tone for key A: 1633Hz, 697Hz, continuous 116 * 117 * @see #ToneGenerator(int, int) 118 */ 119 public static final int TONE_DTMF_A = 12; 120 /** 121 * DTMF tone for key B: 1633Hz, 770Hz, continuous 122 * 123 * @see #ToneGenerator(int, int) 124 */ 125 public static final int TONE_DTMF_B = 13; 126 /** 127 * DTMF tone for key C: 1633Hz, 852Hz, continuous 128 * 129 * @see #ToneGenerator(int, int) 130 */ 131 public static final int TONE_DTMF_C = 14; 132 /** 133 * DTMF tone for key D: 1633Hz, 941Hz, continuous 134 * 135 * @see #ToneGenerator(int, int) 136 */ 137 public static final int TONE_DTMF_D = 15; 138 /** 139 * Call supervisory tone, Dial tone: 140 * CEPT: 425Hz, continuous 141 * ANSI (IS-95): 350Hz+440Hz, continuous 142 * JAPAN: 400Hz, continuous 143 * 144 * @see #ToneGenerator(int, int) 145 */ 146 public static final int TONE_SUP_DIAL = 16; 147 /** 148 * Call supervisory tone, Busy: 149 * CEPT: 425Hz, 500ms ON, 500ms OFF... 150 * ANSI (IS-95): 480Hz+620Hz, 500ms ON, 500ms OFF... 151 * JAPAN: 400Hz, 500ms ON, 500ms OFF... 152 * 153 * @see #ToneGenerator(int, int) 154 */ 155 public static final int TONE_SUP_BUSY = 17; 156 /** 157 * Call supervisory tone, Congestion: 158 * CEPT, JAPAN: 425Hz, 200ms ON, 200ms OFF... 159 * ANSI (IS-95): 480Hz+620Hz, 250ms ON, 250ms OFF... 160 * 161 * @see #ToneGenerator(int, int) 162 */ 163 public static final int TONE_SUP_CONGESTION = 18; 164 /** 165 * Call supervisory tone, Radio path acknowlegment : 166 * CEPT, ANSI: 425Hz, 200ms ON 167 * JAPAN: 400Hz, 1s ON, 2s OFF... 168 * 169 * @see #ToneGenerator(int, int) 170 */ 171 public static final int TONE_SUP_RADIO_ACK = 19; 172 /** 173 * Call supervisory tone, Radio path not available: 425Hz, 200ms ON, 200 OFF 3 bursts 174 * 175 * @see #ToneGenerator(int, int) 176 */ 177 public static final int TONE_SUP_RADIO_NOTAVAIL = 20; 178 /** 179 * Call supervisory tone, Error/Special info: 950Hz+1400Hz+1800Hz, 330ms ON, 1s OFF... 180 * 181 * @see #ToneGenerator(int, int) 182 */ 183 public static final int TONE_SUP_ERROR = 21; 184 /** 185 * Call supervisory tone, Call Waiting: 186 * CEPT, JAPAN: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF... 187 * ANSI (IS-95): 440 Hz, 300 ms ON, 9.7 s OFF, 188 * (100 ms ON, 100 ms OFF, 100 ms ON, 9.7s OFF ...) 189 * 190 * @see #ToneGenerator(int, int) 191 */ 192 public static final int TONE_SUP_CALL_WAITING = 22; 193 /** 194 * Call supervisory tone, Ring Tone: 195 * CEPT, JAPAN: 425Hz, 1s ON, 4s OFF... 196 * ANSI (IS-95): 440Hz + 480Hz, 2s ON, 4s OFF... 197 * 198 * @see #ToneGenerator(int, int) 199 */ 200 public static final int TONE_SUP_RINGTONE = 23; 201 /** 202 * Proprietary tone, general beep: 400Hz+1200Hz, 35ms ON 203 * 204 * @see #ToneGenerator(int, int) 205 */ 206 public static final int TONE_PROP_BEEP = 24; 207 /** 208 * Proprietary tone, positive acknowlegement: 1200Hz, 100ms ON, 100ms OFF 2 bursts 209 * 210 * @see #ToneGenerator(int, int) 211 */ 212 public static final int TONE_PROP_ACK = 25; 213 /** 214 * Proprietary tone, negative acknowlegement: 300Hz+400Hz+500Hz, 400ms ON 215 * 216 * @see #ToneGenerator(int, int) 217 */ 218 public static final int TONE_PROP_NACK = 26; 219 /** 220 * Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON 221 * 222 * @see #ToneGenerator(int, int) 223 */ 224 public static final int TONE_PROP_PROMPT = 27; 225 /** 226 * Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON 227 * 228 * @see #ToneGenerator(int, int) 229 */ 230 public static final int TONE_PROP_BEEP2 = 28; 231 /** 232 * Call supervisory tone (IS-95), intercept tone: alternating 440 Hz and 620 Hz tones, 233 * each on for 250 ms 234 * 235 * @see #ToneGenerator(int, int) 236 */ 237 public static final int TONE_SUP_INTERCEPT = 29; 238 /** 239 * Call supervisory tone (IS-95), abbreviated intercept: intercept tone limited to 4 seconds 240 * 241 * @see #ToneGenerator(int, int) 242 */ 243 public static final int TONE_SUP_INTERCEPT_ABBREV = 30; 244 /** 245 * Call supervisory tone (IS-95), abbreviated congestion: congestion tone limited to 4 seconds 246 * 247 * @see #ToneGenerator(int, int) 248 */ 249 public static final int TONE_SUP_CONGESTION_ABBREV = 31; 250 /** 251 * Call supervisory tone (IS-95), confirm tone: a 350 Hz tone added to a 440 Hz tone 252 * repeated 3 times in a 100 ms on, 100 ms off cycle 253 * 254 * @see #ToneGenerator(int, int) 255 */ 256 public static final int TONE_SUP_CONFIRM = 32; 257 /** 258 * Call supervisory tone (IS-95), pip tone: four bursts of 480 Hz tone (0.1 s on, 0.1 s off). 259 * 260 * @see #ToneGenerator(int, int) 261 */ 262 public static final int TONE_SUP_PIP = 33; 263 /** 264 * CDMA Dial tone : 425Hz continuous 265 * 266 * @see #ToneGenerator(int, int) 267 */ 268 public static final int TONE_CDMA_DIAL_TONE_LITE = 34; 269 /** 270 * CDMA USA Ringback: 440Hz+480Hz 2s ON, 4000 OFF ... 271 * 272 * @see #ToneGenerator(int, int) 273 */ 274 public static final int TONE_CDMA_NETWORK_USA_RINGBACK = 35; 275 /** 276 * CDMA Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON ... 277 * 278 * @see #ToneGenerator(int, int) 279 */ 280 public static final int TONE_CDMA_INTERCEPT = 36; 281 /** 282 * CDMA Abbr Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON 283 * 284 * @see #ToneGenerator(int, int) 285 */ 286 public static final int TONE_CDMA_ABBR_INTERCEPT = 37; 287 /** 288 * CDMA Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF... 289 * 290 * @see #ToneGenerator(int, int) 291 */ 292 public static final int TONE_CDMA_REORDER = 38; 293 /** 294 * 295 * CDMA Abbr Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF repeated for 8 times 296 * @see #ToneGenerator(int, int) 297 */ 298 public static final int TONE_CDMA_ABBR_REORDER = 39; 299 /** 300 * CDMA Network Busy tone: 480Hz+620Hz 500ms ON, 500ms OFF continuous 301 * 302 * @see #ToneGenerator(int, int) 303 */ 304 public static final int TONE_CDMA_NETWORK_BUSY = 40; 305 /** 306 * CDMA Confirm tone: 350Hz+440Hz 100ms ON, 100ms OFF repeated for 3 times 307 * 308 * @see #ToneGenerator(int, int) 309 */ 310 public static final int TONE_CDMA_CONFIRM = 41; 311 /** 312 * 313 * CDMA answer tone: silent tone - defintion Frequency 0, 0ms ON, 0ms OFF 314 * @see #ToneGenerator(int, int) 315 */ 316 public static final int TONE_CDMA_ANSWER = 42; 317 /** 318 * 319 * CDMA Network Callwaiting tone: 440Hz 300ms ON 320 * @see #ToneGenerator(int, int) 321 */ 322 public static final int TONE_CDMA_NETWORK_CALLWAITING = 43; 323 /** 324 * CDMA PIP tone: 480Hz 100ms ON, 100ms OFF repeated for 4 times 325 * 326 * @see #ToneGenerator(int, int) 327 */ 328 public static final int TONE_CDMA_PIP = 44; 329 /** 330 * ISDN Call Signal Normal tone: {2091Hz 32ms ON, 2556 64ms ON} 20 times, 331 * 2091 32ms ON, 2556 48ms ON, 4s OFF 332 * 333 * @see #ToneGenerator(int, int) 334 */ 335 public static final int TONE_CDMA_CALL_SIGNAL_ISDN_NORMAL = 45; 336 /** 337 * ISDN Call Signal Intergroup tone: {2091Hz 32ms ON, 2556 64ms ON} 8 times, 338 * 2091Hz 32ms ON, 400ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} times, 339 * 2091Hz 32ms ON, 4s OFF. 340 * 341 * @see #ToneGenerator(int, int) 342 */ 343 public static final int TONE_CDMA_CALL_SIGNAL_ISDN_INTERGROUP = 46; 344 /** 345 * ISDN Call Signal SP PRI tone:{2091Hz 32ms ON, 2556 64ms ON} 4 times 346 * 2091Hz 16ms ON, 200ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 4 times, 347 * 2091Hz 16ms ON, 200ms OFF 348 * 349 * @see #ToneGenerator(int, int) 350 */ 351 public static final int TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI = 47; 352 /** 353 * ISDN Call sign PAT3 tone: silent tone 354 * 355 * @see #ToneGenerator(int, int) 356 */ 357 public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PAT3 = 48; 358 /** 359 * ISDN Ping Ring tone: {2091Hz 32ms ON, 2556Hz 64ms ON} 5 times 360 * 2091Hz 20ms ON 361 * 362 * @see #ToneGenerator(int, int) 363 */ 364 public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PING_RING = 49; 365 /** 366 * 367 * ISDN Pat5 tone: silent tone 368 * @see #ToneGenerator(int, int) 369 */ 370 public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PAT5 = 50; 371 /** 372 * 373 * ISDN Pat6 tone: silent tone 374 * @see #ToneGenerator(int, int) 375 */ 376 public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PAT6 = 51; 377 /** 378 * ISDN Pat7 tone: silent tone 379 * 380 * @see #ToneGenerator(int, int) 381 */ 382 public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PAT7 = 52; 383 /** 384 * TONE_CDMA_HIGH_L tone: {3700Hz 25ms, 4000Hz 25ms} 40 times 385 * 4000ms OFF, Repeat .... 386 * 387 * @see #ToneGenerator(int, int) 388 */ 389 public static final int TONE_CDMA_HIGH_L = 53; 390 /** 391 * TONE_CDMA_MED_L tone: {2600Hz 25ms, 2900Hz 25ms} 40 times 392 * 4000ms OFF, Repeat .... 393 * 394 * @see #ToneGenerator(int, int) 395 */ 396 public static final int TONE_CDMA_MED_L = 54; 397 /** 398 * TONE_CDMA_LOW_L tone: {1300Hz 25ms, 1450Hz 25ms} 40 times, 399 * 4000ms OFF, Repeat .... 400 * 401 * @see #ToneGenerator(int, int) 402 */ 403 public static final int TONE_CDMA_LOW_L = 55; 404 /** 405 * CDMA HIGH SS tone: {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 406 * 400ms OFF, repeat .... 407 * 408 * @see #ToneGenerator(int, int) 409 */ 410 public static final int TONE_CDMA_HIGH_SS = 56; 411 /** 412 * CDMA MED SS tone: {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 413 * 400ms OFF, repeat .... 414 * 415 * @see #ToneGenerator(int, int) 416 */ 417 public static final int TONE_CDMA_MED_SS = 57; 418 /** 419 * CDMA LOW SS tone: {1300z 25ms, 1450Hz 25ms} repeat 16 times, 420 * 400ms OFF, repeat .... 421 * 422 * @see #ToneGenerator(int, int) 423 */ 424 public static final int TONE_CDMA_LOW_SS = 58; 425 /** 426 * CDMA HIGH SSL tone: {3700Hz 25ms, 4000Hz 25ms} 8 times, 427 * 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 8 times, 428 * 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 429 * 4000ms OFF, repeat ... 430 * 431 * @see #ToneGenerator(int, int) 432 */ 433 public static final int TONE_CDMA_HIGH_SSL = 59; 434 /** 435 * CDMA MED SSL tone: {2600Hz 25ms, 2900Hz 25ms} 8 times, 436 * 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 8 times, 437 * 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 438 * 4000ms OFF, repeat ... 439 * 440 * @see #ToneGenerator(int, int) 441 */ 442 public static final int TONE_CDMA_MED_SSL = 60; 443 /** 444 * CDMA LOW SSL tone: {1300Hz 25ms, 1450Hz 25ms} 8 times, 445 * 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 8 times, 446 * 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 16 times, 447 * 4000ms OFF, repeat ... 448 * 449 * @see #ToneGenerator(int, int) 450 */ 451 public static final int TONE_CDMA_LOW_SSL = 61; 452 /** 453 * CDMA HIGH SS2 tone: {3700Hz 25ms, 4000Hz 25ms} 20 times, 454 * 1000ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 455 * 3000ms OFF, repeat .... 456 * 457 * @see #ToneGenerator(int, int) 458 */ 459 public static final int TONE_CDMA_HIGH_SS_2 = 62; 460 /** 461 * CDMA MED SS2 tone: {2600Hz 25ms, 2900Hz 25ms} 20 times, 462 * 1000ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 463 * 3000ms OFF, repeat .... 464 * 465 * @see #ToneGenerator(int, int) 466 */ 467 public static final int TONE_CDMA_MED_SS_2 = 63; 468 /** 469 * CDMA LOW SS2 tone: {1300Hz 25ms, 1450Hz 25ms} 20 times, 470 * 1000ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 471 * 3000ms OFF, repeat .... 472 * 473 * @see #ToneGenerator(int, int) 474 */ 475 public static final int TONE_CDMA_LOW_SS_2 = 64; 476 /** 477 * CDMA HIGH SLS tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 478 * 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 500ms OFF, 479 * {3700Hz 25ms, 4000Hz 25ms} 10 times, 3000ms OFF, REPEAT 480 * 481 * @see #ToneGenerator(int, int) 482 */ 483 public static final int TONE_CDMA_HIGH_SLS = 65; 484 /** 485 * CDMA MED SLS tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 486 * 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 500ms OFF, 487 * {2600Hz 25ms, 2900Hz 25ms} 10 times, 3000ms OFF, REPEAT 488 * 489 * 490 * @see #ToneGenerator(int, int) 491 */ 492 public static final int TONE_CDMA_MED_SLS = 66; 493 /** 494 * CDMA LOW SLS tone: {1300Hz 25ms, 1450Hz 25ms} 10 times, 495 * 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 500ms OFF, 496 * {1300Hz 25ms, 1450Hz 25ms} 10 times, 3000ms OFF, REPEAT 497 * 498 * @see #ToneGenerator(int, int) 499 */ 500 public static final int TONE_CDMA_LOW_SLS = 67; 501 /** 502 * CDMA HIGH S X4 tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 503 * 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, 504 * {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, 505 * {3700Hz 25ms, 4000Hz 25ms} 10 times, 2500ms OFF, REPEAT.... 506 * 507 * @see #ToneGenerator(int, int) 508 */ 509 public static final int TONE_CDMA_HIGH_S_X4 = 68; 510 /** 511 * CDMA MED S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 512 * 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, 513 * {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, 514 * {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT.... 515 * 516 * @see #ToneGenerator(int, int) 517 */ 518 public static final int TONE_CDMA_MED_S_X4 = 69; 519 /** 520 * CDMA LOW S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 521 * 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, 522 * {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, 523 * {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT.... 524 * 525 * 526 * @see #ToneGenerator(int, int) 527 */ 528 public static final int TONE_CDMA_LOW_S_X4 = 70; 529 /** 530 * CDMA HIGH PBX L: {3700Hz 25ms, 4000Hz 25ms}20 times, 531 * 2000ms OFF, REPEAT.... 532 * 533 * @see #ToneGenerator(int, int) 534 */ 535 public static final int TONE_CDMA_HIGH_PBX_L = 71; 536 /** 537 * CDMA MED PBX L: {2600Hz 25ms, 2900Hz 25ms}20 times, 538 * 2000ms OFF, REPEAT.... 539 * 540 * @see #ToneGenerator(int, int) 541 */ 542 public static final int TONE_CDMA_MED_PBX_L = 72; 543 /** 544 * CDMA LOW PBX L: {1300Hz 25ms,1450Hz 25ms}20 times, 545 * 2000ms OFF, REPEAT.... 546 * 547 * @see #ToneGenerator(int, int) 548 */ 549 public static final int TONE_CDMA_LOW_PBX_L = 73; 550 /** 551 * CDMA HIGH PBX SS tone: {3700Hz 25ms, 4000Hz 25ms} 8 times 552 * 200 ms OFF, {3700Hz 25ms 4000Hz 25ms}8 times, 553 * 2000ms OFF, REPEAT.... 554 * 555 * @see #ToneGenerator(int, int) 556 */ 557 public static final int TONE_CDMA_HIGH_PBX_SS = 74; 558 /** 559 * CDMA MED PBX SS tone: {2600Hz 25ms, 2900Hz 25ms} 8 times 560 * 200 ms OFF, {2600Hz 25ms 2900Hz 25ms}8 times, 561 * 2000ms OFF, REPEAT.... 562 * 563 * @see #ToneGenerator(int, int) 564 */ 565 public static final int TONE_CDMA_MED_PBX_SS = 75; 566 /** 567 * CDMA LOW PBX SS tone: {1300Hz 25ms, 1450Hz 25ms} 8 times 568 * 200 ms OFF, {1300Hz 25ms 1450Hz 25ms}8 times, 569 * 2000ms OFF, REPEAT.... 570 * 571 * @see #ToneGenerator(int, int) 572 */ 573 public static final int TONE_CDMA_LOW_PBX_SS = 76; 574 /** 575 * CDMA HIGH PBX SSL tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 576 * 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, 577 * {3700Hz 25ms, 4000Hz 25ms} 16 times, 1000ms OFF, REPEAT.... 578 * 579 * @see #ToneGenerator(int, int) 580 */ 581 public static final int TONE_CDMA_HIGH_PBX_SSL = 77; 582 /** 583 * CDMA MED PBX SSL tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 584 * 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, 585 * {2600Hz 25ms, 2900Hz 25ms} 16 times, 1000ms OFF, REPEAT.... 586 * 587 * @see #ToneGenerator(int, int) 588 */ 589 public static final int TONE_CDMA_MED_PBX_SSL = 78; 590 /** 591 * CDMA LOW PBX SSL tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 592 * 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, 593 * {1300Hz 25ms, 1450Hz 25ms} 16 times, 1000ms OFF, REPEAT.... 594 * 595 * 596 * @see #ToneGenerator(int, int) 597 */ 598 public static final int TONE_CDMA_LOW_PBX_SSL = 79; 599 /** 600 * CDMA HIGH PBX SSL tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 601 * 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 200ms OFF, 602 * {3700Hz 25ms, 4000Hz 25ms} 8 times, 1000ms OFF, REPEAT.... 603 * 604 * @see #ToneGenerator(int, int) 605 */ 606 public static final int TONE_CDMA_HIGH_PBX_SLS = 80; 607 /** 608 * CDMA HIGH PBX SLS tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 609 * 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 200ms OFF, 610 * {2600Hz 25ms, 2900Hz 25ms} 8 times, 1000ms OFF, REPEAT.... 611 * 612 * @see #ToneGenerator(int, int) 613 */ 614 public static final int TONE_CDMA_MED_PBX_SLS = 81; 615 /** 616 * CDMA HIGH PBX SLS tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 617 * 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 200ms OFF, 618 * {1300Hz 25ms, 1450Hz 25ms} 8 times, 1000ms OFF, REPEAT.... 619 * 620 * @see #ToneGenerator(int, int) 621 */ 622 public static final int TONE_CDMA_LOW_PBX_SLS = 82; 623 /** 624 * CDMA HIGH PBX X S4 tone: {3700Hz 25ms 4000Hz 25ms} 8 times, 625 * 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, 626 * {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, 627 * {3700Hz 25ms 4000Hz 25ms} 8 times, 800ms OFF, REPEAT... 628 * 629 * @see #ToneGenerator(int, int) 630 */ 631 public static final int TONE_CDMA_HIGH_PBX_S_X4 = 83; 632 /** 633 * CDMA MED PBX X S4 tone: {2600Hz 25ms 2900Hz 25ms} 8 times, 634 * 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, 635 * {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, 636 * {2600Hz 25ms 2900Hz 25ms} 8 times, 800ms OFF, REPEAT... 637 * 638 * @see #ToneGenerator(int, int) 639 */ 640 public static final int TONE_CDMA_MED_PBX_S_X4 = 84; 641 /** 642 * CDMA LOW PBX X S4 tone: {1300Hz 25ms 1450Hz 25ms} 8 times, 643 * 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, 644 * {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, 645 * {1300Hz 25ms 1450Hz 25ms} 8 times, 800ms OFF, REPEAT... 646 * 647 * @see #ToneGenerator(int, int) 648 */ 649 public static final int TONE_CDMA_LOW_PBX_S_X4 = 85; 650 /** 651 * CDMA Alert Network Lite tone: 1109Hz 62ms ON, 784Hz 62ms ON, 740Hz 62ms ON 652 * 622Hz 62ms ON, 1109Hz 62ms ON 653 * 654 * @see #ToneGenerator(int, int) 655 */ 656 public static final int TONE_CDMA_ALERT_NETWORK_LITE = 86; 657 /** 658 * CDMA Alert Auto Redial tone: {1245Hz 62ms ON, 659Hz 62ms ON} 3 times, 659 * 1245 62ms ON 660 * 661 * @see #ToneGenerator(int, int) 662 */ 663 public static final int TONE_CDMA_ALERT_AUTOREDIAL_LITE = 87; 664 /** 665 * CDMA One Min Beep tone: 1150Hz+770Hz 400ms ON 666 * 667 * @see #ToneGenerator(int, int) 668 */ 669 public static final int TONE_CDMA_ONE_MIN_BEEP = 88; 670 /** 671 * 672 * CDMA KEYPAD Volume key lite tone: 941Hz+1477Hz 120ms ON 673 * @see #ToneGenerator(int, int) 674 */ 675 public static final int TONE_CDMA_KEYPAD_VOLUME_KEY_LITE = 89; 676 /** 677 * CDMA PRESSHOLDKEY LITE tone: 587Hz 375ms ON, 1175Hz 125ms ON 678 * 679 * @see #ToneGenerator(int, int) 680 */ 681 public static final int TONE_CDMA_PRESSHOLDKEY_LITE = 90; 682 /** 683 * CDMA ALERT INCALL LITE tone: 587Hz 62ms, 784 62ms, 831Hz 62ms, 684 * 784Hz 62ms, 1109 62ms, 784Hz 62ms, 831Hz 62ms, 784Hz 62ms 685 * 686 * @see #ToneGenerator(int, int) 687 */ 688 public static final int TONE_CDMA_ALERT_INCALL_LITE = 91; 689 /** 690 * CDMA EMERGENCY RINGBACK tone: {941Hz 125ms ON, 10ms OFF} 3times 691 * 4990ms OFF, REPEAT... 692 * 693 * @see #ToneGenerator(int, int) 694 */ 695 public static final int TONE_CDMA_EMERGENCY_RINGBACK = 92; 696 /** 697 * CDMA ALERT CALL GUARD tone: {1319Hz 125ms ON, 125ms OFF} 3 times 698 * 699 * @see #ToneGenerator(int, int) 700 */ 701 public static final int TONE_CDMA_ALERT_CALL_GUARD = 93; 702 /** 703 * CDMA SOFT ERROR LITE tone: 1047Hz 125ms ON, 370Hz 125ms 704 * 705 * @see #ToneGenerator(int, int) 706 */ 707 public static final int TONE_CDMA_SOFT_ERROR_LITE = 94; 708 /** 709 * CDMA CALLDROP LITE tone: 1480Hz 125ms, 1397Hz 125ms, 784Hz 125ms 710 * 711 * @see #ToneGenerator(int, int) 712 */ 713 public static final int TONE_CDMA_CALLDROP_LITE = 95; 714 /** 715 * CDMA_NETWORK_BUSY_ONE_SHOT tone: 425Hz 500ms ON, 500ms OFF. 716 * 717 * @see #ToneGenerator(int, int) 718 */ 719 public static final int TONE_CDMA_NETWORK_BUSY_ONE_SHOT = 96; 720 /** 721 * CDMA_ABBR_ALERT tone: 1150Hz+770Hz 400ms ON 722 * @see #ToneGenerator(int, int) 723 */ 724 public static final int TONE_CDMA_ABBR_ALERT = 97; 725 /** 726 * CDMA_SIGNAL_OFF - silent tone 727 * 728 * @see #ToneGenerator(int, int) 729 */ 730 public static final int TONE_CDMA_SIGNAL_OFF = 98; 731 732 /** Maximum volume, for use with {@link #ToneGenerator(int,int)} */ 733 public static final int MAX_VOLUME = 100; 734 /** Minimum volume setting, for use with {@link #ToneGenerator(int,int)} */ 735 public static final int MIN_VOLUME = 0; 736 737 738 /** 739 * ToneGenerator class contructor specifying output stream type and volume. 740 * 741 * @param streamType The streame type used for tone playback (e.g. STREAM_MUSIC). 742 * @param volume The volume of the tone, given in percentage of maximum volume (from 0-100). 743 * 744 */ ToneGenerator(int streamType, int volume)745 public ToneGenerator(int streamType, int volume) { 746 native_setup(streamType, volume); 747 } 748 749 /** 750 * This method starts the playback of a tone of the specified type. 751 * only one tone can play at a time: if a tone is playing while this method is called, 752 * this tone is stopped and replaced by the one requested. 753 * @param toneType The type of tone generated chosen from the following list: 754 * <ul> 755 * <li>{@link #TONE_DTMF_0} 756 * <li>{@link #TONE_DTMF_1} 757 * <li>{@link #TONE_DTMF_2} 758 * <li>{@link #TONE_DTMF_3} 759 * <li>{@link #TONE_DTMF_4} 760 * <li>{@link #TONE_DTMF_5} 761 * <li>{@link #TONE_DTMF_6} 762 * <li>{@link #TONE_DTMF_7} 763 * <li>{@link #TONE_DTMF_8} 764 * <li>{@link #TONE_DTMF_9} 765 * <li>{@link #TONE_DTMF_A} 766 * <li>{@link #TONE_DTMF_B} 767 * <li>{@link #TONE_DTMF_C} 768 * <li>{@link #TONE_DTMF_D} 769 * <li>{@link #TONE_SUP_DIAL} 770 * <li>{@link #TONE_SUP_BUSY} 771 * <li>{@link #TONE_SUP_CONGESTION} 772 * <li>{@link #TONE_SUP_RADIO_ACK} 773 * <li>{@link #TONE_SUP_RADIO_NOTAVAIL} 774 * <li>{@link #TONE_SUP_ERROR} 775 * <li>{@link #TONE_SUP_CALL_WAITING} 776 * <li>{@link #TONE_SUP_RINGTONE} 777 * <li>{@link #TONE_PROP_BEEP} 778 * <li>{@link #TONE_PROP_ACK} 779 * <li>{@link #TONE_PROP_NACK} 780 * <li>{@link #TONE_PROP_PROMPT} 781 * <li>{@link #TONE_PROP_BEEP2} 782 * <li>{@link #TONE_SUP_INTERCEPT} 783 * <li>{@link #TONE_SUP_INTERCEPT_ABBREV} 784 * <li>{@link #TONE_SUP_CONGESTION_ABBREV} 785 * <li>{@link #TONE_SUP_CONFIRM} 786 * <li>{@link #TONE_SUP_PIP} 787 * <li>{@link #TONE_CDMA_DIAL_TONE_LITE} 788 * <li>{@link #TONE_CDMA_NETWORK_USA_RINGBACK} 789 * <li>{@link #TONE_CDMA_INTERCEPT} 790 * <li>{@link #TONE_CDMA_ABBR_INTERCEPT} 791 * <li>{@link #TONE_CDMA_REORDER} 792 * <li>{@link #TONE_CDMA_ABBR_REORDER} 793 * <li>{@link #TONE_CDMA_NETWORK_BUSY} 794 * <li>{@link #TONE_CDMA_CONFIRM} 795 * <li>{@link #TONE_CDMA_ANSWER} 796 * <li>{@link #TONE_CDMA_NETWORK_CALLWAITING} 797 * <li>{@link #TONE_CDMA_PIP} 798 * <li>{@link #TONE_CDMA_CALL_SIGNAL_ISDN_NORMAL} 799 * <li>{@link #TONE_CDMA_CALL_SIGNAL_ISDN_INTERGROUP} 800 * <li>{@link #TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI} 801 * <li>{@link #TONE_CDMA_CALL_SIGNAL_ISDN_PAT3} 802 * <li>{@link #TONE_CDMA_CALL_SIGNAL_ISDN_PING_RING} 803 * <li>{@link #TONE_CDMA_CALL_SIGNAL_ISDN_PAT5} 804 * <li>{@link #TONE_CDMA_CALL_SIGNAL_ISDN_PAT6} 805 * <li>{@link #TONE_CDMA_CALL_SIGNAL_ISDN_PAT7} 806 * <li>{@link #TONE_CDMA_HIGH_L} 807 * <li>{@link #TONE_CDMA_MED_L} 808 * <li>{@link #TONE_CDMA_LOW_L} 809 * <li>{@link #TONE_CDMA_HIGH_SS} 810 * <li>{@link #TONE_CDMA_MED_SS} 811 * <li>{@link #TONE_CDMA_LOW_SS} 812 * <li>{@link #TONE_CDMA_HIGH_SSL} 813 * <li>{@link #TONE_CDMA_MED_SSL} 814 * <li>{@link #TONE_CDMA_LOW_SSL} 815 * <li>{@link #TONE_CDMA_HIGH_SS_2} 816 * <li>{@link #TONE_CDMA_MED_SS_2} 817 * <li>{@link #TONE_CDMA_LOW_SS_2} 818 * <li>{@link #TONE_CDMA_HIGH_SLS} 819 * <li>{@link #TONE_CDMA_MED_SLS} 820 * <li>{@link #TONE_CDMA_LOW_SLS} 821 * <li>{@link #TONE_CDMA_HIGH_S_X4} 822 * <li>{@link #TONE_CDMA_MED_S_X4} 823 * <li>{@link #TONE_CDMA_LOW_S_X4} 824 * <li>{@link #TONE_CDMA_HIGH_PBX_L} 825 * <li>{@link #TONE_CDMA_MED_PBX_L} 826 * <li>{@link #TONE_CDMA_LOW_PBX_L} 827 * <li>{@link #TONE_CDMA_HIGH_PBX_SS} 828 * <li>{@link #TONE_CDMA_MED_PBX_SS} 829 * <li>{@link #TONE_CDMA_LOW_PBX_SS} 830 * <li>{@link #TONE_CDMA_HIGH_PBX_SSL} 831 * <li>{@link #TONE_CDMA_MED_PBX_SSL} 832 * <li>{@link #TONE_CDMA_LOW_PBX_SSL} 833 * <li>{@link #TONE_CDMA_HIGH_PBX_SLS} 834 * <li>{@link #TONE_CDMA_MED_PBX_SLS} 835 * <li>{@link #TONE_CDMA_LOW_PBX_SLS} 836 * <li>{@link #TONE_CDMA_HIGH_PBX_S_X4} 837 * <li>{@link #TONE_CDMA_MED_PBX_S_X4} 838 * <li>{@link #TONE_CDMA_LOW_PBX_S_X4} 839 * <li>{@link #TONE_CDMA_ALERT_NETWORK_LITE} 840 * <li>{@link #TONE_CDMA_ALERT_AUTOREDIAL_LITE} 841 * <li>{@link #TONE_CDMA_ONE_MIN_BEEP} 842 * <li>{@link #TONE_CDMA_KEYPAD_VOLUME_KEY_LITE} 843 * <li>{@link #TONE_CDMA_PRESSHOLDKEY_LITE} 844 * <li>{@link #TONE_CDMA_ALERT_INCALL_LITE} 845 * <li>{@link #TONE_CDMA_EMERGENCY_RINGBACK} 846 * <li>{@link #TONE_CDMA_ALERT_CALL_GUARD} 847 * <li>{@link #TONE_CDMA_SOFT_ERROR_LITE} 848 * <li>{@link #TONE_CDMA_CALLDROP_LITE} 849 * <li>{@link #TONE_CDMA_NETWORK_BUSY_ONE_SHOT} 850 * <li>{@link #TONE_CDMA_ABBR_ALERT} 851 * <li>{@link #TONE_CDMA_SIGNAL_OFF} 852 * </ul> 853 * @see #ToneGenerator(int, int) 854 */ startTone(int toneType)855 public boolean startTone(int toneType) { 856 return startTone(toneType, -1); 857 } 858 859 /** 860 * This method starts the playback of a tone of the specified type for the specified duration. 861 * @param toneType The type of tone generated @see {@link #startTone(int)}. 862 * @param durationMs The tone duration in milliseconds. If the tone is limited in time by definition, 863 * the actual duration will be the minimum of durationMs and the defined tone duration. Setting durationMs to -1, 864 * is equivalent to calling {@link #startTone(int)}. 865 */ startTone(int toneType, int durationMs)866 public native boolean startTone(int toneType, int durationMs); 867 868 /** 869 * This method stops the tone currently playing playback. 870 * @see #ToneGenerator(int, int) 871 */ stopTone()872 public native void stopTone(); 873 874 /** 875 * Releases resources associated with this ToneGenerator object. It is good 876 * practice to call this method when you're done using the ToneGenerator. 877 */ release()878 public native void release(); 879 native_setup(int streamType, int volume)880 private native final void native_setup(int streamType, int volume); 881 native_finalize()882 private native final void native_finalize(); 883 884 /** 885 * Returns the audio session ID. 886 * 887 * @return the ID of the audio session this ToneGenerator belongs to or 0 if an error 888 * occured. 889 */ getAudioSessionId()890 public native final int getAudioSessionId(); 891 892 @Override finalize()893 protected void finalize() { native_finalize(); } 894 895 @SuppressWarnings("unused") 896 private long mNativeContext; // accessed by native methods 897 } 898