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