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