|
From: Yoda-JM <yo...@us...> - 2010-08-15 14:52:56
|
Module: performous
Branch: joinmenu
Commit: 05aaf1dc2011ac1756fe72bb90d07cad14b360d3
Author: Tapio Vierros <tap...@gm...>
Date: Sun Jul 18 17:14:53 2010 +0300
Limit the number of mics.
---
game/audio.cc | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index b92264f..b92e325 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -294,6 +294,7 @@ struct Audio::Impl {
boost::ptr_vector<Analyzer> analyzers;
bool playback;
Impl(): playback() {
+ int mic_count = 0;
// Parse audio devices from config
ConfigItem::StringList devs = config["audio/devices"].sl();
for (ConfigItem::StringList::const_iterator it = devs.begin(), end = devs.end(); it != end; ++it) {
@@ -327,8 +328,9 @@ struct Audio::Impl {
}
devices.push_back(new Device(params.in, params.out, params.rate, params.dev));
Device& d = devices.back();
- // Assign mics for all channels of the device (TODO: proper assignments and limit the number of mics)
+ // Assign mics for all channels of the device (TODO: proper assignments)
for (unsigned int i = 0; i < d.in; ++i) {
+ if (mic_count + i + 1 > 4) break; // Too many mics
Analyzer* a = new Analyzer(d.rate);
analyzers.push_back(a);
d.mics[i] = a;
@@ -340,6 +342,7 @@ struct Audio::Impl {
}
// Start capture/playback on this device
d.start();
+ mic_count += d.in;
} catch(std::runtime_error& e) {
std::cerr << "Audio device '" << *it << "': " << e.what() << std::endl;
}
|