libsoundio audio renderer for Windows and Mac (#97)

This commit is contained in:
Cameron Gutman 2018-10-05 19:22:57 -07:00 committed by GitHub
commit e182445593
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 625 additions and 5828 deletions

View file

@ -1,8 +1,8 @@
#include "../session.h"
#include "renderers/renderer.h"
#ifdef HAVE_PORTAUDIO
#include "renderers/portaudiorenderer.h"
#ifndef Q_OS_LINUX
#include "renderers/soundioaudiorenderer.h"
#else
#include "renderers/sdl.h"
#endif
@ -11,8 +11,8 @@
IAudioRenderer* Session::createAudioRenderer()
{
#ifdef HAVE_PORTAUDIO
return new PortAudioRenderer();
#ifndef Q_OS_LINUX
return new SoundIoAudioRenderer();
#else
return new SdlAudioRenderer();
#endif
@ -101,6 +101,16 @@ void Session::arDecodeAndPlaySample(char* sampleData, int sampleLength)
{
int samplesDecoded;
// Set this thread to high priority to reduce
// the chance of missing our sample delivery time
if (s_ActiveSession->m_AudioSampleCount == 0) {
if (SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH) < 0) {
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
"Unable to set audio thread to high priority: %s",
SDL_GetError());
}
}
s_ActiveSession->m_AudioSampleCount++;
if (s_ActiveSession->m_AudioRenderer != nullptr) {