2009-03-27 09:24:22 -06:00
|
|
|
// Copyright (C) 2003-2009 Dolphin Project.
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
2009-03-28 02:57:34 -06:00
|
|
|
#ifndef _OPENALSTREAM_H_
|
|
|
|
#define _OPENALSTREAM_H_
|
|
|
|
|
2009-03-30 11:45:35 -06:00
|
|
|
#include "Common.h"
|
2009-03-27 09:24:22 -06:00
|
|
|
#include "SoundStream.h"
|
|
|
|
#include "Thread.h"
|
|
|
|
|
2009-03-30 11:45:35 -06:00
|
|
|
|
|
|
|
#if defined HAVE_OPENAL && HAVE_OPENAL
|
2009-03-30 14:25:36 -06:00
|
|
|
#ifdef _WIN32
|
2009-03-30 09:53:04 -06:00
|
|
|
#include "../../../../Externals/OpenAL/include/al.h"
|
|
|
|
#include "../../../../Externals/OpenAL/include/alc.h"
|
2009-04-06 21:56:21 -06:00
|
|
|
#elif defined(__APPLE__)
|
|
|
|
#include "openal/al.h"
|
|
|
|
#include "openal/alc.h"
|
2009-03-30 14:25:36 -06:00
|
|
|
#else
|
|
|
|
#include "AL/al.h"
|
|
|
|
#include "AL/alc.h"
|
|
|
|
#endif // WIN32
|
2009-03-27 09:24:22 -06:00
|
|
|
// public use
|
|
|
|
#define SFX_MAX_SOURCE 1
|
2009-04-03 21:58:16 -06:00
|
|
|
#define OAL_BUFFER_SIZE 1024*1024
|
2009-03-30 11:24:55 -06:00
|
|
|
#endif
|
|
|
|
|
2009-03-27 09:24:22 -06:00
|
|
|
|
|
|
|
class OpenALStream: public SoundStream
|
|
|
|
{
|
2009-03-30 11:45:35 -06:00
|
|
|
#if defined HAVE_OPENAL && HAVE_OPENAL
|
2009-03-27 09:24:22 -06:00
|
|
|
public:
|
|
|
|
OpenALStream(CMixer *mixer, void *hWnd = NULL): SoundStream(mixer) {};
|
|
|
|
virtual ~OpenALStream() {};
|
|
|
|
|
|
|
|
virtual bool Start();
|
|
|
|
virtual void SoundLoop();
|
|
|
|
virtual void Stop();
|
|
|
|
static bool isValid() { return true; }
|
|
|
|
virtual bool usesMixer() const { return true; }
|
|
|
|
virtual void Update();
|
2009-03-30 08:22:31 -06:00
|
|
|
|
2009-03-30 10:30:31 -06:00
|
|
|
static THREAD_RETURN ThreadFunc(void* args);
|
2009-03-30 08:22:31 -06:00
|
|
|
|
2009-03-27 09:24:22 -06:00
|
|
|
private:
|
|
|
|
Common::Thread *thread;
|
|
|
|
Common::CriticalSection soundCriticalSection;
|
|
|
|
Common::Event soundSyncEvent;
|
2009-04-03 21:58:16 -06:00
|
|
|
|
|
|
|
short realtimeBuffer[OAL_BUFFER_SIZE];
|
2009-03-30 11:24:55 -06:00
|
|
|
#else
|
2009-03-30 14:25:36 -06:00
|
|
|
public:
|
2009-03-30 11:24:55 -06:00
|
|
|
OpenALStream(CMixer *mixer, void *hWnd = NULL): SoundStream(mixer) {}
|
|
|
|
#endif // HAVE_OPENAL
|
2009-03-27 09:24:22 -06:00
|
|
|
};
|
|
|
|
|
2009-03-30 11:24:55 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // OPENALSTREAM
|