Files
dolphin/Source/Core/AudioCommon/Src/OpenALStream.h
T

75 lines
1.9 KiB
C++
Raw Normal View History

2009-03-27 15:24:22 +00: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 08:57:34 +00:00
#ifndef _OPENALSTREAM_H_
#define _OPENALSTREAM_H_
2009-03-30 17:45:35 +00:00
#include "Common.h"
2009-03-27 15:24:22 +00:00
#include "SoundStream.h"
#include "Thread.h"
2009-03-30 17:45:35 +00:00
#if defined HAVE_OPENAL && HAVE_OPENAL
2009-03-30 20:25:36 +00:00
#ifdef _WIN32
2009-03-30 15:53:04 +00:00
#include "../../../../Externals/OpenAL/include/al.h"
#include "../../../../Externals/OpenAL/include/alc.h"
2009-04-07 03:56:21 +00:00
#elif defined(__APPLE__)
#include "openal/al.h"
#include "openal/alc.h"
2009-03-30 20:25:36 +00:00
#else
#include "AL/al.h"
#include "AL/alc.h"
#endif // WIN32
2009-03-27 15:24:22 +00:00
// public use
#define SFX_MAX_SOURCE 1
#define OAL_BUFFER_SIZE 1024*1024
2009-03-30 17:24:55 +00:00
#endif
2009-03-27 15:24:22 +00:00
class OpenALStream: public SoundStream
{
2009-03-30 17:45:35 +00:00
#if defined HAVE_OPENAL && HAVE_OPENAL
2009-03-27 15:24:22 +00: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 14:22:31 +00:00
2009-03-30 16:30:31 +00:00
static THREAD_RETURN ThreadFunc(void* args);
2009-03-30 14:22:31 +00:00
2009-03-27 15:24:22 +00:00
private:
Common::Thread *thread;
Common::CriticalSection soundCriticalSection;
Common::Event soundSyncEvent;
short realtimeBuffer[OAL_BUFFER_SIZE];
2009-03-30 17:24:55 +00:00
#else
2009-03-30 20:25:36 +00:00
public:
2009-03-30 17:24:55 +00:00
OpenALStream(CMixer *mixer, void *hWnd = NULL): SoundStream(mixer) {}
#endif // HAVE_OPENAL
2009-03-27 15:24:22 +00:00
};
2009-03-30 17:24:55 +00:00
#endif // OPENALSTREAM