zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit b8236eadf9ea41871dcbad1fa712798dd3f04fa5
parent 8a2dfe2f1fdf4878334aba1c6de744be87414df3
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Sat,  4 Sep 2010 16:19:14 -0400

PortAudio: Fixed Driver Compile issue

Should Fix:
sf.net/tracker/index.php?func=detail&aid=3054853&group_id=62934&atid=502312

Diffstat:
Msrc/Nio/PaEngine.cpp | 25++++++++++++++++++-------
Msrc/Nio/PaEngine.h | 5++++-
2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/src/Nio/PaEngine.cpp b/src/Nio/PaEngine.cpp @@ -21,13 +21,12 @@ */ #include "PaEngine.h" -#include "../Samples/Sample.h" #include <iostream> using namespace std; -PaEngine::PaEngine(OutMgr *out) - :AudioOut(out) +PaEngine::PaEngine() + :stream(NULL) { name = "PA"; } @@ -40,9 +39,8 @@ PaEngine::~PaEngine() bool PaEngine::Start() { - if(enabled()) + if(getAudioEn()) return true; - enabled = true; Pa_Initialize(); PaStreamParameters outputParameters; @@ -71,6 +69,19 @@ bool PaEngine::Start() return true; } +void PaEngine::setAudioEn(bool nval) +{ + if(nval) + Start(); + else + Stop(); +} + +bool PaEngine::getAudioEn() const +{ + return stream; +} + int PaEngine::PAprocess(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo *outTime, PaStreamCallbackFlags flags, @@ -99,11 +110,11 @@ int PaEngine::process(float *out, unsigned long framesPerBuffer) void PaEngine::Stop() { - if(!enabled()) + if(!getAudioEn()) return; - enabled = false; Pa_StopStream(stream); Pa_CloseStream(stream); + stream = NULL; Pa_Terminate(); } diff --git a/src/Nio/PaEngine.h b/src/Nio/PaEngine.h @@ -30,12 +30,15 @@ class PaEngine: public AudioOut { public: - PaEngine(OutMgr *out); + PaEngine(); ~PaEngine(); bool Start(); void Stop(); + void setAudioEn(bool nval); + bool getAudioEn() const; + protected: static int PAprocess(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer,