Files
dolphin/Source/Core/AudioCommon/AlsaSoundStream.h
T

51 lines
909 B
C++
Raw Normal View History

// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
#if defined(HAVE_ALSA) && HAVE_ALSA
#include <alsa/asoundlib.h>
#endif
2014-02-17 05:18:15 -05:00
#include "AudioCommon/SoundStream.h"
2014-09-07 20:06:58 -05:00
#include "Common/CommonTypes.h"
2014-02-17 05:18:15 -05:00
#include "Common/Thread.h"
2014-03-18 10:37:45 -04:00
class AlsaSound final : public SoundStream
{
#if defined(HAVE_ALSA) && HAVE_ALSA
public:
AlsaSound(CMixer *mixer);
virtual ~AlsaSound();
2014-03-08 01:54:44 +01:00
virtual bool Start() override;
virtual void SoundLoop() override;
virtual void Stop() override;
2014-08-30 16:29:15 -04:00
static bool isValid()
{
return true;
}
2014-03-08 01:54:44 +01:00
virtual void Update() override;
private:
bool AlsaInit();
void AlsaShutdown();
u8 *mix_buffer;
std::thread thread;
// 0 = continue
// 1 = shutdown
// 2 = done shutting down.
volatile int thread_data;
snd_pcm_t *handle;
2010-05-21 22:48:57 +00:00
int frames_to_deliver;
#else
public:
AlsaSound(CMixer *mixer) : SoundStream(mixer) {}
#endif
};