1 /* 2 * Copyright (c) 2021-2022 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 #ifndef ST_AUDIO_SYSTEM_MANAGER_H 17 #define ST_AUDIO_SYSTEM_MANAGER_H 18 19 #include <cstdlib> 20 #include <list> 21 #include <map> 22 #include <mutex> 23 #include <vector> 24 #include <unordered_map> 25 26 #include "parcel.h" 27 #include "audio_device_descriptor.h" 28 #include "audio_info.h" 29 #include "audio_stream_change_info.h" 30 #include "audio_interrupt_callback.h" 31 #include "audio_group_manager.h" 32 #include "audio_routing_manager.h" 33 34 namespace OHOS { 35 namespace AudioStandard { 36 struct AudioSpatialEnabledStateForDevice { 37 sptr<AudioDeviceDescriptor> deviceDescriptor; 38 bool enabled; 39 }; 40 41 struct DistributedRoutingInfo { 42 sptr<AudioDeviceDescriptor> descriptor; 43 CastType type; 44 }; 45 46 class InterruptGroupInfo; 47 class InterruptGroupInfo : public Parcelable { 48 friend class AudioSystemManager; 49 public: 50 int32_t interruptGroupId_ = 0; 51 int32_t mappingId_ = 0; 52 std::string groupName_; 53 std::string networkId_; 54 ConnectType connectType_ = CONNECT_TYPE_LOCAL; 55 InterruptGroupInfo(); 56 InterruptGroupInfo(int32_t interruptGroupId, int32_t mappingId, std::string groupName, std::string networkId, 57 ConnectType type); 58 virtual ~InterruptGroupInfo(); 59 bool Marshalling(Parcel &parcel) const override; 60 static sptr<InterruptGroupInfo> Unmarshalling(Parcel &parcel); 61 }; 62 63 class VolumeGroupInfo; 64 class VolumeGroupInfo : public Parcelable { 65 friend class AudioSystemManager; 66 public: 67 int32_t volumeGroupId_ = 0; 68 int32_t mappingId_ = 0; 69 std::string groupName_; 70 std::string networkId_; 71 ConnectType connectType_ = CONNECT_TYPE_LOCAL; 72 73 /** 74 * @brief Volume group info. 75 * 76 * @since 9 77 */ 78 VolumeGroupInfo(); 79 80 /** 81 * @brief Volume group info. 82 * 83 * @param volumeGroupId volumeGroupId 84 * @param mappingId mappingId 85 * @param groupName groupName 86 * @param networkId networkId 87 * @param type type 88 * @since 9 89 */ 90 VolumeGroupInfo(int32_t volumeGroupId, int32_t mappingId, std::string groupName, std::string networkId, 91 ConnectType type); 92 virtual ~VolumeGroupInfo(); 93 94 /** 95 * @brief Marshall. 96 * 97 * @since 8 98 * @return bool 99 */ 100 bool Marshalling(Parcel &parcel) const override; 101 102 /** 103 * @brief Unmarshall. 104 * 105 * @since 8 106 * @return Returns volume group info 107 */ 108 static sptr<VolumeGroupInfo> Unmarshalling(Parcel &parcel); 109 }; 110 111 /** 112 * Describes the device change type and device information. 113 * 114 * @since 7 115 */ 116 struct DeviceChangeAction { 117 DeviceChangeType type; 118 DeviceFlag flag; 119 std::vector<sptr<AudioDeviceDescriptor>> deviceDescriptors; 120 }; 121 122 /** 123 * Describes the mic phone blocked device information. 124 * 125 * @since 13 126 */ 127 struct MicrophoneBlockedInfo { 128 DeviceBlockStatus blockStatus; 129 std::vector<sptr<AudioDeviceDescriptor>> devices; 130 }; 131 132 /** 133 * @brief AudioRendererFilter is used for select speficed AudioRenderer. 134 */ 135 class AudioRendererFilter; 136 class AudioRendererFilter : public Parcelable { 137 friend class AudioSystemManager; 138 public: 139 AudioRendererFilter(); 140 virtual ~AudioRendererFilter(); 141 142 int32_t uid = -1; 143 AudioRendererInfo rendererInfo = {}; 144 AudioStreamType streamType = AudioStreamType::STREAM_DEFAULT; 145 int32_t streamId = -1; 146 147 bool Marshalling(Parcel &parcel) const override; 148 static sptr<AudioRendererFilter> Unmarshalling(Parcel &in); 149 }; 150 151 /** 152 * @brief AudioCapturerFilter is used for select speficed audiocapturer. 153 */ 154 class AudioCapturerFilter; 155 class AudioCapturerFilter : public Parcelable { 156 friend class AudioSystemManager; 157 public: 158 AudioCapturerFilter(); 159 virtual ~AudioCapturerFilter(); 160 161 int32_t uid = -1; 162 AudioCapturerInfo capturerInfo = {SOURCE_TYPE_INVALID, 0}; 163 164 bool Marshalling(Parcel &parcel) const override; 165 static sptr<AudioCapturerFilter> Unmarshalling(Parcel &in); 166 }; 167 168 // AudioManagerCallback OnInterrupt is added to handle compilation error in call manager 169 // Once call manager adapt to new interrupt APIs, this will be removed 170 class AudioManagerCallback { 171 public: 172 virtual ~AudioManagerCallback() = default; 173 /** 174 * Called when an interrupt is received. 175 * 176 * @param interruptAction Indicates the InterruptAction information needed by client. 177 * For details, refer InterruptAction struct in audio_info.h 178 */ 179 virtual void OnInterrupt(const InterruptAction &interruptAction) = 0; 180 std::mutex cbMutex_; 181 }; 182 183 class AudioManagerInterruptCallbackImpl : public AudioInterruptCallback { 184 public: 185 explicit AudioManagerInterruptCallbackImpl(); 186 virtual ~AudioManagerInterruptCallbackImpl(); 187 188 /** 189 * Called when an interrupt is received. 190 * 191 * @param interruptAction Indicates the InterruptAction information needed by client. 192 * For details, refer InterruptAction struct in audio_info.h 193 * @since 7 194 */ 195 void OnInterrupt(const InterruptEventInternal &interruptEvent) override; 196 void SaveCallback(const std::weak_ptr<AudioManagerCallback> &callback); 197 private: 198 std::weak_ptr<AudioManagerCallback> callback_; 199 std::shared_ptr<AudioManagerCallback> cb_; 200 }; 201 202 class AudioManagerDeviceChangeCallback { 203 public: 204 virtual ~AudioManagerDeviceChangeCallback() = default; 205 /** 206 * Called when an interrupt is received. 207 * 208 * @param deviceChangeAction Indicates the DeviceChangeAction information needed by client. 209 * For details, refer DeviceChangeAction struct 210 * @since 8 211 */ 212 virtual void OnDeviceChange(const DeviceChangeAction &deviceChangeAction) = 0; 213 }; 214 215 class AudioQueryClientTypeCallback { 216 public: 217 virtual ~AudioQueryClientTypeCallback() = default; 218 virtual bool OnQueryClientType(const std::string &bundleName, uint32_t uid) = 0; 219 }; 220 221 class AudioManagerAvailableDeviceChangeCallback { 222 public: 223 virtual ~AudioManagerAvailableDeviceChangeCallback() = default; 224 /** 225 * Called when an interrupt is received. 226 * 227 * @param deviceChangeAction Indicates the DeviceChangeAction information needed by client. 228 * For details, refer DeviceChangeAction struct 229 * @since 11 230 */ 231 virtual void OnAvailableDeviceChange(const AudioDeviceUsage usage, 232 const DeviceChangeAction &deviceChangeAction) = 0; 233 }; 234 235 class AudioManagerMicrophoneBlockedCallback { 236 public: 237 virtual ~AudioManagerMicrophoneBlockedCallback() = default; 238 /** 239 * Called when micro phone is blocked. 240 * 241 * @param microphoneBlockedInfo Indicates the MisPhoneBlockedInfo information needed by client. 242 * For details, refer MisPhoneBlockedInfo struct 243 * @since 13 244 */ 245 virtual void OnMicrophoneBlocked(const MicrophoneBlockedInfo µphoneBlockedInfo) = 0; 246 }; 247 248 class VolumeKeyEventCallback { 249 public: 250 virtual ~VolumeKeyEventCallback() = default; 251 /** 252 * @brief VolumeKeyEventCallback will be executed when hard volume key is pressed up/down 253 * 254 * @param volumeEvent the volume event info. 255 * @since 8 256 */ 257 virtual void OnVolumeKeyEvent(VolumeEvent volumeEvent) = 0; 258 }; 259 260 class AudioParameterCallback { 261 public: 262 virtual ~AudioParameterCallback() = default; 263 /** 264 * @brief AudioParameterCallback will be executed when parameter change. 265 * 266 * @param networkId networkId 267 * @param key Audio paramKey 268 * @param condition condition 269 * @param value value 270 * @since 9 271 */ 272 virtual void OnAudioParameterChange(const std::string networkId, const AudioParamKey key, 273 const std::string& condition, const std::string& value) = 0; 274 }; 275 276 class AudioCapturerSourceCallback { 277 public: 278 virtual ~AudioCapturerSourceCallback() = default; 279 virtual void OnCapturerState(bool isActive) = 0; 280 }; 281 282 class WakeUpSourceCloseCallback { 283 public: 284 virtual ~WakeUpSourceCloseCallback() = default; 285 virtual void OnWakeupClose() = 0; 286 }; 287 288 class WakeUpSourceCallback : public AudioCapturerSourceCallback, public WakeUpSourceCloseCallback { 289 public: 290 virtual ~WakeUpSourceCallback() = default; 291 // Stop all listening capturers from sending false callbacks; 292 // when all capturers have stopped, allow one capturer to start sending true callbacks 293 virtual void OnCapturerState(bool isActive) = 0; 294 virtual void OnWakeupClose() = 0; 295 }; 296 297 class AudioPreferredOutputDeviceChangeCallback; 298 299 class AudioFocusInfoChangeCallback { 300 public: 301 virtual ~AudioFocusInfoChangeCallback() = default; 302 /** 303 * Called when focus info change. 304 * 305 * @param focusInfoList Indicates the focusInfoList information needed by client. 306 * For details, refer audioFocusInfoList_ struct in audio_policy_server.h 307 * @since 9 308 */ 309 virtual void OnAudioFocusInfoChange(const std::list<std::pair<AudioInterrupt, AudioFocuState>> &focusInfoList) = 0; 310 OnAudioFocusRequested(const AudioInterrupt &)311 virtual void OnAudioFocusRequested(const AudioInterrupt &) {} 312 OnAudioFocusAbandoned(const AudioInterrupt &)313 virtual void OnAudioFocusAbandoned(const AudioInterrupt &) {} 314 }; 315 316 class AudioFocusInfoChangeCallbackImpl : public AudioFocusInfoChangeCallback { 317 public: 318 explicit AudioFocusInfoChangeCallbackImpl(); 319 virtual ~AudioFocusInfoChangeCallbackImpl(); 320 321 /** 322 * Called when focus info change. 323 * 324 * @param focusInfoList Indicates the focusInfoList information needed by client. 325 * For details, refer audioFocusInfoList_ struct in audio_policy_server.h 326 * @since 9 327 */ 328 void OnAudioFocusInfoChange(const std::list<std::pair<AudioInterrupt, AudioFocuState>> &focusInfoList) override; 329 void OnAudioFocusRequested(const AudioInterrupt &requestFocus) override; 330 void OnAudioFocusAbandoned(const AudioInterrupt &abandonFocus) override; 331 void SaveCallback(const std::weak_ptr<AudioFocusInfoChangeCallback> &callback); 332 333 /** 334 * Cancel when focus info change. 335 * 336 * @since 9 337 */ 338 void RemoveCallback(const std::weak_ptr<AudioFocusInfoChangeCallback> &callback); 339 private: 340 std::list<std::weak_ptr<AudioFocusInfoChangeCallback>> callbackList_; 341 std::shared_ptr<AudioFocusInfoChangeCallback> cb_; 342 std::mutex cbListMutex_; 343 }; 344 345 class AudioDistributedRoutingRoleCallback { 346 public: 347 virtual ~AudioDistributedRoutingRoleCallback() = default; 348 349 /** 350 * Called when audio device descriptor change. 351 * 352 * @param descriptor Indicates the descriptor needed by client. 353 * For details, refer AudioDeviceDescriptor in audio_system_manager.h 354 * @since 9 355 */ 356 virtual void OnDistributedRoutingRoleChange(const AudioDeviceDescriptor *descriptor, const CastType type) = 0; 357 std::mutex cbMutex_; 358 }; 359 360 class AudioDistributedRoutingRoleCallbackImpl : public AudioDistributedRoutingRoleCallback { 361 public: 362 explicit AudioDistributedRoutingRoleCallbackImpl(); 363 virtual ~AudioDistributedRoutingRoleCallbackImpl(); 364 365 /** 366 * Called when audio device descriptor change. 367 * 368 * @param descriptor Indicates the descriptor needed by client. 369 * For details, refer AudioDeviceDescriptor in audio_system_manager.h 370 * @since 9 371 */ 372 void OnDistributedRoutingRoleChange(const AudioDeviceDescriptor *descriptor, const CastType type) override; 373 void SaveCallback(const std::shared_ptr<AudioDistributedRoutingRoleCallback> &callback); 374 void RemoveCallback(const std::shared_ptr<AudioDistributedRoutingRoleCallback> &callback); 375 private: 376 std::list<std::shared_ptr<AudioDistributedRoutingRoleCallback>> callbackList_; 377 std::shared_ptr<AudioDistributedRoutingRoleCallback> cb_; 378 std::mutex cbListMutex_; 379 }; 380 381 class AudioDeviceRefiner { 382 public: 383 virtual ~AudioDeviceRefiner() = default; 384 385 virtual int32_t OnAudioOutputDeviceRefined(std::vector<std::unique_ptr<AudioDeviceDescriptor>> &descs, 386 RouterType routerType, StreamUsage streamUsage, int32_t clientUid, AudioPipeType audioPipeType) = 0; 387 virtual int32_t OnAudioInputDeviceRefined(std::vector<std::unique_ptr<AudioDeviceDescriptor>> &descs, 388 RouterType routerType, SourceType sourceType, int32_t clientUid, AudioPipeType audioPipeType) = 0; 389 }; 390 391 /** 392 * @brief The AudioSystemManager class is an abstract definition of audio manager. 393 * Provides a series of client/interfaces for audio management 394 */ 395 396 class AudioSystemManager { 397 public: 398 static AudioSystemManager *GetInstance(); 399 400 /** 401 * @brief Map volume to HDI. 402 * 403 * @param volume volume value. 404 * @return Returns current volume. 405 * @since 8 406 */ 407 static float MapVolumeToHDI(int32_t volume); 408 409 /** 410 * @brief Map volume from HDI. 411 * 412 * @param volume volume value. 413 * @return Returns current volume. 414 * @since 8 415 */ 416 static int32_t MapVolumeFromHDI(float volume); 417 418 /** 419 * @brief Get audio streamType. 420 * 421 * @param contentType Enumerates the audio content type. 422 * @param streamUsage Enumerates the stream usage. 423 * @return Returns Audio streamType. 424 * @since 8 425 */ 426 static AudioStreamType GetStreamType(ContentType contentType, StreamUsage streamUsage); 427 428 /** 429 * @brief Set the stream volume. 430 * 431 * @param volumeType Enumerates the audio volume type. 432 * @param volume The volume to be set for the current stream. 433 * @return Returns {@link SUCCESS} if volume is successfully set; returns an error code 434 * defined in {@link audio_errors.h} otherwise. 435 * @since 8 436 */ 437 int32_t SetVolume(AudioVolumeType volumeType, int32_t volume) const; 438 439 /** 440 * @brief Obtains the current stream volume. 441 * 442 * @param volumeType Enumerates the audio volume type. 443 * @return Returns current stream volume. 444 * @since 8 445 */ 446 int32_t GetVolume(AudioVolumeType volumeType) const; 447 448 /** 449 * @brief Set volume discount factor. 450 * 451 * @param streamId stream Unique identification. 452 * @param volume Adjustment percentage. 453 * @return Whether the operation is effective 454 * @since 9 455 */ 456 int32_t SetLowPowerVolume(int32_t streamId, float volume) const; 457 458 /** 459 * @brief get volume discount factor. 460 * 461 * @param streamId stream Unique identification. 462 * @return Returns current stream volume. 463 * @since 9 464 */ 465 float GetLowPowerVolume(int32_t streamId) const; 466 467 /** 468 * @brief get single stream volume. 469 * 470 * @param streamId stream Unique identification. 471 * @return Returns current stream volume. 472 * @since 9 473 */ 474 float GetSingleStreamVolume(int32_t streamId) const; 475 476 /** 477 * @brief get max stream volume. 478 * 479 * @param volumeType audio volume type. 480 * @return Returns current stream volume. 481 * @since 8 482 */ 483 int32_t GetMaxVolume(AudioVolumeType volumeType); 484 485 /** 486 * @brief get min stream volume. 487 * 488 * @param volumeType audio volume type. 489 * @return Returns current stream volume. 490 * @since 8 491 */ 492 int32_t GetMinVolume(AudioVolumeType volumeType); 493 494 /** 495 * @brief set stream mute. 496 * 497 * @param volumeType audio volume type. 498 * @param mute Specifies whether the stream is muted. 499 * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined 500 * in {@link audio_errors.h} otherwise. 501 * @since 8 502 */ 503 int32_t SetMute(AudioVolumeType volumeType, bool mute) const; 504 505 /** 506 * @brief is stream mute. 507 * 508 * @param volumeType audio volume type. 509 * @return Returns <b>true</b> if the rendering is successfully started; returns <b>false</b> otherwise. 510 * @since 8 511 */ 512 bool IsStreamMute(AudioVolumeType volumeType) const; 513 514 /** 515 * @brief Set global microphone mute state. 516 * 517 * @param mute Specifies whether the Microphone is muted. 518 * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined 519 * in {@link audio_errors.h} otherwise. 520 * @since 8 521 */ 522 int32_t SetMicrophoneMute(bool isMute); 523 524 /** 525 * @brief get global microphone mute state. 526 * 527 * @return Returns <b>true</b> if the rendering is successfully started; returns <b>false</b> otherwise. 528 * @since 9 529 */ 530 bool IsMicrophoneMute(); 531 532 /** 533 * @brief Select output device. 534 * 535 * @param audioDeviceDescriptors Output device object. 536 * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined 537 * in {@link audio_errors.h} otherwise. 538 * @since 9 539 */ 540 int32_t SelectOutputDevice(std::vector<sptr<AudioDeviceDescriptor>> audioDeviceDescriptors) const; 541 542 /** 543 * @brief Select input device. 544 * 545 * @param audioDeviceDescriptors Output device object. 546 * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined 547 * in {@link audio_errors.h} otherwise. 548 * @since 9 549 */ 550 int32_t SelectInputDevice(std::vector<sptr<AudioDeviceDescriptor>> audioDeviceDescriptors) const; 551 552 /** 553 * @brief get selected device info. 554 * 555 * @param uid identifier. 556 * @param pid identifier. 557 * @param streamType audio stream type. 558 * @return Returns device info. 559 * @since 9 560 */ 561 std::string GetSelectedDeviceInfo(int32_t uid, int32_t pid, AudioStreamType streamType) const; 562 563 /** 564 * @brief Select the audio output device according to the filter conditions. 565 * 566 * @param audioRendererFilter filter conditions. 567 * @param audioDeviceDescriptors Output device object. 568 * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined 569 * in {@link audio_errors.h} otherwise. 570 * @since 9 571 */ 572 int32_t SelectOutputDevice(sptr<AudioRendererFilter> audioRendererFilter, 573 std::vector<sptr<AudioDeviceDescriptor>> audioDeviceDescriptors) const; 574 575 /** 576 * @brief Select the audio input device according to the filter conditions. 577 * 578 * @param audioRendererFilter filter conditions. 579 * @param audioDeviceDescriptors Output device object. 580 * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined 581 * in {@link audio_errors.h} otherwise. 582 * @since 9 583 */ 584 int32_t SelectInputDevice(sptr<AudioCapturerFilter> audioCapturerFilter, 585 std::vector<sptr<AudioDeviceDescriptor>> audioDeviceDescriptors) const; 586 587 /** 588 * @brief Get the list of audio devices. 589 * 590 * @param deviceFlag Flag of device type. 591 * @param GetAudioParameter Key of audio parameters to be obtained. 592 * @return Returns the device list is obtained. 593 * @since 9 594 */ 595 std::vector<sptr<AudioDeviceDescriptor>> GetDevices(DeviceFlag deviceFlag); 596 597 /** 598 * @brief Get the list of audio devices (inner). 599 * 600 * @param deviceFlag Flag of device type. 601 * @return Returns the device list is obtained. 602 * @since 12 603 */ 604 std::vector<sptr<AudioDeviceDescriptor>> GetDevicesInner(DeviceFlag deviceFlag); 605 606 /** 607 * @brief Get audio parameter. 608 * 609 * @param key Key of audio parameters to be obtained. 610 * @return Returns the value of the obtained audio parameter 611 * @since 9 612 */ 613 const std::string GetAudioParameter(const std::string key); 614 615 /** 616 * @brief set audio parameter. 617 * 618 * @param key The key of the set audio parameter. 619 * @param value The value of the set audio parameter. 620 * @since 9 621 */ 622 void SetAudioParameter(const std::string &key, const std::string &value); 623 624 /** 625 * @brief set audio parameter. 626 * 627 * @parame key The key of the set audio parameter. 628 * @param value The value of the set audio parameter. 629 * @since 12 630 */ 631 int32_t SetAsrAecMode(const AsrAecMode asrAecMode); 632 /** 633 * @brief set audio parameter. 634 * 635 * @parame key The key of the set audio parameter. 636 * @param value The value of the set audio parameter. 637 * @since 12 638 */ 639 int32_t GetAsrAecMode(AsrAecMode &asrAecMode); 640 /** 641 * @brief set audio parameter. 642 * 643 * @parame key The key of the set audio parameter. 644 * @param value The value of the set audio parameter. 645 * @since 12 646 */ 647 int32_t SetAsrNoiseSuppressionMode(const AsrNoiseSuppressionMode asrNoiseSuppressionMode); 648 /** 649 * @brief set audio parameter. 650 * 651 * @parame key The key of the set audio parameter. 652 * @param value The value of the set audio parameter. 653 * @since 12 654 */ 655 int32_t GetAsrNoiseSuppressionMode(AsrNoiseSuppressionMode &asrNoiseSuppressionMode); 656 /** 657 * @brief set audio parameter. 658 * 659 * @parame key The key of the set audio parameter. 660 * @param value The value of the set audio parameter. 661 * @since 12 662 */ 663 int32_t SetAsrWhisperDetectionMode(const AsrWhisperDetectionMode asrWhisperDetectionMode); 664 /** 665 * @brief set audio parameter. 666 * 667 * @parame key The key of the set audio parameter. 668 * @param value The value of the set audio parameter. 669 * @since 12 670 */ 671 int32_t GetAsrWhisperDetectionMode(AsrWhisperDetectionMode &asrWhisperDetectionMode); 672 /** 673 * @brief set audio parameter. 674 * 675 * @parame key The key of the set audio parameter. 676 * @param value The value of the set audio parameter. 677 * @since 12 678 */ 679 int32_t SetAsrVoiceControlMode(const AsrVoiceControlMode asrVoiceControlMode, bool on); 680 /** 681 * @brief set audio parameter. 682 * 683 * @parame key The key of the set audio parameter. 684 * @param value The value of the set audio parameter. 685 * @since 12 686 */ 687 int32_t SetAsrVoiceMuteMode(const AsrVoiceMuteMode asrVoiceMuteMode, bool on); 688 /** 689 * @brief set audio parameter. 690 * 691 * @parame key The key of the set audio parameter. 692 * @param value The value of the set audio parameter. 693 * @since 12 694 */ 695 int32_t IsWhispering(); 696 697 /** 698 * @brief Get audio parameter. 699 * 700 * @param mainKey Main key of audio parameters to be obtained. 701 * @param subKeys subKeys of audio parameters to be obtained. 702 * @param result value of sub key parameters. 703 * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined 704 * @since 11 705 */ 706 int32_t GetExtraParameters(const std::string &mainKey, 707 const std::vector<std::string> &subKeys, std::vector<std::pair<std::string, std::string>> &result); 708 709 /** 710 * @brief Set audio parameters. 711 * 712 * @param key The main key of the set audio parameter. 713 * @param kvpairs The pairs with sub keys and values of the set audio parameter. 714 * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined 715 * @since 11 716 */ 717 int32_t SetExtraParameters(const std::string &key, 718 const std::vector<std::pair<std::string, std::string>> &kvpairs); 719 720 /** 721 * @brief Get transaction Id. 722 * 723 * @param deviceType device type. 724 * @param deviceRole device role. 725 * @return Returns transaction Id. 726 * @since 9 727 */ 728 uint64_t GetTransactionId(DeviceType deviceType, DeviceRole deviceRole); 729 730 /** 731 * @brief Set device active. 732 * 733 * @param deviceType device type. 734 * @param flag Device activation status. 735 * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined 736 * in {@link audio_errors.h} otherwise. 737 * @since 9 738 */ 739 int32_t SetDeviceActive(DeviceType deviceType, bool flag) const; 740 741 /** 742 * @brief get device active. 743 * 744 * @param deviceType device type. 745 * @return Returns <b>true</b> if the rendering is successfully started; returns <b>false</b> otherwise. 746 * @since 9 747 */ 748 bool IsDeviceActive(DeviceType deviceType) const; 749 750 /** 751 * @brief get active output device. 752 * 753 * @return Returns device type. 754 * @since 9 755 */ 756 DeviceType GetActiveOutputDevice(); 757 758 /** 759 * @brief get active input device. 760 * 761 * @return Returns device type. 762 * @since 9 763 */ 764 DeviceType GetActiveInputDevice(); 765 766 /** 767 * @brief Is stream active. 768 * 769 * @param volumeType audio volume type. 770 * @return Returns <b>true</b> if the rendering is successfully started; returns <b>false</b> otherwise. 771 * @since 9 772 */ 773 bool IsStreamActive(AudioVolumeType volumeType) const; 774 775 /** 776 * @brief Set ringer mode. 777 * 778 * @param ringMode audio ringer mode. 779 * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined 780 * in {@link audio_errors.h} otherwise. 781 * @since 8 782 */ 783 int32_t SetRingerMode(AudioRingerMode ringMode); 784 785 /** 786 * @brief Get ringer mode. 787 * 788 * @return Returns audio ringer mode. 789 * @since 8 790 */ 791 AudioRingerMode GetRingerMode(); 792 793 /** 794 * @brief Set audio scene. 795 * 796 * @param scene audio scene. 797 * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined 798 * in {@link audio_errors.h} otherwise. 799 * @since 8 800 */ 801 int32_t SetAudioScene(const AudioScene &scene); 802 803 /** 804 * @brief Get audio scene. 805 * 806 * @return Returns audio scene. 807 * @since 8 808 */ 809 AudioScene GetAudioScene() const; 810 811 /** 812 * @brief Registers the deviceChange callback listener. 813 * 814 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 815 * defined in {@link audio_errors.h} otherwise. 816 * @since 8 817 */ 818 int32_t SetDeviceChangeCallback(const DeviceFlag flag, const std::shared_ptr<AudioManagerDeviceChangeCallback> 819 &callback); 820 821 /** 822 * @brief Unregisters the deviceChange callback listener 823 * 824 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 825 * defined in {@link audio_errors.h} otherwise. 826 * @since 8 827 */ 828 int32_t UnsetDeviceChangeCallback(DeviceFlag flag = DeviceFlag::ALL_DEVICES_FLAG, 829 std::shared_ptr<AudioManagerDeviceChangeCallback> callback = nullptr); 830 831 /** 832 * @brief Registers the ringerMode callback listener. 833 * 834 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 835 * defined in {@link audio_errors.h} otherwise. 836 * @since 8 837 */ 838 int32_t SetRingerModeCallback(const int32_t clientId, 839 const std::shared_ptr<AudioRingerModeCallback> &callback); 840 841 /** 842 * @brief Unregisters the VolumeKeyEvent callback listener 843 * 844 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 845 * defined in {@link audio_errors.h} otherwise. 846 * @since 8 847 */ 848 int32_t UnsetRingerModeCallback(const int32_t clientId) const; 849 850 /** 851 * @brief registers the volumeKeyEvent callback listener 852 * 853 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 854 * defined in {@link audio_errors.h} otherwise. 855 * @since 8 856 */ 857 int32_t RegisterVolumeKeyEventCallback(const int32_t clientPid, 858 const std::shared_ptr<VolumeKeyEventCallback> &callback, API_VERSION api_v = API_9); 859 860 /** 861 * @brief Unregisters the volumeKeyEvent callback listener 862 * 863 * @return Returns {@link SUCCESS} if callback unregistration is successful; returns an error code 864 * defined in {@link audio_errors.h} otherwise. 865 * @since 8 866 */ 867 int32_t UnregisterVolumeKeyEventCallback(const int32_t clientPid, 868 const std::shared_ptr<VolumeKeyEventCallback> &callback = nullptr); 869 870 /** 871 * @brief Set mono audio state 872 * 873 * @param monoState mono state 874 * @since 8 875 */ 876 void SetAudioMonoState(bool monoState); 877 878 /** 879 * @brief Set audio balance value 880 * 881 * @param balanceValue balance value 882 * @since 8 883 */ 884 void SetAudioBalanceValue(float balanceValue); 885 886 /** 887 * @brief Set system sound uri 888 * 889 * @param key the key of uri 890 * @param uri the value of uri 891 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 892 * defined in {@link audio_errors.h} otherwise. 893 * @since 10 894 */ 895 int32_t SetSystemSoundUri(const std::string &key, const std::string &uri); 896 897 /** 898 * @brief Get system sound uri 899 * 900 * @param key the key of uri 901 * @return Returns the value of uri for the key 902 * @since 10 903 */ 904 std::string GetSystemSoundUri(const std::string &key); 905 906 // Below APIs are added to handle compilation error in call manager 907 // Once call manager adapt to new interrupt APIs, this will be removed 908 909 /** 910 * @brief registers the audioManager callback listener 911 * 912 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 913 * defined in {@link audio_errors.h} otherwise. 914 * @since 8 915 */ 916 int32_t SetAudioManagerCallback(const AudioVolumeType streamType, 917 const std::shared_ptr<AudioManagerCallback> &callback); 918 919 /** 920 * @brief Unregisters the audioManager callback listener 921 * 922 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 923 * defined in {@link audio_errors.h} otherwise. 924 * @since 8 925 */ 926 int32_t UnsetAudioManagerCallback(const AudioVolumeType streamType) const; 927 928 /** 929 * @brief Activate audio Interrupt 930 * 931 * @param audioInterrupt audioInterrupt 932 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 933 * defined in {@link audio_errors.h} otherwise. 934 * @since 8 935 */ 936 int32_t ActivateAudioInterrupt(const AudioInterrupt &audioInterrupt); 937 938 /** 939 * @brief Deactivactivate audio Interrupt 940 * 941 * @param audioInterrupt audioInterrupt 942 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 943 * defined in {@link audio_errors.h} otherwise. 944 * @since 8 945 */ 946 int32_t DeactivateAudioInterrupt(const AudioInterrupt &audioInterrupt) const; 947 948 /** 949 * @brief registers the Interrupt callback listener 950 * 951 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 952 * defined in {@link audio_errors.h} otherwise. 953 * @since 8 954 */ 955 int32_t SetAudioManagerInterruptCallback(const std::shared_ptr<AudioManagerCallback> &callback); 956 957 /** 958 * @brief Unregisters the Interrupt callback listener 959 * 960 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 961 * defined in {@link audio_errors.h} otherwise. 962 * @since 8 963 */ 964 int32_t UnsetAudioManagerInterruptCallback(); 965 966 /** 967 * @brief Request audio focus 968 * 969 * @param audioInterrupt audioInterrupt 970 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 971 * defined in {@link audio_errors.h} otherwise. 972 * @since 8 973 */ 974 int32_t RequestAudioFocus(const AudioInterrupt &audioInterrupt); 975 976 /** 977 * @brief Abandon audio focus 978 * 979 * @param audioInterrupt audioInterrupt 980 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 981 * defined in {@link audio_errors.h} otherwise. 982 * @since 8 983 */ 984 int32_t AbandonAudioFocus(const AudioInterrupt &audioInterrupt); 985 986 /** 987 * @brief Reconfigure audio channel 988 * 989 * @param count count 990 * @param deviceType device type 991 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 992 * defined in {@link audio_errors.h} otherwise. 993 * @since 8 994 */ 995 int32_t ReconfigureAudioChannel(const uint32_t &count, DeviceType deviceType); 996 997 /** 998 * @brief Request independent interrupt 999 * 1000 * @param focusType focus type 1001 * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined 1002 * in {@link audio_errors.h} otherwise. 1003 * @since 8 1004 */ 1005 bool RequestIndependentInterrupt(FocusType focusType); 1006 1007 /** 1008 * @brief Abandon independent interrupt 1009 * 1010 * @param focusType focus type 1011 * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined 1012 * in {@link audio_errors.h} otherwise. 1013 * @since 8 1014 */ 1015 bool AbandonIndependentInterrupt(FocusType focusType); 1016 1017 /** 1018 * @brief Get audio latency from Xml 1019 * 1020 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 1021 * defined in {@link audio_errors.h} otherwise. 1022 * @since 8 1023 */ 1024 int32_t GetAudioLatencyFromXml() const; 1025 1026 /** 1027 * @brief Get audio sink from Xml 1028 * 1029 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 1030 * defined in {@link audio_errors.h} otherwise. 1031 * @since 8 1032 */ 1033 uint32_t GetSinkLatencyFromXml() const; 1034 1035 /** 1036 * @brief Update stream state 1037 * 1038 * @param clientUid client Uid 1039 * @param streamSetState streamSetState 1040 * @param streamUsage streamUsage 1041 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 1042 * defined in {@link audio_errors.h} otherwise. 1043 * @since 8 1044 */ 1045 int32_t UpdateStreamState(const int32_t clientUid, StreamSetState streamSetState, 1046 StreamUsage streamUsage); 1047 1048 /** 1049 * @brief Get Pin Value From Type 1050 * 1051 * @param deviceType deviceType 1052 * @param deviceRole deviceRole 1053 * @return Returns Enumerate AudioPin 1054 * @since 8 1055 */ 1056 AudioPin GetPinValueFromType(DeviceType deviceType, DeviceRole deviceRole) const; 1057 1058 /** 1059 * @brief Get type Value From Pin 1060 * 1061 * @param pin AudioPin 1062 * @return Returns Enumerate DeviceType 1063 * @since 8 1064 */ 1065 DeviceType GetTypeValueFromPin(AudioPin pin) const; 1066 1067 /** 1068 * @brief Get volume groups 1069 * 1070 * @param networkId networkId 1071 * @param info VolumeGroupInfo 1072 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 1073 * defined in {@link audio_errors.h} otherwise. 1074 * @since 8 1075 */ 1076 int32_t GetVolumeGroups(std::string networkId, std::vector<sptr<VolumeGroupInfo>> &info); 1077 1078 /** 1079 * @brief Get volume groups manager 1080 * 1081 * @param networkId networkId 1082 * @return Returns AudioGroupManager 1083 * @since 8 1084 */ 1085 std::shared_ptr<AudioGroupManager> GetGroupManager(int32_t groupId); 1086 1087 /** 1088 * @brief Get active output deviceDescriptors 1089 * 1090 * @return Returns AudioDeviceDescriptor 1091 * @since 8 1092 */ 1093 std::vector<sptr<AudioDeviceDescriptor>> GetActiveOutputDeviceDescriptors(); 1094 1095 /** 1096 * @brief Get preferred input device deviceDescriptors 1097 * 1098 * @return Returns AudioDeviceDescriptor 1099 * @since 10 1100 */ 1101 int32_t GetPreferredInputDeviceDescriptors(); 1102 1103 /** 1104 * @brief Get audio focus info 1105 * 1106 * @return Returns success or not 1107 * @since 10 1108 */ 1109 int32_t GetAudioFocusInfoList(std::list<std::pair<AudioInterrupt, AudioFocuState>> &focusInfoList); 1110 1111 /** 1112 * @brief Register callback to listen audio focus info change event 1113 * 1114 * @return Returns success or not 1115 * @since 10 1116 */ 1117 int32_t RegisterFocusInfoChangeCallback(const std::shared_ptr<AudioFocusInfoChangeCallback> &callback); 1118 1119 /** 1120 * @brief Unregister callback to listen audio focus info change event 1121 * 1122 * @return Returns success or not 1123 * @since 10 1124 */ 1125 int32_t UnregisterFocusInfoChangeCallback( 1126 const std::shared_ptr<AudioFocusInfoChangeCallback> &callback = nullptr); 1127 1128 /** 1129 * @brief Ask audio native process to request thread priority for client 1130 * 1131 * @param tid Target thread id 1132 * @since 10 1133 */ 1134 void RequestThreadPriority(uint32_t tid); 1135 1136 int32_t SetAudioCapturerSourceCallback(const std::shared_ptr<AudioCapturerSourceCallback> &callback); 1137 1138 int32_t SetWakeUpSourceCloseCallback(const std::shared_ptr<WakeUpSourceCloseCallback> &callback); 1139 1140 /** 1141 * @brief Set whether or not absolute volume is supported for the specified Bluetooth device 1142 * 1143 * @return Returns success or not 1144 * @since 11 1145 */ 1146 int32_t SetDeviceAbsVolumeSupported(const std::string &macAddress, const bool support); 1147 1148 /** 1149 * @brief Set the absolute volume value for the specified Bluetooth device 1150 * 1151 * @return Returns success or not 1152 * @since 11 1153 */ 1154 int32_t SetA2dpDeviceVolume(const std::string &macAddress, const int32_t volume, const bool updateUi); 1155 /** 1156 * @brief Registers the availbale deviceChange callback listener. 1157 * 1158 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 1159 * defined in {@link audio_errors.h} otherwise. 1160 * @since 11 1161 */ 1162 int32_t SetAvailableDeviceChangeCallback(const AudioDeviceUsage usage, 1163 const std::shared_ptr<AudioManagerAvailableDeviceChangeCallback>& callback); 1164 /** 1165 * @brief UnRegisters the availbale deviceChange callback listener. 1166 * 1167 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 1168 * defined in {@link audio_errors.h} otherwise. 1169 * @since 11 1170 */ 1171 int32_t UnsetAvailableDeviceChangeCallback(AudioDeviceUsage usage); 1172 1173 /** 1174 * @brief Switch the output device accoring different cast type. 1175 * 1176 * @return Returns {@link SUCCESS} if device is successfully switched; returns an error code 1177 * defined in {@link audio_errors.h} otherwise. 1178 * @since 11 1179 */ 1180 int32_t ConfigDistributedRoutingRole(AudioDeviceDescriptor *desciptor, CastType type); 1181 1182 /** 1183 * @brief Registers the descriptor Change callback listener. 1184 * 1185 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 1186 * defined in {@link audio_errors.h} otherwise. 1187 * @since 11 1188 */ 1189 int32_t SetDistributedRoutingRoleCallback(const std::shared_ptr<AudioDistributedRoutingRoleCallback> &callback); 1190 1191 /** 1192 * @brief UnRegisters the descriptor Change callback callback listener. 1193 * 1194 * @return Returns {@link SUCCESS} if callback registration is successful; returns an error code 1195 * defined in {@link audio_errors.h} otherwise. 1196 * @since 11 1197 */ 1198 int32_t UnsetDistributedRoutingRoleCallback(const std::shared_ptr<AudioDistributedRoutingRoleCallback> &callback); 1199 1200 /** 1201 * @brief Set device address. 1202 * 1203 * @param deviceType device type. 1204 * @param flag Device activation status. 1205 * @param address Device address 1206 * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined 1207 * in {@link audio_errors.h} otherwise. 1208 * @since 11 1209 */ 1210 int32_t SetCallDeviceActive(DeviceType deviceType, bool flag, std::string address) const; 1211 1212 /** 1213 * @brief get the effect algorithmic latency value for a specified audio stream. 1214 * 1215 * @param sessionId the session ID value for the stream 1216 * @return Returns the effect algorithmic latency in ms. 1217 * @since 12 1218 */ 1219 uint32_t GetEffectLatency(const std::string &sessionId); 1220 1221 /** 1222 * @brief set useraction command 1223 * 1224 * @param actionCommand action command 1225 * @param paramInfo information 1226 * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined 1227 * in {@link audio_errors.h} otherwise. 1228 * @since 12 1229 */ 1230 int32_t DisableSafeMediaVolume(); 1231 1232 static void AudioServerDied(pid_t pid); 1233 1234 int32_t SetMicrophoneBlockedCallback(const std::shared_ptr<AudioManagerMicrophoneBlockedCallback>& callback); 1235 int32_t UnsetMicrophoneBlockedCallback(std::shared_ptr<AudioManagerMicrophoneBlockedCallback> callback = nullptr); 1236 1237 std::string GetSelfBundleName(int32_t uid); 1238 1239 std::string GetSelfBundleName(); 1240 1241 int32_t SetQueryClientTypeCallback(const std::shared_ptr<AudioQueryClientTypeCallback> &callback); 1242 1243 /** 1244 * @brief inject interruption event. 1245 * 1246 * @param networkId networkId. 1247 * @param event Indicates the InterruptEvent information needed by client. 1248 * For details, refer InterruptEvent struct in audio_interrupt_info.h 1249 * @return Returns {@link SUCCESS} if the setting is successful; returns an error code defined 1250 * in {@link audio_errors.h} otherwise. 1251 * @since 12 1252 */ 1253 int32_t InjectInterruption(const std::string networkId, InterruptEvent &event); 1254 1255 /** 1256 * @brief Load the split module for audio stream separation. 1257 * 1258 * @param splitArgs Specifies the types of audio to be split into different streams. 1259 * @param networkId The network identifier of the output device. 1260 * @return Returns {@link SUCCESS} if the module is loaded successfully; otherwise, returns an error code defined 1261 * in {@link audio_errors.h}. 1262 * @since 12 1263 */ 1264 int32_t LoadSplitModule(const std::string &splitArgs, const std::string &networkId); 1265 1266 /** 1267 * @brief Set Custmoized Ring Back Tone mute state. 1268 * 1269 * @param isMute Specifies whether the Customized Ring Back Tone is muted. 1270 * @return Returns {@link SUCCESS} if the settings is successfully; otherwise, returns an error code defined 1271 * in {@link audio_errors.h}. 1272 */ 1273 int32_t SetVoiceRingtoneMute(bool isMute); 1274 1275 /** 1276 * @brief Get standby state. 1277 * 1278 * @param sessionId Specifies which stream to be check. 1279 * @param isStandby true means the stream is in standby status. 1280 * @param enterStandbyTime Specifies when the stream enter standby status, in MONOTONIC time. 1281 * @return Returns {@link SUCCESS} if the operation is successfully. 1282 * @return Returns {@link ERR_ILLEGAL_STATE} if the server is not available. 1283 * @return Returns {@link ERR_INVALID_PARAM} if the sessionId is not exist. 1284 */ 1285 int32_t GetStandbyStatus(uint32_t sessionId, bool &isStandby, int64_t &enterStandbyTime); 1286 private: 1287 class WakeUpCallbackImpl : public WakeUpSourceCallback { 1288 public: WakeUpCallbackImpl(AudioSystemManager * audioSystemManager)1289 WakeUpCallbackImpl(AudioSystemManager *audioSystemManager) 1290 :audioSystemManager_(audioSystemManager) 1291 { 1292 } OnCapturerState(bool isActive)1293 void OnCapturerState(bool isActive) override 1294 { 1295 auto callback = audioSystemManager_ -> audioCapturerSourceCallback_; 1296 if (callback != nullptr) { 1297 callback -> OnCapturerState(isActive); 1298 } 1299 } OnWakeupClose()1300 void OnWakeupClose() override 1301 { 1302 auto callback = audioSystemManager_ -> audioWakeUpSourceCloseCallback_; 1303 if (callback != nullptr) { 1304 callback -> OnWakeupClose(); 1305 } 1306 } 1307 private: 1308 AudioSystemManager *audioSystemManager_; 1309 }; 1310 1311 static constexpr int32_t MAX_VOLUME_LEVEL = 15; 1312 static constexpr int32_t MIN_VOLUME_LEVEL = 0; 1313 static constexpr int32_t CONST_FACTOR = 100; 1314 static const std::map<std::pair<ContentType, StreamUsage>, AudioStreamType> streamTypeMap_; 1315 1316 AudioSystemManager(); 1317 virtual ~AudioSystemManager(); 1318 1319 static std::map<std::pair<ContentType, StreamUsage>, AudioStreamType> CreateStreamMap(); 1320 static void CreateStreamMap(std::map<std::pair<ContentType, StreamUsage>, AudioStreamType> &streamMap); 1321 int32_t GetCallingPid(); 1322 1323 int32_t RegisterWakeupSourceCallback(); 1324 void OtherDeviceTypeCases(DeviceType deviceType) const; 1325 1326 int32_t cbClientId_ = -1; 1327 int32_t volumeChangeClientPid_ = -1; 1328 AudioRingerMode ringModeBackup_ = RINGER_MODE_NORMAL; 1329 std::shared_ptr<AudioManagerDeviceChangeCallback> deviceChangeCallback_ = nullptr; 1330 std::shared_ptr<AudioInterruptCallback> audioInterruptCallback_ = nullptr; 1331 std::shared_ptr<AudioRingerModeCallback> ringerModeCallback_ = nullptr; 1332 std::shared_ptr<AudioFocusInfoChangeCallback> audioFocusInfoCallback_ = nullptr; 1333 std::shared_ptr<AudioDistributedRoutingRoleCallback> audioDistributedRoutingRoleCallback_ = nullptr; 1334 std::vector<std::shared_ptr<AudioGroupManager>> groupManagerMap_; 1335 std::mutex ringerModeCallbackMutex_; 1336 1337 std::shared_ptr<AudioCapturerSourceCallback> audioCapturerSourceCallback_ = nullptr; 1338 std::shared_ptr<WakeUpSourceCloseCallback> audioWakeUpSourceCloseCallback_ = nullptr; 1339 1340 std::shared_ptr<WakeUpCallbackImpl> remoteWakeUpCallback_; 1341 }; 1342 } // namespace AudioStandard 1343 } // namespace OHOS 1344 #endif // ST_AUDIO_SYSTEM_MANAGER_H 1345