2012-03-17 06:18:15 +00:00
|
|
|
#ifndef GAME_SOUND_SOUND_DECODER_H
|
|
|
|
#define GAME_SOUND_SOUND_DECODER_H
|
|
|
|
|
2012-03-18 18:56:54 +00:00
|
|
|
#include <string>
|
|
|
|
|
2012-03-20 17:34:36 +00:00
|
|
|
#include <OgreResourceGroupManager.h>
|
|
|
|
|
2012-03-17 06:18:15 +00:00
|
|
|
namespace MWSound
|
|
|
|
{
|
2012-03-18 18:56:54 +00:00
|
|
|
enum SampleType {
|
|
|
|
SampleType_UInt8,
|
2013-02-26 18:19:33 +00:00
|
|
|
SampleType_Int16,
|
|
|
|
SampleType_Float32
|
2012-03-18 18:56:54 +00:00
|
|
|
};
|
2012-03-19 09:31:40 +00:00
|
|
|
const char *getSampleTypeName(SampleType type);
|
|
|
|
|
2012-03-18 18:56:54 +00:00
|
|
|
enum ChannelConfig {
|
|
|
|
ChannelConfig_Mono,
|
2012-12-13 12:10:19 +00:00
|
|
|
ChannelConfig_Stereo,
|
|
|
|
ChannelConfig_Quad,
|
|
|
|
ChannelConfig_5point1,
|
|
|
|
ChannelConfig_7point1
|
2012-03-18 18:56:54 +00:00
|
|
|
};
|
2012-03-19 09:31:40 +00:00
|
|
|
const char *getChannelConfigName(ChannelConfig config);
|
2012-03-18 18:56:54 +00:00
|
|
|
|
2012-03-19 12:29:04 +00:00
|
|
|
size_t framesToBytes(size_t frames, ChannelConfig config, SampleType type);
|
|
|
|
size_t bytesToFrames(size_t bytes, ChannelConfig config, SampleType type);
|
|
|
|
|
2012-03-20 17:34:36 +00:00
|
|
|
struct Sound_Decoder
|
2012-03-17 06:18:15 +00:00
|
|
|
{
|
2012-03-20 17:34:36 +00:00
|
|
|
Ogre::ResourceGroupManager &mResourceMgr;
|
|
|
|
|
2012-03-18 18:47:15 +00:00
|
|
|
virtual void open(const std::string &fname) = 0;
|
|
|
|
virtual void close() = 0;
|
2012-03-17 06:18:15 +00:00
|
|
|
|
2012-12-13 06:19:44 +00:00
|
|
|
virtual std::string getName() = 0;
|
2012-03-18 18:47:15 +00:00
|
|
|
virtual void getInfo(int *samplerate, ChannelConfig *chans, SampleType *type) = 0;
|
2012-03-19 15:48:25 +00:00
|
|
|
|
2012-03-18 18:47:15 +00:00
|
|
|
virtual size_t read(char *buffer, size_t bytes) = 0;
|
2012-03-21 00:57:28 +00:00
|
|
|
virtual void readAll(std::vector<char> &output);
|
2012-03-19 15:48:25 +00:00
|
|
|
virtual void rewind() = 0;
|
2012-12-13 13:04:53 +00:00
|
|
|
virtual size_t getSampleOffset() = 0;
|
2012-03-17 09:51:46 +00:00
|
|
|
|
2012-03-20 17:34:36 +00:00
|
|
|
Sound_Decoder() : mResourceMgr(Ogre::ResourceGroupManager::getSingleton())
|
|
|
|
{ }
|
2012-03-17 06:18:15 +00:00
|
|
|
virtual ~Sound_Decoder() { }
|
2012-03-24 10:49:03 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Sound_Decoder(const Sound_Decoder &rhs);
|
|
|
|
Sound_Decoder& operator=(const Sound_Decoder &rhs);
|
2012-03-17 06:18:15 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|