2012-03-16 22:12:17 -07:00
|
|
|
#ifndef GAME_SOUND_OPENAL_OUTPUT_H
|
|
|
|
#define GAME_SOUND_OPENAL_OUTPUT_H
|
|
|
|
|
2012-03-16 23:40:07 -07:00
|
|
|
#include <string>
|
2012-03-19 07:11:01 -07:00
|
|
|
#include <vector>
|
2012-03-16 22:12:17 -07:00
|
|
|
|
|
|
|
#include "alc.h"
|
|
|
|
#include "al.h"
|
|
|
|
|
2012-03-16 23:40:07 -07:00
|
|
|
#include "sound_output.hpp"
|
|
|
|
|
2012-03-16 22:12:17 -07:00
|
|
|
namespace MWSound
|
|
|
|
{
|
2012-03-16 23:40:07 -07:00
|
|
|
class SoundManager;
|
2012-03-17 02:55:08 -07:00
|
|
|
class Sound;
|
2012-03-16 23:40:07 -07:00
|
|
|
|
2012-03-16 22:12:17 -07:00
|
|
|
class OpenAL_Output : public Sound_Output
|
|
|
|
{
|
2012-03-18 11:30:53 -07:00
|
|
|
ALCdevice *mDevice;
|
|
|
|
ALCcontext *mContext;
|
2012-03-16 22:12:17 -07:00
|
|
|
|
2012-03-19 07:11:01 -07:00
|
|
|
typedef std::vector<ALuint> IDVec;
|
|
|
|
IDVec mFreeSources;
|
|
|
|
|
2012-03-18 12:19:54 -07:00
|
|
|
virtual void init(const std::string &devname="");
|
2012-03-18 11:30:53 -07:00
|
|
|
virtual void deinit();
|
2012-03-16 22:12:17 -07:00
|
|
|
|
2012-03-18 11:30:53 -07:00
|
|
|
virtual Sound *playSound(const std::string &fname, float volume, float pitch, bool loop);
|
|
|
|
virtual Sound *playSound3D(const std::string &fname, const float *pos, float volume, float pitch,
|
2012-03-17 06:51:44 -07:00
|
|
|
float min, float max, bool loop);
|
|
|
|
|
2012-03-18 11:30:53 -07:00
|
|
|
virtual Sound *streamSound(const std::string &fname, float volume, float pitch);
|
2012-03-19 07:28:03 -07:00
|
|
|
virtual Sound *streamSound3D(const std::string &fname, const float *pos, float volume, float pitch,
|
|
|
|
float min, float max);
|
2012-03-17 02:55:08 -07:00
|
|
|
|
2012-03-18 11:30:53 -07:00
|
|
|
virtual void updateListener(const float *pos, const float *atdir, const float *updir);
|
2012-03-17 04:22:54 -07:00
|
|
|
|
2012-03-16 22:12:17 -07:00
|
|
|
OpenAL_Output(SoundManager &mgr);
|
|
|
|
virtual ~OpenAL_Output();
|
|
|
|
|
2012-03-19 02:15:08 -07:00
|
|
|
class StreamThread;
|
|
|
|
std::auto_ptr<StreamThread> mStreamThread;
|
|
|
|
|
2012-03-19 07:11:01 -07:00
|
|
|
friend class OpenAL_Sound;
|
2012-03-19 02:15:08 -07:00
|
|
|
friend class OpenAL_SoundStream;
|
2012-03-16 22:12:17 -07:00
|
|
|
friend class SoundManager;
|
|
|
|
};
|
|
|
|
#ifndef DEFAULT_OUTPUT
|
|
|
|
#define DEFAULT_OUTPUT OpenAL_Output
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|