hand off audio bandwidth to BandwidthManager

This commit is contained in:
Stephen Birarda 2015-01-21 12:39:04 -08:00
parent 1a87fa93f4
commit 693c52da55
2 changed files with 9 additions and 2 deletions

View file

@ -283,6 +283,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
audioIO->setPositionGetter(getPositionForAudio);
audioIO->setOrientationGetter(getOrientationForAudio);
connect(audioIO.data(), &AudioClient::inputBytesFromNetwork, &_bandwidthMeter, &BandwidthMeter::updateAudioInputBytes);
connect(audioIO.data(), &AudioClient::outputBytesToNetwork, &_bandwidthMeter, &BandwidthMeter::updateAudioOutputBytes);
audioIO->moveToThread(audioThread);
connect(audioThread, &QThread::started, audioIO.data(), &AudioClient::start);

View file

@ -19,8 +19,8 @@
#include <TextRenderer.h>
class BandwidthMeter {
class BandwidthMeter : public QObject {
Q_OBJECT
public:
BandwidthMeter();
@ -67,6 +67,10 @@ public:
Stream const& outputStream(ChannelIndex i) const { return _streams[i * 2 + 1]; }
ChannelInfo& channelInfo(ChannelIndex i) { return _channels[i]; }
ChannelInfo const& channelInfo(ChannelIndex i) const { return _channels[i]; }
public slots:
void updateAudioInputBytes(int numBytes) { inputStream(AUDIO).updateValue(numBytes); }
void updateAudioOutputBytes(int numBytes) { outputStream(AUDIO).updateValue(numBytes); }
private:
static void setColorRGBA(unsigned c);