1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 06:39:49 +00:00
OpenMW/apps/openmw/mwsound/openal_output.hpp

70 lines
1.9 KiB
C++
Raw Normal View History

#ifndef GAME_SOUND_OPENAL_OUTPUT_H
#define GAME_SOUND_OPENAL_OUTPUT_H
#include <string>
#include <vector>
2012-03-19 17:33:06 +00:00
#include <map>
#include <deque>
#include "alc.h"
#include "al.h"
#include "sound_output.hpp"
namespace MWSound
{
class SoundManager;
2012-03-17 09:55:08 +00:00
class Sound;
class OpenAL_Output : public Sound_Output
{
ALCdevice *mDevice;
ALCcontext *mContext;
2012-03-28 12:35:51 +00:00
typedef std::deque<ALuint> IDDq;
IDDq mFreeSources;
IDDq mUnusedBuffers;
2012-03-19 17:33:06 +00:00
typedef std::map<std::string,ALuint> NameMap;
NameMap mBufferCache;
typedef std::map<ALuint,ALuint> IDRefMap;
IDRefMap mBufferRefs;
uint64_t mBufferCacheMemSize;
2012-03-19 17:33:06 +00:00
ALuint getBuffer(const std::string &fname);
void bufferFinished(ALuint buffer);
virtual std::vector<std::string> enumerate();
2012-03-18 19:19:54 +00:00
virtual void init(const std::string &devname="");
virtual void deinit();
virtual SoundPtr playSound(const std::string &fname, float volume, float pitch, bool loop);
virtual SoundPtr playSound3D(const std::string &fname, const Ogre::Vector3 &pos,
float volume, float pitch, float min, float max, bool loop);
virtual SoundPtr streamSound(const std::string &fname, float volume, float pitch);
2012-03-17 09:55:08 +00:00
virtual void updateListener(const Ogre::Vector3 &pos, const Ogre::Vector3 &atdir, const Ogre::Vector3 &updir);
OpenAL_Output& operator=(const OpenAL_Output &rhs);
OpenAL_Output(const OpenAL_Output &rhs);
OpenAL_Output(SoundManager &mgr);
virtual ~OpenAL_Output();
class StreamThread;
std::auto_ptr<StreamThread> mStreamThread;
friend class OpenAL_Sound;
friend class OpenAL_Sound3D;
friend class OpenAL_SoundStream;
friend class SoundManager;
};
#ifndef DEFAULT_OUTPUT
2012-03-23 01:44:55 +00:00
#define DEFAULT_OUTPUT (::MWSound::OpenAL_Output)
#endif
};
#endif