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