PortAudio adjustments for OSX

Seems to be some sort of audio init race condition, intermittent crash
on startup
This commit is contained in:
Charles J. Cliffe 2014-11-09 05:18:33 -05:00
parent b70b659a5f
commit 14d7e431bd
3 changed files with 12 additions and 5 deletions

View File

@ -76,9 +76,8 @@ else (DEFINED WIN32)
link_directories(${RTLSDR_LIB})
set(FFTW_LIB fftw3)
find_package (OpenAL)
include_directories ( ${OPENAL_INCLUDE_DIR} )
SET (PORTAUDIO_LIBRARY portaudio)
endif (DEFINED WIN32)

View File

@ -15,7 +15,9 @@
#include "AppFrame.h"
#include <algorithm>
#ifdef WIN32
#include "pa_debugprint.h"
#endif
wxString glGetwxString(GLenum name) {
const GLubyte *v = glGetString(name);
@ -109,10 +111,14 @@ static int patestCallback(const void *inputBuffer, void *outputBuffer, unsigned
TestGLCanvas *src = (TestGLCanvas *) userData;
float *out = (float*) outputBuffer;
if (!src->audio_queue.size()) {
for (int i = 0; i < framesPerBuffer * 2; i++) {
out[i] = 0;
}
return paContinue;
}
float *out = (float*) outputBuffer;
std::vector<float> *nextBuffer = src->audio_queue.front();
@ -161,7 +167,7 @@ TestGLCanvas::TestGLCanvas(wxWindow *parent, int *attribList) :
std::cout << "Error starting :(\n";
}
outputParameters.device = 5; /* default output device */
outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
if (outputParameters.device == paNoDevice) {
std::cout << "Error: No default output device.\n";
}

View File

@ -12,7 +12,9 @@
#include "liquid/liquid.h"
#include "portaudio.h"
#ifdef WIN32
#include "pa_stream.h"
#endif
class PrimaryGLContext: public wxGLContext {
public: