OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
sound_decoder.hpp
Go to the documentation of this file.
1 #ifndef GAME_SOUND_SOUND_DECODER_H
2 #define GAME_SOUND_SOUND_DECODER_H
3 
4 #include <string>
5 #include <vector>
6 
7 namespace VFS
8 {
9  class Manager;
10 }
11 
12 namespace MWSound
13 {
14  enum SampleType {
18  };
19  const char *getSampleTypeName(SampleType type);
20 
27  };
28  const char *getChannelConfigName(ChannelConfig config);
29 
30  size_t framesToBytes(size_t frames, ChannelConfig config, SampleType type);
31  size_t bytesToFrames(size_t bytes, ChannelConfig config, SampleType type);
32 
34  {
36 
37  virtual void open(const std::string &fname) = 0;
38  virtual void close() = 0;
39 
40  virtual std::string getName() = 0;
41  virtual void getInfo(int *samplerate, ChannelConfig *chans, SampleType *type) = 0;
42 
43  virtual size_t read(char *buffer, size_t bytes) = 0;
44  virtual void readAll(std::vector<char> &output);
45  virtual size_t getSampleOffset() = 0;
46 
47  Sound_Decoder(const VFS::Manager* resourceMgr) : mResourceMgr(resourceMgr)
48  { }
49  virtual ~Sound_Decoder() { }
50 
51  private:
52  Sound_Decoder(const Sound_Decoder &rhs);
54  };
55 }
56 
57 #endif
size_t framesToBytes(size_t frames, ChannelConfig config, SampleType type)
Definition: soundmanagerimp.cpp:1159
virtual ~Sound_Decoder()
Definition: sound_decoder.hpp:49
virtual void readAll(std::vector< char > &output)
Definition: soundmanagerimp.cpp:1120
SampleType
Definition: sound_decoder.hpp:14
virtual void open(const std::string &fname)=0
size_t bytesToFrames(size_t bytes, ChannelConfig config, SampleType type)
Definition: soundmanagerimp.cpp:1178
Definition: sound_decoder.hpp:17
Sound_Decoder & operator=(const Sound_Decoder &rhs)
Definition: sound_decoder.hpp:24
virtual void getInfo(int *samplerate, ChannelConfig *chans, SampleType *type)=0
Definition: sound_decoder.hpp:16
Definition: sound_decoder.hpp:22
Definition: sound_decoder.hpp:15
const VFS::Manager * mResourceMgr
Definition: sound_decoder.hpp:35
Definition: sound_decoder.hpp:26
virtual std::string getName()=0
Definition: sound_decoder.hpp:25
Sound_Decoder(const VFS::Manager *resourceMgr)
Definition: sound_decoder.hpp:47
virtual void close()=0
virtual size_t getSampleOffset()=0
const char * getSampleTypeName(SampleType type)
Definition: soundmanagerimp.cpp:1135
The main class responsible for loading files from a virtual file system.
Definition: manager.hpp:20
const char * getChannelConfigName(ChannelConfig config)
Definition: soundmanagerimp.cpp:1146
Definition: sound_decoder.hpp:23
Definition: sound_decoder.hpp:33
virtual size_t read(char *buffer, size_t bytes)=0
ChannelConfig
Definition: sound_decoder.hpp:21