OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 return -1; | 330 return -1; |
331 } | 331 } |
332 | 332 |
333 // volume range is 0.0 to 1.0 | 333 // volume range is 0.0 to 1.0 |
334 // we convert that to 0 - 255 | 334 // we convert that to 0 - 255 |
335 minVolume = 0; | 335 minVolume = 0; |
336 | 336 |
337 return 0; | 337 return 0; |
338 } | 338 } |
339 | 339 |
340 int32_t AudioMixerManagerMac::SpeakerVolumeStepSize(uint16_t& stepSize) const { | |
341 if (_outputDeviceID == kAudioObjectUnknown) { | |
342 LOG(LS_WARNING) << "device ID has not been set"; | |
343 return -1; | |
344 } | |
345 | |
346 // volume range is 0.0 to 1.0 | |
347 // we convert that to 0 - 255 | |
348 stepSize = 1; | |
349 | |
350 return 0; | |
351 } | |
352 | |
353 int32_t AudioMixerManagerMac::SpeakerVolumeIsAvailable(bool& available) { | 340 int32_t AudioMixerManagerMac::SpeakerVolumeIsAvailable(bool& available) { |
354 if (_outputDeviceID == kAudioObjectUnknown) { | 341 if (_outputDeviceID == kAudioObjectUnknown) { |
355 LOG(LS_WARNING) << "device ID has not been set"; | 342 LOG(LS_WARNING) << "device ID has not been set"; |
356 return -1; | 343 return -1; |
357 } | 344 } |
358 | 345 |
359 OSStatus err = noErr; | 346 OSStatus err = noErr; |
360 | 347 |
361 // Does the capture device have a master volume control? | 348 // Does the capture device have a master volume control? |
362 // If so, use it exclusively. | 349 // If so, use it exclusively. |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 // 1 means muted | 684 // 1 means muted |
698 enabled = static_cast<bool>(muted); | 685 enabled = static_cast<bool>(muted); |
699 } | 686 } |
700 | 687 |
701 LOG(LS_VERBOSE) << "AudioMixerManagerMac::MicrophoneMute() => enabled=" | 688 LOG(LS_VERBOSE) << "AudioMixerManagerMac::MicrophoneMute() => enabled=" |
702 << enabled; | 689 << enabled; |
703 | 690 |
704 return 0; | 691 return 0; |
705 } | 692 } |
706 | 693 |
707 int32_t AudioMixerManagerMac::MicrophoneBoostIsAvailable(bool& available) { | |
708 if (_inputDeviceID == kAudioObjectUnknown) { | |
709 LOG(LS_WARNING) << "device ID has not been set"; | |
710 return -1; | |
711 } | |
712 | |
713 available = false; // No AudioObjectPropertySelector value for Mic Boost | |
714 | |
715 return 0; | |
716 } | |
717 | |
718 int32_t AudioMixerManagerMac::SetMicrophoneBoost(bool enable) { | |
719 LOG(LS_VERBOSE) << "AudioMixerManagerMac::SetMicrophoneBoost(enable=" | |
720 << enable << ")"; | |
721 | |
722 rtc::CritScope lock(&_critSect); | |
723 | |
724 if (_inputDeviceID == kAudioObjectUnknown) { | |
725 LOG(LS_WARNING) << "device ID has not been set"; | |
726 return -1; | |
727 } | |
728 | |
729 // Ensure that the selected microphone has a valid boost control. | |
730 bool available(false); | |
731 MicrophoneBoostIsAvailable(available); | |
732 if (!available) { | |
733 LOG(LS_WARNING) << "it is not possible to enable microphone boost"; | |
734 return -1; | |
735 } | |
736 | |
737 // It is assumed that the call above fails! | |
738 return 0; | |
739 } | |
740 | |
741 int32_t AudioMixerManagerMac::MicrophoneBoost(bool& enabled) const { | |
742 if (_inputDeviceID == kAudioObjectUnknown) { | |
743 LOG(LS_WARNING) << "device ID has not been set"; | |
744 return -1; | |
745 } | |
746 | |
747 // Microphone boost cannot be enabled on this platform! | |
748 enabled = false; | |
749 | |
750 return 0; | |
751 } | |
752 | |
753 int32_t AudioMixerManagerMac::MicrophoneVolumeIsAvailable(bool& available) { | 694 int32_t AudioMixerManagerMac::MicrophoneVolumeIsAvailable(bool& available) { |
754 if (_inputDeviceID == kAudioObjectUnknown) { | 695 if (_inputDeviceID == kAudioObjectUnknown) { |
755 LOG(LS_WARNING) << "device ID has not been set"; | 696 LOG(LS_WARNING) << "device ID has not been set"; |
756 return -1; | 697 return -1; |
757 } | 698 } |
758 | 699 |
759 OSStatus err = noErr; | 700 OSStatus err = noErr; |
760 | 701 |
761 // Does the capture device have a master volume control? | 702 // Does the capture device have a master volume control? |
762 // If so, use it exclusively. | 703 // If so, use it exclusively. |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 return -1; | 863 return -1; |
923 } | 864 } |
924 | 865 |
925 // volume range is 0.0 to 1.0 | 866 // volume range is 0.0 to 1.0 |
926 // we convert that to 0 - 10 | 867 // we convert that to 0 - 10 |
927 minVolume = 0; | 868 minVolume = 0; |
928 | 869 |
929 return 0; | 870 return 0; |
930 } | 871 } |
931 | 872 |
932 int32_t AudioMixerManagerMac::MicrophoneVolumeStepSize( | |
933 uint16_t& stepSize) const { | |
934 if (_inputDeviceID == kAudioObjectUnknown) { | |
935 LOG(LS_WARNING) << "device ID has not been set"; | |
936 return -1; | |
937 } | |
938 | |
939 // volume range is 0.0 to 1.0 | |
940 // we convert that to 0 - 10 | |
941 stepSize = 1; | |
942 | |
943 return 0; | |
944 } | |
945 | |
946 // ============================================================================ | 873 // ============================================================================ |
947 // Private Methods | 874 // Private Methods |
948 // ============================================================================ | 875 // ============================================================================ |
949 | 876 |
950 // CoreAudio errors are best interpreted as four character strings. | 877 // CoreAudio errors are best interpreted as four character strings. |
951 void AudioMixerManagerMac::logCAMsg(const rtc::LoggingSeverity sev, | 878 void AudioMixerManagerMac::logCAMsg(const rtc::LoggingSeverity sev, |
952 const char* msg, | 879 const char* msg, |
953 const char* err) { | 880 const char* err) { |
954 RTC_DCHECK(msg != NULL); | 881 RTC_DCHECK(msg != NULL); |
955 RTC_DCHECK(err != NULL); | 882 RTC_DCHECK(err != NULL); |
(...skipping 20 matching lines...) Expand all Loading... |
976 LOG(LS_WARNING) << msg << ": " << err[3] << err[2] << err[1] << err[0]; | 903 LOG(LS_WARNING) << msg << ": " << err[3] << err[2] << err[1] << err[0]; |
977 break; | 904 break; |
978 default: | 905 default: |
979 break; | 906 break; |
980 } | 907 } |
981 #endif | 908 #endif |
982 } | 909 } |
983 | 910 |
984 } // namespace webrtc | 911 } // namespace webrtc |
985 // EOF | 912 // EOF |
OLD | NEW |