replace audio with AudioIOStatsRenderer in ApplicationOverlay

This commit is contained in:
Stephen Birarda 2014-12-16 14:53:36 -08:00
parent 1db12453d4
commit 0f18a9651b
4 changed files with 16 additions and 8 deletions

View file

@ -105,6 +105,8 @@ public:
bool mousePressEvent(int x, int y);
void renderToolBox(int x, int y, bool boxed);
const AudioIOStats& getStats() const { return _stats; }
float getInputRingBufferMsecsAvailable() const;
float getAudioOutputMsecsUnplayed() const;

View file

@ -16,16 +16,18 @@
#include <NodeList.h>
#include <Util.h>
#include "Audio.h"
#include "AudioIOStats.h"
#include "AudioIOStatsRenderer.h"
AudioIOStatsRenderer::AudioIOStatsRenderer(const AudioIOStats* stats) :
_stats(stats),
AudioIOStatsRenderer::AudioIOStatsRenderer() :
_stats(NULL),
_isEnabled(false),
_shouldShowInjectedStreams(false)
{
// grab the stats object from the audio I/O singleton
_stats = &DependencyManager::get<Audio>()->getStats();
}
#ifdef _WIN32

View file

@ -14,18 +14,22 @@
#include <QObject>
#include <DependencyManager.h>
class AudioIOStats;
class AudioStreamStats;
class AudioIOStatsRenderer : public QObject {
class AudioIOStatsRenderer : public QObject, public DependencyManager::Dependency {
Q_OBJECT
public:
AudioIOStatsRenderer(const AudioIOStats* audioIOStats);
void render(const float* color, int width, int height);
friend class DependencyManager;
public slots:
void toggle() { _isEnabled = !_isEnabled; }
void toggleShowInjectedStreams() { _shouldShowInjectedStreams = !_shouldShowInjectedStreams; }
protected:
AudioIOStatsRenderer();
private:
// audio stats methods for rendering
void renderAudioStreamStats(const AudioStreamStats* streamStats, int horizontalOffset, int& verticalOffset,

View file

@ -15,6 +15,7 @@
#include <PerfStat.h>
#include "audio/AudioScope.h"
#include "audio/AudioIOStatsRenderer.h"
#include "Application.h"
#include "ApplicationOverlay.h"
#include "devices/OculusManager.h"
@ -830,8 +831,7 @@ void ApplicationOverlay::renderAudioMeter() {
audio->renderToolBox(MIRROR_VIEW_LEFT_PADDING + AUDIO_METER_GAP, audioMeterY, boxed);
DependencyManager::get<AudioScope>()->render(glWidget->width(), glWidget->height());
audio->renderStats(WHITE_TEXT, glWidget->width(), glWidget->height());
DependencyManager::get<AudioIOStatsRenderer>()->render(WHITE_TEXT, glWidget->width(), glWidget->height());
glBegin(GL_QUADS);
if (isClipping) {