AlsaSound: fix buffer type, clean up macros

This commit is contained in:
booto
2015-09-30 16:41:33 +08:00
parent 16957fcaec
commit 6c28ea58ab
2 changed files with 14 additions and 16 deletions

View File

@ -21,7 +21,6 @@ class AlsaSound final : public SoundStream
#if defined(HAVE_ALSA) && HAVE_ALSA
public:
AlsaSound();
virtual ~AlsaSound();
bool Start() override;
void SoundLoop() override;
@ -35,6 +34,15 @@ public:
}
private:
// maximum number of frames the buffer can hold
static constexpr size_t BUFFER_SIZE_MAX = 8192;
// minimum number of frames to deliver in one transfer
static constexpr u32 FRAME_COUNT_MIN = 256;
// number of channels per frame
static constexpr u32 CHANNEL_COUNT = 2;
enum class ALSAThreadStatus
{
RUNNING,
@ -45,7 +53,7 @@ private:
bool AlsaInit();
void AlsaShutdown();
u8 *mix_buffer;
s16 mix_buffer[BUFFER_SIZE_MAX * CHANNEL_COUNT];
std::thread thread;
std::atomic<ALSAThreadStatus> m_thread_status;
std::condition_variable cv;