summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphoglund@webrtc.org <phoglund@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2013-05-16 13:10:00 +0000
committerphoglund@webrtc.org <phoglund@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2013-05-16 13:10:00 +0000
commita4f0d20eb79269d2d649b3f062b70fc9b6dbbe65 (patch)
treed0a6009fd6dc56a9252d53259e96a2b15cdff9e1
parent2a9108f911ae7a758f16061ba06bb73b270dd170 (diff)
downloadwebrtc-a4f0d20eb79269d2d649b3f062b70fc9b6dbbe65.tar.gz
Wrote a small portable tool for forcing the mic volume to 100%.
BUG= R=henrika@webrtc.org, kjellander@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1477005 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@4045 4adac7df-926f-26a2-2b94-8c16560cd09d
-rw-r--r--tools/force_mic_volume_max/force_mic_volume_max.cc47
-rw-r--r--tools/tools.gyp10
2 files changed, 57 insertions, 0 deletions
diff --git a/tools/force_mic_volume_max/force_mic_volume_max.cc b/tools/force_mic_volume_max/force_mic_volume_max.cc
new file mode 100644
index 00000000..c824f8a8
--- /dev/null
+++ b/tools/force_mic_volume_max/force_mic_volume_max.cc
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+// This utility will portably force the volume of the default microphone to max.
+
+#include <cstdio>
+
+#include "webrtc/system_wrappers/interface/scoped_ptr.h"
+#include "webrtc/test/channel_transport/include/channel_transport.h"
+#include "webrtc/voice_engine/include/voe_audio_processing.h"
+#include "webrtc/voice_engine/include/voe_base.h"
+#include "webrtc/voice_engine/include/voe_volume_control.h"
+
+int main(int argc, char** argv) {
+ webrtc::VoiceEngine* voe = webrtc::VoiceEngine::Create();
+ if (voe == NULL) {
+ fprintf(stderr, "Failed to initialize voice engine.\n");
+ return 1;
+ }
+
+ webrtc::VoEBase* base = webrtc::VoEBase::GetInterface(voe);
+ webrtc::VoEVolumeControl* volume_control =
+ webrtc::VoEVolumeControl::GetInterface(voe);
+
+ if (base->Init() != 0) {
+ fprintf(stderr, "Failed to initialize voice engine base.\n");
+ return 1;
+ }
+ // Set to 0 first in case the mic is above 100%.
+ if (volume_control->SetMicVolume(0) != 0) {
+ fprintf(stderr, "Failed set volume to 0.\n");
+ return 1;
+ }
+ if (volume_control->SetMicVolume(255) != 0) {
+ fprintf(stderr, "Failed set volume to 255.\n");
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/tools/tools.gyp b/tools/tools.gyp
index 3a6787e2..a16ad518 100644
--- a/tools/tools.gyp
+++ b/tools/tools.gyp
@@ -102,6 +102,16 @@
'frame_editing/frame_editing.cc',
],
}, # frame_editing
+ {
+ 'target_name': 'force_mic_volume_max',
+ 'type': 'executable',
+ 'dependencies': [
+ '<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine_core',
+ ],
+ 'sources': [
+ 'force_mic_volume_max/force_mic_volume_max.cc',
+ ],
+ }, # force_mic_volume_max
],
'conditions': [
['include_tests==1', {