1/* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit AudioKit 19 */ 20 21import { ErrorCallback, AsyncCallback, Callback } from './@ohos.base'; 22 23/** 24 * @namespace audio 25 * @since 7 26 */ 27/** 28 * @namespace audio 29 * @atomicservice 30 * @since 12 31 */ 32declare namespace audio { 33 /** 34 * Enumerates audio errors. 35 * @enum {number} 36 * @syscap SystemCapability.Multimedia.Audio.Core 37 * @since 9 38 */ 39 enum AudioErrors { 40 /** 41 * Invalid parameter. 42 * @syscap SystemCapability.Multimedia.Audio.Core 43 * @since 9 44 */ 45 ERROR_INVALID_PARAM = 6800101, 46 /** 47 * Allocate memory failed. 48 * @syscap SystemCapability.Multimedia.Audio.Core 49 * @since 9 50 */ 51 ERROR_NO_MEMORY = 6800102, 52 /** 53 * Operation not permit at current state. 54 * @syscap SystemCapability.Multimedia.Audio.Core 55 * @since 9 56 */ 57 ERROR_ILLEGAL_STATE = 6800103, 58 /** 59 * Unsupported option. 60 * @syscap SystemCapability.Multimedia.Audio.Core 61 * @since 9 62 */ 63 ERROR_UNSUPPORTED = 6800104, 64 /** 65 * Time out. 66 * @syscap SystemCapability.Multimedia.Audio.Core 67 * @since 9 68 */ 69 ERROR_TIMEOUT = 6800105, 70 /** 71 * Audio specific errors. 72 * @syscap SystemCapability.Multimedia.Audio.Core 73 * @since 9 74 */ 75 ERROR_STREAM_LIMIT = 6800201, 76 /** 77 * Default error. 78 * @syscap SystemCapability.Multimedia.Audio.Core 79 * @since 9 80 */ 81 ERROR_SYSTEM = 6800301 82 } 83 84 /** 85 * Define local device network id for audio 86 * @constant 87 * @syscap SystemCapability.Multimedia.Audio.Device 88 * @systemapi 89 * @since 9 90 */ 91 const LOCAL_NETWORK_ID: string; 92 93 /** 94 * Define default volume group id for audio 95 * @constant 96 * @syscap SystemCapability.Multimedia.Audio.Volume 97 * @since 9 98 */ 99 const DEFAULT_VOLUME_GROUP_ID: number; 100 101 /** 102 * Define default interrupt group id for audio 103 * @constant 104 * @syscap SystemCapability.Multimedia.Audio.Interrupt 105 * @since 9 106 */ 107 const DEFAULT_INTERRUPT_GROUP_ID: number; 108 109 /** 110 * Obtains an {@link AudioManager} instance. 111 * @returns { AudioManager } this {@link AudioManager} object. 112 * @syscap SystemCapability.Multimedia.Audio.Core 113 * @since 7 114 */ 115 function getAudioManager(): AudioManager; 116 117 /** 118 * Obtains an {@link AudioCapturer} instance. This method uses an asynchronous callback to return the capturer instance. 119 * @param { AudioCapturerOptions } options - Capturer configurations. 120 * @param { AsyncCallback<AudioCapturer> } callback - Callback used to return the audio capturer instance. 121 * @syscap SystemCapability.Multimedia.Audio.Capturer 122 * @since 8 123 */ 124 function createAudioCapturer(options: AudioCapturerOptions, callback: AsyncCallback<AudioCapturer>): void; 125 126 /** 127 * Obtains an {@link AudioCapturer} instance. This method uses a promise to return the capturer instance. 128 * @param { AudioCapturerOptions } options - Capturer configurations. 129 * @returns { Promise<AudioCapturer> } Promise used to return the audio capturer instance. 130 * @syscap SystemCapability.Multimedia.Audio.Capturer 131 * @since 8 132 */ 133 function createAudioCapturer(options: AudioCapturerOptions): Promise<AudioCapturer>; 134 135 /** 136 * Obtains an {@link AudioRenderer} instance. This method uses an asynchronous callback to return the renderer instance. 137 * @param { AudioRendererOptions } options - Renderer configurations. 138 * @param { AsyncCallback<AudioRenderer> } callback - Callback used to return the audio renderer instance. 139 * @syscap SystemCapability.Multimedia.Audio.Renderer 140 * @since 8 141 */ 142 function createAudioRenderer(options: AudioRendererOptions, callback: AsyncCallback<AudioRenderer>): void; 143 144 /** 145 * Obtains an {@link AudioRenderer} instance. This method uses a promise to return the renderer instance. 146 * @param { AudioRendererOptions } options - Renderer configurations. 147 * @returns { Promise<AudioRenderer> } Promise used to return the audio renderer instance. 148 * @syscap SystemCapability.Multimedia.Audio.Renderer 149 * @since 8 150 */ 151 function createAudioRenderer(options: AudioRendererOptions): Promise<AudioRenderer>; 152 153 /** 154 * Obtains a {@link TonePlayer} instance. This method uses an asynchronous callback to return the renderer instance. 155 * @param { AudioRendererInfo } options - Tone playing attribute. 156 * @param { AsyncCallback<TonePlayer> } callback - Callback used to return the tonePlayer instance. 157 * @syscap SystemCapability.Multimedia.Audio.Tone 158 * @systemapi 159 * @since 9 160 */ 161 function createTonePlayer(options: AudioRendererInfo, callback: AsyncCallback<TonePlayer>): void; 162 163 /** 164 * Obtains a {@link TonePlayer} instance. This method uses a promise to return the renderer instance. 165 * @param { AudioRendererInfo } options - Tone playing attribute. 166 * @returns { Promise<TonePlayer> } Promise used to return the tonePlayer instance. 167 * @syscap SystemCapability.Multimedia.Audio.Tone 168 * @systemapi 169 * @since 9 170 */ 171 function createTonePlayer(options: AudioRendererInfo): Promise<TonePlayer>; 172 173 /** 174 * Enumerates the audio states. 175 * @enum { number } 176 * @syscap SystemCapability.Multimedia.Audio.Core 177 * @since 8 178 */ 179 enum AudioState { 180 /** 181 * Invalid state. 182 * @syscap SystemCapability.Multimedia.Audio.Core 183 * @since 8 184 */ 185 STATE_INVALID = -1, 186 /** 187 * Create new instance state. 188 * @syscap SystemCapability.Multimedia.Audio.Core 189 * @since 8 190 */ 191 STATE_NEW = 0, 192 /** 193 * Prepared state. 194 * @syscap SystemCapability.Multimedia.Audio.Core 195 * @since 8 196 */ 197 STATE_PREPARED = 1, 198 /** 199 * Running state. 200 * @syscap SystemCapability.Multimedia.Audio.Core 201 * @since 8 202 */ 203 STATE_RUNNING = 2, 204 /** 205 * Stopped state. 206 * @syscap SystemCapability.Multimedia.Audio.Core 207 * @since 8 208 */ 209 STATE_STOPPED = 3, 210 /** 211 * Released state. 212 * @syscap SystemCapability.Multimedia.Audio.Core 213 * @since 8 214 */ 215 STATE_RELEASED = 4, 216 /** 217 * Paused state. 218 * @syscap SystemCapability.Multimedia.Audio.Core 219 * @since 8 220 */ 221 STATE_PAUSED = 5 222 } 223 224 /** 225 * Enumerates audio stream types. 226 * @enum { number } 227 * @syscap SystemCapability.Multimedia.Audio.Volume 228 * @since 7 229 */ 230 enum AudioVolumeType { 231 /** 232 * Audio streams for voice calls. 233 * @syscap SystemCapability.Multimedia.Audio.Volume 234 * @since 8 235 */ 236 VOICE_CALL = 0, 237 /** 238 * Audio streams for ringtones. 239 * @syscap SystemCapability.Multimedia.Audio.Volume 240 * @since 7 241 */ 242 RINGTONE = 2, 243 /** 244 * Audio streams for media purpose. 245 * @syscap SystemCapability.Multimedia.Audio.Volume 246 * @since 7 247 */ 248 MEDIA = 3, 249 /** 250 * Audio volume for alarm purpose. 251 * @syscap SystemCapability.Multimedia.Audio.Volume 252 * @since 10 253 */ 254 ALARM = 4, 255 /** 256 * Audio volume for accessibility purpose. 257 * @syscap SystemCapability.Multimedia.Audio.Volume 258 * @since 10 259 */ 260 ACCESSIBILITY = 5, 261 /** 262 * Audio stream for voice assistant. 263 * @syscap SystemCapability.Multimedia.Audio.Volume 264 * @since 8 265 */ 266 VOICE_ASSISTANT = 9, 267 /** 268 * Audio volume for ultrasonic. 269 * @syscap SystemCapability.Multimedia.Audio.Volume 270 * @systemapi 271 * @since 10 272 */ 273 ULTRASONIC = 10, 274 /** 275 * Audio stream for all common. 276 * @syscap SystemCapability.Multimedia.Audio.Volume 277 * @systemapi 278 * @since 9 279 */ 280 ALL = 100, 281 } 282 283 /** 284 * Enumerates audio device flags. 285 * @enum { number } 286 * @syscap SystemCapability.Multimedia.Audio.Device 287 * @since 7 288 */ 289 enum DeviceFlag { 290 /** 291 * None devices. 292 * @syscap SystemCapability.Multimedia.Audio.Device 293 * @systemapi 294 * @since 9 295 */ 296 NONE_DEVICES_FLAG = 0, 297 /** 298 * Output devices. 299 * @syscap SystemCapability.Multimedia.Audio.Device 300 * @since 7 301 */ 302 OUTPUT_DEVICES_FLAG = 1, 303 /** 304 * Input devices. 305 * @syscap SystemCapability.Multimedia.Audio.Device 306 * @since 7 307 */ 308 INPUT_DEVICES_FLAG = 2, 309 /** 310 * All devices. 311 * @syscap SystemCapability.Multimedia.Audio.Device 312 * @since 7 313 */ 314 ALL_DEVICES_FLAG = 3, 315 /** 316 * Distributed output devices. 317 * @syscap SystemCapability.Multimedia.Audio.Device 318 * @systemapi 319 * @since 9 320 */ 321 DISTRIBUTED_OUTPUT_DEVICES_FLAG = 4, 322 /** 323 * Distributed input devices. 324 * @syscap SystemCapability.Multimedia.Audio.Device 325 * @systemapi 326 * @since 9 327 */ 328 DISTRIBUTED_INPUT_DEVICES_FLAG = 8, 329 /** 330 * All Distributed devices. 331 * @syscap SystemCapability.Multimedia.Audio.Device 332 * @systemapi 333 * @since 9 334 */ 335 ALL_DISTRIBUTED_DEVICES_FLAG = 12, 336 } 337 338 /** 339 * Enumerates audio device for usage. 340 * @enum { number } 341 * @syscap SystemCapability.Multimedia.Audio.Device 342 * @systemapi 343 * @since 11 344 */ 345 enum DeviceUsage { 346 /** 347 * Media output devices. 348 * @syscap SystemCapability.Multimedia.Audio.Device 349 * @systemapi 350 * @since 11 351 */ 352 MEDIA_OUTPUT_DEVICES = 1, 353 /** 354 * Media input devices. 355 * @syscap SystemCapability.Multimedia.Audio.Device 356 * @systemapi 357 * @since 11 358 */ 359 MEDIA_INPUT_DEVICES = 2, 360 /** 361 * All media devices. 362 * @syscap SystemCapability.Multimedia.Audio.Device 363 * @systemapi 364 * @since 11 365 */ 366 ALL_MEDIA_DEVICES = 3, 367 /** 368 * Call output devices. 369 * @syscap SystemCapability.Multimedia.Audio.Device 370 * @systemapi 371 * @since 11 372 */ 373 CALL_OUTPUT_DEVICES = 4, 374 /** 375 * Call input devices. 376 * @syscap SystemCapability.Multimedia.Audio.Device 377 * @systemapi 378 * @since 11 379 */ 380 CALL_INPUT_DEVICES = 8, 381 /** 382 * All call devices. 383 * @syscap SystemCapability.Multimedia.Audio.Device 384 * @systemapi 385 * @since 11 386 */ 387 ALL_CALL_DEVICES = 12, 388 } 389 390 /** 391 * Enumerates device roles. 392 * @enum { number } 393 * @syscap SystemCapability.Multimedia.Audio.Device 394 * @since 7 395 */ 396 /** 397 * Enumerates device roles. 398 * @enum { number } 399 * @syscap SystemCapability.Multimedia.Audio.Device 400 * @atomicservice 401 * @since 12 402 */ 403 enum DeviceRole { 404 /** 405 * Input role. 406 * @syscap SystemCapability.Multimedia.Audio.Device 407 * @since 7 408 */ 409 /** 410 * Input role. 411 * @syscap SystemCapability.Multimedia.Audio.Device 412 * @atomicservice 413 * @since 12 414 */ 415 INPUT_DEVICE = 1, 416 /** 417 * Output role. 418 * @syscap SystemCapability.Multimedia.Audio.Device 419 * @since 7 420 */ 421 /** 422 * Output role. 423 * @syscap SystemCapability.Multimedia.Audio.Device 424 * @atomicservice 425 * @since 12 426 */ 427 OUTPUT_DEVICE = 2, 428 } 429 430 /** 431 * Enumerates device types. 432 * @enum { number } 433 * @syscap SystemCapability.Multimedia.Audio.Device 434 * @since 7 435 */ 436 /** 437 * Enumerates device types. 438 * @enum { number } 439 * @syscap SystemCapability.Multimedia.Audio.Device 440 * @atomicservice 441 * @since 12 442 */ 443 enum DeviceType { 444 /** 445 * Invalid device. 446 * @syscap SystemCapability.Multimedia.Audio.Device 447 * @since 7 448 */ 449 /** 450 * Invalid device. 451 * @syscap SystemCapability.Multimedia.Audio.Device 452 * @atomicservice 453 * @since 12 454 */ 455 INVALID = 0, 456 /** 457 * Built-in earpiece. 458 * @syscap SystemCapability.Multimedia.Audio.Device 459 * @since 7 460 */ 461 /** 462 * Built-in earpiece. 463 * @syscap SystemCapability.Multimedia.Audio.Device 464 * @atomicservice 465 * @since 12 466 */ 467 EARPIECE = 1, 468 /** 469 * Built-in speaker. 470 * @syscap SystemCapability.Multimedia.Audio.Device 471 * @since 7 472 */ 473 /** 474 * Built-in speaker. 475 * @syscap SystemCapability.Multimedia.Audio.Device 476 * @atomicservice 477 * @since 12 478 */ 479 SPEAKER = 2, 480 /** 481 * Wired headset, which is a combination of a pair of earpieces and a microphone. 482 * @syscap SystemCapability.Multimedia.Audio.Device 483 * @since 7 484 */ 485 /** 486 * Wired headset, which is a combination of a pair of earpieces and a microphone. 487 * @syscap SystemCapability.Multimedia.Audio.Device 488 * @atomicservice 489 * @since 12 490 */ 491 WIRED_HEADSET = 3, 492 /** 493 * A pair of wired headphones. 494 * @syscap SystemCapability.Multimedia.Audio.Device 495 * @since 7 496 */ 497 /** 498 * A pair of wired headphones. 499 * @syscap SystemCapability.Multimedia.Audio.Device 500 * @atomicservice 501 * @since 12 502 */ 503 WIRED_HEADPHONES = 4, 504 /** 505 * Bluetooth device using the synchronous connection oriented link (SCO). 506 * @syscap SystemCapability.Multimedia.Audio.Device 507 * @since 7 508 */ 509 /** 510 * Bluetooth device using the synchronous connection oriented link (SCO). 511 * @syscap SystemCapability.Multimedia.Audio.Device 512 * @atomicservice 513 * @since 12 514 */ 515 BLUETOOTH_SCO = 7, 516 /** 517 * Bluetooth device using advanced audio distribution profile (A2DP). 518 * @syscap SystemCapability.Multimedia.Audio.Device 519 * @since 7 520 */ 521 /** 522 * Bluetooth device using advanced audio distribution profile (A2DP). 523 * @syscap SystemCapability.Multimedia.Audio.Device 524 * @atomicservice 525 * @since 12 526 */ 527 BLUETOOTH_A2DP = 8, 528 /** 529 * Built-in microphone. 530 * @syscap SystemCapability.Multimedia.Audio.Device 531 * @since 7 532 */ 533 /** 534 * Built-in microphone. 535 * @syscap SystemCapability.Multimedia.Audio.Device 536 * @atomicservice 537 * @since 12 538 */ 539 MIC = 15, 540 /** 541 * USB audio headset. 542 * @syscap SystemCapability.Multimedia.Audio.Device 543 * @since 7 544 */ 545 /** 546 * USB audio headset. 547 * @syscap SystemCapability.Multimedia.Audio.Device 548 * @atomicservice 549 * @since 12 550 */ 551 USB_HEADSET = 22, 552 /** 553 * Display port device. 554 * @syscap SystemCapability.Multimedia.Audio.Device 555 * @atomicservice 556 * @since 12 557 */ 558 DISPLAY_PORT = 23, 559 /** 560 * Device type for rerouting audio to other remote devices by system application 561 * @syscap SystemCapability.Multimedia.Audio.Device 562 * @atomicservice 563 * @since 12 564 */ 565 REMOTE_CAST = 24, 566 /** 567 * Default device type. 568 * @syscap SystemCapability.Multimedia.Audio.Device 569 * @since 9 570 */ 571 /** 572 * Default device type. 573 * @syscap SystemCapability.Multimedia.Audio.Device 574 * @atomicservice 575 * @since 12 576 */ 577 DEFAULT = 1000, 578 } 579 580 /** 581 * Enumerates the active device types. 582 * @enum { number } 583 * @syscap SystemCapability.Multimedia.Audio.Device 584 * @since 7 585 * @deprecated since 9 586 * @useinstead ohos.multimedia.audio.CommunicationDeviceType 587 */ 588 enum ActiveDeviceType { 589 /** 590 * Speaker. 591 * @syscap SystemCapability.Multimedia.Audio.Device 592 * @since 7 593 * @deprecated since 9 594 * @useinstead ohos.multimedia.audio.CommunicationDeviceType.SPEAKER 595 */ 596 SPEAKER = 2, 597 /** 598 * Bluetooth device using the SCO link. 599 * @syscap SystemCapability.Multimedia.Audio.Device 600 * @since 7 601 * @deprecated since 9 602 */ 603 BLUETOOTH_SCO = 7, 604 } 605 606 /** 607 * Enumerates the available device types for communication. 608 * @enum { number } 609 * @syscap SystemCapability.Multimedia.Audio.Communication 610 * @since 9 611 */ 612 enum CommunicationDeviceType { 613 /** 614 * Speaker. 615 * @syscap SystemCapability.Multimedia.Audio.Communication 616 * @since 9 617 */ 618 SPEAKER = 2 619 } 620 621 /** 622 * Enumerates ringer modes. 623 * @enum { number } 624 * @syscap SystemCapability.Multimedia.Audio.Communication 625 * @since 7 626 */ 627 enum AudioRingMode { 628 /** 629 * Silent mode. 630 * @syscap SystemCapability.Multimedia.Audio.Communication 631 * @since 7 632 */ 633 RINGER_MODE_SILENT = 0, 634 /** 635 * Vibration mode. 636 * @syscap SystemCapability.Multimedia.Audio.Communication 637 * @since 7 638 */ 639 RINGER_MODE_VIBRATE = 1, 640 /** 641 * Normal mode. 642 * @syscap SystemCapability.Multimedia.Audio.Communication 643 * @since 7 644 */ 645 RINGER_MODE_NORMAL = 2, 646 } 647 648 /** 649 * Enumerates the audio sample formats. 650 * @enum { number } 651 * @syscap SystemCapability.Multimedia.Audio.Core 652 * @since 8 653 */ 654 enum AudioSampleFormat { 655 /** 656 * Invalid format. 657 * @syscap SystemCapability.Multimedia.Audio.Core 658 * @since 8 659 */ 660 SAMPLE_FORMAT_INVALID = -1, 661 /** 662 * Unsigned 8 format. 663 * @syscap SystemCapability.Multimedia.Audio.Core 664 * @since 8 665 */ 666 SAMPLE_FORMAT_U8 = 0, 667 /** 668 * Signed 16 bit integer, little endian. 669 * @syscap SystemCapability.Multimedia.Audio.Core 670 * @since 8 671 */ 672 SAMPLE_FORMAT_S16LE = 1, 673 /** 674 * Signed 24 bit integer, little endian. 675 * @syscap SystemCapability.Multimedia.Audio.Core 676 * @since 8 677 */ 678 SAMPLE_FORMAT_S24LE = 2, 679 /** 680 * Signed 32 bit integer, little endian. 681 * @syscap SystemCapability.Multimedia.Audio.Core 682 * @since 8 683 */ 684 SAMPLE_FORMAT_S32LE = 3, 685 /** 686 * Signed 32 bit float, little endian. 687 * @syscap SystemCapability.Multimedia.Audio.Core 688 * @since 9 689 */ 690 SAMPLE_FORMAT_F32LE = 4, 691 } 692 693 /** 694 * Enumerates the audio channel. 695 * @enum { number } 696 * @syscap SystemCapability.Multimedia.Audio.Core 697 * @since 8 698 */ 699 enum AudioChannel { 700 /** 701 * Channel 1. 702 * @syscap SystemCapability.Multimedia.Audio.Core 703 * @since 8 704 */ 705 CHANNEL_1 = 0x1 << 0, 706 /** 707 * Channel 2. 708 * @syscap SystemCapability.Multimedia.Audio.Core 709 * @since 8 710 */ 711 CHANNEL_2 = 0x1 << 1, 712 /** 713 * Channel 3. 714 * @syscap SystemCapability.Multimedia.Audio.Core 715 * @since 11 716 */ 717 CHANNEL_3 = 3, 718 /** 719 * Channel 4. 720 * @syscap SystemCapability.Multimedia.Audio.Core 721 * @since 11 722 */ 723 CHANNEL_4 = 4, 724 /** 725 * Channel 5. 726 * @syscap SystemCapability.Multimedia.Audio.Core 727 * @since 11 728 */ 729 CHANNEL_5 = 5, 730 /** 731 * Channel 6. 732 * @syscap SystemCapability.Multimedia.Audio.Core 733 * @since 11 734 */ 735 CHANNEL_6 = 6, 736 /** 737 * Channel 7. 738 * @syscap SystemCapability.Multimedia.Audio.Core 739 * @since 11 740 */ 741 CHANNEL_7 = 7, 742 /** 743 * Channel 8. 744 * @syscap SystemCapability.Multimedia.Audio.Core 745 * @since 11 746 */ 747 CHANNEL_8 = 8, 748 /** 749 * Channel 9. 750 * @syscap SystemCapability.Multimedia.Audio.Core 751 * @since 11 752 */ 753 CHANNEL_9 = 9, 754 /** 755 * Channel 10. 756 * @syscap SystemCapability.Multimedia.Audio.Core 757 * @since 11 758 */ 759 CHANNEL_10 = 10, 760 /** 761 * Channel 12. 762 * @syscap SystemCapability.Multimedia.Audio.Core 763 * @since 11 764 */ 765 CHANNEL_12 = 12, 766 /** 767 * Channel 14. 768 * @syscap SystemCapability.Multimedia.Audio.Core 769 * @since 11 770 */ 771 CHANNEL_14 = 14, 772 /** 773 * Channel 16. 774 * @syscap SystemCapability.Multimedia.Audio.Core 775 * @since 11 776 */ 777 CHANNEL_16 = 16 778 } 779 780 /** 781 * Enumerates the audio sampling rate. 782 * @enum { number } 783 * @syscap SystemCapability.Multimedia.Audio.Core 784 * @since 8 785 */ 786 enum AudioSamplingRate { 787 /** 788 * 8kHz sample rate. 789 * @syscap SystemCapability.Multimedia.Audio.Core 790 * @since 8 791 */ 792 SAMPLE_RATE_8000 = 8000, 793 /** 794 * 11.025kHz sample rate. 795 * @syscap SystemCapability.Multimedia.Audio.Core 796 * @since 8 797 */ 798 SAMPLE_RATE_11025 = 11025, 799 /** 800 * 12kHz sample rate. 801 * @syscap SystemCapability.Multimedia.Audio.Core 802 * @since 8 803 */ 804 SAMPLE_RATE_12000 = 12000, 805 /** 806 * 16kHz sample rate. 807 * @syscap SystemCapability.Multimedia.Audio.Core 808 * @since 8 809 */ 810 SAMPLE_RATE_16000 = 16000, 811 /** 812 * 22.05kHz sample rate. 813 * @syscap SystemCapability.Multimedia.Audio.Core 814 * @since 8 815 */ 816 SAMPLE_RATE_22050 = 22050, 817 /** 818 * 24kHz sample rate. 819 * @syscap SystemCapability.Multimedia.Audio.Core 820 * @since 8 821 */ 822 SAMPLE_RATE_24000 = 24000, 823 /** 824 * 32kHz sample rate. 825 * @syscap SystemCapability.Multimedia.Audio.Core 826 * @since 8 827 */ 828 SAMPLE_RATE_32000 = 32000, 829 /** 830 * 44.1kHz sample rate. 831 * @syscap SystemCapability.Multimedia.Audio.Core 832 * @since 8 833 */ 834 SAMPLE_RATE_44100 = 44100, 835 /** 836 * 48kHz sample rate. 837 * @syscap SystemCapability.Multimedia.Audio.Core 838 * @since 8 839 */ 840 SAMPLE_RATE_48000 = 48000, 841 /** 842 * 64kHz sample rate. 843 * @syscap SystemCapability.Multimedia.Audio.Core 844 * @since 8 845 */ 846 SAMPLE_RATE_64000 = 64000, 847 /** 848 * 88.2kHz sample rate. 849 * @syscap SystemCapability.Multimedia.Audio.Core 850 * @since 12 851 */ 852 SAMPLE_RATE_88200 = 88200, 853 /** 854 * 96kHz sample rate. 855 * @syscap SystemCapability.Multimedia.Audio.Core 856 * @since 8 857 */ 858 SAMPLE_RATE_96000 = 96000, 859 /** 860 * 176.4kHz sample rate. 861 * @syscap SystemCapability.Multimedia.Audio.Core 862 * @since 12 863 */ 864 SAMPLE_RATE_176400 = 176400, 865 /** 866 * 192kHz sample rate. 867 * @syscap SystemCapability.Multimedia.Audio.Core 868 * @since 12 869 */ 870 SAMPLE_RATE_192000 = 192000 871 } 872 873 /** 874 * Enumerates the audio encoding type. 875 * @enum { number } 876 * @syscap SystemCapability.Multimedia.Audio.Core 877 * @since 8 878 */ 879 /** 880 * Enumerates the audio encoding type. 881 * @enum { number } 882 * @syscap SystemCapability.Multimedia.Audio.Core 883 * @atomicservice 884 * @since 12 885 */ 886 enum AudioEncodingType { 887 /** 888 * Invalid type. 889 * @syscap SystemCapability.Multimedia.Audio.Core 890 * @since 8 891 */ 892 /** 893 * Invalid type. 894 * @syscap SystemCapability.Multimedia.Audio.Core 895 * @atomicservice 896 * @since 12 897 */ 898 ENCODING_TYPE_INVALID = -1, 899 /** 900 * PCM encoding. 901 * @syscap SystemCapability.Multimedia.Audio.Core 902 * @since 8 903 */ 904 /** 905 * PCM encoding. 906 * @syscap SystemCapability.Multimedia.Audio.Core 907 * @atomicservice 908 * @since 12 909 */ 910 ENCODING_TYPE_RAW = 0 911 } 912 913 /** 914 * Enumerates the audio content type. 915 * @enum { number } 916 * @syscap SystemCapability.Multimedia.Audio.Core 917 * @since 7 918 * @deprecated since 10 919 * @useinstead ohos.multimedia.audio.StreamUsage 920 */ 921 enum ContentType { 922 /** 923 * Unknown content. 924 * @syscap SystemCapability.Multimedia.Audio.Core 925 * @since 7 926 * @deprecated since 10 927 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_UNKNOWN 928 */ 929 CONTENT_TYPE_UNKNOWN = 0, 930 /** 931 * Speech content. 932 * @syscap SystemCapability.Multimedia.Audio.Core 933 * @since 7 934 * @deprecated since 10 935 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION 936 */ 937 CONTENT_TYPE_SPEECH = 1, 938 /** 939 * Music content. 940 * @syscap SystemCapability.Multimedia.Audio.Core 941 * @since 7 942 * @deprecated since 10 943 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_MUSIC 944 */ 945 CONTENT_TYPE_MUSIC = 2, 946 /** 947 * Movie content. 948 * @syscap SystemCapability.Multimedia.Audio.Core 949 * @since 7 950 * @deprecated since 10 951 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_MOVIE 952 */ 953 CONTENT_TYPE_MOVIE = 3, 954 /** 955 * Notification content. 956 * @syscap SystemCapability.Multimedia.Audio.Core 957 * @since 7 958 * @deprecated since 10 959 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_NOTIFICATION 960 */ 961 CONTENT_TYPE_SONIFICATION = 4, 962 /** 963 * Ringtone content. 964 * @syscap SystemCapability.Multimedia.Audio.Core 965 * @since 8 966 * @deprecated since 10 967 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_RINGTONE 968 */ 969 CONTENT_TYPE_RINGTONE = 5, 970 } 971 972 /** 973 * Enumerates the stream usage. 974 * @enum { number } 975 * @syscap SystemCapability.Multimedia.Audio.Core 976 * @since 7 977 */ 978 /** 979 * Enumerates the stream usage. 980 * @enum { number } 981 * @syscap SystemCapability.Multimedia.Audio.Core 982 * @atomicservice 983 * @since 12 984 */ 985 enum StreamUsage { 986 /** 987 * Unknown usage. 988 * @syscap SystemCapability.Multimedia.Audio.Core 989 * @since 7 990 */ 991 /** 992 * Unknown usage. 993 * @syscap SystemCapability.Multimedia.Audio.Core 994 * @atomicservice 995 * @since 12 996 */ 997 STREAM_USAGE_UNKNOWN = 0, 998 /** 999 * Media usage. 1000 * @syscap SystemCapability.Multimedia.Audio.Core 1001 * @since 7 1002 * @deprecated since 10 1003 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_MUSIC or 1004 * ohos.multimedia.audio.StreamUsage.STREAM_USAGE_MOVIE or 1005 * ohos.multimedia.audio.StreamUsage.STREAM_USAGE_GAME or 1006 * ohos.multimedia.audio.StreamUsage.STREAM_USAGE_AUDIOBOOK 1007 */ 1008 STREAM_USAGE_MEDIA = 1, 1009 /** 1010 * Music usage. 1011 * @syscap SystemCapability.Multimedia.Audio.Core 1012 * @since 10 1013 */ 1014 /** 1015 * Music usage. 1016 * @syscap SystemCapability.Multimedia.Audio.Core 1017 * @atomicservice 1018 * @since 12 1019 */ 1020 STREAM_USAGE_MUSIC = 1, 1021 /** 1022 * Voice communication usage. 1023 * @syscap SystemCapability.Multimedia.Audio.Core 1024 * @since 7 1025 */ 1026 /** 1027 * Voice communication usage. 1028 * @syscap SystemCapability.Multimedia.Audio.Core 1029 * @atomicservice 1030 * @since 12 1031 */ 1032 STREAM_USAGE_VOICE_COMMUNICATION = 2, 1033 /** 1034 * Voice assistant broadcast usage. 1035 * @syscap SystemCapability.Multimedia.Audio.Core 1036 * @since 9 1037 */ 1038 /** 1039 * Voice assistant broadcast usage. 1040 * @syscap SystemCapability.Multimedia.Audio.Core 1041 * @atomicservice 1042 * @since 12 1043 */ 1044 STREAM_USAGE_VOICE_ASSISTANT = 3, 1045 /** 1046 * Alarm usage. 1047 * @syscap SystemCapability.Multimedia.Audio.Core 1048 * @since 10 1049 */ 1050 /** 1051 * Alarm usage. 1052 * @syscap SystemCapability.Multimedia.Audio.Core 1053 * @atomicservice 1054 * @since 12 1055 */ 1056 STREAM_USAGE_ALARM = 4, 1057 /** 1058 * Voice message usage. 1059 * @syscap SystemCapability.Multimedia.Audio.Core 1060 * @since 10 1061 */ 1062 /** 1063 * Voice message usage. 1064 * @syscap SystemCapability.Multimedia.Audio.Core 1065 * @atomicservice 1066 * @since 12 1067 */ 1068 STREAM_USAGE_VOICE_MESSAGE = 5, 1069 /** 1070 * Notification or ringtone usage. 1071 * @syscap SystemCapability.Multimedia.Audio.Core 1072 * @since 7 1073 * @deprecated since 10 1074 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_RINGTONE 1075 */ 1076 STREAM_USAGE_NOTIFICATION_RINGTONE = 6, 1077 /** 1078 * Ringtone usage. 1079 * @syscap SystemCapability.Multimedia.Audio.Core 1080 * @since 10 1081 */ 1082 /** 1083 * Ringtone usage. 1084 * @syscap SystemCapability.Multimedia.Audio.Core 1085 * @atomicservice 1086 * @since 12 1087 */ 1088 STREAM_USAGE_RINGTONE = 6, 1089 /** 1090 * Notification usage. 1091 * @syscap SystemCapability.Multimedia.Audio.Core 1092 * @since 10 1093 */ 1094 /** 1095 * Notification usage. 1096 * @syscap SystemCapability.Multimedia.Audio.Core 1097 * @atomicservice 1098 * @since 12 1099 */ 1100 STREAM_USAGE_NOTIFICATION = 7, 1101 /** 1102 * Accessibility usage, such as screen reader. 1103 * @syscap SystemCapability.Multimedia.Audio.Core 1104 * @since 10 1105 */ 1106 /** 1107 * Accessibility usage, such as screen reader. 1108 * @syscap SystemCapability.Multimedia.Audio.Core 1109 * @atomicservice 1110 * @since 12 1111 */ 1112 STREAM_USAGE_ACCESSIBILITY = 8, 1113 /** 1114 * System usage, such as screen lock or key click. 1115 * @syscap SystemCapability.Multimedia.Audio.Core 1116 * @systemapi 1117 * @since 10 1118 */ 1119 STREAM_USAGE_SYSTEM = 9, 1120 /** 1121 * Movie or video usage. 1122 * @syscap SystemCapability.Multimedia.Audio.Core 1123 * @since 10 1124 */ 1125 /** 1126 * Movie or video usage. 1127 * @syscap SystemCapability.Multimedia.Audio.Core 1128 * @atomicservice 1129 * @since 12 1130 */ 1131 STREAM_USAGE_MOVIE = 10, 1132 /** 1133 * Game sound effect usage. 1134 * @syscap SystemCapability.Multimedia.Audio.Core 1135 * @since 10 1136 */ 1137 /** 1138 * Game sound effect usage. 1139 * @syscap SystemCapability.Multimedia.Audio.Core 1140 * @atomicservice 1141 * @since 12 1142 */ 1143 STREAM_USAGE_GAME = 11, 1144 /** 1145 * Audiobook usage. 1146 * @syscap SystemCapability.Multimedia.Audio.Core 1147 * @since 10 1148 */ 1149 /** 1150 * Audiobook usage. 1151 * @syscap SystemCapability.Multimedia.Audio.Core 1152 * @atomicservice 1153 * @since 12 1154 */ 1155 STREAM_USAGE_AUDIOBOOK = 12, 1156 /** 1157 * Navigation usage. 1158 * @syscap SystemCapability.Multimedia.Audio.Core 1159 * @since 10 1160 */ 1161 /** 1162 * Navigation usage. 1163 * @syscap SystemCapability.Multimedia.Audio.Core 1164 * @atomicservice 1165 * @since 12 1166 */ 1167 STREAM_USAGE_NAVIGATION = 13, 1168 /** 1169 * DTMF dial tone usage. 1170 * @syscap SystemCapability.Multimedia.Audio.Core 1171 * @systemapi 1172 * @since 10 1173 */ 1174 STREAM_USAGE_DTMF = 14, 1175 /** 1176 * Enforced tone usage, such as camera shutter. 1177 * @syscap SystemCapability.Multimedia.Audio.Core 1178 * @systemapi 1179 * @since 10 1180 */ 1181 STREAM_USAGE_ENFORCED_TONE = 15, 1182 /** 1183 * Ultrasonic playing usage. This type is only used for msdp condition. 1184 * @syscap SystemCapability.Multimedia.Audio.Core 1185 * @systemapi 1186 * @since 10 1187 */ 1188 STREAM_USAGE_ULTRASONIC = 16, 1189 /** 1190 * Video call usage. 1191 * @syscap SystemCapability.Multimedia.Audio.Core 1192 * @atomicservice 1193 * @since 12 1194 */ 1195 STREAM_USAGE_VIDEO_COMMUNICATION = 17, 1196 } 1197 1198 /** 1199 * Enumerates the audio interrupt request type. 1200 * @enum { number } 1201 * @syscap SystemCapability.Multimedia.Audio.Interrupt 1202 * @systemapi 1203 * @since 9 1204 */ 1205 enum InterruptRequestType { 1206 /** 1207 * Default type to request audio interrupt. 1208 * @syscap SystemCapability.Multimedia.Audio.Interrupt 1209 * @systemapi 1210 * @since 9 1211 */ 1212 INTERRUPT_REQUEST_TYPE_DEFAULT = 0, 1213 } 1214 1215 /** 1216 * Enumerates volume related operations. 1217 * Flags should be powers of 2! 1218 * @enum { number } 1219 * @syscap SystemCapability.Multimedia.Audio.Volume 1220 * @systemapi 1221 * @since 12 1222 */ 1223 enum VolumeFlag { 1224 /** 1225 * Show system volume bar. 1226 * @syscap SystemCapability.Multimedia.Audio.Volume 1227 * @systemapi 1228 * @since 12 1229 */ 1230 FLAG_SHOW_SYSTEM_UI = 1, 1231 } 1232 1233 /** 1234 * Describes audio stream information. 1235 * @typedef AudioStreamInfo 1236 * @syscap SystemCapability.Multimedia.Audio.Core 1237 * @since 8 1238 */ 1239 interface AudioStreamInfo { 1240 /** 1241 * Sampling rate. 1242 * @syscap SystemCapability.Multimedia.Audio.Core 1243 * @since 8 1244 */ 1245 samplingRate: AudioSamplingRate; 1246 /** 1247 * Audio channels. 1248 * @syscap SystemCapability.Multimedia.Audio.Core 1249 * @since 8 1250 */ 1251 channels: AudioChannel; 1252 /** 1253 * Audio sample format. 1254 * @syscap SystemCapability.Multimedia.Audio.Core 1255 * @since 8 1256 */ 1257 sampleFormat: AudioSampleFormat; 1258 /** 1259 * Audio encoding type. 1260 * @syscap SystemCapability.Multimedia.Audio.Core 1261 * @since 8 1262 */ 1263 encodingType: AudioEncodingType; 1264 /** 1265 * Audio channel layout. 1266 * @type { ?AudioChannelLayout } 1267 * @syscap SystemCapability.Multimedia.Audio.Core 1268 * @since 11 1269 */ 1270 channelLayout?: AudioChannelLayout; 1271 } 1272 1273 /** 1274 * Describes audio renderer information. 1275 * @typedef AudioRendererInfo 1276 * @syscap SystemCapability.Multimedia.Audio.Core 1277 * @since 8 1278 */ 1279 /** 1280 * Describes audio renderer information. 1281 * @typedef AudioRendererInfo 1282 * @syscap SystemCapability.Multimedia.Audio.Core 1283 * @atomicservice 1284 * @since 12 1285 */ 1286 interface AudioRendererInfo { 1287 /** 1288 * Content type. 1289 * @type { ContentType } 1290 * @syscap SystemCapability.Multimedia.Audio.Core 1291 * @since 8 1292 * @deprecated since 10 1293 * @useinstead ohos.multimedia.audio.AudioRendererInfo#usage 1294 */ 1295 /** 1296 * Content type. 1297 * @type { ?ContentType } 1298 * @syscap SystemCapability.Multimedia.Audio.Core 1299 * @since 10 1300 */ 1301 content?: ContentType; 1302 /** 1303 * Stream usage. 1304 * @syscap SystemCapability.Multimedia.Audio.Core 1305 * @since 8 1306 */ 1307 /** 1308 * Stream usage. 1309 * @syscap SystemCapability.Multimedia.Audio.Core 1310 * @atomicservice 1311 * @since 12 1312 */ 1313 usage: StreamUsage; 1314 /** 1315 * Audio renderer flags. 1316 * @syscap SystemCapability.Multimedia.Audio.Core 1317 * @since 8 1318 */ 1319 /** 1320 * Audio renderer flags. 1321 * @syscap SystemCapability.Multimedia.Audio.Core 1322 * @atomicservice 1323 * @since 12 1324 */ 1325 rendererFlags: number; 1326 } 1327 1328 /** 1329 * Describes audio renderer filter. 1330 * @typedef AudioRendererFilter 1331 * @syscap SystemCapability.Multimedia.Audio.Core 1332 * @systemapi 1333 * @since 9 1334 */ 1335 interface AudioRendererFilter { 1336 /** 1337 * Application uid. 1338 * @syscap SystemCapability.Multimedia.Audio.Core 1339 * @systemapi 1340 * @since 9 1341 */ 1342 uid?: number; 1343 /** 1344 * Renderer information. 1345 * @syscap SystemCapability.Multimedia.Audio.Renderer 1346 * @systemapi 1347 * @since 9 1348 */ 1349 rendererInfo?: AudioRendererInfo; 1350 /** 1351 * AudioRenderer id. 1352 * @syscap SystemCapability.Multimedia.Audio.Renderer 1353 * @systemapi 1354 * @since 9 1355 */ 1356 rendererId?: number; 1357 } 1358 1359 /** 1360 * Describes audio renderer configuration options. 1361 * @typedef AudioRendererOptions 1362 * @syscap SystemCapability.Multimedia.Audio.Renderer 1363 * @since 8 1364 */ 1365 interface AudioRendererOptions { 1366 /** 1367 * Stream information. 1368 * @syscap SystemCapability.Multimedia.Audio.Renderer 1369 * @since 8 1370 */ 1371 streamInfo: AudioStreamInfo; 1372 /** 1373 * Renderer information. 1374 * @syscap SystemCapability.Multimedia.Audio.Renderer 1375 * @since 8 1376 */ 1377 rendererInfo: AudioRendererInfo; 1378 /** 1379 * Privacy configuration. 1380 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 1381 * @since 10 1382 */ 1383 privacyType?: AudioPrivacyType; 1384 } 1385 1386 /** 1387 * Enumerates audio stream privacy type for playback capture. 1388 * @enum { number } 1389 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 1390 * @since 10 1391 */ 1392 enum AudioPrivacyType { 1393 /** 1394 * Privacy type that stream can be captured by third party applications. 1395 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 1396 * @since 10 1397 */ 1398 PRIVACY_TYPE_PUBLIC = 0, 1399 1400 /** 1401 * Privacy type that stream can not be captured. 1402 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 1403 * @since 10 1404 */ 1405 PRIVACY_TYPE_PRIVATE = 1, 1406 } 1407 1408 /** 1409 * Enumerates the interrupt modes. 1410 * @enum { number } 1411 * @syscap SystemCapability.Multimedia.Audio.Interrupt 1412 * @since 9 1413 */ 1414 /** 1415 * Enumerates the interrupt modes. 1416 * @enum { number } 1417 * @syscap SystemCapability.Multimedia.Audio.Interrupt 1418 * @atomicservice 1419 * @since 12 1420 */ 1421 enum InterruptMode { 1422 /** 1423 * Mode that different stream share one interrupt unit. 1424 * @syscap SystemCapability.Multimedia.Audio.Interrupt 1425 * @since 9 1426 */ 1427 /** 1428 * Mode that different stream share one interrupt unit. 1429 * @syscap SystemCapability.Multimedia.Audio.Interrupt 1430 * @atomicservice 1431 * @since 12 1432 */ 1433 SHARE_MODE = 0, 1434 /** 1435 * Mode that each stream has independent interrupt unit. 1436 * @syscap SystemCapability.Multimedia.Audio.Interrupt 1437 * @since 9 1438 */ 1439 /** 1440 * Mode that each stream has independent interrupt unit. 1441 * @syscap SystemCapability.Multimedia.Audio.Interrupt 1442 * @atomicservice 1443 * @since 12 1444 */ 1445 INDEPENDENT_MODE = 1 1446 } 1447 1448 /** 1449 * Enumerates the audio renderer rates. 1450 * @enum { number } 1451 * @syscap SystemCapability.Multimedia.Audio.Renderer 1452 * @since 8 1453 */ 1454 enum AudioRendererRate { 1455 /** 1456 * Normal rate. 1457 * @syscap SystemCapability.Multimedia.Audio.Renderer 1458 * @since 8 1459 */ 1460 RENDER_RATE_NORMAL = 0, 1461 /** 1462 * Double rate. 1463 * @syscap SystemCapability.Multimedia.Audio.Renderer 1464 * @since 8 1465 */ 1466 RENDER_RATE_DOUBLE = 1, 1467 /** 1468 * Half rate. 1469 * @syscap SystemCapability.Multimedia.Audio.Renderer 1470 * @since 8 1471 */ 1472 RENDER_RATE_HALF = 2 1473 } 1474 1475 /** 1476 * Enumerates the interrupt types. 1477 * @enum { number } 1478 * @syscap SystemCapability.Multimedia.Audio.Renderer 1479 * @since 7 1480 */ 1481 /** 1482 * Enumerates the interrupt types. 1483 * @enum { number } 1484 * @syscap SystemCapability.Multimedia.Audio.Renderer 1485 * @atomicservice 1486 * @since 12 1487 */ 1488 enum InterruptType { 1489 /** 1490 * Audio playback interruption started. 1491 * @syscap SystemCapability.Multimedia.Audio.Renderer 1492 * @since 7 1493 */ 1494 /** 1495 * Audio playback interruption started. 1496 * @syscap SystemCapability.Multimedia.Audio.Renderer 1497 * @atomicservice 1498 * @since 12 1499 */ 1500 INTERRUPT_TYPE_BEGIN = 1, 1501 1502 /** 1503 * Audio playback interruption ended. 1504 * @syscap SystemCapability.Multimedia.Audio.Renderer 1505 * @since 7 1506 */ 1507 /** 1508 * Audio playback interruption ended. 1509 * @syscap SystemCapability.Multimedia.Audio.Renderer 1510 * @atomicservice 1511 * @since 12 1512 */ 1513 INTERRUPT_TYPE_END = 2 1514 } 1515 1516 /** 1517 * Enumerates the interrupt hints. 1518 * @enum { number } 1519 * @syscap SystemCapability.Multimedia.Audio.Renderer 1520 * @since 7 1521 */ 1522 /** 1523 * Enumerates the interrupt hints. 1524 * @enum { number } 1525 * @syscap SystemCapability.Multimedia.Audio.Renderer 1526 * @atomicservice 1527 * @since 12 1528 */ 1529 enum InterruptHint { 1530 /** 1531 * None. 1532 * @syscap SystemCapability.Multimedia.Audio.Renderer 1533 * @since 8 1534 */ 1535 /** 1536 * None. 1537 * @syscap SystemCapability.Multimedia.Audio.Renderer 1538 * @atomicservice 1539 * @since 12 1540 */ 1541 INTERRUPT_HINT_NONE = 0, 1542 /** 1543 * Resume the playback. 1544 * @syscap SystemCapability.Multimedia.Audio.Renderer 1545 * @since 7 1546 */ 1547 /** 1548 * Resume the playback. 1549 * @syscap SystemCapability.Multimedia.Audio.Renderer 1550 * @atomicservice 1551 * @since 12 1552 */ 1553 INTERRUPT_HINT_RESUME = 1, 1554 1555 /** 1556 * Paused/Pause the playback. 1557 * @syscap SystemCapability.Multimedia.Audio.Renderer 1558 * @since 7 1559 */ 1560 /** 1561 * Paused/Pause the playback. 1562 * @syscap SystemCapability.Multimedia.Audio.Renderer 1563 * @atomicservice 1564 * @since 12 1565 */ 1566 INTERRUPT_HINT_PAUSE = 2, 1567 1568 /** 1569 * Stopped/Stop the playback. 1570 * @syscap SystemCapability.Multimedia.Audio.Renderer 1571 * @since 7 1572 */ 1573 /** 1574 * Stopped/Stop the playback. 1575 * @syscap SystemCapability.Multimedia.Audio.Renderer 1576 * @atomicservice 1577 * @since 12 1578 */ 1579 INTERRUPT_HINT_STOP = 3, 1580 1581 /** 1582 * Ducked the playback. (In ducking, the audio volume is reduced, but not silenced.) 1583 * @syscap SystemCapability.Multimedia.Audio.Renderer 1584 * @since 7 1585 */ 1586 /** 1587 * Ducked the playback. (In ducking, the audio volume is reduced, but not silenced.) 1588 * @syscap SystemCapability.Multimedia.Audio.Renderer 1589 * @atomicservice 1590 * @since 12 1591 */ 1592 INTERRUPT_HINT_DUCK = 4, 1593 1594 /** 1595 * Unducked the playback. 1596 * @syscap SystemCapability.Multimedia.Audio.Renderer 1597 * @since 8 1598 */ 1599 /** 1600 * Unducked the playback. 1601 * @syscap SystemCapability.Multimedia.Audio.Renderer 1602 * @atomicservice 1603 * @since 12 1604 */ 1605 INTERRUPT_HINT_UNDUCK = 5, 1606 } 1607 1608 /** 1609 * Enumerates the interrupt force types. 1610 * @enum { number } 1611 * @syscap SystemCapability.Multimedia.Audio.Renderer 1612 * @since 9 1613 */ 1614 /** 1615 * Enumerates the interrupt force types. 1616 * @enum { number } 1617 * @syscap SystemCapability.Multimedia.Audio.Renderer 1618 * @atomicservice 1619 * @since 12 1620 */ 1621 enum InterruptForceType { 1622 /** 1623 * Forced action taken by system. 1624 * @syscap SystemCapability.Multimedia.Audio.Renderer 1625 * @since 9 1626 */ 1627 /** 1628 * Forced action taken by system. 1629 * @syscap SystemCapability.Multimedia.Audio.Renderer 1630 * @atomicservice 1631 * @since 12 1632 */ 1633 INTERRUPT_FORCE = 0, 1634 /** 1635 * Share type, application can choose to take action or ignore. 1636 * @syscap SystemCapability.Multimedia.Audio.Renderer 1637 * @since 9 1638 */ 1639 /** 1640 * Share type, application can choose to take action or ignore. 1641 * @syscap SystemCapability.Multimedia.Audio.Renderer 1642 * @atomicservice 1643 * @since 12 1644 */ 1645 INTERRUPT_SHARE = 1 1646 } 1647 1648 /** 1649 * Describes the interrupt event received by the app when playback is interrupted. 1650 * @typedef InterruptEvent 1651 * @syscap SystemCapability.Multimedia.Audio.Renderer 1652 * @since 9 1653 */ 1654 /** 1655 * Describes the interrupt event received by the app when playback is interrupted. 1656 * @typedef InterruptEvent 1657 * @syscap SystemCapability.Multimedia.Audio.Renderer 1658 * @atomicservice 1659 * @since 12 1660 */ 1661 interface InterruptEvent { 1662 /** 1663 * Indicates whether the interruption has started or finished. 1664 * @syscap SystemCapability.Multimedia.Audio.Renderer 1665 * @since 9 1666 */ 1667 /** 1668 * Indicates whether the interruption has started or finished. 1669 * @syscap SystemCapability.Multimedia.Audio.Renderer 1670 * @atomicservice 1671 * @since 12 1672 */ 1673 eventType: InterruptType; 1674 1675 /** 1676 * Indicates whether the action is taken by system or to be taken by the app. 1677 * @syscap SystemCapability.Multimedia.Audio.Renderer 1678 * @since 9 1679 */ 1680 /** 1681 * Indicates whether the action is taken by system or to be taken by the app. 1682 * @syscap SystemCapability.Multimedia.Audio.Renderer 1683 * @atomicservice 1684 * @since 12 1685 */ 1686 forceType: InterruptForceType; 1687 1688 /** 1689 * Indicates the kind of action. 1690 * @syscap SystemCapability.Multimedia.Audio.Renderer 1691 * @since 9 1692 */ 1693 /** 1694 * Indicates the kind of action. 1695 * @syscap SystemCapability.Multimedia.Audio.Renderer 1696 * @atomicservice 1697 * @since 12 1698 */ 1699 hintType: InterruptHint; 1700 } 1701 1702 /** 1703 * Enumerates interrupt action types. 1704 * @enum { number } 1705 * @syscap SystemCapability.Multimedia.Audio.Renderer 1706 * @since 7 1707 * @deprecated since 9 1708 */ 1709 enum InterruptActionType { 1710 1711 /** 1712 * Focus gain event. 1713 * @syscap SystemCapability.Multimedia.Audio.Renderer 1714 * @since 7 1715 * @deprecated since 9 1716 */ 1717 TYPE_ACTIVATED = 0, 1718 1719 /** 1720 * Audio interruption event. 1721 * @syscap SystemCapability.Multimedia.Audio.Renderer 1722 * @since 7 1723 * @deprecated since 9 1724 */ 1725 TYPE_INTERRUPT = 1 1726 } 1727 1728 /** 1729 * Enumerates device change types. 1730 * @enum { number } 1731 * @syscap SystemCapability.Multimedia.Audio.Device 1732 * @since 7 1733 */ 1734 enum DeviceChangeType { 1735 /** 1736 * Device connection. 1737 * @syscap SystemCapability.Multimedia.Audio.Device 1738 * @since 7 1739 */ 1740 CONNECT = 0, 1741 1742 /** 1743 * Device disconnection. 1744 * @syscap SystemCapability.Multimedia.Audio.Device 1745 * @since 7 1746 */ 1747 DISCONNECT = 1, 1748 } 1749 1750 /** 1751 * Enumerates audio scenes. 1752 * @enum { number } 1753 * @syscap SystemCapability.Multimedia.Audio.Communication 1754 * @since 8 1755 */ 1756 enum AudioScene { 1757 /** 1758 * Default audio scene 1759 * @syscap SystemCapability.Multimedia.Audio.Communication 1760 * @since 8 1761 */ 1762 AUDIO_SCENE_DEFAULT = 0, 1763 /** 1764 * Ringing audio scene 1765 * @syscap SystemCapability.Multimedia.Audio.Communication 1766 * @systemapi 1767 * @since 8 1768 */ 1769 AUDIO_SCENE_RINGING = 1, 1770 /** 1771 * Phone call audio scene 1772 * @syscap SystemCapability.Multimedia.Audio.Communication 1773 * @systemapi 1774 * @since 8 1775 */ 1776 AUDIO_SCENE_PHONE_CALL = 2, 1777 /** 1778 * Voice chat audio scene 1779 * @syscap SystemCapability.Multimedia.Audio.Communication 1780 * @since 8 1781 */ 1782 AUDIO_SCENE_VOICE_CHAT = 3 1783 } 1784 1785 /** 1786 * Enumerates volume adjustment types. 1787 * @enum { number } 1788 * @syscap SystemCapability.Multimedia.Audio.Volume 1789 * @systemapi 1790 * @since 10 1791 */ 1792 enum VolumeAdjustType { 1793 /** 1794 * Adjust volume up. 1795 * @syscap SystemCapability.Multimedia.Audio.Volume 1796 * @systemapi 1797 * @since 10 1798 */ 1799 VOLUME_UP = 0, 1800 /** 1801 * Adjust volume down. 1802 * @syscap SystemCapability.Multimedia.Audio.Volume 1803 * @systemapi 1804 * @since 10 1805 */ 1806 VOLUME_DOWN = 1, 1807 } 1808 1809 /** 1810 * Implements audio volume and audio device management. 1811 * @typedef AudioManager 1812 * @syscap SystemCapability.Multimedia.Audio.Core 1813 * @since 7 1814 */ 1815 interface AudioManager { 1816 /** 1817 * Sets the volume for a stream. This method uses an asynchronous callback to return the result. 1818 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 1819 * @param { AudioVolumeType } volumeType - Audio stream type. 1820 * @param { number } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. 1821 * @param { AsyncCallback<void> } callback - Callback used to return the result. 1822 * @syscap SystemCapability.Multimedia.Audio.Volume 1823 * @since 7 1824 * @deprecated since 9 1825 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setVolume 1826 */ 1827 setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback<void>): void; 1828 /** 1829 * Sets the volume for a stream. This method uses a promise to return the result. 1830 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 1831 * @param { AudioVolumeType } volumeType - Audio stream type. 1832 * @param { number } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. 1833 * @returns { Promise<void> } Promise used to return the result. 1834 * @syscap SystemCapability.Multimedia.Audio.Volume 1835 * @since 7 1836 * @deprecated since 9 1837 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setVolume 1838 */ 1839 setVolume(volumeType: AudioVolumeType, volume: number): Promise<void>; 1840 /** 1841 * Obtains the volume of a stream. This method uses an asynchronous callback to return the query result. 1842 * @param { AudioVolumeType } volumeType - Audio stream type. 1843 * @param { AsyncCallback<number> } callback - Callback used to return the volume. 1844 * @syscap SystemCapability.Multimedia.Audio.Volume 1845 * @since 7 1846 * @deprecated since 9 1847 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getVolume 1848 */ 1849 getVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void; 1850 /** 1851 * Obtains the volume of a stream. This method uses a promise to return the query result. 1852 * @param { AudioVolumeType } volumeType - Audio stream type. 1853 * @returns { Promise<number> } Promise used to return the volume. 1854 * @syscap SystemCapability.Multimedia.Audio.Volume 1855 * @since 7 1856 * @deprecated since 9 1857 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getVolume 1858 */ 1859 getVolume(volumeType: AudioVolumeType): Promise<number>; 1860 /** 1861 * Obtains the minimum volume allowed for a stream. This method uses an asynchronous callback to return the query result. 1862 * @param { AudioVolumeType } volumeType - Audio stream type. 1863 * @param { AsyncCallback<number> } callback - Callback used to return the minimum volume. 1864 * @syscap SystemCapability.Multimedia.Audio.Volume 1865 * @since 7 1866 * @deprecated since 9 1867 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMinVolume 1868 */ 1869 getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void; 1870 /** 1871 * Obtains the minimum volume allowed for a stream. This method uses a promise to return the query result. 1872 * @param { AudioVolumeType } volumeType - Audio stream type. 1873 * @returns { Promise<number> } Promise used to return the minimum volume. 1874 * @syscap SystemCapability.Multimedia.Audio.Volume 1875 * @since 7 1876 * @deprecated since 9 1877 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMinVolume 1878 */ 1879 getMinVolume(volumeType: AudioVolumeType): Promise<number>; 1880 /** 1881 * Obtains the maximum volume allowed for a stream. This method uses an asynchronous callback to return the query result. 1882 * @param { AudioVolumeType } volumeType - Audio stream type. 1883 * @param { AsyncCallback<number> } callback - Callback used to return the maximum volume. 1884 * @syscap SystemCapability.Multimedia.Audio.Volume 1885 * @since 7 1886 * @deprecated since 9 1887 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMaxVolume 1888 */ 1889 getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void; 1890 /** 1891 * Obtains the maximum volume allowed for a stream. This method uses a promise to return the query result. 1892 * @param { AudioVolumeType } volumeType - Audio stream type. 1893 * @returns { Promise<number> } Promise used to return the maximum volume. 1894 * @syscap SystemCapability.Multimedia.Audio.Volume 1895 * @since 7 1896 * @deprecated since 9 1897 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMaxVolume 1898 */ 1899 getMaxVolume(volumeType: AudioVolumeType): Promise<number>; 1900 /** 1901 * Obtains the audio devices with a specific flag. This method uses an asynchronous callback to return the query result. 1902 * @param { DeviceFlag } deviceFlag - Audio device flag. 1903 * @param { AsyncCallback<AudioDeviceDescriptors> } callback - Callback used to return the device list. 1904 * @syscap SystemCapability.Multimedia.Audio.Device 1905 * @since 7 1906 * @deprecated since 9 1907 * @useinstead ohos.multimedia.audio.AudioRoutingManager#getDevices 1908 */ 1909 getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescriptors>): void; 1910 /** 1911 * Obtains the audio devices with a specific flag. This method uses a promise to return the query result. 1912 * @param { DeviceFlag } deviceFlag - Audio device flag. 1913 * @returns { Promise<AudioDeviceDescriptors> } Promise used to return the device list. 1914 * @syscap SystemCapability.Multimedia.Audio.Device 1915 * @since 7 1916 * @deprecated since 9 1917 * @useinstead ohos.multimedia.audio.AudioRoutingManager#getDevices 1918 */ 1919 getDevices(deviceFlag: DeviceFlag): Promise<AudioDeviceDescriptors>; 1920 /** 1921 * Mutes a stream. This method uses an asynchronous callback to return the result. 1922 * @param { AudioVolumeType } volumeType - Audio stream type. 1923 * @param { boolean } mute - Mute status to set. The value true means to mute the stream, and false means the opposite. 1924 * @param { AsyncCallback<void> } callback - Callback used to return the result. 1925 * @syscap SystemCapability.Multimedia.Audio.Volume 1926 * @since 7 1927 * @deprecated since 9 1928 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#mute 1929 */ 1930 mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback<void>): void; 1931 /** 1932 * Mutes a stream. This method uses a promise to return the result. 1933 * @param { AudioVolumeType } volumeType - Audio stream type. 1934 * @param { boolean } mute - Mute status to set. The value true means to mute the stream, and false means the opposite. 1935 * @returns { Promise<void> } Promise used to return the result. 1936 * @syscap SystemCapability.Multimedia.Audio.Volume 1937 * @since 7 1938 * @deprecated since 9 1939 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#mute 1940 */ 1941 mute(volumeType: AudioVolumeType, mute: boolean): Promise<void>; 1942 /** 1943 * Checks whether a stream is muted. This method uses an asynchronous callback to return the query result. 1944 * @param { AudioVolumeType } volumeType - Audio stream type. 1945 * @param { AsyncCallback<boolean> } callback - Callback used to return the mute status of the stream. 1946 * The value true means that the stream is muted, and false means the opposite. 1947 * @syscap SystemCapability.Multimedia.Audio.Volume 1948 * @since 7 1949 * @deprecated since 9 1950 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMute 1951 */ 1952 isMute(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): void; 1953 /** 1954 * Checks whether a stream is muted. This method uses a promise to return the result. 1955 * @param { AudioVolumeType } volumeType - Audio stream type. 1956 * @returns { Promise<boolean> } Promise used to return the mute status of the stream. The value true means 1957 * that the stream is muted, and false means the opposite. 1958 * @syscap SystemCapability.Multimedia.Audio.Volume 1959 * @since 7 1960 * @deprecated since 9 1961 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMute 1962 */ 1963 isMute(volumeType: AudioVolumeType): Promise<boolean>; 1964 /** 1965 * Checks whether a stream is active. This method uses an asynchronous callback to return the query result. 1966 * @param { AudioVolumeType } volumeType - Audio stream type. 1967 * @param { AsyncCallback<boolean> } callback - Callback used to return the active status of the stream. 1968 * The value true means that the stream is active, and false means the opposite. 1969 * @syscap SystemCapability.Multimedia.Audio.Volume 1970 * @since 7 1971 * @deprecated since 9 1972 * @useinstead ohos.multimedia.audio.AudioStreamManager#isActive 1973 */ 1974 isActive(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): void; 1975 /** 1976 * Checks whether a stream is active. This method uses a promise to return the query result. 1977 * @param { AudioVolumeType } volumeType - Audio stream type. 1978 * @returns { Promise<boolean> } Promise used to return the active status of the stream. The value true means 1979 * that the stream is active, and false means the opposite. 1980 * @syscap SystemCapability.Multimedia.Audio.Volume 1981 * @since 7 1982 * @deprecated since 9 1983 * @useinstead ohos.multimedia.audio.AudioStreamManager#isActive 1984 */ 1985 isActive(volumeType: AudioVolumeType): Promise<boolean>; 1986 /** 1987 * Mutes or unmutes the microphone. This method uses an asynchronous callback to return the result. 1988 * @permission ohos.permission.MICROPHONE 1989 * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. 1990 * @param { AsyncCallback<void> } callback - Callback used to return the result. 1991 * @syscap SystemCapability.Multimedia.Audio.Device 1992 * @since 7 1993 * @deprecated since 9 1994 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicrophoneMute 1995 */ 1996 setMicrophoneMute(mute: boolean, callback: AsyncCallback<void>): void; 1997 /** 1998 * Mutes or unmutes the microphone. This method uses a promise to return the result. 1999 * @permission ohos.permission.MICROPHONE 2000 * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. 2001 * @returns { Promise<void> } Promise used to return the result. 2002 * @syscap SystemCapability.Multimedia.Audio.Device 2003 * @since 7 2004 * @deprecated since 9 2005 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicrophoneMute 2006 */ 2007 setMicrophoneMute(mute: boolean): Promise<void>; 2008 /** 2009 * Checks whether the microphone is muted. This method uses an asynchronous callback to return the query result. 2010 * @permission ohos.permission.MICROPHONE 2011 * @param { AsyncCallback<boolean> } callback - used to return the mute status of the microphone. The value 2012 * true means that the microphone is muted, and false means the opposite. 2013 * @syscap SystemCapability.Multimedia.Audio.Device 2014 * @since 7 2015 * @deprecated since 9 2016 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMicrophoneMute 2017 */ 2018 isMicrophoneMute(callback: AsyncCallback<boolean>): void; 2019 /** 2020 * Checks whether the microphone is muted. This method uses a promise to return the query result. 2021 * @permission ohos.permission.MICROPHONE 2022 * @returns { Promise<boolean> } Promise used to return the mute status of the microphone. The value 2023 * true means that the microphone is muted, and false means the opposite. 2024 * @syscap SystemCapability.Multimedia.Audio.Device 2025 * @since 7 2026 * @deprecated since 9 2027 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMicrophoneMute 2028 */ 2029 isMicrophoneMute(): Promise<boolean>; 2030 /** 2031 * Sets the ringer mode. This method uses an asynchronous callback to return the result. 2032 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 2033 * @param { AudioRingMode } mode - Ringer mode. 2034 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2035 * @syscap SystemCapability.Multimedia.Audio.Communication 2036 * @since 7 2037 * @deprecated since 9 2038 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setRingerMode 2039 */ 2040 setRingerMode(mode: AudioRingMode, callback: AsyncCallback<void>): void; 2041 /** 2042 * Sets the ringer mode. This method uses a promise to return the result. 2043 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 2044 * @param { AudioRingMode } mode - Ringer mode. 2045 * @returns { Promise<void> } Promise used to return the result. 2046 * @syscap SystemCapability.Multimedia.Audio.Communication 2047 * @since 7 2048 * @deprecated since 9 2049 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setRingerMode 2050 */ 2051 setRingerMode(mode: AudioRingMode): Promise<void>; 2052 /** 2053 * Obtains the ringer mode. This method uses an asynchronous callback to return the query result. 2054 * @param { AsyncCallback<AudioRingMode> } callback - Callback used to return the ringer mode. 2055 * @syscap SystemCapability.Multimedia.Audio.Communication 2056 * @since 7 2057 * @deprecated since 9 2058 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getRingerMode 2059 */ 2060 getRingerMode(callback: AsyncCallback<AudioRingMode>): void; 2061 /** 2062 * Obtains the ringer mode. This method uses a promise to return the query result. 2063 * @returns { Promise<AudioRingMode> } Promise used to return the ringer mode. 2064 * @syscap SystemCapability.Multimedia.Audio.Communication 2065 * @since 7 2066 * @deprecated since 9 2067 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getRingerMode 2068 */ 2069 getRingerMode(): Promise<AudioRingMode>; 2070 /** 2071 * Sets an audio parameter. This method uses an asynchronous callback to return the result. 2072 * @permission ohos.permission.MODIFY_AUDIO_SETTINGS 2073 * @param { string } key - Key of the audio parameter to set. 2074 * @param { string } value - Value of the audio parameter to set. 2075 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2076 * @syscap SystemCapability.Multimedia.Audio.Core 2077 * @since 7 2078 * @deprecated since 11 2079 * @useinstead ohos.multimedia.audio.AudioManager#setExtraParameters 2080 */ 2081 setAudioParameter(key: string, value: string, callback: AsyncCallback<void>): void; 2082 /** 2083 * Sets an audio parameter. This method uses a promise to return the result. 2084 * @permission ohos.permission.MODIFY_AUDIO_SETTINGS 2085 * @param { string } key - Key of the audio parameter to set. 2086 * @param { string } value - Value of the audio parameter to set. 2087 * @returns { Promise<void> } Promise used to return the result. 2088 * @syscap SystemCapability.Multimedia.Audio.Core 2089 * @since 7 2090 * @deprecated since 11 2091 * @useinstead ohos.multimedia.audio.AudioManager#setExtraParameters 2092 */ 2093 setAudioParameter(key: string, value: string): Promise<void>; 2094 2095 /** 2096 * Obtains the value of an audio parameter. This method uses an asynchronous callback to return the query result. 2097 * @param { string } key - Key of the audio parameter whose value is to be obtained. 2098 * @param { AsyncCallback<string> } callback - Callback used to return the value of the audio parameter. 2099 * @syscap SystemCapability.Multimedia.Audio.Core 2100 * @since 7 2101 * @deprecated since 11 2102 * @useinstead ohos.multimedia.audio.AudioManager#getExtraParameters 2103 */ 2104 getAudioParameter(key: string, callback: AsyncCallback<string>): void; 2105 /** 2106 * Obtains the value of an audio parameter. This method uses a promise to return the query result. 2107 * @param { string } key - Key of the audio parameter whose value is to be obtained. 2108 * @returns { Promise<string> } Promise used to return the value of the audio parameter. 2109 * @syscap SystemCapability.Multimedia.Audio.Core 2110 * @since 7 2111 * @deprecated since 11 2112 * @useinstead ohos.multimedia.audio.AudioManager#getExtraParameters 2113 */ 2114 getAudioParameter(key: string): Promise<string>; 2115 2116 /** 2117 * Sets extra audio parameters. This method uses a promise to return the result. 2118 * @permission ohos.permission.MODIFY_AUDIO_SETTINGS 2119 * @param { string } mainKey - Main key of the audio parameters to set. 2120 * @param { Record<string, string> } kvpairs - Key-value pairs with subkeys and values to set. 2121 * @returns { Promise<void> } Promise used to return the result. 2122 * @throws { BusinessError } 201 - Permission denied. 2123 * @throws { BusinessError } 202 - Not system App. 2124 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2125 * 1.Mandatory parameters are left unspecified; 2126 * 2.Incorrect parameter types. 2127 * @throws { BusinessError } 6800101 - Parameter verification failed. 2128 * @syscap SystemCapability.Multimedia.Audio.Core 2129 * @systemapi 2130 * @since 11 2131 */ 2132 setExtraParameters(mainKey: string, kvpairs: Record<string, string>): Promise<void>; 2133 2134 /** 2135 * Obtains the values of a certain key. This method uses a promise to return the query result. 2136 * @param { string } mainKey - Main key of the audio parameters to get. 2137 * @param { Array<string> } subKeys - Sub keys of the audio parameters to get. 2138 * @returns { Promise<Record<string, string>> } Promise used to return the key-value pairs. 2139 * @throws { BusinessError } 202 - Not system App. 2140 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2141 * 1.Mandatory parameters are left unspecified; 2142 * 2.Incorrect parameter types. 2143 * @throws { BusinessError } 6800101 - Parameter verification failed. 2144 * @syscap SystemCapability.Multimedia.Audio.Core 2145 * @systemapi 2146 * @since 11 2147 */ 2148 getExtraParameters(mainKey: string, subKeys?: Array<string>): Promise<Record<string, string>>; 2149 2150 /** 2151 * Sets a device to the active state. This method uses an asynchronous callback to return the result. 2152 * @param { ActiveDeviceType } deviceType - Audio device type. 2153 * @param { boolean } active - Active status to set. The value true means to set the device to the active 2154 * status, and false means the opposite. 2155 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2156 * @syscap SystemCapability.Multimedia.Audio.Device 2157 * @since 7 2158 * @deprecated since 9 2159 * @useinstead ohos.multimedia.audio.AudioRoutingManager#setCommunicationDevice 2160 */ 2161 setDeviceActive(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback<void>): void; 2162 /** 2163 * Sets a device to the active state. This method uses a promise to return the result. 2164 * @param { ActiveDeviceType } deviceType - Audio device type. 2165 * @param { boolean } active - Active status to set. The value true means to set the device to the active 2166 * status, and false means the opposite. 2167 * @returns { Promise<void> } Promise used to return the result. 2168 * @syscap SystemCapability.Multimedia.Audio.Device 2169 * @since 7 2170 * @deprecated since 9 2171 * @useinstead ohos.multimedia.audio.AudioRoutingManager#setCommunicationDevice 2172 */ 2173 setDeviceActive(deviceType: ActiveDeviceType, active: boolean): Promise<void>; 2174 /** 2175 * Checks whether a device is active. This method uses an asynchronous callback to return the query result. 2176 * @param { ActiveDeviceType } deviceType - Audio device type. 2177 * @param { AsyncCallback<boolean> } callback - Callback used to return the active status of the device. 2178 * @syscap SystemCapability.Multimedia.Audio.Device 2179 * @since 7 2180 * @deprecated since 9 2181 * @useinstead ohos.multimedia.audio.AudioRoutingManager#isCommunicationDeviceActive 2182 */ 2183 isDeviceActive(deviceType: ActiveDeviceType, callback: AsyncCallback<boolean>): void; 2184 /** 2185 * Checks whether a device is active. This method uses a promise to return the query result. 2186 * @param { ActiveDeviceType } deviceType - Audio device type. 2187 * @returns { Promise<boolean> } Promise used to return the active status of the device. 2188 * @syscap SystemCapability.Multimedia.Audio.Device 2189 * @since 7 2190 * @deprecated since 9 2191 * @useinstead ohos.multimedia.audio.AudioRoutingManager#isCommunicationDeviceActive 2192 */ 2193 isDeviceActive(deviceType: ActiveDeviceType): Promise<boolean>; 2194 /** 2195 * Listens for system volume change events. This method uses a callback to get volume change events. 2196 * @param { 'volumeChange' } type - Type of the event to listen for. Only the volumeChange event is supported. 2197 * @param { Callback<VolumeEvent> } callback - Callback used to get the system volume change event. 2198 * @syscap SystemCapability.Multimedia.Audio.Volume 2199 * @systemapi 2200 * @since 8 2201 * @deprecated since 9 2202 * @useinstead ohos.multimedia.audio.AudioVolumeManager#event:volumeChange 2203 */ 2204 on(type: 'volumeChange', callback: Callback<VolumeEvent>): void; 2205 /** 2206 * Listens for ringer mode change events. This method uses a callback to get ringer mode changes. 2207 * @param { 'ringerModeChange' } type - Type of the event to listen for. Only the ringerModeChange event is supported. 2208 * @param { Callback<AudioRingMode> } callback - Callback used to get the updated ringer mode. 2209 * @syscap SystemCapability.Multimedia.Audio.Communication 2210 * @systemapi 2211 * @since 8 2212 * @deprecated since 9 2213 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#event:ringerModeChange 2214 */ 2215 on(type: 'ringerModeChange', callback: Callback<AudioRingMode>): void; 2216 /** 2217 * Sets the audio scene mode to change audio strategies. This method uses an asynchronous callback to return the 2218 * result. 2219 * @param { AudioScene } scene - Audio scene mode. 2220 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2221 * @syscap SystemCapability.Multimedia.Audio.Communication 2222 * @systemapi 2223 * @since 8 2224 */ 2225 setAudioScene(scene: AudioScene, callback: AsyncCallback<void>): void; 2226 /** 2227 * Sets the audio scene mode to change audio strategies. This method uses a promise to return the result. 2228 * @param { AudioScene } scene - Audio scene mode. 2229 * @returns { Promise<void> } Promise used to return the result. 2230 * @syscap SystemCapability.Multimedia.Audio.Communication 2231 * @systemapi 2232 * @since 8 2233 */ 2234 setAudioScene(scene: AudioScene): Promise<void>; 2235 /** 2236 * Obtains the audio scene mode. This method uses an asynchronous callback to return the query result. 2237 * @param { AsyncCallback<AudioScene> } callback - Callback used to return the audio scene mode. 2238 * @syscap SystemCapability.Multimedia.Audio.Communication 2239 * @since 8 2240 */ 2241 getAudioScene(callback: AsyncCallback<AudioScene>): void; 2242 /** 2243 * Obtains the audio scene mode. This method uses a promise to return the query result. 2244 * @returns { Promise<AudioScene> } Promise used to return the audio scene mode. 2245 * @syscap SystemCapability.Multimedia.Audio.Communication 2246 * @since 8 2247 */ 2248 getAudioScene(): Promise<AudioScene>; 2249 /** 2250 * Obtains the audio scene mode. 2251 * @returns { AudioScene } Current audio scene mode. 2252 * @syscap SystemCapability.Multimedia.Audio.Communication 2253 * @since 10 2254 */ 2255 getAudioSceneSync(): AudioScene; 2256 2257 /** 2258 * Subscribes to device change events. When a device is connected/disconnected, registered clients will receive 2259 * the callback. 2260 * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. 2261 * @param { Callback<DeviceChangeAction> } callback - Callback used to obtain the device update details. 2262 * @syscap SystemCapability.Multimedia.Audio.Device 2263 * @since 7 2264 * @deprecated since 9 2265 * @useinstead ohos.multimedia.audio.AudioRoutingManager#event:deviceChange 2266 */ 2267 on(type: 'deviceChange', callback: Callback<DeviceChangeAction>): void; 2268 2269 /** 2270 * UnSubscribes to device change events. 2271 * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. 2272 * @param { Callback<DeviceChangeAction> } callback - Callback used to obtain the device update details. 2273 * @syscap SystemCapability.Multimedia.Audio.Device 2274 * @since 7 2275 * @deprecated since 9 2276 * @useinstead ohos.multimedia.audio.AudioRoutingManager#event:deviceChange 2277 */ 2278 off(type: 'deviceChange', callback?: Callback<DeviceChangeAction>): void; 2279 2280 /** 2281 * Listens for audio interruption events. When the audio of an application is interrupted by another application, 2282 * the callback is invoked to notify the former application. 2283 * @param { 'interrupt' } type - Type of the event to listen for. Only the interrupt event is supported. 2284 * @param { AudioInterrupt } interrupt - Parameters of the audio interruption event type. 2285 * @param { Callback<InterruptAction> } callback - Callback invoked for the audio interruption event. 2286 * @syscap SystemCapability.Multimedia.Audio.Renderer 2287 * @since 7 2288 * @deprecated since 11 2289 * @useinstead ohos.multimedia.audio.AudioRenderer#event:audioInterrupt 2290 */ 2291 on(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback<InterruptAction>): void; 2292 2293 /** 2294 * Cancels the listening of audio interruption events. 2295 * @param { 'interrupt' } type - Type of the event to listen for. Only the interrupt event is supported. 2296 * @param { AudioInterrupt } interrupt - Input parameters of the audio interruption event. 2297 * @param { Callback<InterruptAction> } callback - Callback invoked for the audio interruption event. 2298 * @syscap SystemCapability.Multimedia.Audio.Renderer 2299 * @since 7 2300 * @deprecated since 11 2301 * @useinstead ohos.multimedia.audio.AudioRenderer#event:audioInterrupt 2302 */ 2303 off(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback<InterruptAction>): void; 2304 2305 /** 2306 * Obtains an {@link AudioVolumeManager} instance. 2307 * @returns { AudioVolumeManager } AudioVolumeManager instance. 2308 * @syscap SystemCapability.Multimedia.Audio.Volume 2309 * @since 9 2310 */ 2311 getVolumeManager(): AudioVolumeManager; 2312 2313 /** 2314 * Obtains an {@link AudioStreamManager} instance. 2315 * @returns { AudioStreamManager } AudioStreamManager instance. 2316 * @syscap SystemCapability.Multimedia.Audio.Core 2317 * @since 9 2318 */ 2319 getStreamManager(): AudioStreamManager; 2320 2321 /** 2322 * Obtains an {@link AudioRoutingManager} instance. 2323 * @returns { AudioRoutingManager } AudioRoutingManager instance. 2324 * @syscap SystemCapability.Multimedia.Audio.Device 2325 * @since 9 2326 */ 2327 getRoutingManager(): AudioRoutingManager; 2328 2329 /** 2330 * Obtains an {@link AudioSpatializationManager} instance. 2331 * @returns { AudioSpatializationManager } AudioSpatializationManager instance. 2332 * @throws { BusinessError } 202 - Not system App. 2333 * @syscap SystemCapability.Multimedia.Audio.Spatialization 2334 * @systemapi 2335 * @since 11 2336 */ 2337 getSpatializationManager(): AudioSpatializationManager; 2338 2339 /** 2340 * user disable the safe media volume state. 2341 * @permission ohos.permission.MODIFY_AUDIO_SETTINGS 2342 * @returns {Promise<void>} Promise used to return the result. 2343 * @throws {BusinessError} 201 - Permission denied. 2344 * @throws {BusinessError} 202 - Not system App. 2345 * @syscap SystemCapability.Multimedia.Audio.Core 2346 * @systemapi 2347 * @since 12 2348 */ 2349 disableSafeMediaVolume(): Promise<void>; 2350 } 2351 2352 /** 2353 * Enumerates audio interrupt request result type. 2354 * @enum { number } 2355 * @syscap SystemCapability.Multimedia.Audio.Interrupt 2356 * @systemapi 2357 * @since 9 2358 */ 2359 enum InterruptRequestResultType { 2360 /** 2361 * Request audio interrupt success 2362 * @syscap SystemCapability.Multimedia.Audio.Interrupt 2363 * @systemapi 2364 * @since 9 2365 */ 2366 INTERRUPT_REQUEST_GRANT = 0, 2367 /** 2368 * Request audio interrupt fail, may have higher priority type 2369 * @syscap SystemCapability.Multimedia.Audio.Interrupt 2370 * @systemapi 2371 * @since 9 2372 */ 2373 INTERRUPT_REQUEST_REJECT = 1 2374 } 2375 2376 /** 2377 * Describes audio interrupt operation results. 2378 * @typedef InterruptResult 2379 * @syscap SystemCapability.Multimedia.Audio.Interrupt 2380 * @systemapi 2381 * @since 9 2382 */ 2383 interface InterruptResult { 2384 /** 2385 * Interrupt request or abandon result. 2386 * @syscap SystemCapability.Multimedia.Audio.Interrupt 2387 * @systemapi 2388 * @since 9 2389 */ 2390 requestResult: InterruptRequestResultType; 2391 /** 2392 * Interrupt node as a unit to receive interrupt change event. 2393 * @syscap SystemCapability.Multimedia.Audio.Interrupt 2394 * @systemapi 2395 * @since 9 2396 */ 2397 interruptNode: number; 2398 } 2399 2400 /** 2401 * Implements audio router management. 2402 * @typedef AudioRoutingManager 2403 * @syscap SystemCapability.Multimedia.Audio.Device 2404 * @since 9 2405 */ 2406 interface AudioRoutingManager { 2407 /** 2408 * Obtains the audio devices with a specific flag. This method uses an asynchronous callback to return the query result. 2409 * @param { DeviceFlag } deviceFlag - Audio device flag. 2410 * @param { AsyncCallback<AudioDeviceDescriptors> } callback - Callback used to return the device list. 2411 * @syscap SystemCapability.Multimedia.Audio.Device 2412 * @since 9 2413 */ 2414 getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescriptors>): void; 2415 /** 2416 * Obtains the audio devices with a specific flag. This method uses a promise to return the query result. 2417 * @param { DeviceFlag } deviceFlag - Audio device flag. 2418 * @returns { Promise<AudioDeviceDescriptors> } Promise used to return the device list. 2419 * @syscap SystemCapability.Multimedia.Audio.Device 2420 * @since 9 2421 */ 2422 getDevices(deviceFlag: DeviceFlag): Promise<AudioDeviceDescriptors>; 2423 /** 2424 * Obtains the audio devices with a specific flag. 2425 * @param { DeviceFlag } deviceFlag - Audio device flag. 2426 * @returns { AudioDeviceDescriptors } The device list. 2427 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2428 * 1.Mandatory parameters are left unspecified; 2429 * 2.Incorrect parameter types. 2430 * @throws { BusinessError } 6800101 - Parameter verification failed. 2431 * @syscap SystemCapability.Multimedia.Audio.Device 2432 * @since 10 2433 */ 2434 getDevicesSync(deviceFlag: DeviceFlag): AudioDeviceDescriptors; 2435 2436 /** 2437 * Subscribes to device change events. When a device is connected/disconnected, registered clients will receive 2438 * the callback. 2439 * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. 2440 * @param { DeviceFlag } deviceFlag - Audio device flag. 2441 * @param { Callback<DeviceChangeAction> } callback - Callback used to obtain the device update details. 2442 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2443 * 1.Mandatory parameters are left unspecified; 2444 * 2.Incorrect parameter types. 2445 * @throws { BusinessError } 6800101 - Parameter verification failed. 2446 * @syscap SystemCapability.Multimedia.Audio.Device 2447 * @since 9 2448 */ 2449 on(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback<DeviceChangeAction>): void; 2450 2451 /** 2452 * UnSubscribes to device change events. 2453 * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. 2454 * @param { Callback<DeviceChangeAction> } callback - Callback used to obtain the device update details. 2455 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2456 * 1.Mandatory parameters are left unspecified; 2457 * 2.Incorrect parameter types. 2458 * @throws { BusinessError } 6800101 - Parameter verification failed. 2459 * @syscap SystemCapability.Multimedia.Audio.Device 2460 * @since 9 2461 */ 2462 off(type: 'deviceChange', callback?: Callback<DeviceChangeAction>): void; 2463 2464 /** 2465 * Obtains all the available audio devices with a specific device usage. 2466 * @param { DeviceUsage } deviceUsage - Audio device usage. 2467 * @returns { AudioDeviceDescriptors } The device list. 2468 * @throws { BusinessError } 202 - Not system App. 2469 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2470 * 1.Mandatory parameters are left unspecified; 2471 * 2.Incorrect parameter types. 2472 * @throws { BusinessError } 6800101 - Parameter verification failed. 2473 * @syscap SystemCapability.Multimedia.Audio.Device 2474 * @systemapi 2475 * @since 11 2476 */ 2477 getAvailableDevices(deviceUsage: DeviceUsage): AudioDeviceDescriptors; 2478 2479 /** 2480 * Subscribes to available device change events. When a device is connected/disconnected, registered clients will receive 2481 * the callback. 2482 * @param { 'availableDeviceChange' } type - Type of the event to listen for. Only the availableDeviceChange event is supported. 2483 * @param { DeviceUsage } deviceUsage - Audio device usage. 2484 * @param { Callback<DeviceChangeAction> } callback - Callback used to obtain the device update details. 2485 * @throws { BusinessError } 202 - Not system App. 2486 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2487 * 1.Mandatory parameters are left unspecified; 2488 * 2.Incorrect parameter types. 2489 * @throws { BusinessError } 6800101 - Parameter verification failed. 2490 * @syscap SystemCapability.Multimedia.Audio.Device 2491 * @systemapi 2492 * @since 11 2493 */ 2494 on(type: 'availableDeviceChange', deviceUsage: DeviceUsage, callback: Callback<DeviceChangeAction>): void; 2495 2496 /** 2497 * UnSubscribes to available device change events. 2498 * @param { 'availableDeviceChange' } type - Type of the event to listen for. Only the availableDeviceChange event is supported. 2499 * @param { Callback<DeviceChangeAction> } callback - Callback used to obtain the device update details. 2500 * @throws { BusinessError } 202 - Not system App. 2501 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2502 * 1.Mandatory parameters are left unspecified; 2503 * 2.Incorrect parameter types. 2504 * @throws { BusinessError } 6800101 - Parameter verification failed. 2505 * @syscap SystemCapability.Multimedia.Audio.Device 2506 * @systemapi 2507 * @since 11 2508 */ 2509 off(type: 'availableDeviceChange', callback?: Callback<DeviceChangeAction>): void; 2510 2511 /** 2512 * Sets a device to the active state. This method uses an asynchronous callback to return the result. 2513 * @param { CommunicationDeviceType } deviceType - Audio device type. 2514 * @param { boolean } active - Active status to set. The value true means to set the device to 2515 * the active status, and false means the opposite. 2516 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2517 * @syscap SystemCapability.Multimedia.Audio.Communication 2518 * @since 9 2519 */ 2520 setCommunicationDevice(deviceType: CommunicationDeviceType, active: boolean, callback: AsyncCallback<void>): void; 2521 /** 2522 * Sets a device to the active state. This method uses a promise to return the result. 2523 * @param { CommunicationDeviceType } deviceType - Audio device type. 2524 * @param { boolean } active - Active status to set. The value true means to set the device to the active status, 2525 * and false means the opposite. 2526 * @returns { Promise<void> } Promise used to return the result. 2527 * @syscap SystemCapability.Multimedia.Audio.Communication 2528 * @since 9 2529 */ 2530 setCommunicationDevice(deviceType: CommunicationDeviceType, active: boolean): Promise<void>; 2531 2532 /** 2533 * Checks whether a device is active. This method uses an asynchronous callback to return the query result. 2534 * @param { CommunicationDeviceType } deviceType - Audio device type. 2535 * @param { AsyncCallback<boolean> } callback - Callback used to return the active status of the device. 2536 * @syscap SystemCapability.Multimedia.Audio.Communication 2537 * @since 9 2538 */ 2539 isCommunicationDeviceActive(deviceType: CommunicationDeviceType, callback: AsyncCallback<boolean>): void; 2540 /** 2541 * Checks whether a device is active. This method uses a promise to return the query result. 2542 * @param { CommunicationDeviceType } deviceType - Audio device type. 2543 * @returns { Promise<boolean> } Promise used to return the active status of the device. 2544 * @syscap SystemCapability.Multimedia.Audio.Communication 2545 * @since 9 2546 */ 2547 isCommunicationDeviceActive(deviceType: CommunicationDeviceType): Promise<boolean>; 2548 /** 2549 * Checks whether a device is active. 2550 * @param { CommunicationDeviceType } deviceType - Audio device type. 2551 * @returns { boolean } The active status of the device. 2552 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2553 * 1.Mandatory parameters are left unspecified; 2554 * 2.Incorrect parameter types. 2555 * @throws { BusinessError } 6800101 - Parameter verification failed. 2556 * @syscap SystemCapability.Multimedia.Audio.Communication 2557 * @since 10 2558 */ 2559 isCommunicationDeviceActiveSync(deviceType: CommunicationDeviceType): boolean; 2560 2561 /** 2562 * Select the output device. This method uses an asynchronous callback to return the result. 2563 * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description 2564 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2565 * @syscap SystemCapability.Multimedia.Audio.Device 2566 * @systemapi 2567 * @since 9 2568 */ 2569 selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback<void>): void; 2570 /** 2571 * Select the output device. This method uses a promise to return the result. 2572 * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description 2573 * @returns { Promise<void> } Promise used to return the result. 2574 * @syscap SystemCapability.Multimedia.Audio.Device 2575 * @systemapi 2576 * @since 9 2577 */ 2578 selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors): Promise<void>; 2579 2580 /** 2581 * Select the output device with desired AudioRenderer. This method uses an asynchronous callback to return the result. 2582 * @param { AudioRendererFilter } filter - Filter for AudioRenderer. 2583 * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description. 2584 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2585 * @syscap SystemCapability.Multimedia.Audio.Device 2586 * @systemapi 2587 * @since 9 2588 */ 2589 selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback<void>): void; 2590 /** 2591 * Select the output device with desired AudioRenderer. This method uses a promise to return the result. 2592 * @param { AudioRendererFilter } filter - Filter for AudioRenderer. 2593 * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description 2594 * @returns { Promise<void> } Promise used to return the result. 2595 * @syscap SystemCapability.Multimedia.Audio.Device 2596 * @systemapi 2597 * @since 9 2598 */ 2599 selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors): Promise<void>; 2600 2601 /** 2602 * Select the input device. This method uses an asynchronous callback to return the result. 2603 * @param { AudioDeviceDescriptors } inputAudioDevices - Audio device description 2604 * @param { AsyncCallback<void> } callback - Callback used to return the result. 2605 * @syscap SystemCapability.Multimedia.Audio.Device 2606 * @systemapi 2607 * @since 9 2608 */ 2609 selectInputDevice(inputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback<void>): void; 2610 /** 2611 * Select the input device. This method uses a promise to return the result. 2612 * @param { AudioDeviceDescriptors } inputAudioDevices - Audio device description 2613 * @returns { Promise<void> } Promise used to return the result. 2614 * @syscap SystemCapability.Multimedia.Audio.Device 2615 * @systemapi 2616 * @since 9 2617 */ 2618 selectInputDevice(inputAudioDevices: AudioDeviceDescriptors): Promise<void>; 2619 2620 /** 2621 * Get output device for target audio renderer info. 2622 * @param { AudioRendererInfo } rendererInfo - Audio renderer information 2623 * @param { AsyncCallback<AudioDeviceDescriptors> } callback - Callback used to return the result. 2624 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2625 * 1.Mandatory parameters are left unspecified; 2626 * 2.Incorrect parameter types. 2627 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 2628 * @throws { BusinessError } 6800301 - System error. Return by callback. 2629 * @syscap SystemCapability.Multimedia.Audio.Device 2630 * @since 10 2631 */ 2632 getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo, callback: AsyncCallback<AudioDeviceDescriptors>): void; 2633 /** 2634 * Get output device for target audio renderer info. 2635 * @param { AudioRendererInfo } rendererInfo - Audio renderer information. 2636 * @returns { Promise<AudioDeviceDescriptors> } Promise used to return the result. 2637 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2638 * 1.Mandatory parameters are left unspecified; 2639 * 2.Incorrect parameter types. 2640 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 2641 * @throws { BusinessError } 6800301 - System error. Return by promise. 2642 * @syscap SystemCapability.Multimedia.Audio.Device 2643 * @since 10 2644 */ 2645 getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo): Promise<AudioDeviceDescriptors>; 2646 2647 /** 2648 * Gets preferred output device for target audio renderer info. 2649 * @param { AudioRendererInfo } rendererInfo - Audio renderer information. 2650 * @returns { AudioDeviceDescriptors } The preferred devices. 2651 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2652 * 1.Mandatory parameters are left unspecified; 2653 * 2.Incorrect parameter types. 2654 * @throws { BusinessError } 6800101 - Parameter verification failed. 2655 * @syscap SystemCapability.Multimedia.Audio.Device 2656 * @since 10 2657 */ 2658 getPreferredOutputDeviceForRendererInfoSync(rendererInfo: AudioRendererInfo): AudioDeviceDescriptors; 2659 2660 /** 2661 * Subscribes to prefer output device change events. When prefer device for target audio renderer info changes, 2662 * registered clients will receive the callback. 2663 * @param { 'preferOutputDeviceChangeForRendererInfo' } type - Type of the event to listen for. Only the 2664 * preferOutputDeviceChangeForRendererInfo event is supported. 2665 * @param { AudioRendererInfo } rendererInfo - Audio renderer information. 2666 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to obtain the changed prefer devices information. 2667 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2668 * 1.Mandatory parameters are left unspecified; 2669 * 2.Incorrect parameter types. 2670 * @throws { BusinessError } 6800101 - Parameter verification failed. 2671 * @syscap SystemCapability.Multimedia.Audio.Device 2672 * @since 10 2673 */ 2674 on(type: 'preferOutputDeviceChangeForRendererInfo', rendererInfo: AudioRendererInfo, callback: Callback<AudioDeviceDescriptors>): void; 2675 /** 2676 * UnSubscribes to prefer output device change events. 2677 * @param { 'preferOutputDeviceChangeForRendererInfo' } type - Type of the event to listen for. Only the 2678 * preferOutputDeviceChangeForRendererInfo event is supported. 2679 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to obtain the changed prefer devices in subscribe. 2680 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2681 * 1.Mandatory parameters are left unspecified; 2682 * 2.Incorrect parameter types. 2683 * @throws { BusinessError } 6800101 - Parameter verification failed. 2684 * @syscap SystemCapability.Multimedia.Audio.Device 2685 * @since 10 2686 */ 2687 off(type: 'preferOutputDeviceChangeForRendererInfo', callback?: Callback<AudioDeviceDescriptors>): void; 2688 2689 /** 2690 * Get input device for target audio capturer info. 2691 * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. 2692 * @param { AsyncCallback<AudioDeviceDescriptors> } callback - Callback used to return the result. 2693 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2694 * 1.Mandatory parameters are left unspecified; 2695 * 2.Incorrect parameter types. 2696 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 2697 * @throws { BusinessError } 6800301 - System error. Return by callback. 2698 * @syscap SystemCapability.Multimedia.Audio.Device 2699 * @since 10 2700 */ 2701 getPreferredInputDeviceForCapturerInfo(capturerInfo: AudioCapturerInfo, callback: AsyncCallback<AudioDeviceDescriptors>): void; 2702 /** 2703 * Get input device for target audio capturer info. 2704 * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. 2705 * @returns { Promise<AudioDeviceDescriptors> } Promise used to return the result. 2706 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2707 * 1.Mandatory parameters are left unspecified; 2708 * 2.Incorrect parameter types. 2709 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 2710 * @throws { BusinessError } 6800301 - System error. Return by promise. 2711 * @syscap SystemCapability.Multimedia.Audio.Device 2712 * @since 10 2713 */ 2714 getPreferredInputDeviceForCapturerInfo(capturerInfo: AudioCapturerInfo): Promise<AudioDeviceDescriptors>; 2715 2716 /** 2717 * Subscribes to preferred input device change events. When preferred device for target audio capturer info changes, 2718 * registered clients will receive the callback. 2719 * @param { 'preferredInputDeviceChangeForCapturerInfo' } type - Type of the event to listen for. 2720 * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. 2721 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to obtain the changed preferred devices information. 2722 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2723 * 1.Mandatory parameters are left unspecified; 2724 * 2.Incorrect parameter types. 2725 * @throws { BusinessError } 6800101 - Parameter verification failed. 2726 * @syscap SystemCapability.Multimedia.Audio.Device 2727 * @since 10 2728 */ 2729 on(type: 'preferredInputDeviceChangeForCapturerInfo', capturerInfo: AudioCapturerInfo, callback: Callback<AudioDeviceDescriptors>): void; 2730 /** 2731 * Unsubscribes to preferred input device change events. 2732 * @param { 'preferredInputDeviceChangeForCapturerInfo' } type - Type of the event to listen for. 2733 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to obtain the changed preferred devices in subscribe. 2734 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2735 * 1.Mandatory parameters are left unspecified; 2736 * 2.Incorrect parameter types. 2737 * @throws { BusinessError } 6800101 - Parameter verification failed. 2738 * @syscap SystemCapability.Multimedia.Audio.Device 2739 * @since 10 2740 */ 2741 off(type: 'preferredInputDeviceChangeForCapturerInfo', callback?: Callback<AudioDeviceDescriptors>): void; 2742 2743 /** 2744 * Gets preferred input device for target audio capturer info. 2745 * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. 2746 * @returns { AudioDeviceDescriptors } The preferred devices. 2747 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2748 * 1.Mandatory parameters are left unspecified; 2749 * 2.Incorrect parameter types. 2750 * @throws { BusinessError } 6800101 - Parameter verification failed. 2751 * @syscap SystemCapability.Multimedia.Audio.Device 2752 * @since 10 2753 */ 2754 getPreferredInputDeviceForCapturerInfoSync(capturerInfo: AudioCapturerInfo): AudioDeviceDescriptors; 2755 } 2756 2757 /** 2758 * Implements audio stream management. 2759 * @typedef AudioStreamManager 2760 * @syscap SystemCapability.Multimedia.Audio.Core 2761 * @since 9 2762 */ 2763 interface AudioStreamManager { 2764 /** 2765 * Get information of current existing audio renderers. 2766 * @param { AsyncCallback<AudioRendererChangeInfoArray> } callback - Callback used to return the information 2767 * of current existing audio renderers. 2768 * @syscap SystemCapability.Multimedia.Audio.Renderer 2769 * @since 9 2770 */ 2771 getCurrentAudioRendererInfoArray(callback: AsyncCallback<AudioRendererChangeInfoArray>): void; 2772 /** 2773 * Get information of current existing audio renderers. 2774 * @returns { Promise<AudioRendererChangeInfoArray> } Promise used to return the information of current 2775 * existing audio renderers. 2776 * @syscap SystemCapability.Multimedia.Audio.Renderer 2777 * @since 9 2778 */ 2779 getCurrentAudioRendererInfoArray(): Promise<AudioRendererChangeInfoArray>; 2780 /** 2781 * Get information of current existing audio renderers. 2782 * @returns { AudioRendererChangeInfoArray } The information of current existing audio renderers. 2783 * @syscap SystemCapability.Multimedia.Audio.Renderer 2784 * @since 10 2785 */ 2786 getCurrentAudioRendererInfoArraySync(): AudioRendererChangeInfoArray; 2787 2788 /** 2789 * Get information of current existing audio capturers. 2790 * @param { AsyncCallback<AudioCapturerChangeInfoArray> } callback - Callback used to return the information 2791 * of current existing audio capturers. 2792 * @syscap SystemCapability.Multimedia.Audio.Renderer 2793 * @since 9 2794 */ 2795 getCurrentAudioCapturerInfoArray(callback: AsyncCallback<AudioCapturerChangeInfoArray>): void; 2796 /** 2797 * Get information of current existing audio capturers. 2798 * @returns { Promise<AudioCapturerChangeInfoArray> } Promise used to return the information of current existing 2799 * audio capturers. 2800 * @syscap SystemCapability.Multimedia.Audio.Renderer 2801 * @since 9 2802 */ 2803 getCurrentAudioCapturerInfoArray(): Promise<AudioCapturerChangeInfoArray>; 2804 /** 2805 * Get information of current existing audio capturers. 2806 * @returns { AudioCapturerChangeInfoArray } The information of current existing audio capturers. 2807 * @syscap SystemCapability.Multimedia.Audio.Capturer 2808 * @since 10 2809 */ 2810 getCurrentAudioCapturerInfoArraySync(): AudioCapturerChangeInfoArray; 2811 2812 /** 2813 * Gets information of audio effects. 2814 * @param { StreamUsage } usage - Stream usage. 2815 * @param { AsyncCallback<AudioEffectInfoArray> } callback - Callback used to return the information of audio effects. 2816 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2817 * 1.Mandatory parameters are left unspecified; 2818 * 2.Incorrect parameter types. 2819 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 2820 * @syscap SystemCapability.Multimedia.Audio.Renderer 2821 * @since 10 2822 */ 2823 getAudioEffectInfoArray(usage: StreamUsage, callback: AsyncCallback<AudioEffectInfoArray>): void; 2824 /** 2825 * Gets information of audio effects. 2826 * @param { StreamUsage } usage - Stream usage. 2827 * @returns { Promise<AudioEffectInfoArray> } Promise used to return the information of audio effects. 2828 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2829 * 1.Mandatory parameters are left unspecified; 2830 * 2.Incorrect parameter types. 2831 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 2832 * @syscap SystemCapability.Multimedia.Audio.Renderer 2833 * @since 10 2834 */ 2835 getAudioEffectInfoArray(usage: StreamUsage): Promise<AudioEffectInfoArray>; 2836 /** 2837 * Gets information of audio effects. 2838 * @param { StreamUsage } usage - Stream usage. 2839 * @returns { AudioEffectInfoArray } The information of audio effects. 2840 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2841 * 1.Mandatory parameters are left unspecified; 2842 * 2.Incorrect parameter types. 2843 * @throws { BusinessError } 6800101 - Parameter verification failed. 2844 * @syscap SystemCapability.Multimedia.Audio.Renderer 2845 * @since 10 2846 */ 2847 getAudioEffectInfoArraySync(usage: StreamUsage): AudioEffectInfoArray; 2848 2849 /** 2850 * Listens for audio renderer change events. When there is any audio renderer change, 2851 * registered clients will receive the callback. 2852 * @param { 'audioRendererChange' } type - Type of the event to listen for. Only the audioRendererChange event is supported. 2853 * @param { Callback<AudioRendererChangeInfoArray> } callback - Callback invoked for the audio renderer change event. 2854 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2855 * 1.Mandatory parameters are left unspecified; 2856 * 2.Incorrect parameter types. 2857 * @throws { BusinessError } 6800101 - Parameter verification failed. 2858 * @syscap SystemCapability.Multimedia.Audio.Renderer 2859 * @since 9 2860 */ 2861 on(type: 'audioRendererChange', callback: Callback<AudioRendererChangeInfoArray>): void; 2862 2863 /** 2864 * UnSubscribes to audio renderer change events. 2865 * @param { 'audioRendererChange' } type - Type of the event to listen for. Only the audioRendererChange event is supported. 2866 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2867 * 1.Mandatory parameters are left unspecified; 2868 * 2.Incorrect parameter types. 2869 * @throws { BusinessError } 6800101 - Parameter verification failed. 2870 * @syscap SystemCapability.Multimedia.Audio.Renderer 2871 * @since 9 2872 */ 2873 off(type: 'audioRendererChange'): void; 2874 2875 /** 2876 * Listens for audio capturer change events. When there is any audio capturer change, 2877 * registered clients will receive the callback. 2878 * @param { 'audioCapturerChange' } type - Type of the event to listen for. Only the audioCapturerChange event is supported. 2879 * @param { Callback<AudioCapturerChangeInfoArray> } callback - Callback invoked for the audio capturer change event. 2880 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2881 * 1.Mandatory parameters are left unspecified; 2882 * 2.Incorrect parameter types. 2883 * @throws { BusinessError } 6800101 - Parameter verification failed. 2884 * @syscap SystemCapability.Multimedia.Audio.Capturer 2885 * @since 9 2886 */ 2887 on(type: 'audioCapturerChange', callback: Callback<AudioCapturerChangeInfoArray>): void; 2888 2889 /** 2890 * UnSubscribes to audio capturer change events. 2891 * @param { 'audioCapturerChange' } type - Type of the event to listen for. Only the audioCapturerChange event is supported. 2892 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2893 * 1.Mandatory parameters are left unspecified; 2894 * 2.Incorrect parameter types. 2895 * @throws { BusinessError } 6800101 - Parameter verification failed. 2896 * @syscap SystemCapability.Multimedia.Audio.Capturer 2897 * @since 9 2898 */ 2899 off(type: 'audioCapturerChange'): void; 2900 2901 /** 2902 * Checks whether a stream is active. This method uses an asynchronous callback to return the query result. 2903 * @param { AudioVolumeType } volumeType - Audio stream type. 2904 * @param { AsyncCallback<boolean> } callback - Callback used to return the active status of the stream. 2905 * The value true means that the stream is active, and false means the opposite. 2906 * @syscap SystemCapability.Multimedia.Audio.Renderer 2907 * @since 9 2908 */ 2909 isActive(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): void; 2910 /** 2911 * Checks whether a stream is active. This method uses a promise to return the query result. 2912 * @param { AudioVolumeType } volumeType - Audio stream type. 2913 * @returns { Promise<boolean> } Promise used to return the active status of the stream. The value 2914 * true means that the stream is active, and false means the opposite. 2915 * @syscap SystemCapability.Multimedia.Audio.Renderer 2916 * @since 9 2917 */ 2918 isActive(volumeType: AudioVolumeType): Promise<boolean>; 2919 /** 2920 * Checks whether a stream is active. 2921 * @param { AudioVolumeType } volumeType - Audio stream type. 2922 * @returns { boolean } The active status of the stream. 2923 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2924 * 1.Mandatory parameters are left unspecified; 2925 * 2.Incorrect parameter types. 2926 * @throws { BusinessError } 6800101 - Parameter verification failed. 2927 * @syscap SystemCapability.Multimedia.Audio.Renderer 2928 * @since 10 2929 */ 2930 isActiveSync(volumeType: AudioVolumeType): boolean; 2931 } 2932 2933 /** 2934 * Implements audio volume management. 2935 * @typedef AudioVolumeManager 2936 * @syscap SystemCapability.Multimedia.Audio.Volume 2937 * @since 9 2938 */ 2939 interface AudioVolumeManager { 2940 /** 2941 * Get the volume group list for a networkId. This method uses an asynchronous callback to return the result. 2942 * @param { string } networkId - Distributed deice net work id 2943 * @param { AsyncCallback<VolumeGroupInfos> } callback - Callback used to return the result. 2944 * @syscap SystemCapability.Multimedia.Audio.Volume 2945 * @systemapi 2946 * @since 9 2947 */ 2948 getVolumeGroupInfos(networkId: string, callback: AsyncCallback<VolumeGroupInfos>): void; 2949 /** 2950 * Get the volume group list for a networkId. This method uses a promise to return the result. 2951 * @param { string } networkId - Distributed deice net work id 2952 * @returns { Promise<VolumeGroupInfos> } Promise used to return the result. 2953 * @syscap SystemCapability.Multimedia.Audio.Volume 2954 * @systemapi 2955 * @since 9 2956 */ 2957 getVolumeGroupInfos(networkId: string): Promise<VolumeGroupInfos>; 2958 /** 2959 * Get the volume group list for a networkId. 2960 * @param { string } networkId - Distributed deice net work id 2961 * @returns { VolumeGroupInfos } Volume group info list. 2962 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2963 * 1.Mandatory parameters are left unspecified; 2964 * 2.Incorrect parameter types. 2965 * @throws { BusinessError } 6800101 - Parameter verification failed. 2966 * @syscap SystemCapability.Multimedia.Audio.Volume 2967 * @systemapi 2968 * @since 10 2969 */ 2970 getVolumeGroupInfosSync(networkId: string): VolumeGroupInfos; 2971 2972 /** 2973 * Obtains an AudioVolumeGroupManager instance. This method uses an asynchronous callback to return the result. 2974 * @param { number } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default 2975 * @param { AsyncCallback<AudioVolumeGroupManager> } callback - Callback used to return the result. 2976 * @syscap SystemCapability.Multimedia.Audio.Volume 2977 * @since 9 2978 */ 2979 getVolumeGroupManager(groupId: number, callback: AsyncCallback<AudioVolumeGroupManager>): void; 2980 /** 2981 * Obtains an AudioVolumeGroupManager instance. This method uses a promise to return the result. 2982 * @param { number } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default 2983 * @returns { Promise<AudioVolumeGroupManager> } Promise used to return the result. 2984 * @syscap SystemCapability.Multimedia.Audio.Volume 2985 * @since 9 2986 */ 2987 getVolumeGroupManager(groupId: number): Promise<AudioVolumeGroupManager>; 2988 /** 2989 * Obtains an AudioVolumeGroupManager instance. 2990 * @param { number } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default 2991 * @returns { AudioVolumeGroupManager } The audio volume group manager instance. 2992 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2993 * 1.Mandatory parameters are left unspecified; 2994 * 2.Incorrect parameter types. 2995 * @throws { BusinessError } 6800101 - Parameter verification failed. 2996 * @syscap SystemCapability.Multimedia.Audio.Volume 2997 * @since 10 2998 */ 2999 getVolumeGroupManagerSync(groupId: number): AudioVolumeGroupManager; 3000 3001 /** 3002 * Listens for system volume change events. This method uses a callback to get volume change events. 3003 * @param { 'volumeChange' } type - Type of the event to listen for. Only the volumeChange event is supported. 3004 * @param { Callback<VolumeEvent> } callback - Callback used to get the system volume change event. 3005 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3006 * 1.Mandatory parameters are left unspecified; 3007 * 2.Incorrect parameter types. 3008 * @throws { BusinessError } 6800101 - Parameter verification failed. 3009 * @syscap SystemCapability.Multimedia.Audio.Volume 3010 * @since 9 3011 */ 3012 on(type: 'volumeChange', callback: Callback<VolumeEvent>): void; 3013 } 3014 3015 /** 3016 * Implements audio volume group management. 3017 * @typedef AudioVolumeGroupManager 3018 * @syscap SystemCapability.Multimedia.Audio.Volume 3019 * @since 9 3020 */ 3021 interface AudioVolumeGroupManager { 3022 /** 3023 * Sets the volume for a stream. This method uses an asynchronous callback to return the result. 3024 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 3025 * @param { AudioVolumeType } volumeType - Audio stream type. 3026 * @param { number } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. 3027 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3028 * @syscap SystemCapability.Multimedia.Audio.Volume 3029 * @systemapi 3030 * @since 9 3031 */ 3032 setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback<void>): void; 3033 /** 3034 * Sets the volume for a stream. This method uses a promise to return the result. 3035 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 3036 * @param { AudioVolumeType } volumeType - Audio stream type. 3037 * @param { number } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. 3038 * @returns { Promise<void> } Promise used to return the result. 3039 * @syscap SystemCapability.Multimedia.Audio.Volume 3040 * @systemapi 3041 * @since 9 3042 */ 3043 setVolume(volumeType: AudioVolumeType, volume: number): Promise<void>; 3044 3045 /** 3046 * Sets the volume for a stream. This method uses a promise to return the result. 3047 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 3048 * @param { AudioVolumeType } volumeType - Audio stream type. 3049 * @param { number } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. 3050 * @param { number } flags - volume flags used to enable different operations, can be union of {@link VolumeFlag} 3051 * @returns { Promise<void> } Promise used to return the result. 3052 * @throws { BusinessError } 201 - Permission denied. 3053 * @throws { BusinessError } 202 - Not system App. 3054 * @syscap SystemCapability.Multimedia.Audio.Volume 3055 * @systemapi 3056 * @since 12 3057 */ 3058 setVolumeWithFlag(volumeType: AudioVolumeType, volume: number, flags: number): Promise<void>; 3059 3060 /** 3061 * Obtains the volume of a stream. This method uses an asynchronous callback to return the query result. 3062 * @param { AudioVolumeType } volumeType - Audio stream type. 3063 * @param { AsyncCallback<number> } callback - Callback used to return the volume. 3064 * @syscap SystemCapability.Multimedia.Audio.Volume 3065 * @since 9 3066 */ 3067 getVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void; 3068 /** 3069 * Obtains the volume of a stream. This method uses a promise to return the query result. 3070 * @param { AudioVolumeType } volumeType - Audio stream type. 3071 * @returns { Promise<number> } Promise used to return the volume. 3072 * @syscap SystemCapability.Multimedia.Audio.Volume 3073 * @since 9 3074 */ 3075 getVolume(volumeType: AudioVolumeType): Promise<number>; 3076 /** 3077 * Obtains the volume of a stream. 3078 * @param { AudioVolumeType } volumeType - Audio stream type. 3079 * @returns { number } Current system volume level. 3080 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3081 * 1.Mandatory parameters are left unspecified; 3082 * 2.Incorrect parameter types. 3083 * @throws { BusinessError } 6800101 - Parameter verification failed. 3084 * @syscap SystemCapability.Multimedia.Audio.Volume 3085 * @since 10 3086 */ 3087 getVolumeSync(volumeType: AudioVolumeType): number; 3088 3089 /** 3090 * Obtains the minimum volume allowed for a stream. This method uses an asynchronous callback to return the query result. 3091 * @param { AudioVolumeType } volumeType - Audio stream type. 3092 * @param { AsyncCallback<number> } callback - Callback used to return the minimum volume. 3093 * @syscap SystemCapability.Multimedia.Audio.Volume 3094 * @since 9 3095 */ 3096 getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void; 3097 /** 3098 * Obtains the minimum volume allowed for a stream. This method uses a promise to return the query result. 3099 * @param { AudioVolumeType } volumeType - Audio stream type. 3100 * @returns { Promise<number> } Promise used to return the minimum volume. 3101 * @syscap SystemCapability.Multimedia.Audio.Volume 3102 * @since 9 3103 */ 3104 getMinVolume(volumeType: AudioVolumeType): Promise<number>; 3105 /** 3106 * Obtains the minimum volume allowed for a stream. 3107 * @param { AudioVolumeType } volumeType - Audio stream type. 3108 * @returns { number } Min volume level. 3109 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3110 * 1.Mandatory parameters are left unspecified; 3111 * 2.Incorrect parameter types. 3112 * @throws { BusinessError } 6800101 - Parameter verification failed. 3113 * @syscap SystemCapability.Multimedia.Audio.Volume 3114 * @since 10 3115 */ 3116 getMinVolumeSync(volumeType: AudioVolumeType): number; 3117 3118 /** 3119 * Obtains the maximum volume allowed for a stream. This method uses an asynchronous callback to return the query result. 3120 * @param { AudioVolumeType } volumeType - Audio stream type. 3121 * @param { AsyncCallback<number> } callback - Callback used to return the maximum volume. 3122 * @syscap SystemCapability.Multimedia.Audio.Volume 3123 * @since 9 3124 */ 3125 getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): void; 3126 /** 3127 * Obtains the maximum volume allowed for a stream. This method uses a promise to return the query result. 3128 * @param { AudioVolumeType } volumeType - Audio stream type. 3129 * @returns { Promise<number> } Promise used to return the maximum volume. 3130 * @syscap SystemCapability.Multimedia.Audio.Volume 3131 * @since 9 3132 */ 3133 getMaxVolume(volumeType: AudioVolumeType): Promise<number>; 3134 /** 3135 * Obtains the maximum volume allowed for a stream. 3136 * @param { AudioVolumeType } volumeType - Audio stream type. 3137 * @returns { number } Max volume level. 3138 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3139 * 1.Mandatory parameters are left unspecified; 3140 * 2.Incorrect parameter types. 3141 * @throws { BusinessError } 6800101 - Parameter verification failed. 3142 * @syscap SystemCapability.Multimedia.Audio.Volume 3143 * @since 10 3144 */ 3145 getMaxVolumeSync(volumeType: AudioVolumeType): number; 3146 3147 /** 3148 * Mutes a stream. This method uses an asynchronous callback to return the result. 3149 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 3150 * @param { AudioVolumeType } volumeType - Audio stream type. 3151 * @param { boolean } mute - Mute status to set. The value true means to mute the stream, and false means the opposite. 3152 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3153 * @syscap SystemCapability.Multimedia.Audio.Volume 3154 * @systemapi 3155 * @since 9 3156 */ 3157 mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback<void>): void; 3158 /** 3159 * Mutes a stream. This method uses a promise to return the result. 3160 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 3161 * @param { AudioVolumeType } volumeType - Audio stream type. 3162 * @param { boolean } mute - Mute status to set. The value true means to mute the stream, and false means the opposite. 3163 * @returns { Promise<void> } Promise used to return the result. 3164 * @syscap SystemCapability.Multimedia.Audio.Volume 3165 * @systemapi 3166 * @since 9 3167 */ 3168 mute(volumeType: AudioVolumeType, mute: boolean): Promise<void>; 3169 3170 /** 3171 * Checks whether a stream is muted. This method uses an asynchronous callback to return the query result. 3172 * @param { AudioVolumeType } volumeType - Audio stream type. 3173 * @param { AsyncCallback<boolean> } callback - Callback used to return the mute status of the stream. The 3174 * value true means that the stream is muted, and false means the opposite. 3175 * @syscap SystemCapability.Multimedia.Audio.Volume 3176 * @since 9 3177 */ 3178 isMute(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): void; 3179 /** 3180 * Checks whether a stream is muted. This method uses a promise to return the result. 3181 * @param { AudioVolumeType } volumeType - Audio stream type. 3182 * @returns { Promise<boolean> } Promise used to return the mute status of the stream. The value true 3183 * means that the stream is muted, and false means the opposite. 3184 * @syscap SystemCapability.Multimedia.Audio.Volume 3185 * @since 9 3186 */ 3187 isMute(volumeType: AudioVolumeType): Promise<boolean>; 3188 /** 3189 * Checks whether a stream is muted. 3190 * @param { AudioVolumeType } volumeType - Audio stream type. 3191 * @returns { boolean } The mute status of the stream. The value true 3192 * means that the stream is muted, and false means the opposite. 3193 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3194 * 1.Mandatory parameters are left unspecified; 3195 * 2.Incorrect parameter types. 3196 * @throws { BusinessError } 6800101 - Parameter verification failed. 3197 * @syscap SystemCapability.Multimedia.Audio.Volume 3198 * @since 10 3199 */ 3200 isMuteSync(volumeType: AudioVolumeType): boolean; 3201 3202 /** 3203 * Sets the ringer mode. This method uses an asynchronous callback to return the result. 3204 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 3205 * @param { AudioRingMode } mode - Ringer mode. 3206 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3207 * @syscap SystemCapability.Multimedia.Audio.Volume 3208 * @systemapi 3209 * @since 9 3210 */ 3211 setRingerMode(mode: AudioRingMode, callback: AsyncCallback<void>): void; 3212 /** 3213 * Sets the ringer mode. This method uses a promise to return the result. 3214 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 3215 * @param { AudioRingMode } mode - Ringer mode. 3216 * @returns { Promise<void> } Promise used to return the result. 3217 * @syscap SystemCapability.Multimedia.Audio.Volume 3218 * @systemapi 3219 * @since 9 3220 */ 3221 setRingerMode(mode: AudioRingMode): Promise<void>; 3222 3223 /** 3224 * Obtains the ringer mode. This method uses an asynchronous callback to return the query result. 3225 * @param { AsyncCallback<AudioRingMode> } callback - Callback used to return the ringer mode. 3226 * @syscap SystemCapability.Multimedia.Audio.Volume 3227 * @since 9 3228 */ 3229 getRingerMode(callback: AsyncCallback<AudioRingMode>): void; 3230 /** 3231 * Obtains the ringer mode. This method uses a promise to return the query result. 3232 * @returns { Promise<AudioRingMode> } Promise used to return the ringer mode. 3233 * @syscap SystemCapability.Multimedia.Audio.Volume 3234 * @since 9 3235 */ 3236 getRingerMode(): Promise<AudioRingMode>; 3237 /** 3238 * Obtains the ringer mode. 3239 * @returns { AudioRingMode } Current ringer mode. 3240 * @syscap SystemCapability.Multimedia.Audio.Volume 3241 * @since 10 3242 */ 3243 getRingerModeSync(): AudioRingMode; 3244 3245 /** 3246 * Listens for ringer mode change events. This method uses a callback to get ringer mode changes. 3247 * @param { 'ringerModeChange' } type - Type of the event to listen for. Only the ringerModeChange event is supported. 3248 * @param { Callback<AudioRingMode> } callback - Callback used to get the updated ringer mode. 3249 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3250 * 1.Mandatory parameters are left unspecified; 3251 * 2.Incorrect parameter types. 3252 * @throws { BusinessError } 6800101 - Parameter verification failed. 3253 * @syscap SystemCapability.Multimedia.Audio.Volume 3254 * @since 9 3255 */ 3256 on(type: 'ringerModeChange', callback: Callback<AudioRingMode>): void; 3257 3258 /** 3259 * Mutes or unmutes the microphone. This method uses an asynchronous callback to return the result. 3260 * @permission ohos.permission.MANAGE_AUDIO_CONFIG 3261 * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. 3262 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3263 * @syscap SystemCapability.Multimedia.Audio.Volume 3264 * @since 9 3265 * @deprecated since 11 3266 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicMute 3267 */ 3268 setMicrophoneMute(mute: boolean, callback: AsyncCallback<void>): void; 3269 /** 3270 * Mutes or unmutes the microphone. This method uses a promise to return the result. 3271 * @permission ohos.permission.MANAGE_AUDIO_CONFIG 3272 * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. 3273 * @returns { Promise<void> } Promise used to return the result. 3274 * @syscap SystemCapability.Multimedia.Audio.Volume 3275 * @since 9 3276 * @deprecated since 11 3277 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicMute 3278 */ 3279 setMicrophoneMute(mute: boolean): Promise<void>; 3280 3281 /** 3282 * Mutes or unmutes the microphone. This method uses a promise to return the result. 3283 * @permission ohos.permission.MANAGE_AUDIO_CONFIG 3284 * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. 3285 * @returns { Promise<void> } Promise used to return the result. 3286 * @throws { BusinessError } 201 - Permission denied. 3287 * @throws { BusinessError } 202 - Not system App. 3288 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3289 * 1.Mandatory parameters are left unspecified; 3290 * 2.Incorrect parameter types. 3291 * @throws { BusinessError } 6800101 - Parameter verification failed. 3292 * @syscap SystemCapability.Multimedia.Audio.Volume 3293 * @systemapi 3294 * @since 11 3295 */ 3296 setMicMute(mute: boolean): Promise<void>; 3297 3298 /** 3299 * Checks whether the microphone is muted. This method uses an asynchronous callback to return the query result. 3300 * @param { AsyncCallback<boolean> } callback - used to return the mute status of the microphone. The value 3301 * true means that the microphone is muted, and false means the opposite. 3302 * @syscap SystemCapability.Multimedia.Audio.Volume 3303 * @since 9 3304 */ 3305 isMicrophoneMute(callback: AsyncCallback<boolean>): void; 3306 /** 3307 * Checks whether the microphone is muted. This method uses a promise to return the query result. 3308 * @returns { Promise<boolean> } Promise used to return the mute status of the microphone. The value true 3309 * means that the microphone is muted, and false means the opposite. 3310 * @syscap SystemCapability.Multimedia.Audio.Volume 3311 * @since 9 3312 */ 3313 isMicrophoneMute(): Promise<boolean>; 3314 /** 3315 * Checks whether the microphone is muted. 3316 * @returns { boolean } The mute status of the microphone. The value true 3317 * means that the microphone is muted, and false means the opposite. 3318 * @syscap SystemCapability.Multimedia.Audio.Volume 3319 * @since 10 3320 */ 3321 isMicrophoneMuteSync(): boolean; 3322 3323 /** 3324 * Listens for system microphone state change events. This method uses a callback to get microphone change events. 3325 * @param { 'micStateChange' } type - Type of the event to listen for. Only the micStateChange event is supported. 3326 * @param { Callback<MicStateChangeEvent> } callback - Callback used to get the system microphone state change event. 3327 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3328 * 1.Mandatory parameters are left unspecified; 3329 * 2.Incorrect parameter types. 3330 * @throws { BusinessError } 6800101 - Parameter verification failed. 3331 * @syscap SystemCapability.Multimedia.Audio.Volume 3332 * @since 9 3333 */ 3334 on(type: 'micStateChange', callback: Callback<MicStateChangeEvent>): void; 3335 3336 /** 3337 * Gets if this volume group is volume unadjustable. 3338 * @returns { boolean } Whether it is volume unadjustable. 3339 * @syscap SystemCapability.Multimedia.Audio.Volume 3340 * @since 10 3341 */ 3342 isVolumeUnadjustable(): boolean; 3343 3344 /** 3345 * Adjusts system volume by step, volume type is decided by system. 3346 * This method uses an asynchronous callback to return the result. 3347 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 3348 * @param { VolumeAdjustType } adjustType - Volume adjustment type. 3349 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3350 * @throws { BusinessError } 201 - Permission denied. 3351 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3352 * 1.Mandatory parameters are left unspecified; 3353 * 2.Incorrect parameter types. 3354 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 3355 * @throws { BusinessError } 6800301 - System error. Return by callback. 3356 * @syscap SystemCapability.Multimedia.Audio.Volume 3357 * @systemapi 3358 * @since 10 3359 */ 3360 adjustVolumeByStep(adjustType: VolumeAdjustType, callback: AsyncCallback<void>): void; 3361 /** 3362 * Adjusts system volume by step, volume type is decided by system. 3363 * This method uses a promise to return the result. 3364 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 3365 * @param { VolumeAdjustType } adjustType - Volume adjustment type. 3366 * @returns { Promise<void> } Promise used to return the result. 3367 * @throws { BusinessError } 201 - Permission denied. 3368 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3369 * 1.Mandatory parameters are left unspecified; 3370 * 2.Incorrect parameter types. 3371 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 3372 * @throws { BusinessError } 6800301 - System error. Return by promise. 3373 * @syscap SystemCapability.Multimedia.Audio.Volume 3374 * @systemapi 3375 * @since 10 3376 */ 3377 adjustVolumeByStep(adjustType: VolumeAdjustType): Promise<void>; 3378 3379 /** 3380 * Adjusts system volume by step for target volume type. 3381 * This method uses an asynchronous callback to return the result. 3382 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 3383 * @param { AudioVolumeType } volumeType - Audio volume type. 3384 * @param { VolumeAdjustType } adjustType - Volume adjustment type. 3385 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3386 * @throws { BusinessError } 201 - Permission denied. 3387 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3388 * 1.Mandatory parameters are left unspecified; 3389 * 2.Incorrect parameter types. 3390 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 3391 * @throws { BusinessError } 6800301 - System error. Return by callback. 3392 * @syscap SystemCapability.Multimedia.Audio.Volume 3393 * @systemapi 3394 * @since 10 3395 */ 3396 adjustSystemVolumeByStep(volumeType: AudioVolumeType, adjustType: VolumeAdjustType, callback: AsyncCallback<void>): void; 3397 /** 3398 * Adjusts system volume by step for target volume type. 3399 * This method uses a promise to return the result. 3400 * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY 3401 * @param { AudioVolumeType } volumeType - Audio volume type. 3402 * @param { VolumeAdjustType } adjustType - Volume adjustment type. 3403 * @returns { Promise<void> } Promise used to return the result. 3404 * @throws { BusinessError } 201 - Permission denied. 3405 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3406 * 1.Mandatory parameters are left unspecified; 3407 * 2.Incorrect parameter types. 3408 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 3409 * @throws { BusinessError } 6800301 - System error. Return by promise. 3410 * @syscap SystemCapability.Multimedia.Audio.Volume 3411 * @systemapi 3412 * @since 10 3413 */ 3414 adjustSystemVolumeByStep(volumeType: AudioVolumeType, adjustType: VolumeAdjustType): Promise<void>; 3415 3416 /** 3417 * Gets the volume db value that system calculate by volume type, volume level and device type. 3418 * This method uses an asynchronous callback to return the result. 3419 * @param { AudioVolumeType } volumeType - Audio volume type. 3420 * @param { number } volumeLevel - Volume level to set. 3421 * @param { DeviceType } device - Output device type. 3422 * @param { AsyncCallback<number> } callback - Callback used to return the result. 3423 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3424 * 1.Mandatory parameters are left unspecified; 3425 * 2.Incorrect parameter types. 3426 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 3427 * @throws { BusinessError } 6800301 - System error. Return by callback. 3428 * @syscap SystemCapability.Multimedia.Audio.Volume 3429 * @since 10 3430 */ 3431 getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: DeviceType, callback: AsyncCallback<number>): void; 3432 /** 3433 * Gets the volume db value that system calculate by volume type, volume level and device type. 3434 * This method uses a promise to return the result. 3435 * @param { AudioVolumeType } volumeType - Audio volume type. 3436 * @param { number } volumeLevel - Volume level to set. 3437 * @param { DeviceType } device - Output device type. 3438 * @returns { Promise<number> } Promise used to return the result. 3439 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3440 * 1.Mandatory parameters are left unspecified; 3441 * 2.Incorrect parameter types. 3442 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 3443 * @throws { BusinessError } 6800301 - System error. Return by promise. 3444 * @syscap SystemCapability.Multimedia.Audio.Volume 3445 * @since 10 3446 */ 3447 getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: DeviceType): Promise<number>; 3448 /** 3449 * Gets the volume db value that system calculate by volume type, volume level and device type. 3450 * @param { AudioVolumeType } volumeType - Audio volume type. 3451 * @param { number } volumeLevel - Volume level to set. 3452 * @param { DeviceType } device - Output device type. 3453 * @returns { number } The system volume in dB. 3454 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3455 * 1.Mandatory parameters are left unspecified; 3456 * 2.Incorrect parameter types. 3457 * @throws { BusinessError } 6800101 - Parameter verification failed. 3458 * @syscap SystemCapability.Multimedia.Audio.Volume 3459 * @since 10 3460 */ 3461 getSystemVolumeInDbSync(volumeType: AudioVolumeType, volumeLevel: number, device: DeviceType): number; 3462 3463 /** 3464 * Gets the max amplitude value for a specific input device. 3465 * This method uses a promise to return the result. 3466 * @param { AudioDeviceDescriptor } inputDevice - the target device. 3467 * @returns { Promise<number> } Promise used to return the max amplitude value. 3468 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3469 * 1.Mandatory parameters are left unspecified; 3470 * 2.Incorrect parameter types. 3471 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 3472 * @throws { BusinessError } 6800301 - System error. Return by promise. 3473 * @syscap SystemCapability.Multimedia.Audio.Volume 3474 * @since 12 3475 */ 3476 getMaxAmplitudeForInputDevice(inputDevice: AudioDeviceDescriptor): Promise<number>; 3477 /** 3478 * Gets the max amplitude value for a specific output device. 3479 * This method uses a promise to return the result. 3480 * @param { AudioDeviceDescriptor } outputDevice - the target device. 3481 * @returns { Promise<number> } Promise used to return the max amplitude value. 3482 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3483 * 1.Mandatory parameters are left unspecified; 3484 * 2.Incorrect parameter types. 3485 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 3486 * @throws { BusinessError } 6800301 - System error. Return by promise. 3487 * @syscap SystemCapability.Multimedia.Audio.Volume 3488 * @since 12 3489 */ 3490 getMaxAmplitudeForOutputDevice(outputDevice: AudioDeviceDescriptor): Promise<number>; 3491 } 3492 3493 /** 3494 * Implements audio spatialization management. 3495 * @typedef AudioSpatializationManager 3496 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3497 * @systemapi 3498 * @since 11 3499 */ 3500 interface AudioSpatializationManager { 3501 /** 3502 * Checks whether spatialization is supported by system. 3503 * @returns { boolean } Whether spatialization is supported by system. 3504 * @throws { BusinessError } 202 - Not system App. 3505 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3506 * @systemapi 3507 * @since 11 3508 */ 3509 isSpatializationSupported(): boolean; 3510 3511 /** 3512 * Checks whether spatialization is supported by the specified device. 3513 * @param { AudioDeviceDescriptor } deviceDescriptor - Audio device description. 3514 * @returns { boolean } Whether spatialization is supported by the specified device. 3515 * @throws { BusinessError } 202 - Not system App. 3516 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3517 * 1.Mandatory parameters are left unspecified; 3518 * 2.Incorrect parameter types. 3519 * @throws { BusinessError } 6800101 - Parameter verification failed. 3520 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3521 * @systemapi 3522 * @since 11 3523 */ 3524 isSpatializationSupportedForDevice(deviceDescriptor: AudioDeviceDescriptor): boolean; 3525 3526 /** 3527 * Checks whether head tracking is supported by system. 3528 * @returns { boolean } Whether head tracking is supported by system. 3529 * @throws { BusinessError } 202 - Not system App. 3530 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3531 * @systemapi 3532 * @since 11 3533 */ 3534 isHeadTrackingSupported(): boolean; 3535 3536 /** 3537 * Checks whether head tracking is supported by the specified device. 3538 * @param { AudioDeviceDescriptor } deviceDescriptor - Audio device description. 3539 * @returns { boolean } Whether head tracking is supported by the specified device. 3540 * @throws { BusinessError } 202 - Not system App. 3541 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3542 * 1.Mandatory parameters are left unspecified; 3543 * 2.Incorrect parameter types. 3544 * @throws { BusinessError } 6800101 - Parameter verification failed. 3545 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3546 * @systemapi 3547 * @since 11 3548 */ 3549 isHeadTrackingSupportedForDevice(deviceDescriptor: AudioDeviceDescriptor): boolean; 3550 3551 /** 3552 * Sets the spatialization enabled or disabled. This method uses an asynchronous callback to return the result. 3553 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 3554 * @param { boolean } enable - Spatialization enable state. 3555 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3556 * @throws { BusinessError } 201 - Permission denied. Return by callback. 3557 * @throws { BusinessError } 202 - Not system App. 3558 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3559 * 1.Mandatory parameters are left unspecified; 3560 * 2.Incorrect parameter types. 3561 * @throws { BusinessError } 6800101 - Parameter verification failed. 3562 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3563 * @systemapi 3564 * @since 11 3565 */ 3566 setSpatializationEnabled(enable: boolean, callback: AsyncCallback<void>): void; 3567 /** 3568 * Sets the spatialization enabled or disabled. This method uses a promise to return the result. 3569 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 3570 * @param { boolean } enable - Spatialization enable state. 3571 * @returns { Promise<void> } Promise used to return the result. 3572 * @throws { BusinessError } 201 - Permission denied. Return by promise. 3573 * @throws { BusinessError } 202 - Not system App. 3574 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3575 * 1.Mandatory parameters are left unspecified; 3576 * 2.Incorrect parameter types. 3577 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3578 * @systemapi 3579 * @since 11 3580 */ 3581 setSpatializationEnabled(enable: boolean): Promise<void>; 3582 3583 /** 3584 * Checks whether the spatialization is enabled. 3585 * @returns { boolean } Whether the spatialization is enabled. 3586 * @throws { BusinessError } 202 - Not system App. 3587 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3588 * @systemapi 3589 * @since 11 3590 */ 3591 isSpatializationEnabled(): boolean; 3592 3593 /** 3594 * Subscribes to the spatialization enable state change events. When the spatialization enable state changes, 3595 * registered clients will receive the callback. 3596 * @param { 'spatializationEnabledChange' } type - Type of the event to listen for. 3597 * @param { Callback<boolean> } callback - Callback used to get the spatialization enable state. 3598 * @throws { BusinessError } 202 - Not system App. 3599 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3600 * 1.Mandatory parameters are left unspecified; 3601 * 2.Incorrect parameter types. 3602 * @throws { BusinessError } 6800101 - Parameter verification failed. 3603 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3604 * @systemapi 3605 * @since 11 3606 */ 3607 on(type: 'spatializationEnabledChange', callback: Callback<boolean>): void; 3608 3609 /** 3610 * Unsubscribes to the spatialization enable state change events. 3611 * @param { 'spatializationEnabledChange' } type - Type of the event to listen for. 3612 * @param { Callback<boolean> } callback - Callback used to get the spatialization enable state. 3613 * @throws { BusinessError } 202 - Not system App. 3614 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3615 * 1.Mandatory parameters are left unspecified; 3616 * 2.Incorrect parameter types. 3617 * @throws { BusinessError } 6800101 - Parameter verification failed. 3618 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3619 * @systemapi 3620 * @since 11 3621 */ 3622 off(type: 'spatializationEnabledChange', callback?: Callback<boolean>): void; 3623 3624 /** 3625 * Sets the head tracking enabled or disabled. This method uses an asynchronous callback to return the result. 3626 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 3627 * @param { boolean } enable - Head tracking enable state. 3628 * @param { AsyncCallback<void> } callback - Callback used to return the result. 3629 * @throws { BusinessError } 201 - Permission denied. Return by callback. 3630 * @throws { BusinessError } 202 - Not system App. 3631 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3632 * 1.Mandatory parameters are left unspecified; 3633 * 2.Incorrect parameter types. 3634 * @throws { BusinessError } 6800101 - Parameter verification failed. 3635 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3636 * @systemapi 3637 * @since 11 3638 */ 3639 setHeadTrackingEnabled(enable: boolean, callback: AsyncCallback<void>): void; 3640 /** 3641 * Sets the head tracking enabled or disabled. This method uses a promise to return the result. 3642 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 3643 * @param { boolean } enable - Head tracking enable state. 3644 * @returns { Promise<void> } Promise used to return the result. 3645 * @throws { BusinessError } 201 - Permission denied. Return by promise. 3646 * @throws { BusinessError } 202 - Not system App. 3647 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3648 * 1.Mandatory parameters are left unspecified; 3649 * 2.Incorrect parameter types. 3650 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3651 * @systemapi 3652 * @since 11 3653 */ 3654 setHeadTrackingEnabled(enable: boolean): Promise<void>; 3655 3656 /** 3657 * Checks whether the head tracking is enabled. 3658 * @returns { boolean } Whether the head tracking is enabled. 3659 * @throws { BusinessError } 202 - Not system App. 3660 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3661 * @systemapi 3662 * @since 11 3663 */ 3664 isHeadTrackingEnabled(): boolean; 3665 3666 /** 3667 * Subscribes to the head tracking enable state change events. When the head tracking enable state changes, 3668 * registered clients will receive the callback. 3669 * @param { 'headTrackingEnabledChange' } type - Type of the event to listen for. 3670 * @param { Callback<boolean> } callback - Callback used to get the head tracking enable state. 3671 * @throws { BusinessError } 202 - Not system App. 3672 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3673 * 1.Mandatory parameters are left unspecified; 3674 * 2.Incorrect parameter types. 3675 * @throws { BusinessError } 6800101 - Parameter verification failed. 3676 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3677 * @systemapi 3678 * @since 11 3679 */ 3680 on(type: 'headTrackingEnabledChange', callback: Callback<boolean>): void; 3681 3682 /** 3683 * Unsubscribes to the head tracking enable state change events. 3684 * @param { 'headTrackingEnabledChange' } type - Type of the event to listen for. 3685 * @param { Callback<boolean> } callback - Callback used to get the head tracking enable state. 3686 * @throws { BusinessError } 202 - Not system App. 3687 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3688 * 1.Mandatory parameters are left unspecified; 3689 * 2.Incorrect parameter types. 3690 * @throws { BusinessError } 6800101 - Parameter verification failed. 3691 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3692 * @systemapi 3693 * @since 11 3694 */ 3695 off(type: 'headTrackingEnabledChange', callback?: Callback<boolean>): void; 3696 3697 /** 3698 * Updates the spatial device state. 3699 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 3700 * @param { AudioSpatialDeviceState } spatialDeviceState - Spatial device state. 3701 * @throws { BusinessError } 201 - Permission denied. 3702 * @throws { BusinessError } 202 - Not system App. 3703 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3704 * 1.Mandatory parameters are left unspecified; 3705 * 2.Incorrect parameter types. 3706 * @throws { BusinessError } 6800101 - Parameter verification failed. 3707 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3708 * @systemapi 3709 * @since 11 3710 */ 3711 updateSpatialDeviceState(spatialDeviceState: AudioSpatialDeviceState): void; 3712 3713 /** 3714 * Set spatialization rendering scene type. 3715 * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS 3716 * @param { AudioSpatializationSceneType } spatializationSceneType - Spatialization scene type. 3717 * @throws { BusinessError } 201 - Permission denied. 3718 * @throws { BusinessError } 202 - Not system App. 3719 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3720 * 1.Mandatory parameters are left unspecified; 3721 * 2.Incorrect parameter types. 3722 * @throws { BusinessError } 6800101 - Parameter verification failed. 3723 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3724 * @systemapi 3725 * @since 12 3726 */ 3727 setSpatializationSceneType(spatializationSceneType: AudioSpatializationSceneType): void; 3728 3729 /** 3730 * Get spatialization rendering scene type. 3731 * @returns { AudioSpatializationSceneType } Current spatialization rendering scene type. 3732 * @throws { BusinessError } 202 - Not system App. 3733 * @syscap SystemCapability.Multimedia.Audio.Spatialization 3734 * @systemapi 3735 * @since 12 3736 */ 3737 getSpatializationSceneType(): AudioSpatializationSceneType; 3738 } 3739 3740 /** 3741 * Connect type for device. 3742 * @enum { number } 3743 * @syscap SystemCapability.Multimedia.Audio.Volume 3744 * @systemapi 3745 * @since 9 3746 */ 3747 enum ConnectType { 3748 /** 3749 * Connect type for local device. 3750 * @syscap SystemCapability.Multimedia.Audio.Volume 3751 * @systemapi 3752 * @since 9 3753 */ 3754 CONNECT_TYPE_LOCAL = 1, 3755 3756 /** 3757 * Connect type for distributed device. 3758 * @syscap SystemCapability.Multimedia.Audio.Volume 3759 * @systemapi 3760 * @since 9 3761 */ 3762 CONNECT_TYPE_DISTRIBUTED = 2 3763 } 3764 3765 /** 3766 * Describes an audio volume group. 3767 * @typedef VolumeGroupInfo 3768 * @syscap SystemCapability.Multimedia.Audio.Volume 3769 * @systemapi 3770 * @since 9 3771 */ 3772 interface VolumeGroupInfo { 3773 /** 3774 * Device network id. 3775 * @syscap SystemCapability.Multimedia.Audio.Volume 3776 * @systemapi 3777 * @since 9 3778 */ 3779 readonly networkId: string; 3780 3781 /** 3782 * Volume group id. 3783 * @syscap SystemCapability.Multimedia.Audio.Volume 3784 * @systemapi 3785 * @since 9 3786 */ 3787 readonly groupId: number; 3788 3789 /** 3790 * Volume mapping group id. 3791 * @syscap SystemCapability.Multimedia.Audio.Volume 3792 * @systemapi 3793 * @since 9 3794 */ 3795 readonly mappingId: number; 3796 3797 /** 3798 * Volume group name. 3799 * @syscap SystemCapability.Multimedia.Audio.Volume 3800 * @systemapi 3801 * @since 9 3802 */ 3803 readonly groupName: string; 3804 3805 /** 3806 * Connect type of device for this group. 3807 * @syscap SystemCapability.Multimedia.Audio.Volume 3808 * @systemapi 3809 * @since 9 3810 */ 3811 readonly type: ConnectType; 3812 } 3813 3814 /** 3815 * Array of VolumeGroupInfos, which is read-only. 3816 * @typedef { Array<Readonly<VolumeGroupInfo>> } VolumeGroupInfos 3817 * @syscap SystemCapability.Multimedia.Audio.Volume 3818 * @systemapi 3819 * @since 9 3820 */ 3821 type VolumeGroupInfos = Array<Readonly<VolumeGroupInfo>>; 3822 3823 /** 3824 * Array of AudioRendererChangeInfo, which is read-only. 3825 * @typedef { Array<Readonly<AudioRendererChangeInfo>> } AudioRendererChangeInfoArray 3826 * @syscap SystemCapability.Multimedia.Audio.Renderer 3827 * @since 9 3828 */ 3829 type AudioRendererChangeInfoArray = Array<Readonly<AudioRendererChangeInfo>>; 3830 3831 /** 3832 * Describes audio renderer change information. 3833 * @typedef AudioRendererChangeInfo 3834 * @syscap SystemCapability.Multimedia.Audio.Renderer 3835 * @since 9 3836 */ 3837 interface AudioRendererChangeInfo { 3838 /** 3839 * Audio stream unique id. 3840 * @syscap SystemCapability.Multimedia.Audio.Renderer 3841 * @since 9 3842 */ 3843 readonly streamId: number; 3844 3845 /** 3846 * Uid for audio renderer client application. 3847 * @syscap SystemCapability.Multimedia.Audio.Renderer 3848 * @systemapi 3849 * @since 9 3850 */ 3851 readonly clientUid: number; 3852 3853 /** 3854 * Audio renderer information. 3855 * @syscap SystemCapability.Multimedia.Audio.Renderer 3856 * @since 9 3857 */ 3858 readonly rendererInfo: AudioRendererInfo; 3859 3860 /** 3861 * Audio state. 3862 * @syscap SystemCapability.Multimedia.Audio.Renderer 3863 * @systemapi 3864 * @since 9 3865 */ 3866 readonly rendererState: AudioState; 3867 3868 /** 3869 * Audio output devices. 3870 * @syscap SystemCapability.Multimedia.Audio.Renderer 3871 * @since 9 3872 */ 3873 readonly deviceDescriptors: AudioDeviceDescriptors; 3874 } 3875 3876 /** 3877 * Array of AudioCapturerChangeInfo, which is read-only. 3878 * @typedef { Array<Readonly<AudioCapturerChangeInfo>> } AudioCapturerChangeInfoArray 3879 * @syscap SystemCapability.Multimedia.Audio.Capturer 3880 * @since 9 3881 */ 3882 type AudioCapturerChangeInfoArray = Array<Readonly<AudioCapturerChangeInfo>>; 3883 3884 /** 3885 * Describes audio capturer change information. 3886 * @typedef AudioCapturerChangeInfo 3887 * @syscap SystemCapability.Multimedia.Audio.Capturer 3888 * @since 9 3889 */ 3890 interface AudioCapturerChangeInfo { 3891 /** 3892 * Audio stream unique id. 3893 * @syscap SystemCapability.Multimedia.Audio.Capturer 3894 * @since 9 3895 */ 3896 readonly streamId: number; 3897 3898 /** 3899 * Uid for audio capturer client application. 3900 * @syscap SystemCapability.Multimedia.Audio.Capturer 3901 * @systemapi 3902 * @since 9 3903 */ 3904 readonly clientUid: number; 3905 3906 /** 3907 * Audio capturer information. 3908 * @syscap SystemCapability.Multimedia.Audio.Capturer 3909 * @since 9 3910 */ 3911 readonly capturerInfo: AudioCapturerInfo; 3912 3913 /** 3914 * Audio state. 3915 * @syscap SystemCapability.Multimedia.Audio.Capturer 3916 * @systemapi 3917 * @since 9 3918 */ 3919 readonly capturerState: AudioState; 3920 3921 /** 3922 * Audio input devices. 3923 * @syscap SystemCapability.Multimedia.Audio.Capturer 3924 * @since 9 3925 */ 3926 readonly deviceDescriptors: AudioDeviceDescriptors; 3927 3928 /** 3929 * Audio capturer muted status. 3930 * @syscap SystemCapability.Multimedia.Audio.Capturer 3931 * @since 11 3932 */ 3933 readonly muted?: boolean; 3934 } 3935 3936 /** 3937 * Describes an audio device. 3938 * @typedef AudioDeviceDescriptor 3939 * @syscap SystemCapability.Multimedia.Audio.Device 3940 * @since 7 3941 */ 3942 /** 3943 * Describes an audio device. 3944 * @typedef AudioDeviceDescriptor 3945 * @syscap SystemCapability.Multimedia.Audio.Device 3946 * @atomicservice 3947 * @since 12 3948 */ 3949 interface AudioDeviceDescriptor { 3950 /** 3951 * Audio device role. 3952 * @syscap SystemCapability.Multimedia.Audio.Device 3953 * @since 7 3954 */ 3955 /** 3956 * Audio device role. 3957 * @syscap SystemCapability.Multimedia.Audio.Device 3958 * @atomicservice 3959 * @since 12 3960 */ 3961 readonly deviceRole: DeviceRole; 3962 3963 /** 3964 * Audio device type. 3965 * @syscap SystemCapability.Multimedia.Audio.Device 3966 * @since 7 3967 */ 3968 /** 3969 * Audio device type. 3970 * @syscap SystemCapability.Multimedia.Audio.Device 3971 * @atomicservice 3972 * @since 12 3973 */ 3974 readonly deviceType: DeviceType; 3975 3976 /** 3977 * Audio device id. 3978 * @syscap SystemCapability.Multimedia.Audio.Device 3979 * @since 9 3980 */ 3981 /** 3982 * Audio device id. 3983 * @syscap SystemCapability.Multimedia.Audio.Device 3984 * @atomicservice 3985 * @since 12 3986 */ 3987 readonly id: number; 3988 3989 /** 3990 * Audio device name. 3991 * @syscap SystemCapability.Multimedia.Audio.Device 3992 * @since 9 3993 */ 3994 /** 3995 * Audio device name. 3996 * @syscap SystemCapability.Multimedia.Audio.Device 3997 * @atomicservice 3998 * @since 12 3999 */ 4000 readonly name: string; 4001 4002 /** 4003 * Audio device address. 4004 * @syscap SystemCapability.Multimedia.Audio.Device 4005 * @since 9 4006 */ 4007 /** 4008 * Audio device address. 4009 * @syscap SystemCapability.Multimedia.Audio.Device 4010 * @atomicservice 4011 * @since 12 4012 */ 4013 readonly address: string; 4014 4015 /** 4016 * Supported sampling rates. 4017 * @syscap SystemCapability.Multimedia.Audio.Device 4018 * @since 9 4019 */ 4020 /** 4021 * Supported sampling rates. 4022 * @syscap SystemCapability.Multimedia.Audio.Device 4023 * @atomicservice 4024 * @since 12 4025 */ 4026 readonly sampleRates: Array<number>; 4027 4028 /** 4029 * Supported channel counts. 4030 * @syscap SystemCapability.Multimedia.Audio.Device 4031 * @since 9 4032 */ 4033 /** 4034 * Supported channel counts. 4035 * @syscap SystemCapability.Multimedia.Audio.Device 4036 * @atomicservice 4037 * @since 12 4038 */ 4039 readonly channelCounts: Array<number>; 4040 4041 /** 4042 * Supported channel masks. 4043 * @syscap SystemCapability.Multimedia.Audio.Device 4044 * @since 9 4045 */ 4046 /** 4047 * Supported channel masks. 4048 * @syscap SystemCapability.Multimedia.Audio.Device 4049 * @atomicservice 4050 * @since 12 4051 */ 4052 readonly channelMasks: Array<number>; 4053 /** 4054 * Device network id 4055 * @syscap SystemCapability.Multimedia.Audio.Device 4056 * @systemapi 4057 * @since 9 4058 */ 4059 readonly networkId: string; 4060 /** 4061 * Interrupt group id 4062 * @syscap SystemCapability.Multimedia.Audio.Device 4063 * @systemapi 4064 * @since 9 4065 */ 4066 readonly interruptGroupId: number; 4067 /** 4068 * Volume group id 4069 * @syscap SystemCapability.Multimedia.Audio.Device 4070 * @systemapi 4071 * @since 9 4072 */ 4073 readonly volumeGroupId: number; 4074 /** 4075 * Name used to display, considering distributed device situation. 4076 * @syscap SystemCapability.Multimedia.Audio.Device 4077 * @since 10 4078 */ 4079 /** 4080 * Name used to display, considering distributed device situation. 4081 * @syscap SystemCapability.Multimedia.Audio.Device 4082 * @atomicservice 4083 * @since 12 4084 */ 4085 readonly displayName: string; 4086 4087 /** 4088 * Supported encoding types. 4089 * @syscap SystemCapability.Multimedia.Audio.Core 4090 * @since 11 4091 */ 4092 /** 4093 * Supported encoding types. 4094 * @syscap SystemCapability.Multimedia.Audio.Core 4095 * @atomicservice 4096 * @since 12 4097 */ 4098 readonly encodingTypes?: Array<AudioEncodingType>; 4099 } 4100 4101 /** 4102 * Array of AudioDeviceDescriptors, which is read-only. 4103 * @typedef { Array<Readonly<AudioDeviceDescriptor>> } AudioDeviceDescriptors 4104 * @syscap SystemCapability.Multimedia.Audio.Device 4105 * @since 7 4106 */ 4107 /** 4108 * Array of AudioDeviceDescriptors, which is read-only. 4109 * @typedef { Array<Readonly<AudioDeviceDescriptor>> } AudioDeviceDescriptors 4110 * @syscap SystemCapability.Multimedia.Audio.Device 4111 * @atomicservice 4112 * @since 12 4113 */ 4114 type AudioDeviceDescriptors = Array<Readonly<AudioDeviceDescriptor>>; 4115 4116 /** 4117 * Describes the volume event received by the app when the volume is changed. 4118 * @typedef VolumeEvent 4119 * @syscap SystemCapability.Multimedia.Audio.Volume 4120 * @since 9 4121 */ 4122 interface VolumeEvent { 4123 /** 4124 * Volume type of the current stream. 4125 * @syscap SystemCapability.Multimedia.Audio.Volume 4126 * @since 9 4127 */ 4128 volumeType: AudioVolumeType; 4129 /** 4130 * Volume level. 4131 * @syscap SystemCapability.Multimedia.Audio.Volume 4132 * @since 9 4133 */ 4134 volume: number; 4135 /** 4136 * Whether to show the volume change in UI. 4137 * @syscap SystemCapability.Multimedia.Audio.Volume 4138 * @since 9 4139 */ 4140 updateUi: boolean; 4141 /** 4142 * volumeGroup id 4143 * @syscap SystemCapability.Multimedia.Audio.Volume 4144 * @systemapi 4145 * @since 9 4146 */ 4147 volumeGroupId: number; 4148 /** 4149 * Device network id 4150 * @syscap SystemCapability.Multimedia.Audio.Volume 4151 * @systemapi 4152 * @since 9 4153 */ 4154 networkId: string; 4155 } 4156 4157 /** 4158 * Describes the callback invoked for audio interruption or focus gain events.When the audio of an application 4159 * is interrupted by another application, the callback is invoked to notify the former application. 4160 * @typedef InterruptAction 4161 * @syscap SystemCapability.Multimedia.Audio.Renderer 4162 * @since 7 4163 * @deprecated since 9 4164 * @useinstead ohos.multimedia.audio.InterruptEvent 4165 */ 4166 interface InterruptAction { 4167 4168 /** 4169 * Event type. 4170 * The value TYPE_ACTIVATED means the focus gain event, and TYPE_INTERRUPT means the audio interruption event. 4171 * @syscap SystemCapability.Multimedia.Audio.Renderer 4172 * @since 7 4173 * @deprecated since 9 4174 */ 4175 actionType: InterruptActionType; 4176 4177 /** 4178 * Type of the audio interruption event. 4179 * @syscap SystemCapability.Multimedia.Audio.Renderer 4180 * @since 7 4181 * @deprecated since 9 4182 */ 4183 type?: InterruptType; 4184 4185 /** 4186 * Hint for the audio interruption event. 4187 * @syscap SystemCapability.Multimedia.Audio.Renderer 4188 * @since 7 4189 * @deprecated since 9 4190 */ 4191 hint?: InterruptHint; 4192 4193 /** 4194 * Whether the focus is gained or released. The value true means that the focus is gained or released, 4195 * and false means that the focus fails to be gained or released. 4196 * @syscap SystemCapability.Multimedia.Audio.Renderer 4197 * @since 7 4198 * @deprecated since 9 4199 */ 4200 activated?: boolean; 4201 } 4202 4203 /** 4204 * Describes input parameters of audio listening events. 4205 * @typedef AudioInterrupt 4206 * @syscap SystemCapability.Multimedia.Audio.Renderer 4207 * @since 7 4208 * @deprecated since 9 4209 */ 4210 interface AudioInterrupt { 4211 4212 /** 4213 * Audio stream usage type. 4214 * @syscap SystemCapability.Multimedia.Audio.Renderer 4215 * @since 7 4216 * @deprecated since 9 4217 */ 4218 streamUsage: StreamUsage; 4219 4220 /** 4221 * Type of the media interrupted. 4222 * @syscap SystemCapability.Multimedia.Audio.Renderer 4223 * @since 7 4224 * @deprecated since 9 4225 */ 4226 contentType: ContentType; 4227 4228 /** 4229 * Whether audio playback can be paused when it is interrupted. 4230 * The value true means that audio playback can be paused when it is interrupted, and false means the opposite. 4231 * @syscap SystemCapability.Multimedia.Audio.Renderer 4232 * @since 7 4233 * @deprecated since 9 4234 */ 4235 pauseWhenDucked: boolean; 4236 } 4237 4238 /** 4239 * Describes the microphone state change event received by the app when the microphone state is changed. 4240 * @typedef MicStateChangeEvent 4241 * @syscap SystemCapability.Multimedia.Audio.Device 4242 * @since 9 4243 */ 4244 interface MicStateChangeEvent { 4245 /** 4246 * Mic mute state. 4247 * @syscap SystemCapability.Multimedia.Audio.Device 4248 * @since 9 4249 */ 4250 mute: boolean; 4251 } 4252 /** 4253 * Describes the device change type and device information. 4254 * @typedef DeviceChangeAction 4255 * @syscap SystemCapability.Multimedia.Audio.Device 4256 * @since 7 4257 */ 4258 interface DeviceChangeAction { 4259 /** 4260 * Device change type. 4261 * @syscap SystemCapability.Multimedia.Audio.Device 4262 * @since 7 4263 */ 4264 type: DeviceChangeType; 4265 4266 /** 4267 * Device information. 4268 * @syscap SystemCapability.Multimedia.Audio.Device 4269 * @since 7 4270 */ 4271 deviceDescriptors: AudioDeviceDescriptors; 4272 } 4273 4274 /** 4275 * Enumerates channel blend mode. 4276 * @enum { number } 4277 * @syscap SystemCapability.Multimedia.Audio.Core 4278 * @since 11 4279 */ 4280 enum ChannelBlendMode { 4281 /** 4282 * No channel process. 4283 * @syscap SystemCapability.Multimedia.Audio.Core 4284 * @since 11 4285 */ 4286 MODE_DEFAULT = 0, 4287 /** 4288 * Blend left and right channel. 4289 * @syscap SystemCapability.Multimedia.Audio.Core 4290 * @since 11 4291 */ 4292 MODE_BLEND_LR = 1, 4293 /** 4294 * Replicate left to right channel. 4295 * @syscap SystemCapability.Multimedia.Audio.Core 4296 * @since 11 4297 */ 4298 MODE_ALL_LEFT = 2, 4299 /** 4300 * Replicate right to left channel. 4301 * @syscap SystemCapability.Multimedia.Audio.Core 4302 * @since 11 4303 */ 4304 MODE_ALL_RIGHT = 3, 4305 } 4306 4307 /** 4308 * Enumerates audio stream device change reason. 4309 * @enum {number} 4310 * @syscap SystemCapability.Multimedia.Audio.Device 4311 * @since 11 4312 */ 4313 /** 4314 * Enumerates audio stream device change reason. 4315 * @enum {number} 4316 * @syscap SystemCapability.Multimedia.Audio.Device 4317 * @atomicservice 4318 * @since 12 4319 */ 4320 enum AudioStreamDeviceChangeReason { 4321 /** 4322 * Unknown. 4323 * @syscap SystemCapability.Multimedia.Audio.Device 4324 * @since 11 4325 */ 4326 /** 4327 * Unknown. 4328 * @syscap SystemCapability.Multimedia.Audio.Device 4329 * @atomicservice 4330 * @since 12 4331 */ 4332 REASON_UNKNOWN = 0, 4333 /** 4334 * New device available. 4335 * @syscap SystemCapability.Multimedia.Audio.Device 4336 * @since 11 4337 */ 4338 /** 4339 * New device available. 4340 * @syscap SystemCapability.Multimedia.Audio.Device 4341 * @atomicservice 4342 * @since 12 4343 */ 4344 REASON_NEW_DEVICE_AVAILABLE = 1, 4345 /** 4346 * Old device unavailable. Applications should consider to pause the audio playback when this reason is 4347 * reported. 4348 * @syscap SystemCapability.Multimedia.Audio.Device 4349 * @since 11 4350 */ 4351 /** 4352 * Old device unavailable. Applications should consider to pause the audio playback when this reason is 4353 * reported. 4354 * @syscap SystemCapability.Multimedia.Audio.Device 4355 * @atomicservice 4356 * @since 12 4357 */ 4358 REASON_OLD_DEVICE_UNAVAILABLE = 2, 4359 /** 4360 * Overrode by user or system. 4361 * @syscap SystemCapability.Multimedia.Audio.Device 4362 * @since 11 4363 */ 4364 /** 4365 * Overrode by user or system. 4366 * @syscap SystemCapability.Multimedia.Audio.Device 4367 * @atomicservice 4368 * @since 12 4369 */ 4370 REASON_OVERRODE = 3, 4371 } 4372 /** 4373 * Audio stream device change info. 4374 * @typedef AudioStreamDeviceChangeInfo 4375 * @syscap SystemCapability.Multimedia.Audio.Device 4376 * @since 11 4377 */ 4378 /** 4379 * Audio stream device change info. 4380 * @typedef AudioStreamDeviceChangeInfo 4381 * @syscap SystemCapability.Multimedia.Audio.Device 4382 * @atomicservice 4383 * @since 12 4384 */ 4385 interface AudioStreamDeviceChangeInfo { 4386 /** 4387 * Audio device descriptors after change. 4388 * @type {AudioDeviceDescriptors} 4389 * @syscap SystemCapability.Multimedia.Audio.Device 4390 * @since 11 4391 */ 4392 /** 4393 * Audio device descriptors after change. 4394 * @type {AudioDeviceDescriptors} 4395 * @syscap SystemCapability.Multimedia.Audio.Device 4396 * @atomicservice 4397 * @since 12 4398 */ 4399 devices: AudioDeviceDescriptors; 4400 /** 4401 * Audio stream device change reason. 4402 * @type {AudioStreamDeviceChangeReason} 4403 * @syscap SystemCapability.Multimedia.Audio.Device 4404 * @since 11 4405 */ 4406 /** 4407 * Audio stream device change reason. 4408 * @type {AudioStreamDeviceChangeReason} 4409 * @syscap SystemCapability.Multimedia.Audio.Device 4410 * @atomicservice 4411 * @since 12 4412 */ 4413 changeReason: AudioStreamDeviceChangeReason; 4414 } 4415 4416 /** 4417 * Provides audio playback APIs. 4418 * @typedef AudioRenderer 4419 * @syscap SystemCapability.Multimedia.Audio.Renderer 4420 * @since 8 4421 */ 4422 interface AudioRenderer { 4423 /** 4424 * Defines the current render state. 4425 * @syscap SystemCapability.Multimedia.Audio.Renderer 4426 * @since 8 4427 */ 4428 readonly state: AudioState; 4429 4430 /** 4431 * Obtains the renderer information provided while creating a renderer instance. This method uses an asynchronous 4432 * callback to return the result. 4433 * @param { AsyncCallback<AudioRendererInfo> } callback - Callback used to return the renderer information. 4434 * @syscap SystemCapability.Multimedia.Audio.Renderer 4435 * @since 8 4436 */ 4437 getRendererInfo(callback: AsyncCallback<AudioRendererInfo>): void; 4438 /** 4439 * Obtains the renderer information provided while creating a renderer instance. This method uses a promise to 4440 * return the result. 4441 * @returns { Promise<AudioRendererInfo> } Promise used to return the renderer information. 4442 * @syscap SystemCapability.Multimedia.Audio.Renderer 4443 * @since 8 4444 */ 4445 getRendererInfo(): Promise<AudioRendererInfo>; 4446 /** 4447 * Obtains the renderer information provided while creating a renderer instance. 4448 * @returns { AudioRendererInfo } The renderer information. 4449 * @syscap SystemCapability.Multimedia.Audio.Renderer 4450 * @since 10 4451 */ 4452 getRendererInfoSync(): AudioRendererInfo; 4453 4454 /** 4455 * Obtains the renderer stream information. This method uses an asynchronous callback to return the result. 4456 * @param { AsyncCallback<AudioStreamInfo> } callback - Callback used to return the stream information. 4457 * @syscap SystemCapability.Multimedia.Audio.Renderer 4458 * @since 8 4459 */ 4460 getStreamInfo(callback: AsyncCallback<AudioStreamInfo>): void; 4461 /** 4462 * Obtains the renderer stream information. This method uses a promise to return the result. 4463 * @returns { Promise<AudioStreamInfo> } Promise used to return the stream information. 4464 * @syscap SystemCapability.Multimedia.Audio.Renderer 4465 * @since 8 4466 */ 4467 getStreamInfo(): Promise<AudioStreamInfo>; 4468 /** 4469 * Obtains the renderer stream information. 4470 * @returns { AudioStreamInfo } The stream information. 4471 * @syscap SystemCapability.Multimedia.Audio.Renderer 4472 * @since 10 4473 */ 4474 getStreamInfoSync(): AudioStreamInfo; 4475 4476 /** 4477 * Obtains the renderer stream id. This method uses an asynchronous callback to return the result. 4478 * @param { AsyncCallback<number> } callback - Callback used to return the stream id. 4479 * @syscap SystemCapability.Multimedia.Audio.Renderer 4480 * @since 9 4481 */ 4482 getAudioStreamId(callback: AsyncCallback<number>): void; 4483 /** 4484 * Obtains the renderer stream id. This method uses a promise to return the result. 4485 * @returns { Promise<number> } Promise used to return the stream id. 4486 * @syscap SystemCapability.Multimedia.Audio.Renderer 4487 * @since 9 4488 */ 4489 getAudioStreamId(): Promise<number>; 4490 /** 4491 * Obtains the renderer stream id. 4492 * @returns { number } The stream id. 4493 * @syscap SystemCapability.Multimedia.Audio.Renderer 4494 * @since 10 4495 */ 4496 getAudioStreamIdSync(): number; 4497 4498 /** 4499 * Obtains the current audio effect mode. This method uses an asynchronous callback to return the query result. 4500 * @param { AsyncCallback<AudioEffectMode> } callback - Callback used to return the current audio effect mode. 4501 * @syscap SystemCapability.Multimedia.Audio.Renderer 4502 * @since 10 4503 */ 4504 getAudioEffectMode(callback: AsyncCallback<AudioEffectMode>): void; 4505 /** 4506 * Obtains the current audio effect mode. This method uses a promise to return the query result. 4507 * @returns { Promise<AudioEffectMode> } Promise used to return the current audio effect mode. 4508 * @syscap SystemCapability.Multimedia.Audio.Renderer 4509 * @since 10 4510 */ 4511 getAudioEffectMode(): Promise<AudioEffectMode>; 4512 4513 /** 4514 * Sets the current audio effect mode. This method uses an asynchronous callback to return the result. 4515 * @param { AudioEffectMode } mode - Audio effect mode. 4516 * @param { AsyncCallback<void> } callback - Callback used to return the result. 4517 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4518 * 1.Mandatory parameters are left unspecified; 4519 * 2.Incorrect parameter types. 4520 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. 4521 * @syscap SystemCapability.Multimedia.Audio.Renderer 4522 * @since 10 4523 */ 4524 setAudioEffectMode(mode: AudioEffectMode, callback: AsyncCallback<void>): void; 4525 /** 4526 * Sets the current audio effect mode. This method uses a promise to return the result. 4527 * @param { AudioEffectMode } mode - Audio effect mode. 4528 * @returns { Promise<void> } Promise used to return the result. 4529 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4530 * 1.Mandatory parameters are left unspecified; 4531 * 2.Incorrect parameter types. 4532 * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. 4533 * @syscap SystemCapability.Multimedia.Audio.Renderer 4534 * @since 10 4535 */ 4536 setAudioEffectMode(mode: AudioEffectMode): Promise<void>; 4537 4538 /** 4539 * Starts the renderer. This method uses an asynchronous callback to return the result. 4540 * @param { AsyncCallback<void> } callback - Callback used to return the result. 4541 * @syscap SystemCapability.Multimedia.Audio.Renderer 4542 * @since 8 4543 */ 4544 start(callback: AsyncCallback<void>): void; 4545 /** 4546 * Starts the renderer. This method uses a promise to return the result. 4547 * @returns { Promise<void> } Promise used to return the result. 4548 * @syscap SystemCapability.Multimedia.Audio.Renderer 4549 * @since 8 4550 */ 4551 start(): Promise<void>; 4552 4553 /** 4554 * Writes the buffer. This method uses an asynchronous callback to return the result. 4555 * @param { ArrayBuffer } buffer - Buffer to be written. 4556 * @param { AsyncCallback<number> } callback - Returns the number of bytes written if the operation is successful. 4557 * Returns an error code otherwise. 4558 * @syscap SystemCapability.Multimedia.Audio.Renderer 4559 * @since 8 4560 * @deprecated since 11 4561 * @useinstead ohos.multimedia.audio.AudioRenderer#event:writeData 4562 */ 4563 write(buffer: ArrayBuffer, callback: AsyncCallback<number>): void; 4564 /** 4565 * Writes the buffer. This method uses a promise to return the result. 4566 * @param { ArrayBuffer } buffer - Buffer to be written. 4567 * @returns { Promise<number> } Returns the number of bytes written if the operation is successful. 4568 * Returns an error code otherwise. 4569 * @syscap SystemCapability.Multimedia.Audio.Renderer 4570 * @since 8 4571 * @deprecated since 11 4572 * @useinstead ohos.multimedia.audio.AudioRenderer#event:writeData 4573 */ 4574 write(buffer: ArrayBuffer): Promise<number>; 4575 4576 /** 4577 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses an 4578 * asynchronous callback to return the result. 4579 * @param { AsyncCallback<number> } callback - Callback used to return the timestamp. 4580 * @syscap SystemCapability.Multimedia.Audio.Renderer 4581 * @since 8 4582 */ 4583 getAudioTime(callback: AsyncCallback<number>): void; 4584 /** 4585 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses a 4586 * promise to return the result. 4587 * @returns { Promise<number> } Promise used to return the timestamp. 4588 * @syscap SystemCapability.Multimedia.Audio.Renderer 4589 * @since 8 4590 */ 4591 getAudioTime(): Promise<number>; 4592 /** 4593 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. 4594 * @returns { number } The audio timestamp. 4595 * @syscap SystemCapability.Multimedia.Audio.Renderer 4596 * @since 10 4597 */ 4598 getAudioTimeSync(): number; 4599 4600 /** 4601 * Drains the playback buffer. This method uses an asynchronous callback to return the result. 4602 * @param { AsyncCallback<void> } callback - Callback used to return the result. 4603 * @syscap SystemCapability.Multimedia.Audio.Renderer 4604 * @since 8 4605 */ 4606 drain(callback: AsyncCallback<void>): void; 4607 /** 4608 * Drains the playback buffer. This method uses a promise to return the result. 4609 * @returns { Promise<void> } Promise used to return the result. 4610 * @syscap SystemCapability.Multimedia.Audio.Renderer 4611 * @since 8 4612 */ 4613 drain(): Promise<void>; 4614 4615 /** 4616 * Flushes the playback buffer. This method uses a promise to return the result. 4617 * @returns { Promise<void> } Promise used to return the result. 4618 * @throws { BusinessError } 6800103 - Operation not permit at current state. Return by promise. 4619 * @syscap SystemCapability.Multimedia.Audio.Renderer 4620 * @since 11 4621 */ 4622 flush(): Promise<void>; 4623 4624 /** 4625 * Pauses rendering. This method uses an asynchronous callback to return the result. 4626 * @param { AsyncCallback<void> } callback - Callback used to return the result. 4627 * @syscap SystemCapability.Multimedia.Audio.Renderer 4628 * @since 8 4629 */ 4630 pause(callback: AsyncCallback<void>): void; 4631 /** 4632 * Pauses rendering. This method uses a promise to return the result. 4633 * @returns { Promise<void> } Promise used to return the result. 4634 * @syscap SystemCapability.Multimedia.Audio.Renderer 4635 * @since 8 4636 */ 4637 pause(): Promise<void>; 4638 4639 /** 4640 * Stops rendering. This method uses an asynchronous callback to return the result. 4641 * @param { AsyncCallback<void> } callback - Callback used to return the result. 4642 * @syscap SystemCapability.Multimedia.Audio.Renderer 4643 * @since 8 4644 */ 4645 stop(callback: AsyncCallback<void>): void; 4646 /** 4647 * Stops rendering. This method uses a promise to return the result. 4648 * @returns { Promise<void> } Promise used to return the result. 4649 * @syscap SystemCapability.Multimedia.Audio.Renderer 4650 * @since 8 4651 */ 4652 stop(): Promise<void>; 4653 4654 /** 4655 * Releases the renderer. This method uses an asynchronous callback to return the result. 4656 * @param { AsyncCallback<void> } callback - Callback used to return the result. 4657 * @syscap SystemCapability.Multimedia.Audio.Renderer 4658 * @since 8 4659 */ 4660 release(callback: AsyncCallback<void>): void; 4661 /** 4662 * Releases the renderer. This method uses a promise to return the result. 4663 * @returns { Promise<void> } Promise used to return the result. 4664 * @syscap SystemCapability.Multimedia.Audio.Renderer 4665 * @since 8 4666 */ 4667 release(): Promise<void>; 4668 4669 /** 4670 * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses an asynchronous callback to 4671 * return the result. 4672 * @param { AsyncCallback<number> } callback - Callback used to return the buffer size. 4673 * @syscap SystemCapability.Multimedia.Audio.Renderer 4674 * @since 8 4675 */ 4676 getBufferSize(callback: AsyncCallback<number>): void; 4677 /** 4678 * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses a promise to return the result. 4679 * @returns { Promise<number> } Promise used to return the buffer size. 4680 * @syscap SystemCapability.Multimedia.Audio.Renderer 4681 * @since 8 4682 */ 4683 getBufferSize(): Promise<number>; 4684 /** 4685 * Obtains a reasonable minimum buffer size in bytes for rendering. 4686 * @returns { number } The audio buffer size. 4687 * @syscap SystemCapability.Multimedia.Audio.Renderer 4688 * @since 10 4689 */ 4690 getBufferSizeSync(): number; 4691 4692 /** 4693 * Sets the render rate. This method uses an asynchronous callback to return the result. 4694 * @param { AudioRendererRate } rate - Audio render rate. 4695 * @param { AsyncCallback<void> } callback - Callback used to return the result. 4696 * @syscap SystemCapability.Multimedia.Audio.Renderer 4697 * @since 8 4698 * @deprecated since 11 4699 * @useinstead ohos.multimedia.audio.AudioRenderer#setSpeed 4700 */ 4701 setRenderRate(rate: AudioRendererRate, callback: AsyncCallback<void>): void; 4702 4703 /** 4704 * Sets the render rate. This method uses a promise to return the result. 4705 * @param { AudioRendererRate } rate - Audio render rate. 4706 * @returns { Promise<void> } Promise used to return the result. 4707 * @syscap SystemCapability.Multimedia.Audio.Renderer 4708 * @since 8 4709 * @deprecated since 11 4710 * @useinstead ohos.multimedia.audio.AudioRenderer#setSpeed 4711 */ 4712 setRenderRate(rate: AudioRendererRate): Promise<void>; 4713 4714 /** 4715 * Sets the playback speed. 4716 * @param { number } speed - Audio playback speed. The value type is float, form 0.25 to 4.0. 4717 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4718 * 1.Mandatory parameters are left unspecified; 4719 * 2.Incorrect parameter types. 4720 * @throws { BusinessError } 6800101 - Parameter verification failed. 4721 * @syscap SystemCapability.Multimedia.Audio.Renderer 4722 * @since 11 4723 */ 4724 setSpeed(speed: number): void; 4725 4726 /** 4727 * Obtains the current render rate. This method uses an asynchronous callback to return the result. 4728 * @param { AsyncCallback<AudioRendererRate> } callback - Callback used to return the audio render rate. 4729 * @syscap SystemCapability.Multimedia.Audio.Renderer 4730 * @since 8 4731 * @deprecated since 11 4732 * @useinstead ohos.multimedia.audio.AudioRenderer#getSpeed 4733 */ 4734 getRenderRate(callback: AsyncCallback<AudioRendererRate>): void; 4735 4736 /** 4737 * Obtains the current render rate. This method uses a promise to return the result. 4738 * @returns { Promise<AudioRendererRate> } Promise used to return the audio render rate. 4739 * @syscap SystemCapability.Multimedia.Audio.Renderer 4740 * @since 8 4741 * @deprecated since 11 4742 * @useinstead ohos.multimedia.audio.AudioRenderer#getSpeed 4743 */ 4744 getRenderRate(): Promise<AudioRendererRate>; 4745 4746 /** 4747 * Obtains the current render rate. 4748 * @returns { AudioRendererRate } The audio render rate. 4749 * @syscap SystemCapability.Multimedia.Audio.Renderer 4750 * @since 10 4751 * @deprecated since 11 4752 * @useinstead ohos.multimedia.audio.AudioRenderer#getSpeed 4753 */ 4754 getRenderRateSync(): AudioRendererRate; 4755 4756 /** 4757 * Obtains the current playback speed. 4758 * @returns { number } The playback speed. 4759 * @syscap SystemCapability.Multimedia.Audio.Renderer 4760 * @since 11 4761 */ 4762 getSpeed(): number; 4763 4764 /** 4765 * Set interrupt mode. 4766 * @param { InterruptMode } mode - The interrupt mode. 4767 * @param { AsyncCallback<void> } callback - Callback used to return the result. 4768 * @syscap SystemCapability.Multimedia.Audio.Interrupt 4769 * @since 9 4770 */ 4771 setInterruptMode(mode: InterruptMode, callback: AsyncCallback<void>): void; 4772 /** 4773 * Set interrupt mode. 4774 * @param { InterruptMode } mode - The interrupt mode. 4775 * @returns { Promise<void> } Promise used to return the result. 4776 * @syscap SystemCapability.Multimedia.Audio.Interrupt 4777 * @since 9 4778 */ 4779 setInterruptMode(mode: InterruptMode): Promise<void>; 4780 /** 4781 * Set interrupt mode. 4782 * @param { InterruptMode } mode - The interrupt mode. 4783 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4784 * 1.Mandatory parameters are left unspecified; 4785 * 2.Incorrect parameter types. 4786 * @throws { BusinessError } 6800101 - Parameter verification failed. 4787 * @syscap SystemCapability.Multimedia.Audio.Interrupt 4788 * @since 10 4789 */ 4790 setInterruptModeSync(mode: InterruptMode): void; 4791 4792 /** 4793 * Sets the volume for this stream. This method uses an asynchronous callback to return the result. 4794 * @param { number } volume - Volume to set. The value type is float, form 0.0 to 1.0. 4795 * @param { AsyncCallback<void> } callback - Callback used to return the result. 4796 * @syscap SystemCapability.Multimedia.Audio.Renderer 4797 * @since 9 4798 */ 4799 setVolume(volume: number, callback: AsyncCallback<void>): void; 4800 /** 4801 * Sets the volume for a stream. This method uses a promise to return the result. 4802 * @param { number } volume - Volume to set. The value type is float, form 0.0 to 1.0. 4803 * @returns { Promise<void> } Promise used to return the result. 4804 * @syscap SystemCapability.Multimedia.Audio.Renderer 4805 * @since 9 4806 */ 4807 setVolume(volume: number): Promise<void>; 4808 4809 /** 4810 * Gets volume of this stream. 4811 * @returns { number } Returns one float value. 4812 * @syscap SystemCapability.Multimedia.Audio.Renderer 4813 * @since 12 4814 */ 4815 getVolume(): number; 4816 4817 /** 4818 * Changes the volume with ramp for a duration. 4819 * @param { number } volume - Volume to set. The value type is float, form 0.0 to 1.0. 4820 * @param { number } duration - Duration for volume ramp, in millisecond. 4821 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4822 * 1.Mandatory parameters are left unspecified; 4823 * 2.Incorrect parameter types. 4824 * @throws { BusinessError } 6800101 - Parameter verification failed. 4825 * @syscap SystemCapability.Multimedia.Audio.Renderer 4826 * @since 11 4827 */ 4828 setVolumeWithRamp(volume: number, duration: number): void; 4829 4830 /** 4831 * Gets the min volume this stream can set. This method uses an asynchronous callback to return the result. 4832 * @param { AsyncCallback<number> } callback - Callback used to return the result. 4833 * @syscap SystemCapability.Multimedia.Audio.Renderer 4834 * @since 10 4835 */ 4836 getMinStreamVolume(callback: AsyncCallback<number>): void; 4837 /** 4838 * Gets the min volume this stream can set. This method uses a promise to return the result. 4839 * @returns { Promise<number> } Promise used to return the result. 4840 * @syscap SystemCapability.Multimedia.Audio.Renderer 4841 * @since 10 4842 */ 4843 getMinStreamVolume(): Promise<number>; 4844 /** 4845 * Gets the min volume this stream can set. 4846 * @returns { number } Min stream volume. 4847 * @syscap SystemCapability.Multimedia.Audio.Renderer 4848 * @since 10 4849 */ 4850 getMinStreamVolumeSync(): number; 4851 4852 /** 4853 * Gets the max volume this stream can set. This method uses an asynchronous callback to return the result. 4854 * @param { AsyncCallback<number> } callback - Callback used to return the result. 4855 * @syscap SystemCapability.Multimedia.Audio.Renderer 4856 * @since 10 4857 */ 4858 getMaxStreamVolume(callback: AsyncCallback<number>): void; 4859 /** 4860 * Gets the max volume this stream can set. This method uses a promise to return the result. 4861 * @returns { Promise<number> } Promise used to return the result. 4862 * @syscap SystemCapability.Multimedia.Audio.Renderer 4863 * @since 10 4864 */ 4865 getMaxStreamVolume(): Promise<number>; 4866 /** 4867 * Gets the max volume this stream can set. 4868 * @returns { number } Max stream volume. 4869 * @syscap SystemCapability.Multimedia.Audio.Renderer 4870 * @since 10 4871 */ 4872 getMaxStreamVolumeSync(): number; 4873 4874 /** 4875 * Gets buffer underflow count. This method uses an asynchronous callback to return the result. 4876 * @param { AsyncCallback<number> } callback - Callback used to return the result. 4877 * @syscap SystemCapability.Multimedia.Audio.Renderer 4878 * @since 10 4879 */ 4880 getUnderflowCount(callback: AsyncCallback<number>): void; 4881 /** 4882 * Gets buffer underflow count. This method uses a promise to return the result. 4883 * @returns { Promise<number> } Promise used to return the result. 4884 * @syscap SystemCapability.Multimedia.Audio.Renderer 4885 * @since 10 4886 */ 4887 getUnderflowCount(): Promise<number>; 4888 /** 4889 * Gets buffer underflow count. 4890 * @returns { number } Underflow count number. 4891 * @syscap SystemCapability.Multimedia.Audio.Renderer 4892 * @since 10 4893 */ 4894 getUnderflowCountSync(): number; 4895 4896 /** 4897 * Gets the output device or devices for this stream. 4898 * This method uses an asynchronous callback to return the result. 4899 * @param { AsyncCallback<AudioDeviceDescriptors> } callback - Callback used to return the result. 4900 * @syscap SystemCapability.Multimedia.Audio.Device 4901 * @since 10 4902 */ 4903 getCurrentOutputDevices(callback: AsyncCallback<AudioDeviceDescriptors>): void; 4904 /** 4905 * Gets the output device or devices for this stream. 4906 * This method uses a promise to return the result. 4907 * @returns { Promise<AudioDeviceDescriptors> } Promise used to return the result. 4908 * @syscap SystemCapability.Multimedia.Audio.Device 4909 * @since 10 4910 */ 4911 getCurrentOutputDevices(): Promise<AudioDeviceDescriptors>; 4912 /** 4913 * Gets the output device or devices for this stream. 4914 * @returns { AudioDeviceDescriptors } Output device or devices. 4915 * @syscap SystemCapability.Multimedia.Audio.Device 4916 * @since 10 4917 */ 4918 getCurrentOutputDevicesSync(): AudioDeviceDescriptors; 4919 4920 /** 4921 * Sets channel blend mode for this stream. 4922 * @param { ChannelBlendMode } mode - Target channel blend mode. 4923 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4924 * 1.Mandatory parameters are left unspecified; 4925 * 2.Incorrect parameter types. 4926 * @throws { BusinessError } 6800101 - Parameter verification failed. 4927 * @throws { BusinessError } 6800103 - Operation not permit at current state. 4928 * @syscap SystemCapability.Multimedia.Audio.Renderer 4929 * @since 11 4930 */ 4931 setChannelBlendMode(mode: ChannelBlendMode): void; 4932 4933 /** 4934 * Listens for audio interrupt events. This method uses a callback to get interrupt events. The interrupt event is 4935 * triggered when audio playback is interrupted. 4936 * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. 4937 * @param { Callback<InterruptEvent> } callback - Callback used to listen for interrupt callback. 4938 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4939 * 1.Mandatory parameters are left unspecified; 4940 * 2.Incorrect parameter types. 4941 * @throws { BusinessError } 6800101 - Parameter verification failed. 4942 * @syscap SystemCapability.Multimedia.Audio.Interrupt 4943 * @since 9 4944 */ 4945 on(type: 'audioInterrupt', callback: Callback<InterruptEvent>): void; 4946 4947 /** 4948 * Subscribes to mark reached events. When the number of frames rendered reaches the value of the frame parameter, 4949 * the callback is invoked. 4950 * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. 4951 * @param { number } frame - Number of frames to trigger the event. The value must be greater than 0. 4952 * @param { Callback<number> } callback - Callback invoked when the event is triggered. 4953 * @syscap SystemCapability.Multimedia.Audio.Renderer 4954 * @since 8 4955 */ 4956 on(type: 'markReach', frame: number, callback: Callback<number>): void; 4957 /** 4958 * Unsubscribes from mark reached events. 4959 * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. 4960 * @syscap SystemCapability.Multimedia.Audio.Renderer 4961 * @since 8 4962 */ 4963 off(type: 'markReach'): void; 4964 4965 /** 4966 * Subscribes to period reached events. When the period of frame rendering reaches the value of frame parameter, 4967 * the callback is invoked. 4968 * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. 4969 * @param { number } frame - Period during which frame rendering is listened. The value must be greater than 0. 4970 * @param { Callback<number> } callback - Callback invoked when the event is triggered. 4971 * @syscap SystemCapability.Multimedia.Audio.Renderer 4972 * @since 8 4973 */ 4974 on(type: 'periodReach', frame: number, callback: Callback<number>): void; 4975 /** 4976 * Unsubscribes from period reached events. 4977 * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. 4978 * @syscap SystemCapability.Multimedia.Audio.Renderer 4979 * @since 8 4980 */ 4981 off(type: 'periodReach'): void; 4982 4983 /** 4984 * Subscribes audio state change event callback. 4985 * @param { 'stateChange' } type - Type of the event to listen for. Only the stateChange event is supported. 4986 * @param { Callback<AudioState> } callback - Callback invoked when state change. 4987 * @syscap SystemCapability.Multimedia.Audio.Renderer 4988 * @since 8 4989 */ 4990 on(type: 'stateChange', callback: Callback<AudioState>): void; 4991 4992 /** 4993 * Subscribes output device change event callback. 4994 * The event is triggered when output device change for this stream. 4995 * @param { 'outputDeviceChange' } type - Type of the event to listen for. 4996 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to listen device change event. 4997 * @throws { BusinessError } 401 - Parameter error. Possible causes: 4998 * 1.Mandatory parameters are left unspecified; 4999 * 2.Incorrect parameter types. 5000 * @throws { BusinessError } 6800101 - Parameter verification failed. 5001 * @syscap SystemCapability.Multimedia.Audio.Device 5002 * @since 10 5003 */ 5004 on(type: 'outputDeviceChange', callback: Callback<AudioDeviceDescriptors>): void; 5005 5006 /** 5007 * Subscribes output device change event callback. 5008 * The event is triggered when output device change for this stream. 5009 * @param { 'outputDeviceChangeWithInfo' } type - Type of the event to listen for. 5010 * @param { Callback<AudioStreamDeviceChangeInfo> } callback - Callback used to listen device change event. 5011 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5012 * 1.Mandatory parameters are left unspecified; 5013 * 2.Incorrect parameter types. 5014 * @throws { BusinessError } 6800101 - Parameter verification failed. 5015 * @syscap SystemCapability.Multimedia.Audio.Device 5016 * @since 11 5017 */ 5018 on(type: 'outputDeviceChangeWithInfo', callback: Callback<AudioStreamDeviceChangeInfo>): void; 5019 5020 /** 5021 * Unsubscribes output device change event callback. 5022 * @param { 'outputDeviceChange' } type - Type of the event to listen for. 5023 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used in subscribe. 5024 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5025 * 1.Mandatory parameters are left unspecified; 5026 * 2.Incorrect parameter types. 5027 * @throws { BusinessError } 6800101 - Parameter verification failed. 5028 * @syscap SystemCapability.Multimedia.Audio.Device 5029 * @since 10 5030 */ 5031 off(type: 'outputDeviceChange', callback?: Callback<AudioDeviceDescriptors>): void; 5032 5033 /** 5034 * Unsubscribes output device change event callback. 5035 * @param { 'outputDeviceChangeWithInfo' } type - Type of the event to listen for. 5036 * @param { Callback<AudioStreamDeviceChangeInfo> } callback - Callback used in subscribe. 5037 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5038 * 1.Mandatory parameters are left unspecified; 5039 * 2.Incorrect parameter types. 5040 * @throws { BusinessError } 6800101 - Parameter verification failed. 5041 * @syscap SystemCapability.Multimedia.Audio.Device 5042 * @since 11 5043 */ 5044 off(type: 'outputDeviceChangeWithInfo', callback?: Callback<AudioStreamDeviceChangeInfo>): void; 5045 5046 /** 5047 * Subscribes audio data callback. 5048 * The event is triggered when audio buffer is available for writing more data. 5049 * @param { 'writeData' } type - Type of the event to listen for. 5050 * @param { Callback<ArrayBuffer> } callback - Callback with buffer to write. 5051 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5052 * 1.Mandatory parameters are left unspecified; 5053 * 2.Incorrect parameter types. 5054 * @throws { BusinessError } 6800101 - Parameter verification failed. 5055 * @syscap SystemCapability.Multimedia.Audio.Renderer 5056 * @since 11 5057 */ 5058 on(type: 'writeData', callback: Callback<ArrayBuffer>): void; 5059 5060 /** 5061 * Unsubscribes audio data callback. 5062 * @param { 'writeData' } type - Type of the event to listen for. 5063 * @param { Callback<ArrayBuffer> } callback - Callback used in subscribe. 5064 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5065 * 1.Mandatory parameters are left unspecified; 5066 * 2.Incorrect parameter types. 5067 * @throws { BusinessError } 6800101 - Parameter verification failed. 5068 * @syscap SystemCapability.Multimedia.Audio.Renderer 5069 * @since 11 5070 */ 5071 off(type: 'writeData', callback?: Callback<ArrayBuffer>): void; 5072 } 5073 5074 /** 5075 * Enumerates source types. 5076 * @enum { number } 5077 * @syscap SystemCapability.Multimedia.Audio.Core 5078 * @since 8 5079 */ 5080 enum SourceType { 5081 /** 5082 * Invalid source type. 5083 * @syscap SystemCapability.Multimedia.Audio.Core 5084 * @since 8 5085 */ 5086 SOURCE_TYPE_INVALID = -1, 5087 /** 5088 * Mic source type. 5089 * @syscap SystemCapability.Multimedia.Audio.Core 5090 * @since 8 5091 */ 5092 SOURCE_TYPE_MIC = 0, 5093 /** 5094 * Voice recognition source type. 5095 * @syscap SystemCapability.Multimedia.Audio.Core 5096 * @since 9 5097 */ 5098 SOURCE_TYPE_VOICE_RECOGNITION = 1, 5099 /** 5100 * Playback capture source type. 5101 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 5102 * @since 10 5103 * @deprecated since 12 5104 * @useinstead OH_AVScreenCapture in native interface. 5105 */ 5106 SOURCE_TYPE_PLAYBACK_CAPTURE = 2, 5107 /** 5108 * Wakeup source type. 5109 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 5110 * @syscap SystemCapability.Multimedia.Audio.Core 5111 * @systemapi 5112 * @since 10 5113 */ 5114 SOURCE_TYPE_WAKEUP = 3, 5115 5116 /** 5117 * Voice call source type. 5118 * @permission ohos.permission.RECORD_VOICE_CALL 5119 * @syscap SystemCapability.Multimedia.Audio.Core 5120 * @systemapi 5121 * @since 11 5122 */ 5123 SOURCE_TYPE_VOICE_CALL = 4, 5124 5125 /** 5126 * Voice communication source type. 5127 * @syscap SystemCapability.Multimedia.Audio.Core 5128 * @since 8 5129 */ 5130 SOURCE_TYPE_VOICE_COMMUNICATION = 7, 5131 5132 /** 5133 * Voice message source type. 5134 * @syscap SystemCapability.Multimedia.Audio.Core 5135 * @since 12 5136 */ 5137 SOURCE_TYPE_VOICE_MESSAGE = 10, 5138 } 5139 5140 /** 5141 * Describes audio capturer information. 5142 * @typedef AudioCapturerInfo 5143 * @syscap SystemCapability.Multimedia.Audio.Core 5144 * @since 8 5145 */ 5146 interface AudioCapturerInfo { 5147 /** 5148 * Audio source type. 5149 * @syscap SystemCapability.Multimedia.Audio.Core 5150 * @since 8 5151 */ 5152 source: SourceType; 5153 /** 5154 * Audio capturer flags. 5155 * @syscap SystemCapability.Multimedia.Audio.Core 5156 * @since 8 5157 */ 5158 capturerFlags: number; 5159 } 5160 5161 /** 5162 * Describes audio capturer configuration options. 5163 * @typedef AudioCapturerOptions 5164 * @syscap SystemCapability.Multimedia.Audio.Capturer 5165 * @since 8 5166 */ 5167 interface AudioCapturerOptions { 5168 /** 5169 * Stream information. 5170 * @syscap SystemCapability.Multimedia.Audio.Capturer 5171 * @since 8 5172 */ 5173 streamInfo: AudioStreamInfo; 5174 /** 5175 * Capturer information. 5176 * @syscap SystemCapability.Multimedia.Audio.Capturer 5177 * @since 8 5178 */ 5179 capturerInfo: AudioCapturerInfo; 5180 /** 5181 * Playback capture config. 5182 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 5183 * @since 10 5184 * @deprecated since 12 5185 * @useinstead OH_AVScreenCapture in native interface. 5186 */ 5187 playbackCaptureConfig?: AudioPlaybackCaptureConfig; 5188 } 5189 5190 /** 5191 * Describe playback capture filtering options 5192 * @typedef CaptureFilterOptions 5193 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 5194 * @since 10 5195 * @deprecated since 12 5196 * @useinstead OH_AVScreenCapture in native interface. 5197 */ 5198 interface CaptureFilterOptions { 5199 /** 5200 * Filter by stream usages. If you want to capture voice streams, additional permission is needed. 5201 * @permission ohos.permission.CAPTURE_VOICE_DOWNLINK_AUDIO 5202 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 5203 * @since 10 5204 */ 5205 /** 5206 * Filter by stream usages. But not allow to capture voice streams. 5207 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 5208 * @since 11 5209 * @deprecated since 12 5210 * @useinstead OH_AVScreenCapture in native interface. 5211 */ 5212 usages: Array<StreamUsage>; 5213 } 5214 5215 /** 5216 * Describe playback capture config object. 5217 * @typedef AudioPlaybackCaptureConfig 5218 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 5219 * @since 10 5220 * @deprecated since 12 5221 * @useinstead OH_AVScreenCapture in native interface. 5222 */ 5223 interface AudioPlaybackCaptureConfig { 5224 /** 5225 * Add filter options to decide which streams to be captured. 5226 * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture 5227 * @since 10 5228 * @deprecated since 12 5229 * @useinstead OH_AVScreenCapture in native interface. 5230 */ 5231 filterOptions: CaptureFilterOptions; 5232 } 5233 5234 /** 5235 * Provides APIs for audio recording. 5236 * @typedef AudioCapturer 5237 * @syscap SystemCapability.Multimedia.Audio.Capturer 5238 * @since 8 5239 */ 5240 interface AudioCapturer { 5241 /** 5242 * Defines the current capture state. 5243 * @syscap SystemCapability.Multimedia.Audio.Capturer 5244 * @since 8 5245 */ 5246 readonly state: AudioState; 5247 5248 /** 5249 * Obtains the capturer information provided while creating a capturer instance. This method uses an asynchronous 5250 * callback to return the result. 5251 * @param { AsyncCallback<AudioCapturerInfo> } callback - Callback used to return the capturer information. 5252 * @syscap SystemCapability.Multimedia.Audio.Capturer 5253 * @since 8 5254 */ 5255 getCapturerInfo(callback: AsyncCallback<AudioCapturerInfo>): void; 5256 /** 5257 * Obtains the capturer information provided while creating a capturer instance. This method uses a promise to 5258 * return the result. 5259 * @returns { Promise<AudioCapturerInfo> } Promise used to return the capturer information. 5260 * @syscap SystemCapability.Multimedia.Audio.Capturer 5261 * @since 8 5262 */ 5263 getCapturerInfo(): Promise<AudioCapturerInfo>; 5264 /** 5265 * Obtains the capturer information provided while creating a capturer instance. 5266 * @returns { AudioCapturerInfo } The capturer information. 5267 * @syscap SystemCapability.Multimedia.Audio.Capturer 5268 * @since 10 5269 */ 5270 getCapturerInfoSync(): AudioCapturerInfo; 5271 5272 /** 5273 * Obtains the capturer stream information. This method uses an asynchronous callback to return the result. 5274 * @param { AsyncCallback<AudioStreamInfo> } callback - Callback used to return the stream information. 5275 * @syscap SystemCapability.Multimedia.Audio.Capturer 5276 * @since 8 5277 */ 5278 getStreamInfo(callback: AsyncCallback<AudioStreamInfo>): void; 5279 /** 5280 * Obtains the capturer stream information. This method uses a promise to return the result. 5281 * @returns { Promise<AudioStreamInfo> } Promise used to return the stream information. 5282 * @syscap SystemCapability.Multimedia.Audio.Capturer 5283 * @since 8 5284 */ 5285 getStreamInfo(): Promise<AudioStreamInfo>; 5286 /** 5287 * Obtains the capturer stream information. 5288 * @returns { AudioStreamInfo } The stream information. 5289 * @syscap SystemCapability.Multimedia.Audio.Capturer 5290 * @since 10 5291 */ 5292 getStreamInfoSync(): AudioStreamInfo; 5293 5294 /** 5295 * Obtains the capturer stream id. This method uses an asynchronous callback to return the result. 5296 * @param { AsyncCallback<number> } callback - Callback used to return the stream id. 5297 * @syscap SystemCapability.Multimedia.Audio.Capturer 5298 * @since 9 5299 */ 5300 getAudioStreamId(callback: AsyncCallback<number>): void; 5301 /** 5302 * Obtains the capturer stream id. This method uses a promise to return the result. 5303 * @returns { Promise<number> } Promise used to return the stream id. 5304 * @syscap SystemCapability.Multimedia.Audio.Capturer 5305 * @since 9 5306 */ 5307 getAudioStreamId(): Promise<number>; 5308 /** 5309 * Obtains the capturer stream id. 5310 * @returns { number } The stream id. 5311 * @syscap SystemCapability.Multimedia.Audio.Capturer 5312 * @since 10 5313 */ 5314 getAudioStreamIdSync(): number; 5315 5316 /** 5317 * Starts capturing. This method uses an asynchronous callback to return the result. 5318 * @param { AsyncCallback<void> } callback - Callback used to return the result. 5319 * @syscap SystemCapability.Multimedia.Audio.Capturer 5320 * @since 8 5321 */ 5322 start(callback: AsyncCallback<void>): void; 5323 /** 5324 * Starts capturing. This method uses a promise to return the result. 5325 * @returns { Promise<void> } Promise used to return the result. 5326 * @syscap SystemCapability.Multimedia.Audio.Capturer 5327 * @since 8 5328 */ 5329 start(): Promise<void>; 5330 5331 /** 5332 * Reads the buffer from the audio capturer. This method uses an asynchronous callback to return the result. 5333 * @param { number } size - Number of bytes to read. 5334 * @param { boolean } isBlockingRead - Whether the read operation should be blocked. 5335 * @param { AsyncCallback<ArrayBuffer> } callback - Callback used to return the buffer. 5336 * @syscap SystemCapability.Multimedia.Audio.Capturer 5337 * @since 8 5338 * @deprecated since 11 5339 * @useinstead ohos.multimedia.audio.AudioCapturer#event:readData 5340 */ 5341 read(size: number, isBlockingRead: boolean, callback: AsyncCallback<ArrayBuffer>): void; 5342 /** 5343 * Reads the buffer from the audio capturer. This method uses a promise to return the result. 5344 * @param { number } size - Number of bytes to read. 5345 * @param { boolean } isBlockingRead - Whether the read operation should be blocked. 5346 * @returns { Promise<ArrayBuffer> } Returns the buffer data read if the operation is successful. 5347 * Returns an error code otherwise. 5348 * @syscap SystemCapability.Multimedia.Audio.Capturer 5349 * @since 8 5350 * @deprecated since 11 5351 * @useinstead ohos.multimedia.audio.AudioCapturer#event:readData 5352 */ 5353 read(size: number, isBlockingRead: boolean): Promise<ArrayBuffer>; 5354 5355 /** 5356 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses an 5357 * asynchronous callback to return the result. 5358 * @param { AsyncCallback<number> } callback - Callback used to return the timestamp. 5359 * @syscap SystemCapability.Multimedia.Audio.Capturer 5360 * @since 8 5361 */ 5362 getAudioTime(callback: AsyncCallback<number>): void; 5363 /** 5364 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses a 5365 * promise to return the result. 5366 * @returns { Promise<number> } Promise used to return the timestamp. 5367 * @syscap SystemCapability.Multimedia.Audio.Capturer 5368 * @since 8 5369 */ 5370 getAudioTime(): Promise<number>; 5371 /** 5372 * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. 5373 * @returns { number } The audio timestamp. 5374 * @syscap SystemCapability.Multimedia.Audio.Capturer 5375 * @since 10 5376 */ 5377 getAudioTimeSync(): number; 5378 5379 /** 5380 * Stops capturing. This method uses an asynchronous callback to return the result. 5381 * @param { AsyncCallback<void> } callback - Callback used to return the result. 5382 * @syscap SystemCapability.Multimedia.Audio.Capturer 5383 * @since 8 5384 */ 5385 stop(callback: AsyncCallback<void>): void; 5386 /** 5387 * Stops capturing. This method uses a promise to return the result. 5388 * @returns { Promise<void> } Promise used to return the result. 5389 * @syscap SystemCapability.Multimedia.Audio.Capturer 5390 * @since 8 5391 */ 5392 stop(): Promise<void>; 5393 5394 /** 5395 * Releases the capturer. This method uses an asynchronous callback to return the result. 5396 * @param { AsyncCallback<void> } callback - Callback used to return the result. 5397 * @syscap SystemCapability.Multimedia.Audio.Capturer 5398 * @since 8 5399 */ 5400 release(callback: AsyncCallback<void>): void; 5401 /** 5402 * Releases the capturer. This method uses a promise to return the result. 5403 * @returns { Promise<void> } - Promise used to return the result. 5404 * @syscap SystemCapability.Multimedia.Audio.Capturer 5405 * @since 8 5406 */ 5407 release(): Promise<void>; 5408 5409 /** 5410 * Obtains a reasonable minimum buffer size in bytes for capturing. This method uses an asynchronous callback to 5411 * return the result. 5412 * @param { AsyncCallback<number> } callback - Callback used to return the buffer size. 5413 * @syscap SystemCapability.Multimedia.Audio.Capturer 5414 * @since 8 5415 */ 5416 getBufferSize(callback: AsyncCallback<number>): void; 5417 /** 5418 * Obtains a reasonable minimum buffer size in bytes for capturing. This method uses a promise to return the result. 5419 * @returns { Promise<number> } Promise used to return the buffer size. 5420 * @syscap SystemCapability.Multimedia.Audio.Capturer 5421 * @since 8 5422 */ 5423 getBufferSize(): Promise<number>; 5424 /** 5425 * Obtains a reasonable minimum buffer size in bytes for capturing. 5426 * @returns { number } Promise used to return the buffer size. 5427 * @syscap SystemCapability.Multimedia.Audio.Capturer 5428 * @since 10 5429 */ 5430 getBufferSizeSync(): number; 5431 5432 /** 5433 * Gets the input device or devices for this stream. 5434 * @returns { AudioDeviceDescriptors } Descriptors of input devices. 5435 * @syscap SystemCapability.Multimedia.Audio.Device 5436 * @since 11 5437 */ 5438 getCurrentInputDevices(): AudioDeviceDescriptors; 5439 5440 /** 5441 * Gets full capturer info for this stream. 5442 * @returns { AudioCapturerChangeInfo } Full capture info. 5443 * @syscap SystemCapability.Multimedia.Audio.Device 5444 * @since 11 5445 */ 5446 getCurrentAudioCapturerChangeInfo(): AudioCapturerChangeInfo; 5447 5448 /** 5449 * Gets overflow count. 5450 * @returns { Promise<number> } - Promise used to return the result. 5451 * @syscap SystemCapability.Multimedia.Audio.Capturer 5452 * @since 12 5453 */ 5454 getOverflowCount(): Promise<number> 5455 5456 /** 5457 * Gets overflow count. 5458 * @returns { number } Overflow count number. 5459 * @syscap SystemCapability.Multimedia.Audio.Capturer 5460 * @since 12 5461 */ 5462 getOverflowCountSync(): number; 5463 5464 /** 5465 * Subscribes to mark reached events. When the number of frames captured reaches the value of the frame parameter, 5466 * the callback is invoked. 5467 * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. 5468 * @param { number } frame - Number of frames to trigger the event. The value must be greater than 0. 5469 * @param { Callback<number> } callback - Callback invoked when the event is triggered. 5470 * @syscap SystemCapability.Multimedia.Audio.Capturer 5471 * @since 8 5472 */ 5473 on(type: 'markReach', frame: number, callback: Callback<number>): void; 5474 /** 5475 * Unsubscribes from the mark reached events. 5476 * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. 5477 * @syscap SystemCapability.Multimedia.Audio.Capturer 5478 * @since 8 5479 */ 5480 off(type: 'markReach'): void; 5481 5482 /** 5483 * Subscribes to period reached events. When the period of frame capturing reaches the value of frame parameter, 5484 * the callback is invoked. 5485 * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. 5486 * @param { number } frame - Period during which frame capturing is listened. The value must be greater than 0. 5487 * @param { Callback<number> } callback - Callback invoked when the event is triggered. 5488 * @syscap SystemCapability.Multimedia.Audio.Capturer 5489 * @since 8 5490 */ 5491 on(type: 'periodReach', frame: number, callback: Callback<number>): void; 5492 /** 5493 * Unsubscribes from period reached events. 5494 * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. 5495 * @syscap SystemCapability.Multimedia.Audio.Capturer 5496 * @since 8 5497 */ 5498 off(type: 'periodReach'): void; 5499 5500 /** 5501 * Subscribes audio state change event callback. 5502 * @param { 'stateChange' } type - Type of the event to listen for. Only the stateChange event is supported. 5503 * @param { Callback<AudioState> } callback - Callback used to listen for the audio state change event. 5504 * @syscap SystemCapability.Multimedia.Audio.Capturer 5505 * @since 8 5506 */ 5507 on(type: 'stateChange', callback: Callback<AudioState>): void; 5508 5509 /** 5510 * Listens for audio interrupt events. This method uses a callback to get interrupt events. The interrupt event is 5511 * triggered when audio recording is interrupted. 5512 * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. 5513 * @param { Callback<InterruptEvent> } callback - Callback used to listen for interrupt callback. 5514 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5515 * 1.Mandatory parameters are left unspecified; 5516 * 2.Incorrect parameter types. 5517 * @throws { BusinessError } 6800101 - Parameter verification failed. 5518 * @syscap SystemCapability.Multimedia.Audio.Interrupt 5519 * @since 10 5520 */ 5521 on(type: 'audioInterrupt', callback: Callback<InterruptEvent>): void; 5522 5523 /** 5524 * UnSubscribes to audio interrupt events. 5525 * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. 5526 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5527 * 1.Mandatory parameters are left unspecified; 5528 * 2.Incorrect parameter types. 5529 * @throws { BusinessError } 6800101 - Parameter verification failed. 5530 * @syscap SystemCapability.Multimedia.Audio.Interrupt 5531 * @since 10 5532 */ 5533 off(type: 'audioInterrupt'): void; 5534 5535 /** 5536 * Subscribes input device change event callback. 5537 * The event is triggered when input device change for this stream. 5538 * @param { 'inputDeviceChange' } type - Type of the event to listen for. 5539 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used to listen device change event. 5540 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5541 * 1.Mandatory parameters are left unspecified; 5542 * 2.Incorrect parameter types. 5543 * @throws { BusinessError } 6800101 - Parameter verification failed. 5544 * @syscap SystemCapability.Multimedia.Audio.Device 5545 * @since 11 5546 */ 5547 on(type: 'inputDeviceChange', callback: Callback<AudioDeviceDescriptors>): void; 5548 /** 5549 * Unsubscribes input device change event callback. 5550 * @param { 'inputDeviceChange' } type - Type of the event to listen for. 5551 * @param { Callback<AudioDeviceDescriptors> } callback - Callback used in subscribe. 5552 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5553 * 1.Mandatory parameters are left unspecified; 5554 * 2.Incorrect parameter types. 5555 * @throws { BusinessError } 6800101 - Parameter verification failed. 5556 * @syscap SystemCapability.Multimedia.Audio.Device 5557 * @since 11 5558 */ 5559 off(type: 'inputDeviceChange', callback?: Callback<AudioDeviceDescriptors>): void; 5560 5561 /** 5562 * Subscribes audio capturer info change event callback. 5563 * The event is triggered when input device change for this stream. 5564 * @param { 'audioCapturerChange' } type - Type of the event to listen for. 5565 * @param { Callback<AudioCapturerChangeInfo> } callback - Callback used to listen device change event. 5566 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5567 * 1.Mandatory parameters are left unspecified; 5568 * 2.Incorrect parameter types. 5569 * @throws { BusinessError } 6800101 - Parameter verification failed. 5570 * @syscap SystemCapability.Multimedia.Audio.Capturer 5571 * @since 11 5572 */ 5573 on(type: 'audioCapturerChange', callback: Callback<AudioCapturerChangeInfo>): void; 5574 /** 5575 * Unsubscribes audio capturer info change event callback. 5576 * @param { 'audioCapturerChange' } type - Type of the event to listen for. 5577 * @param { Callback<AudioCapturerChangeInfo> } callback - Callback used in subscribe. 5578 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5579 * 1.Mandatory parameters are left unspecified; 5580 * 2.Incorrect parameter types. 5581 * @throws { BusinessError } 6800101 - Parameter verification failed. 5582 * @syscap SystemCapability.Multimedia.Audio.Capturer 5583 * @since 11 5584 */ 5585 off(type: 'audioCapturerChange', callback?: Callback<AudioCapturerChangeInfo>): void; 5586 5587 /** 5588 * Subscribes audio data callback. 5589 * The event is triggered when audio buffer is available for reading more data. 5590 * @param { 'readData' } type - Type of the event to listen for. 5591 * @param { Callback<ArrayBuffer> } callback - Callback with the buffer to read. 5592 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5593 * 1.Mandatory parameters are left unspecified; 5594 * 2.Incorrect parameter types. 5595 * @throws { BusinessError } 6800101 - Parameter verification failed. 5596 * @syscap SystemCapability.Multimedia.Audio.Capturer 5597 * @since 11 5598 */ 5599 on(type: 'readData', callback: Callback<ArrayBuffer>): void; 5600 5601 /** 5602 * Unsubscribes audio data callback. 5603 * @param { 'readData' } type - Type of the event to listen for. 5604 * @param { Callback<ArrayBuffer> } callback - Callback used in subscribe. 5605 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5606 * 1.Mandatory parameters are left unspecified; 5607 * 2.Incorrect parameter types. 5608 * @throws { BusinessError } 6800101 - Parameter verification failed. 5609 * @syscap SystemCapability.Multimedia.Audio.Capturer 5610 * @since 11 5611 */ 5612 off(type: 'readData', callback?: Callback<ArrayBuffer>): void; 5613 } 5614 5615 /** 5616 * ASR noise suppression mode. 5617 * @enum { number } 5618 * @syscap SystemCapability.Multimedia.Audio.Capturer 5619 * @systemapi 5620 * @since 12 5621 */ 5622 enum AsrNoiseSuppressionMode { 5623 /** 5624 * Bypass noise suppression. 5625 * @syscap SystemCapability.Multimedia.Audio.Capturer 5626 * @systemapi 5627 * @since 12 5628 */ 5629 BYPASS = 0, 5630 /** 5631 * Standard noise suppression. 5632 * @syscap SystemCapability.Multimedia.Audio.Capturer 5633 * @systemapi 5634 * @since 12 5635 */ 5636 STANDARD = 1, 5637 /** 5638 * Near field noise suppression. 5639 * @syscap SystemCapability.Multimedia.Audio.Capturer 5640 * @systemapi 5641 * @since 12 5642 */ 5643 NEAR_FIELD = 2, 5644 /** 5645 * Far field noise suppression. 5646 * @syscap SystemCapability.Multimedia.Audio.Capturer 5647 * @systemapi 5648 * @since 12 5649 */ 5650 FAR_FIELD = 3, 5651 } 5652 5653 /** 5654 * ASR AEC mode. 5655 * @enum { number } 5656 * @syscap SystemCapability.Multimedia.Audio.Capturer 5657 * @systemapi 5658 * @since 12 5659 */ 5660 enum AsrAecMode { 5661 /** 5662 * Bypass AEC. 5663 * @syscap SystemCapability.Multimedia.Audio.Capturer 5664 * @systemapi 5665 * @since 12 5666 */ 5667 BYPASS = 0, 5668 /** 5669 * Using standard AEC. 5670 * @syscap SystemCapability.Multimedia.Audio.Capturer 5671 * @systemapi 5672 * @since 12 5673 */ 5674 STANDARD = 1, 5675 } 5676 5677 /** 5678 * ASR processing controller. 5679 * @typedef AsrProcessingController 5680 * @syscap SystemCapability.Multimedia.Audio.Capturer 5681 * @systemapi 5682 * @since 12 5683 */ 5684 interface AsrProcessingController { 5685 /** 5686 * Set ASR AEC mode. 5687 * @param { AsrAecMode } mode - ASR AEC Mode. 5688 * @returns { boolean } Indicates whether the mode has been successfully set. 5689 * @throws { BusinessError } 202 - Caller is not a system application. 5690 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5691 * 1.Mandatory parameters are left unspecified; 5692 * 2.Incorrect parameter types. 5693 * @throws { BusinessError } 6800101 - Parameter verification failed. 5694 * @throws { BusinessError } 6800104 - Operation not allowed. 5695 * @syscap SystemCapability.Multimedia.Audio.Capturer 5696 * @systemapi 5697 * @since 12 5698 */ 5699 setAsrAecMode(mode: AsrAecMode): boolean; 5700 5701 /** 5702 * Get ASR AEC mode. 5703 * @returns { AsrAecMode } ASR AEC Mode. 5704 * @throws { BusinessError } 202 - Caller is not a system application. 5705 * @throws { BusinessError } 6800104 - Operation not allowed. 5706 * @syscap SystemCapability.Multimedia.Audio.Capturer 5707 * @systemapi 5708 * @since 12 5709 */ 5710 getAsrAecMode(): AsrAecMode; 5711 5712 /** 5713 * Set ASR noise suppression mode. 5714 * @param { AsrNoiseSuppressionMode } mode - ASR noise suppression mode. 5715 * @returns { boolean } Indicates whether the mode has been successfully set. 5716 * @throws { BusinessError } 202 - Caller is not a system application. 5717 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5718 * 1.Mandatory parameters are left unspecified; 5719 * 2.Incorrect parameter types. 5720 * @throws { BusinessError } 6800101 - Parameter verification failed. 5721 * @throws { BusinessError } 6800104 - Operation not allowed. 5722 * @syscap SystemCapability.Multimedia.Audio.Capturer 5723 * @systemapi 5724 * @since 12 5725 */ 5726 setAsrNoiseSuppressionMode(mode: AsrNoiseSuppressionMode): boolean; 5727 5728 /** 5729 * Get ASR noise suppression mode. 5730 * @returns { AsrNoiseSuppressionMode } ASR noise suppression mode. 5731 * @throws { BusinessError } 202 - Caller is not a system application. 5732 * @throws { BusinessError } 6800104 - Operation not allowed. 5733 * @syscap SystemCapability.Multimedia.Audio.Capturer 5734 * @systemapi 5735 * @since 12 5736 */ 5737 getAsrNoiseSuppressionMode(): AsrNoiseSuppressionMode; 5738 5739 /** 5740 * Query whether user is whispering. 5741 * @returns { boolean } whether user is whispering. 5742 * @throws { BusinessError } 202 - Caller is not a system application. 5743 * @throws { BusinessError } 6800104 - Operation not allowed. 5744 * @syscap SystemCapability.Multimedia.Audio.Capturer 5745 * @systemapi 5746 * @since 12 5747 */ 5748 isWhispering(): boolean; 5749 } 5750 5751 /** 5752 * Create ASR processing controller on one audio capturer. 5753 * @param { AudioCapturer } audioCapture - The audio capturer whose ASR processing will be controlled. The source type 5754 * of this capturer must be {@link SourceType#SOURCE_TYPE_VOICE_RECOGNITION}. 5755 * @returns { AsrProcessingController } ASR Processing Controller. 5756 * @throws { BusinessError } 202 - Caller is not a system application. 5757 * @throws { BusinessError } 401 - Parameter error. Possible causes: 5758 * 1.Mandatory parameters are left unspecified; 5759 * 2.Incorrect parameter types. 5760 * @throws { BusinessError } 6800101 - Parameter verification failed. 5761 * @throws { BusinessError } 6800104 - Operation not allowed. e.g. the source type of the input audio capturer is not 5762 * {@link SourceType#SOURCE_TYPE_VOICE_RECOGNITION} or {@link SourceType#SOURCE_TYPE_WAKEUP}, or this audio capturer 5763 * is already released. 5764 * @syscap SystemCapability.Multimedia.Audio.Capturer 5765 * @systemapi 5766 * @since 12 5767 */ 5768 function createAsrProcessingController(audioCapturer: AudioCapturer): AsrProcessingController; 5769 5770 /** 5771 * Enumerates tone types for player. 5772 * @enum { number } 5773 * @syscap SystemCapability.Multimedia.Audio.Tone 5774 * @systemapi 5775 * @since 9 5776 */ 5777 enum ToneType { 5778 /** 5779 * Dial tone for key 0. 5780 * @syscap SystemCapability.Multimedia.Audio.Tone 5781 * @systemapi 5782 * @since 9 5783 */ 5784 TONE_TYPE_DIAL_0 = 0, 5785 /** 5786 * Dial tone for key 1. 5787 * @syscap SystemCapability.Multimedia.Audio.Tone 5788 * @systemapi 5789 * @since 9 5790 */ 5791 TONE_TYPE_DIAL_1 = 1, 5792 /** 5793 * Dial tone for key 2. 5794 * @syscap SystemCapability.Multimedia.Audio.Tone 5795 * @systemapi 5796 * @since 9 5797 */ 5798 TONE_TYPE_DIAL_2 = 2, 5799 /** 5800 * Dial tone for key 3. 5801 * @syscap SystemCapability.Multimedia.Audio.Tone 5802 * @systemapi 5803 * @since 9 5804 */ 5805 TONE_TYPE_DIAL_3 = 3, 5806 /** 5807 * Dial tone for key 4. 5808 * @syscap SystemCapability.Multimedia.Audio.Tone 5809 * @systemapi 5810 * @since 9 5811 */ 5812 TONE_TYPE_DIAL_4 = 4, 5813 /** 5814 * Dial tone for key 5. 5815 * @syscap SystemCapability.Multimedia.Audio.Tone 5816 * @systemapi 5817 * @since 9 5818 */ 5819 TONE_TYPE_DIAL_5 = 5, 5820 /** 5821 * Dial tone for key 6. 5822 * @syscap SystemCapability.Multimedia.Audio.Tone 5823 * @systemapi 5824 * @since 9 5825 */ 5826 TONE_TYPE_DIAL_6 = 6, 5827 /** 5828 * Dial tone for key 7. 5829 * @syscap SystemCapability.Multimedia.Audio.Tone 5830 * @systemapi 5831 * @since 9 5832 */ 5833 TONE_TYPE_DIAL_7 = 7, 5834 /** 5835 * Dial tone for key 8. 5836 * @syscap SystemCapability.Multimedia.Audio.Tone 5837 * @systemapi 5838 * @since 9 5839 */ 5840 TONE_TYPE_DIAL_8 = 8, 5841 /** 5842 * Dial tone for key 9. 5843 * @syscap SystemCapability.Multimedia.Audio.Tone 5844 * @systemapi 5845 * @since 9 5846 */ 5847 TONE_TYPE_DIAL_9 = 9, 5848 /** 5849 * Dial tone for key *. 5850 * @syscap SystemCapability.Multimedia.Audio.Tone 5851 * @systemapi 5852 * @since 9 5853 */ 5854 TONE_TYPE_DIAL_S = 10, 5855 /** 5856 * Dial tone for key #. 5857 * @syscap SystemCapability.Multimedia.Audio.Tone 5858 * @systemapi 5859 * @since 9 5860 */ 5861 TONE_TYPE_DIAL_P = 11, 5862 /** 5863 * Dial tone for key A. 5864 * @syscap SystemCapability.Multimedia.Audio.Tone 5865 * @systemapi 5866 * @since 9 5867 */ 5868 TONE_TYPE_DIAL_A = 12, 5869 /** 5870 * Dial tone for key B. 5871 * @syscap SystemCapability.Multimedia.Audio.Tone 5872 * @systemapi 5873 * @since 9 5874 */ 5875 TONE_TYPE_DIAL_B = 13, 5876 /** 5877 * Dial tone for key C. 5878 * @syscap SystemCapability.Multimedia.Audio.Tone 5879 * @systemapi 5880 * @since 9 5881 */ 5882 TONE_TYPE_DIAL_C = 14, 5883 /** 5884 * Dial tone for key D. 5885 * @syscap SystemCapability.Multimedia.Audio.Tone 5886 * @systemapi 5887 * @since 9 5888 */ 5889 TONE_TYPE_DIAL_D = 15, 5890 /** 5891 * Supervisory tone for dial. 5892 * @syscap SystemCapability.Multimedia.Audio.Tone 5893 * @systemapi 5894 * @since 9 5895 */ 5896 TONE_TYPE_COMMON_SUPERVISORY_DIAL = 100, 5897 /** 5898 * Supervisory tone for busy. 5899 * @syscap SystemCapability.Multimedia.Audio.Tone 5900 * @systemapi 5901 * @since 9 5902 */ 5903 TONE_TYPE_COMMON_SUPERVISORY_BUSY = 101, 5904 /** 5905 * Supervisory tone for dial. 5906 * @syscap SystemCapability.Multimedia.Audio.Tone 5907 * @systemapi 5908 * @since 9 5909 */ 5910 TONE_TYPE_COMMON_SUPERVISORY_CONGESTION = 102, 5911 /** 5912 * Supervisory tone for radio path acknowledgment. 5913 * @syscap SystemCapability.Multimedia.Audio.Tone 5914 * @systemapi 5915 * @since 9 5916 */ 5917 TONE_TYPE_COMMON_SUPERVISORY_RADIO_ACK = 103, 5918 /** 5919 * Supervisory tone for radio path not available. 5920 * @syscap SystemCapability.Multimedia.Audio.Tone 5921 * @systemapi 5922 * @since 9 5923 */ 5924 TONE_TYPE_COMMON_SUPERVISORY_RADIO_NOT_AVAILABLE = 104, 5925 /** 5926 * Supervisory tone for call waiting. 5927 * @syscap SystemCapability.Multimedia.Audio.Tone 5928 * @systemapi 5929 * @since 9 5930 */ 5931 TONE_TYPE_COMMON_SUPERVISORY_CALL_WAITING = 106, 5932 /** 5933 * Supervisory tone for ringtone. 5934 * @syscap SystemCapability.Multimedia.Audio.Tone 5935 * @systemapi 5936 * @since 9 5937 */ 5938 TONE_TYPE_COMMON_SUPERVISORY_RINGTONE = 107, 5939 /** 5940 * Proprietary tone for beep. 5941 * @syscap SystemCapability.Multimedia.Audio.Tone 5942 * @systemapi 5943 * @since 9 5944 */ 5945 TONE_TYPE_COMMON_PROPRIETARY_BEEP = 200, 5946 /** 5947 * Proprietary tone for positive acknowledgment. 5948 * @syscap SystemCapability.Multimedia.Audio.Tone 5949 * @systemapi 5950 * @since 9 5951 */ 5952 TONE_TYPE_COMMON_PROPRIETARY_ACK = 201, 5953 /** 5954 * Proprietary tone for prompt. 5955 * @syscap SystemCapability.Multimedia.Audio.Tone 5956 * @systemapi 5957 * @since 9 5958 */ 5959 TONE_TYPE_COMMON_PROPRIETARY_PROMPT = 203, 5960 /** 5961 * Proprietary tone for double beep. 5962 * @syscap SystemCapability.Multimedia.Audio.Tone 5963 * @systemapi 5964 * @since 9 5965 */ 5966 TONE_TYPE_COMMON_PROPRIETARY_DOUBLE_BEEP = 204, 5967 } 5968 5969 /** 5970 * Provides APIs for tone playing. 5971 * @typedef TonePlayer 5972 * @syscap SystemCapability.Multimedia.Audio.Tone 5973 * @systemapi 5974 * @since 9 5975 */ 5976 interface TonePlayer { 5977 /** 5978 * Loads tone. This method uses an asynchronous callback to return the result. 5979 * @param { ToneType } type - Tone type to play. 5980 * @param { AsyncCallback<void> } callback - Callback used to return the result. 5981 * @syscap SystemCapability.Multimedia.Audio.Tone 5982 * @systemapi 5983 * @since 9 5984 */ 5985 load(type: ToneType, callback: AsyncCallback<void>): void; 5986 /** 5987 * Loads tone. This method uses a promise to return the result. 5988 * @param { ToneType } type - Tone type to play. 5989 * @returns { Promise<void> } Promise used to return the result. 5990 * @syscap SystemCapability.Multimedia.Audio.Tone 5991 * @systemapi 5992 * @since 9 5993 */ 5994 load(type: ToneType): Promise<void>; 5995 5996 /** 5997 * Starts player. This method uses an asynchronous callback to return the result. 5998 * @param { AsyncCallback<void> } callback - Callback used to return the result. 5999 * @syscap SystemCapability.Multimedia.Audio.Tone 6000 * @systemapi 6001 * @since 9 6002 */ 6003 start(callback: AsyncCallback<void>): void; 6004 /** 6005 * Starts player. This method uses a promise to return the result. 6006 * @returns { Promise<void> }Promise used to return the result. 6007 * @syscap SystemCapability.Multimedia.Audio.Tone 6008 * @systemapi 6009 * @since 9 6010 */ 6011 start(): Promise<void>; 6012 6013 /** 6014 * Stops player. This method uses an asynchronous callback to return the result. 6015 * @param { AsyncCallback<void> } callback - Callback used to return the result. 6016 * @syscap SystemCapability.Multimedia.Audio.Tone 6017 * @systemapi 6018 * @since 9 6019 */ 6020 stop(callback: AsyncCallback<void>): void; 6021 /** 6022 * Stops player. This method uses a promise to return the result. 6023 * @returns { Promise<void> } Promise used to return the result. 6024 * @syscap SystemCapability.Multimedia.Audio.Tone 6025 * @systemapi 6026 * @since 9 6027 */ 6028 stop(): Promise<void>; 6029 6030 /** 6031 * Releases the player. This method uses an asynchronous callback to return the result. 6032 * @param { AsyncCallback<void> } callback - Callback used to return the result. 6033 * @syscap SystemCapability.Multimedia.Audio.Tone 6034 * @systemapi 6035 * @since 9 6036 */ 6037 release(callback: AsyncCallback<void>): void; 6038 /** 6039 * Releases the player. This method uses a promise to return the result. 6040 * @returns { Promise<void> } Promise used to return the result. 6041 * @syscap SystemCapability.Multimedia.Audio.Tone 6042 * @systemapi 6043 * @since 9 6044 */ 6045 release(): Promise<void>; 6046 } 6047 6048 /** 6049 * Array of AudioEffectMode, which is read-only. 6050 * @typedef { Array<Readonly<AudioEffectMode>> } AudioEffectInfoArray 6051 * @syscap SystemCapability.Multimedia.Audio.Renderer 6052 * @since 10 6053 */ 6054 type AudioEffectInfoArray = Array<Readonly<AudioEffectMode>>; 6055 6056 /** 6057 * Describes an audio effect mode group. 6058 * @enum { number } 6059 * @syscap SystemCapability.Multimedia.Audio.Renderer 6060 * @since 10 6061 */ 6062 /** 6063 * Describes an audio effect mode group. 6064 * @enum { number } 6065 * @syscap SystemCapability.Multimedia.Audio.Renderer 6066 * @atomicservice 6067 * @since 12 6068 */ 6069 enum AudioEffectMode { 6070 /** 6071 * Audio Effect Mode effect none. 6072 * @syscap SystemCapability.Multimedia.Audio.Renderer 6073 * @since 10 6074 */ 6075 /** 6076 * Audio Effect Mode effect none. 6077 * @syscap SystemCapability.Multimedia.Audio.Renderer 6078 * @atomicservice 6079 * @since 12 6080 */ 6081 EFFECT_NONE = 0, 6082 /** 6083 * Audio Effect Mode effect default. 6084 * @syscap SystemCapability.Multimedia.Audio.Renderer 6085 * @since 10 6086 */ 6087 /** 6088 * Audio Effect Mode effect default. 6089 * @syscap SystemCapability.Multimedia.Audio.Renderer 6090 * @atomicservice 6091 * @since 12 6092 */ 6093 EFFECT_DEFAULT = 1, 6094 } 6095 6096 /** 6097 * Describes spatial device state. 6098 * @typedef AudioSpatialDeviceState 6099 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6100 * @systemapi 6101 * @since 11 6102 */ 6103 interface AudioSpatialDeviceState { 6104 /** 6105 * Spatial device address. 6106 * @type { string } 6107 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6108 * @systemapi 6109 * @since 11 6110 */ 6111 address: string; 6112 6113 /** 6114 * Whether the spatial device supports spatial rendering. 6115 * @type { boolean } 6116 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6117 * @systemapi 6118 * @since 11 6119 */ 6120 isSpatializationSupported: boolean; 6121 6122 /** 6123 * Whether the spatial device supports head tracking. 6124 * @type { boolean } 6125 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6126 * @systemapi 6127 * @since 11 6128 */ 6129 isHeadTrackingSupported: boolean; 6130 6131 /** 6132 * Spatial device type. 6133 * @type { AudioSpatialDeviceType } 6134 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6135 * @systemapi 6136 * @since 11 6137 */ 6138 spatialDeviceType: AudioSpatialDeviceType; 6139 } 6140 6141 /** 6142 * Describes a spatial device type group. 6143 * @enum { number } 6144 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6145 * @systemapi 6146 * @since 11 6147 */ 6148 enum AudioSpatialDeviceType { 6149 /** 6150 * Audio Spatial Device Type none. 6151 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6152 * @systemapi 6153 * @since 11 6154 */ 6155 SPATIAL_DEVICE_TYPE_NONE = 0, 6156 /** 6157 * Audio Spatial Device Type in-ear headphone. 6158 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6159 * @systemapi 6160 * @since 11 6161 */ 6162 SPATIAL_DEVICE_TYPE_IN_EAR_HEADPHONE = 1, 6163 /** 6164 * Audio Spatial Device Type half-in-ear headphone. 6165 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6166 * @systemapi 6167 * @since 11 6168 */ 6169 SPATIAL_DEVICE_TYPE_HALF_IN_EAR_HEADPHONE = 2, 6170 /** 6171 * Audio Spatial Device Type over-ear headphone. 6172 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6173 * @systemapi 6174 * @since 11 6175 */ 6176 SPATIAL_DEVICE_TYPE_OVER_EAR_HEADPHONE = 3, 6177 /** 6178 * Audio Spatial Device Type glasses. 6179 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6180 * @systemapi 6181 * @since 11 6182 */ 6183 SPATIAL_DEVICE_TYPE_GLASSES = 4, 6184 /** 6185 * Audio Spatial Device Type others. 6186 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6187 * @systemapi 6188 * @since 11 6189 */ 6190 SPATIAL_DEVICE_TYPE_OTHERS = 5, 6191 } 6192 6193 /** 6194 * Describes a spatialization scene type group. 6195 * @enum { number } 6196 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6197 * @systemapi 6198 * @since 12 6199 */ 6200 enum AudioSpatializationSceneType { 6201 /** 6202 * Audio Spatialization Scene Type Default. 6203 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6204 * @systemapi 6205 * @since 12 6206 */ 6207 DEFAULT = 0, 6208 /** 6209 * Audio Spatialization Scene Type Music. 6210 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6211 * @systemapi 6212 * @since 12 6213 */ 6214 MUSIC = 1, 6215 /** 6216 * Audio Spatialization Scene Type Movie. 6217 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6218 * @systemapi 6219 * @since 12 6220 */ 6221 MOVIE = 2, 6222 /** 6223 * Audio Spatialization Scene Type Audio Book. 6224 * @syscap SystemCapability.Multimedia.Audio.Spatialization 6225 * @systemapi 6226 * @since 12 6227 */ 6228 AUDIOBOOK = 3, 6229 } 6230 6231 /** 6232 * Audio AudioChannel Layout 6233 * A 64-bit integer indicates that the appearance and order of the speakers for recording or playback. 6234 * @enum { number } 6235 * @syscap SystemCapability.Multimedia.Audio.Core 6236 * @since 11 6237 */ 6238 enum AudioChannelLayout { 6239 /** 6240 * Unknown Channel Layout 6241 * @syscap SystemCapability.Multimedia.Audio.Core 6242 * @since 11 6243 */ 6244 CH_LAYOUT_UNKNOWN = 0x0, 6245 /** 6246 * Channel Layout For Mono, 1 channel in total 6247 * Speaker layout: front center(FC) 6248 * @syscap SystemCapability.Multimedia.Audio.Core 6249 * @since 11 6250 */ 6251 CH_LAYOUT_MONO = 0x4, 6252 /** 6253 * Channel Layout For Stereo, 2 channels in total 6254 * Speaker layout: front left(FL), front right(FR) 6255 * @syscap SystemCapability.Multimedia.Audio.Core 6256 * @since 11 6257 */ 6258 CH_LAYOUT_STEREO = 0x3, 6259 /** 6260 * Channel Layout For Stereo-Downmix, 2 channels in total 6261 * Speaker layout: Stereo left, stereo right 6262 * @syscap SystemCapability.Multimedia.Audio.Core 6263 * @since 11 6264 */ 6265 CH_LAYOUT_STEREO_DOWNMIX = 0x60000000, 6266 /** 6267 * Channel Layout For 2.1, 3 channels in total 6268 * Speaker layout: Stereo plus low-frequency effects(LFE) 6269 * @syscap SystemCapability.Multimedia.Audio.Core 6270 * @since 11 6271 */ 6272 CH_LAYOUT_2POINT1 = 0xB, 6273 /** 6274 * Channel Layout For 3.0, 3 channels in total 6275 * Speaker layout: Stereo plus back center(BC) 6276 * @syscap SystemCapability.Multimedia.Audio.Core 6277 * @since 11 6278 */ 6279 CH_LAYOUT_3POINT0 = 0x103, 6280 /** 6281 * Channel Layout For Surround, 3 channels in total 6282 * Speaker layout: Stereo plus FC 6283 * @syscap SystemCapability.Multimedia.Audio.Core 6284 * @since 11 6285 */ 6286 CH_LAYOUT_SURROUND = 0x7, 6287 /** 6288 * Channel Layout For 3.1, 4 channels in total 6289 * Speaker layout: Surround plus LFE 6290 * @syscap SystemCapability.Multimedia.Audio.Core 6291 * @since 11 6292 */ 6293 CH_LAYOUT_3POINT1 = 0xF, 6294 /** 6295 * Channel Layout For 4.0, 4 channels in total 6296 * Speaker layout: Surround plus BC 6297 * @syscap SystemCapability.Multimedia.Audio.Core 6298 * @since 11 6299 */ 6300 CH_LAYOUT_4POINT0 = 0x107, 6301 /** 6302 * Channel Layout For Quad, 4 channels in total 6303 * Speaker layout: Stereo plus left and right back speakers 6304 * @syscap SystemCapability.Multimedia.Audio.Core 6305 * @since 11 6306 */ 6307 CH_LAYOUT_QUAD = 0x33, 6308 /** 6309 * Channel Layout For Quad-Side, 4 channels in total 6310 * Speaker layout: Stereo plus left and right side speakers(SL, SR) 6311 * @syscap SystemCapability.Multimedia.Audio.Core 6312 * @since 11 6313 */ 6314 CH_LAYOUT_QUAD_SIDE = 0x603, 6315 /** 6316 * Channel Layout For 2.0.2, 4 channels in total 6317 * Speaker layout: Stereo plus left and right top side speakers 6318 * @syscap SystemCapability.Multimedia.Audio.Core 6319 * @since 11 6320 */ 6321 CH_LAYOUT_2POINT0POINT2 = 0x3000000003, 6322 /** 6323 * Channel Layout For ORDER1-ACN-N3D First Order Ambisonic(FOA), 4 channels in total 6324 * First order, Ambisonic Channel Number(ACN) format, Normalization of three-D(N3D) 6325 * @syscap SystemCapability.Multimedia.Audio.Core 6326 * @since 11 6327 */ 6328 CH_LAYOUT_AMB_ORDER1_ACN_N3D = 0x100000000001, 6329 /** 6330 * Channel Layout For ORDER1-ACN-SN3D FOA, 4 channels in total 6331 * First order, ACN format, Semi-Normalization of three-D(SN3D) 6332 * @syscap SystemCapability.Multimedia.Audio.Core 6333 * @since 11 6334 */ 6335 CH_LAYOUT_AMB_ORDER1_ACN_SN3D = 0x100000001001, 6336 /** 6337 * Channel Layout For ORDER1-FUMA FOA, 4 channels in total 6338 * First order, Furse-Malham(FuMa) format 6339 * @syscap SystemCapability.Multimedia.Audio.Core 6340 * @since 11 6341 */ 6342 CH_LAYOUT_AMB_ORDER1_FUMA = 0x100000000101, 6343 /** 6344 * Channel Layout For 4.1, 5 channels in total 6345 * Speaker layout: 4.0 plus LFE 6346 * @syscap SystemCapability.Multimedia.Audio.Core 6347 * @since 11 6348 */ 6349 CH_LAYOUT_4POINT1 = 0x10F, 6350 /** 6351 * Channel Layout For 5.0, 5 channels in total 6352 * Speaker layout: Surround plus two side speakers 6353 * @syscap SystemCapability.Multimedia.Audio.Core 6354 * @since 11 6355 */ 6356 CH_LAYOUT_5POINT0 = 0x607, 6357 /** 6358 * Channel Layout For 5.0-Back, 5 channels in total 6359 * Speaker layout: Surround plus two back speakers 6360 * @syscap SystemCapability.Multimedia.Audio.Core 6361 * @since 11 6362 */ 6363 CH_LAYOUT_5POINT0_BACK = 0x37, 6364 /** 6365 * Channel Layout For 2.1.2, 5 channels in total 6366 * Speaker layout: 2.0.2 plus LFE 6367 * @syscap SystemCapability.Multimedia.Audio.Core 6368 * @since 11 6369 */ 6370 CH_LAYOUT_2POINT1POINT2 = 0x300000000B, 6371 /** 6372 * Channel Layout For 3.0.2, 5 channels in total 6373 * Speaker layout: 2.0.2 plus FC 6374 * @syscap SystemCapability.Multimedia.Audio.Core 6375 * @since 11 6376 */ 6377 CH_LAYOUT_3POINT0POINT2 = 0x3000000007, 6378 /** 6379 * Channel Layout For 5.1, 6 channels in total 6380 * Speaker layout: 5.0 plus LFE 6381 * @syscap SystemCapability.Multimedia.Audio.Core 6382 * @since 11 6383 */ 6384 CH_LAYOUT_5POINT1 = 0x60F, 6385 /** 6386 * Channel Layout For 5.1-Back, 6 channels in total 6387 * Speaker layout: 5.0-Back plus LFE 6388 * @syscap SystemCapability.Multimedia.Audio.Core 6389 * @since 11 6390 */ 6391 CH_LAYOUT_5POINT1_BACK = 0x3F, 6392 /** 6393 * Channel Layout For 6.0, 6 channels in total 6394 * Speaker layout: 5.0 plus BC 6395 * @syscap SystemCapability.Multimedia.Audio.Core 6396 * @since 11 6397 */ 6398 CH_LAYOUT_6POINT0 = 0x707, 6399 /** 6400 * Channel Layout For Hexagonal, 6 channels in total 6401 * Speaker layout: 5.0-Back plus BC 6402 * @syscap SystemCapability.Multimedia.Audio.Core 6403 * @since 11 6404 */ 6405 CH_LAYOUT_HEXAGONAL = 0x137, 6406 /** 6407 * Channel Layout For 3.1.2, 6 channels in total 6408 * Speaker layout: 3.1 plus two top front speakers(TFL, TFR) 6409 * @syscap SystemCapability.Multimedia.Audio.Core 6410 * @since 11 6411 */ 6412 CH_LAYOUT_3POINT1POINT2 = 0x500F, 6413 /** 6414 * Channel Layout For 6.0-Front, 6 channels in total 6415 * Speaker layout: Quad-Side plus left and right front center speakers(FLC, FRC) 6416 * @syscap SystemCapability.Multimedia.Audio.Core 6417 * @since 11 6418 */ 6419 CH_LAYOUT_6POINT0_FRONT = 0x6C3, 6420 /** 6421 * Channel Layout For 6.1, 7 channels in total 6422 * Speaker layout: 5.1 plus BC 6423 * @syscap SystemCapability.Multimedia.Audio.Core 6424 * @since 11 6425 */ 6426 CH_LAYOUT_6POINT1 = 0x70F, 6427 /** 6428 * Channel Layout For 6.1-Back, 7 channels in total 6429 * Speaker layout: 5.1-Back plus BC 6430 * @syscap SystemCapability.Multimedia.Audio.Core 6431 * @since 11 6432 */ 6433 CH_LAYOUT_6POINT1_BACK = 0x13F, 6434 /** 6435 * Channel Layout For 6.1-Front, 7 channels in total 6436 * Speaker layout: 6.0-Front plus LFE 6437 * @syscap SystemCapability.Multimedia.Audio.Core 6438 * @since 11 6439 */ 6440 CH_LAYOUT_6POINT1_FRONT = 0x6CB, 6441 /** 6442 * Channel Layout For 7.0, 7 channels in total 6443 * Speaker layout: 5.0 plus two back speakers 6444 * @syscap SystemCapability.Multimedia.Audio.Core 6445 * @since 11 6446 */ 6447 CH_LAYOUT_7POINT0 = 0x637, 6448 /** 6449 * Channel Layout For 7.0-Front, 7 channels in total 6450 * Speaker layout: 5.0 plus left and right front center speakers 6451 * @syscap SystemCapability.Multimedia.Audio.Core 6452 * @since 11 6453 */ 6454 CH_LAYOUT_7POINT0_FRONT = 0x6C7, 6455 /** 6456 * Channel Layout For 7.1, 8 channels in total 6457 * Speaker layout: 5.1 plus two back speakers 6458 * @syscap SystemCapability.Multimedia.Audio.Core 6459 * @since 11 6460 */ 6461 CH_LAYOUT_7POINT1 = 0x63F, 6462 /** 6463 * Channel Layout For Octagonal, 8 channels in total 6464 * Speaker layout: 5.0 plus BL, BR and BC. 6465 * @syscap SystemCapability.Multimedia.Audio.Core 6466 * @since 11 6467 */ 6468 CH_LAYOUT_OCTAGONAL = 0x737, 6469 /** 6470 * Channel Layout For 5.1.2, 8 channels in total 6471 * Speaker layout: 5.1 plus two top side speakers. 6472 * @syscap SystemCapability.Multimedia.Audio.Core 6473 * @since 11 6474 */ 6475 CH_LAYOUT_5POINT1POINT2 = 0x300000060F, 6476 /** 6477 * Channel Layout For 7.1-Wide, 8 channels in total 6478 * Speaker layout: 5.1 plus left and right front center speakers. 6479 * @syscap SystemCapability.Multimedia.Audio.Core 6480 * @since 11 6481 */ 6482 CH_LAYOUT_7POINT1_WIDE = 0x6CF, 6483 /** 6484 * Channel Layout For 7.1-Wide, 8 channels in total 6485 * Speaker layout: 5.1-Back plus left and right front center speakers. 6486 * @syscap SystemCapability.Multimedia.Audio.Core 6487 * @since 11 6488 */ 6489 CH_LAYOUT_7POINT1_WIDE_BACK = 0xFF, 6490 /** 6491 * Channel Layout For ORDER2-ACN-N3D Higher Order Ambisonics(HOA), 9 channels in total 6492 * Second order, ACN format, N3D 6493 * @syscap SystemCapability.Multimedia.Audio.Core 6494 * @since 11 6495 */ 6496 CH_LAYOUT_AMB_ORDER2_ACN_N3D = 0x100000000002, 6497 /** 6498 * Channel Layout For ORDER2-ACN-SN3D HOA, 9 channels in total 6499 * Second order, ACN format, SN3D 6500 * @syscap SystemCapability.Multimedia.Audio.Core 6501 * @since 11 6502 */ 6503 CH_LAYOUT_AMB_ORDER2_ACN_SN3D = 0x100000001002, 6504 /** 6505 * Channel Layout For ORDER2-FUMA HOA, 9 channels in total 6506 * Second order, FuMa format 6507 * @syscap SystemCapability.Multimedia.Audio.Core 6508 * @since 11 6509 */ 6510 CH_LAYOUT_AMB_ORDER2_FUMA = 0x100000000102, 6511 /** 6512 * Channel Layout For 5.1.4, 10 channels in total 6513 * Speaker layout: 5.1 plus four top speakers(TFL, TFR, TBL, TBR) 6514 * @syscap SystemCapability.Multimedia.Audio.Core 6515 * @since 11 6516 */ 6517 CH_LAYOUT_5POINT1POINT4 = 0x2D60F, 6518 /** 6519 * Channel Layout For 7.1.2, 10 channels in total 6520 * Speaker layout: 7.1 plus two top side speakers 6521 * @syscap SystemCapability.Multimedia.Audio.Core 6522 * @since 11 6523 */ 6524 CH_LAYOUT_7POINT1POINT2 = 0x300000063F, 6525 /** 6526 * Channel Layout For 7.1.4, 12 channels in total 6527 * Speaker layout: 7.1 plus four top speakers 6528 * @syscap SystemCapability.Multimedia.Audio.Core 6529 * @since 11 6530 */ 6531 CH_LAYOUT_7POINT1POINT4 = 0x2D63F, 6532 /** 6533 * Channel Layout For 10.2, 12 channels in total 6534 * Speaker layout: FL, FR, FC, TFL, TFR, BL, BR, BC, SL, SR, wide left(WL), and wide right(WR) 6535 * @syscap SystemCapability.Multimedia.Audio.Core 6536 * @since 11 6537 */ 6538 CH_LAYOUT_10POINT2 = 0x180005737, 6539 /** 6540 * Channel Layout For 9.1.4, 14 channels in total 6541 * Speaker layout: 7.1.4 plus two wide speakers(WL, WR) 6542 * @syscap SystemCapability.Multimedia.Audio.Core 6543 * @since 11 6544 */ 6545 CH_LAYOUT_9POINT1POINT4 = 0x18002D63F, 6546 /** 6547 * Channel Layout For 9.1.6, 16 channels in total 6548 * Speaker layout: 9.1.4 plus two top side speakers 6549 * @syscap SystemCapability.Multimedia.Audio.Core 6550 * @since 11 6551 */ 6552 CH_LAYOUT_9POINT1POINT6 = 0x318002D63F, 6553 /** 6554 * Channel Layout For Hexadecagonal, 16 channels in total 6555 * Speaker layout: Octagonal plus two wide speakers, six top speakers(TFL, TFR, TFC, TBL, TBR, TBC) 6556 * @syscap SystemCapability.Multimedia.Audio.Core 6557 * @since 11 6558 */ 6559 CH_LAYOUT_HEXADECAGONAL = 0x18003F737, 6560 /** 6561 * Channel Layout For ORDER3-ACN-N3D HOA, 16 channels in total 6562 * Third order, ACN format, N3D 6563 * @syscap SystemCapability.Multimedia.Audio.Core 6564 * @since 11 6565 */ 6566 CH_LAYOUT_AMB_ORDER3_ACN_N3D = 0x100000000003, 6567 /** 6568 * Channel Layout For ORDER3-ACN-SN3D HOA, 16 channels in total 6569 * Third order, ACN format, N3D 6570 * @syscap SystemCapability.Multimedia.Audio.Core 6571 * @since 11 6572 */ 6573 CH_LAYOUT_AMB_ORDER3_ACN_SN3D = 0x100000001003, 6574 /** 6575 * Channel Layout For ORDER3-FUMA HOA, 16 channels in total 6576 * Third order, FuMa format 6577 * @syscap SystemCapability.Multimedia.Audio.Core 6578 * @since 11 6579 */ 6580 CH_LAYOUT_AMB_ORDER3_FUMA = 0x100000000103 6581 } 6582} 6583 6584export default audio; 6585