2012-03-17 06:40:07 +00:00
|
|
|
#ifndef GAME_SOUND_SOUND_OUTPUT_H
|
|
|
|
#define GAME_SOUND_SOUND_OUTPUT_H
|
|
|
|
|
|
|
|
#include <string>
|
2012-03-17 09:55:08 +00:00
|
|
|
#include <memory>
|
2015-12-02 13:18:43 +00:00
|
|
|
#include <vector>
|
2012-03-17 06:40:07 +00:00
|
|
|
|
2012-08-09 12:33:21 +00:00
|
|
|
#include "soundmanagerimp.hpp"
|
2012-03-27 12:59:09 +00:00
|
|
|
|
2012-03-17 06:40:07 +00:00
|
|
|
namespace MWSound
|
|
|
|
{
|
|
|
|
class SoundManager;
|
2015-03-06 08:36:42 +00:00
|
|
|
struct Sound_Decoder;
|
2012-03-17 09:55:08 +00:00
|
|
|
class Sound;
|
2012-03-17 06:40:07 +00:00
|
|
|
|
2015-11-23 15:50:46 +00:00
|
|
|
// An opaque handle for the implementation's sound buffers.
|
|
|
|
typedef void *Sound_Handle;
|
2015-12-02 13:18:43 +00:00
|
|
|
// An opaque handle for the implementation's sound instances.
|
|
|
|
typedef void *Sound_Instance;
|
2015-11-23 15:50:46 +00:00
|
|
|
|
2012-03-17 06:40:07 +00:00
|
|
|
class Sound_Output
|
|
|
|
{
|
2012-03-18 18:30:53 +00:00
|
|
|
SoundManager &mManager;
|
2012-03-17 06:40:07 +00:00
|
|
|
|
2012-03-22 03:15:01 +00:00
|
|
|
virtual std::vector<std::string> enumerate() = 0;
|
2015-12-04 20:54:41 +00:00
|
|
|
virtual void init(const std::string &devname=std::string()) = 0;
|
2012-03-18 18:30:53 +00:00
|
|
|
virtual void deinit() = 0;
|
2012-03-17 06:40:07 +00:00
|
|
|
|
2015-12-04 20:54:41 +00:00
|
|
|
virtual std::vector<std::string> enumerateHrtf() = 0;
|
|
|
|
virtual void enableHrtf(const std::string &hrtfname, bool auto_enable) = 0;
|
|
|
|
virtual void disableHrtf() = 0;
|
|
|
|
|
2015-11-24 04:13:24 +00:00
|
|
|
virtual Sound_Handle loadSound(const std::string &fname) = 0;
|
2015-11-23 09:01:20 +00:00
|
|
|
virtual void unloadSound(Sound_Handle data) = 0;
|
2015-11-23 14:52:37 +00:00
|
|
|
virtual size_t getSoundDataSize(Sound_Handle data) const = 0;
|
2015-11-23 09:01:20 +00:00
|
|
|
|
2015-12-02 14:35:35 +00:00
|
|
|
virtual void playSound(MWBase::SoundPtr sound, Sound_Handle data, float offset) = 0;
|
|
|
|
virtual void playSound3D(MWBase::SoundPtr sound, Sound_Handle data, float offset) = 0;
|
2015-12-11 23:13:14 +00:00
|
|
|
virtual void finishSound(MWBase::SoundPtr sound) = 0;
|
2015-11-30 13:42:51 +00:00
|
|
|
virtual bool isSoundPlaying(MWBase::SoundPtr sound) = 0;
|
2015-11-30 22:34:14 +00:00
|
|
|
virtual void updateSound(MWBase::SoundPtr sound) = 0;
|
2015-11-30 13:42:51 +00:00
|
|
|
|
2015-12-02 16:04:30 +00:00
|
|
|
virtual void streamSound(DecoderPtr decoder, MWBase::SoundStreamPtr sound) = 0;
|
2016-06-27 19:37:02 +00:00
|
|
|
virtual void streamSound3D(DecoderPtr decoder, MWBase::SoundStreamPtr sound, bool getLoudnessData) = 0;
|
2015-12-11 23:13:14 +00:00
|
|
|
virtual void finishStream(MWBase::SoundStreamPtr sound) = 0;
|
2015-11-30 15:32:42 +00:00
|
|
|
virtual double getStreamDelay(MWBase::SoundStreamPtr sound) = 0;
|
|
|
|
virtual double getStreamOffset(MWBase::SoundStreamPtr sound) = 0;
|
2016-06-27 18:54:42 +00:00
|
|
|
virtual float getStreamLoudness(MWBase::SoundStreamPtr sound) = 0;
|
2015-11-30 15:32:42 +00:00
|
|
|
virtual bool isStreamPlaying(MWBase::SoundStreamPtr sound) = 0;
|
2015-11-30 22:34:14 +00:00
|
|
|
virtual void updateStream(MWBase::SoundStreamPtr sound) = 0;
|
2012-03-17 09:55:08 +00:00
|
|
|
|
2015-11-25 04:37:38 +00:00
|
|
|
virtual void startUpdate() = 0;
|
|
|
|
virtual void finishUpdate() = 0;
|
|
|
|
|
2015-05-12 17:02:56 +00:00
|
|
|
virtual void updateListener(const osg::Vec3f &pos, const osg::Vec3f &atdir, const osg::Vec3f &updir, Environment env) = 0;
|
2012-03-17 11:22:54 +00:00
|
|
|
|
2012-12-18 12:19:35 +00:00
|
|
|
virtual void pauseSounds(int types) = 0;
|
|
|
|
virtual void resumeSounds(int types) = 0;
|
2012-12-12 10:33:12 +00:00
|
|
|
|
2012-03-24 10:49:03 +00:00
|
|
|
Sound_Output& operator=(const Sound_Output &rhs);
|
|
|
|
Sound_Output(const Sound_Output &rhs);
|
|
|
|
|
2012-03-30 14:30:17 +00:00
|
|
|
protected:
|
2012-04-06 17:43:14 +00:00
|
|
|
bool mInitialized;
|
2012-03-30 14:30:17 +00:00
|
|
|
|
|
|
|
Sound_Output(SoundManager &mgr)
|
2015-11-30 16:00:02 +00:00
|
|
|
: mManager(mgr), mInitialized(false)
|
2012-03-30 14:30:17 +00:00
|
|
|
{ }
|
2012-03-17 06:40:07 +00:00
|
|
|
public:
|
|
|
|
virtual ~Sound_Output() { }
|
|
|
|
|
2012-06-06 18:29:30 +00:00
|
|
|
bool isInitialized() const { return mInitialized; }
|
2012-04-06 17:43:14 +00:00
|
|
|
|
2012-03-17 06:40:07 +00:00
|
|
|
friend class OpenAL_Output;
|
|
|
|
friend class SoundManager;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|