From 26c34bb86c36cd573f332ff2f8e471f4831f7d18 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 15 May 2013 11:29:52 -0700 Subject: [PATCH] sensible initialization for Audio member variables --- interface/src/Audio.cpp | 15 ++++++++++----- interface/src/Audio.h | 1 - 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index 9b9ebb222b..68aeb5b3ef 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -285,12 +285,19 @@ void outputPortAudioError(PaError error) { } Audio::Audio(Oscilloscope* scope) : + _stream(NULL), _ringBuffer(RING_BUFFER_SAMPLES, PACKET_LENGTH_SAMPLES), _scope(scope), _averagedLatency(0.0), _measuredJitter(0), _wasStarved(0), - _totalPacketsReceived(0) { + _lastInputLoudness(0), + _mixerLoopbackFlag(false), + _lastVelocity(0), + _lastAcceleration(0), + _totalPacketsReceived(0), + _firstPlaybackTime(), + _packetsReceivedThisPlayback(0) { outputPortAudioError(Pa_Initialize()); @@ -303,8 +310,6 @@ Audio::Audio(Oscilloscope* scope) : audioCallback, (void*) this)); - _initialized = true; - // start the stream now that sources are good to go outputPortAudioError(Pa_StartStream(_stream)); @@ -312,7 +317,7 @@ Audio::Audio(Oscilloscope* scope) : } Audio::~Audio() { - if (_initialized) { + if (_stream) { outputPortAudioError(Pa_CloseStream(_stream)); outputPortAudioError(Pa_Terminate()); } @@ -365,7 +370,7 @@ void Audio::addReceivedAudioToBuffer(unsigned char* receivedData, int receivedB } void Audio::render(int screenWidth, int screenHeight) { - if (_initialized) { + if (_stream) { glLineWidth(2.0); glBegin(GL_LINES); glColor3f(1,1,1); diff --git a/interface/src/Audio.h b/interface/src/Audio.h index e005682b06..4a2b2ec974 100644 --- a/interface/src/Audio.h +++ b/interface/src/Audio.h @@ -35,7 +35,6 @@ public: void addReceivedAudioToBuffer(unsigned char* receivedData, int receivedBytes); private: - bool _initialized; PaStream* _stream; AudioRingBuffer _ringBuffer; Oscilloscope* _scope;