OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
sound_output.hpp
Go to the documentation of this file.
1 #ifndef GAME_SOUND_SOUND_OUTPUT_H
2 #define GAME_SOUND_SOUND_OUTPUT_H
3 
4 #include <string>
5 #include <memory>
6 #include <vector>
7 
8 #include "soundmanagerimp.hpp"
9 
10 namespace MWSound
11 {
12  class SoundManager;
13  struct Sound_Decoder;
14  class Sound;
15 
16  // An opaque handle for the implementation's sound buffers.
17  typedef void *Sound_Handle;
18  // An opaque handle for the implementation's sound instances.
19  typedef void *Sound_Instance;
20 
22  {
24 
25  virtual std::vector<std::string> enumerate() = 0;
26  virtual void init(const std::string &devname=std::string()) = 0;
27  virtual void deinit() = 0;
28 
29  virtual std::vector<std::string> enumerateHrtf() = 0;
30  virtual void enableHrtf(const std::string &hrtfname, bool auto_enable) = 0;
31  virtual void disableHrtf() = 0;
32 
33  virtual Sound_Handle loadSound(const std::string &fname) = 0;
34  virtual void unloadSound(Sound_Handle data) = 0;
35  virtual size_t getSoundDataSize(Sound_Handle data) const = 0;
36 
37  virtual void playSound(MWBase::SoundPtr sound, Sound_Handle data, float offset) = 0;
38  virtual void playSound3D(MWBase::SoundPtr sound, Sound_Handle data, float offset) = 0;
39  virtual void finishSound(MWBase::SoundPtr sound) = 0;
40  virtual bool isSoundPlaying(MWBase::SoundPtr sound) = 0;
41  virtual void updateSound(MWBase::SoundPtr sound) = 0;
42 
43  virtual void streamSound(DecoderPtr decoder, MWBase::SoundStreamPtr sound) = 0;
44  virtual void streamSound3D(DecoderPtr decoder, MWBase::SoundStreamPtr sound, bool getLoudnessData) = 0;
45  virtual void finishStream(MWBase::SoundStreamPtr sound) = 0;
46  virtual double getStreamDelay(MWBase::SoundStreamPtr sound) = 0;
47  virtual double getStreamOffset(MWBase::SoundStreamPtr sound) = 0;
48  virtual float getStreamLoudness(MWBase::SoundStreamPtr sound) = 0;
49  virtual bool isStreamPlaying(MWBase::SoundStreamPtr sound) = 0;
50  virtual void updateStream(MWBase::SoundStreamPtr sound) = 0;
51 
52  virtual void startUpdate() = 0;
53  virtual void finishUpdate() = 0;
54 
55  virtual void updateListener(const osg::Vec3f &pos, const osg::Vec3f &atdir, const osg::Vec3f &updir, Environment env) = 0;
56 
57  virtual void pauseSounds(int types) = 0;
58  virtual void resumeSounds(int types) = 0;
59 
60  Sound_Output& operator=(const Sound_Output &rhs);
61  Sound_Output(const Sound_Output &rhs);
62 
63  protected:
65 
67  : mManager(mgr), mInitialized(false)
68  { }
69  public:
70  virtual ~Sound_Output() { }
71 
72  bool isInitialized() const { return mInitialized; }
73 
74  friend class OpenAL_Output;
75  friend class SoundManager;
76  };
77 }
78 
79 #endif
void * Sound_Handle
Definition: sound_output.hpp:14
virtual float getStreamLoudness(MWBase::SoundStreamPtr sound)=0
Definition: openal_output.hpp:19
Sound_Output(const Sound_Output &rhs)
virtual std::vector< std::string > enumerate()=0
virtual std::vector< std::string > enumerateHrtf()=0
virtual void unloadSound(Sound_Handle data)=0
bool isInitialized() const
Definition: sound_output.hpp:72
virtual void finishUpdate()=0
virtual void finishStream(MWBase::SoundStreamPtr sound)=0
Definition: sound.hpp:8
virtual ~Sound_Output()
Definition: sound_output.hpp:70
virtual size_t getSoundDataSize(Sound_Handle data) const =0
virtual void enableHrtf(const std::string &hrtfname, bool auto_enable)=0
void * Sound_Instance
Definition: sound_output.hpp:19
virtual void updateSound(MWBase::SoundPtr sound)=0
Sound_Output & operator=(const Sound_Output &rhs)
Sound_Output(SoundManager &mgr)
Definition: sound_output.hpp:66
virtual void init(const std::string &devname=std::string())=0
virtual void playSound3D(MWBase::SoundPtr sound, Sound_Handle data, float offset)=0
virtual bool isStreamPlaying(MWBase::SoundStreamPtr sound)=0
boost::shared_ptr< Sound_Decoder > DecoderPtr
Definition: soundmanager.hpp:19
virtual void finishSound(MWBase::SoundPtr sound)=0
bool mInitialized
Definition: sound_output.hpp:64
virtual void pauseSounds(int types)=0
virtual bool isSoundPlaying(MWBase::SoundPtr sound)=0
boost::shared_ptr< MWSound::Stream > SoundStreamPtr
Definition: soundmanager.hpp:26
virtual void updateListener(const osg::Vec3f &pos, const osg::Vec3f &atdir, const osg::Vec3f &updir, Environment env)=0
SoundManager & mManager
Definition: sound_output.hpp:23
virtual void resumeSounds(int types)=0
virtual void streamSound(DecoderPtr decoder, MWBase::SoundStreamPtr sound)=0
virtual void startUpdate()=0
Definition: soundmanagerimp.hpp:45
virtual void updateStream(MWBase::SoundStreamPtr sound)=0
virtual void streamSound3D(DecoderPtr decoder, MWBase::SoundStreamPtr sound, bool getLoudnessData)=0
Definition: sound_output.hpp:21
virtual double getStreamOffset(MWBase::SoundStreamPtr sound)=0
virtual double getStreamDelay(MWBase::SoundStreamPtr sound)=0
virtual void disableHrtf()=0
virtual void deinit()=0
boost::shared_ptr< MWSound::Sound > SoundPtr
Definition: soundmanager.hpp:25
virtual Sound_Handle loadSound(const std::string &fname)=0
virtual void playSound(MWBase::SoundPtr sound, Sound_Handle data, float offset)=0
Environment
Definition: soundmanagerimp.hpp:35