1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-08 09:37:53 +00:00
OpenMW/apps/openmw/mwsound/sound_decoder.hpp
2012-03-19 08:48:25 -07:00

42 lines
1002 B
C++

#ifndef GAME_SOUND_SOUND_DECODER_H
#define GAME_SOUND_SOUND_DECODER_H
#include <string>
namespace MWSound
{
enum SampleType {
SampleType_UInt8,
SampleType_Int16
};
const char *getSampleTypeName(SampleType type);
enum ChannelConfig {
ChannelConfig_Mono,
ChannelConfig_Stereo
};
const char *getChannelConfigName(ChannelConfig config);
size_t framesToBytes(size_t frames, ChannelConfig config, SampleType type);
size_t bytesToFrames(size_t bytes, ChannelConfig config, SampleType type);
class Sound_Decoder
{
public:
virtual void open(const std::string &fname) = 0;
virtual void close() = 0;
virtual void getInfo(int *samplerate, ChannelConfig *chans, SampleType *type) = 0;
virtual size_t read(char *buffer, size_t bytes) = 0;
virtual void rewind() = 0;
virtual ~Sound_Decoder() { }
friend class OpenAL_Output;
friend class SoundManager;
};
}
#endif