| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 // This utility will portably force the volume of the default microphone to max. | |
| 12 | |
| 13 #include <stdio.h> | |
| 14 | |
| 15 #include "webrtc/modules/audio_device/include/audio_device.h" | |
| 16 | |
| 17 using webrtc::AudioDeviceModule; | |
| 18 | |
| 19 #if defined(_WIN32) | |
| 20 #define DEFAULT_INPUT_DEVICE (AudioDeviceModule::kDefaultCommunicationDevice) | |
| 21 #else | |
| 22 #define DEFAULT_INPUT_DEVICE (0) | |
| 23 #endif | |
| 24 | |
| 25 int main(int /*argc*/, char** /*argv*/) { | |
| 26 // Create and initialize the ADM. | |
| 27 rtc::scoped_refptr<AudioDeviceModule> adm( | |
| 28 AudioDeviceModule::Create(1, AudioDeviceModule::kPlatformDefaultAudio)); | |
| 29 if (!adm.get()) { | |
| 30 fprintf(stderr, "Failed to create Audio Device Module.\n"); | |
| 31 return 1; | |
| 32 } | |
| 33 if (adm->Init() != 0) { | |
| 34 fprintf(stderr, "Failed to initialize Audio Device Module.\n"); | |
| 35 return 1; | |
| 36 } | |
| 37 if (adm->SetRecordingDevice(DEFAULT_INPUT_DEVICE) != 0) { | |
| 38 fprintf(stderr, "Failed to set the default input device.\n"); | |
| 39 return 1; | |
| 40 } | |
| 41 if (adm->InitMicrophone() != 0) { | |
| 42 fprintf(stderr, "Failed to to initialize the microphone.\n"); | |
| 43 return 1; | |
| 44 } | |
| 45 | |
| 46 // Set mic volume to max. | |
| 47 uint32_t max_vol = 0; | |
| 48 if (adm->MaxMicrophoneVolume(&max_vol) != 0) { | |
| 49 fprintf(stderr, "Failed to get max volume.\n"); | |
| 50 return 1; | |
| 51 } | |
| 52 if (adm->SetMicrophoneVolume(max_vol) != 0) { | |
| 53 fprintf(stderr, "Failed to set mic volume.\n"); | |
| 54 return 1; | |
| 55 } | |
| 56 | |
| 57 return 0; | |
| 58 } | |
| OLD | NEW |