1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-29 09:32:45 +00:00
OpenMW/apps/openmw/mwsound/sound_output.hpp

81 lines
2.6 KiB
C++
Raw Normal View History

#ifndef GAME_SOUND_SOUND_OUTPUT_H
#define GAME_SOUND_SOUND_OUTPUT_H
#include <string>
2012-03-17 02:55:08 -07:00
#include <memory>
#include <vector>
#include "soundmanagerimp.hpp"
namespace MWSound
{
class SoundManager;
struct Sound_Decoder;
2012-03-17 02:55:08 -07:00
class Sound;
class Stream;
// An opaque handle for the implementation's sound buffers.
typedef void *Sound_Handle;
// An opaque handle for the implementation's sound instances.
typedef void *Sound_Instance;
class Sound_Output
{
SoundManager &mManager;
virtual std::vector<std::string> enumerate() = 0;
virtual bool init(const std::string &devname=std::string()) = 0;
virtual void deinit() = 0;
virtual std::vector<std::string> enumerateHrtf() = 0;
virtual void enableHrtf(const std::string &hrtfname, bool auto_enable) = 0;
virtual void disableHrtf() = 0;
virtual Sound_Handle loadSound(const std::string &fname) = 0;
virtual void unloadSound(Sound_Handle data) = 0;
2015-11-23 06:52:37 -08:00
virtual size_t getSoundDataSize(Sound_Handle data) const = 0;
virtual bool playSound(Sound *sound, Sound_Handle data, float offset) = 0;
virtual bool playSound3D(Sound *sound, Sound_Handle data, float offset) = 0;
virtual void finishSound(Sound *sound) = 0;
virtual bool isSoundPlaying(Sound *sound) = 0;
virtual void updateSound(Sound *sound) = 0;
virtual bool streamSound(DecoderPtr decoder, Stream *sound) = 0;
virtual bool streamSound3D(DecoderPtr decoder, Stream *sound, bool getLoudnessData) = 0;
virtual void finishStream(Stream *sound) = 0;
virtual double getStreamDelay(Stream *sound) = 0;
virtual double getStreamOffset(Stream *sound) = 0;
virtual float getStreamLoudness(Stream *sound) = 0;
virtual bool isStreamPlaying(Stream *sound) = 0;
virtual void updateStream(Stream *sound) = 0;
2012-03-17 02:55:08 -07:00
virtual void startUpdate() = 0;
virtual void finishUpdate() = 0;
2015-05-12 19:02:56 +02:00
virtual void updateListener(const osg::Vec3f &pos, const osg::Vec3f &atdir, const osg::Vec3f &updir, Environment env) = 0;
virtual void pauseSounds(int types) = 0;
virtual void resumeSounds(int types) = 0;
Sound_Output& operator=(const Sound_Output &rhs);
Sound_Output(const Sound_Output &rhs);
protected:
bool mInitialized;
Sound_Output(SoundManager &mgr)
: mManager(mgr), mInitialized(false)
{ }
public:
virtual ~Sound_Output() { }
2012-06-06 20:29:30 +02:00
bool isInitialized() const { return mInitialized; }
friend class OpenAL_Output;
friend class SoundManager;
};
}
#endif