dolphin/Source/Core/AudioCommon/PulseAudioStream.h

54 lines
951 B
C
Raw Normal View History

// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _PULSE_AUDIO_STREAM_H
#define _PULSE_AUDIO_STREAM_H
#if defined(HAVE_PULSEAUDIO) && HAVE_PULSEAUDIO
2013-01-09 23:39:19 +00:00
#include <pulse/simple.h>
#include <pulse/error.h>
#endif
#include "Common.h"
#include "SoundStream.h"
#include "Thread.h"
2013-01-09 23:39:19 +00:00
#include <vector>
class PulseAudio : public SoundStream
{
#if defined(HAVE_PULSEAUDIO) && HAVE_PULSEAUDIO
public:
PulseAudio(CMixer *mixer);
virtual bool Start();
virtual void Stop();
static bool isValid() {return true;}
virtual bool usesMixer() const {return true;}
virtual void Update();
private:
virtual void SoundLoop();
2013-01-09 23:39:19 +00:00
bool PulseInit();
void PulseShutdown();
2013-01-09 23:39:19 +00:00
void Write(const void *data, size_t bytes);
2013-01-09 23:39:19 +00:00
std::vector<s16> mix_buffer;
std::thread thread;
2013-01-09 23:39:19 +00:00
volatile bool run_thread;
2013-01-09 23:39:19 +00:00
pa_simple* pa;
#else
public:
PulseAudio(CMixer *mixer) : SoundStream(mixer) {}
#endif
};
#endif