2015-05-24 07:55:12 +03:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-18 02:08:10 +03:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 06:09:55 +03:00
|
|
|
// Refer to the license.txt file included.
|
2008-08-17 00:58:07 +03:00
|
|
|
|
2014-02-10 20:54:46 +02:00
|
|
|
#pragma once
|
2008-08-17 00:58:07 +03:00
|
|
|
|
2014-08-14 08:14:35 +03:00
|
|
|
#include <mutex>
|
|
|
|
#include <thread>
|
|
|
|
|
2014-02-17 12:18:15 +02:00
|
|
|
#include "AudioCommon/SoundStream.h"
|
2014-04-14 02:15:23 +03:00
|
|
|
#include "Common/Event.h"
|
2014-09-19 07:17:41 +03:00
|
|
|
#include "Common/Thread.h"
|
2009-01-29 02:57:55 +02:00
|
|
|
|
|
|
|
#if defined(HAVE_AO) && HAVE_AO
|
|
|
|
#include <ao/ao.h>
|
|
|
|
#endif
|
|
|
|
|
2014-03-18 16:37:45 +02:00
|
|
|
class AOSound final : public SoundStream
|
2008-08-17 00:58:07 +03:00
|
|
|
{
|
2009-01-29 02:57:55 +02:00
|
|
|
#if defined(HAVE_AO) && HAVE_AO
|
2016-06-24 11:43:46 +03:00
|
|
|
std::thread thread;
|
2016-08-05 17:04:39 +03:00
|
|
|
Common::Flag m_run_thread;
|
2016-06-24 11:43:46 +03:00
|
|
|
std::mutex soundCriticalSection;
|
|
|
|
Common::Event soundSyncEvent;
|
2009-02-21 00:04:52 +02:00
|
|
|
|
2016-06-24 11:43:46 +03:00
|
|
|
int buf_size;
|
2009-02-21 00:04:52 +02:00
|
|
|
|
2016-06-24 11:43:46 +03:00
|
|
|
ao_device* device;
|
|
|
|
ao_sample_format format;
|
|
|
|
int default_driver;
|
2009-02-21 00:04:52 +02:00
|
|
|
|
2016-06-24 11:43:46 +03:00
|
|
|
short realtimeBuffer[1024 * 1024];
|
2009-01-29 02:57:55 +02:00
|
|
|
|
|
|
|
public:
|
2016-06-24 11:43:46 +03:00
|
|
|
bool Start() override;
|
|
|
|
void SoundLoop() override;
|
|
|
|
void Stop() override;
|
|
|
|
void Update() override;
|
2013-03-20 03:51:12 +02:00
|
|
|
|
2016-06-24 11:43:46 +03:00
|
|
|
static bool isValid() { return true; }
|
2009-01-29 02:57:55 +02:00
|
|
|
#endif
|
|
|
|
};
|