2013-04-18 03:09:55 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-08-16 21:58:07 +00:00
|
|
|
|
2009-03-28 08:57:34 +00:00
|
|
|
#ifndef _AOSOUNDSTREAM_H_
|
|
|
|
#define _AOSOUNDSTREAM_H_
|
2008-08-16 21:58:07 +00:00
|
|
|
|
2009-01-29 00:57:55 +00:00
|
|
|
#include "SoundStream.h"
|
2013-10-19 22:58:02 +00:00
|
|
|
#include "Thread.h"
|
2009-01-29 00:57:55 +00:00
|
|
|
|
|
|
|
#if defined(HAVE_AO) && HAVE_AO
|
|
|
|
#include <ao/ao.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class AOSound : public SoundStream
|
2008-08-16 21:58:07 +00:00
|
|
|
{
|
2009-01-29 00:57:55 +00:00
|
|
|
#if defined(HAVE_AO) && HAVE_AO
|
2011-01-27 20:47:58 +00:00
|
|
|
std::thread thread;
|
2011-03-05 06:11:26 +00:00
|
|
|
std::mutex soundCriticalSection;
|
2009-03-26 09:29:14 +00:00
|
|
|
Common::Event soundSyncEvent;
|
2009-02-20 22:04:52 +00:00
|
|
|
|
|
|
|
int buf_size;
|
|
|
|
|
|
|
|
ao_device *device;
|
|
|
|
ao_sample_format format;
|
|
|
|
int default_driver;
|
|
|
|
|
|
|
|
short realtimeBuffer[1024 * 1024];
|
2009-01-29 00:57:55 +00:00
|
|
|
|
|
|
|
public:
|
2009-03-26 09:29:14 +00:00
|
|
|
AOSound(CMixer *mixer) : SoundStream(mixer) {}
|
|
|
|
|
2009-03-27 11:06:52 +00:00
|
|
|
virtual ~AOSound();
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2009-02-20 22:04:52 +00:00
|
|
|
virtual bool Start();
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2009-02-20 22:04:52 +00:00
|
|
|
virtual void SoundLoop();
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2009-02-20 22:04:52 +00:00
|
|
|
virtual void Stop();
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2009-02-20 22:04:52 +00:00
|
|
|
static bool isValid() {
|
|
|
|
return true;
|
|
|
|
}
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2013-10-29 05:23:17 +00:00
|
|
|
virtual bool usesMixer() const {
|
|
|
|
return true;
|
2009-02-20 22:04:52 +00:00
|
|
|
}
|
2013-03-20 01:51:12 +00:00
|
|
|
|
2009-02-20 22:04:52 +00:00
|
|
|
virtual void Update();
|
|
|
|
|
2009-01-29 00:57:55 +00:00
|
|
|
#else
|
|
|
|
public:
|
2009-09-09 21:26:33 +00:00
|
|
|
AOSound(CMixer *mixer) : SoundStream(mixer) {}
|
2009-01-29 00:57:55 +00:00
|
|
|
#endif
|
|
|
|
};
|
2008-08-16 21:58:07 +00:00
|
|
|
|
2009-03-28 08:57:34 +00:00
|
|
|
#endif //_AOSOUNDSTREAM_H_
|