mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-23 18:01:30 +00:00
cdf2a17c5a
Since this gets used by both the sound backend and the music code it needs to be in a place accessible to both.
40 lines
956 B
C++
40 lines
956 B
C++
#pragma once
|
|
|
|
#include "../../music_common/fileio.h"
|
|
#include <vector>
|
|
|
|
enum SampleType
|
|
{
|
|
SampleType_UInt8,
|
|
SampleType_Int16
|
|
};
|
|
enum ChannelConfig
|
|
{
|
|
ChannelConfig_Mono,
|
|
ChannelConfig_Stereo
|
|
};
|
|
|
|
struct SoundDecoder
|
|
{
|
|
static SoundDecoder* CreateDecoder(MusicIO::FileInterface* reader);
|
|
|
|
virtual void getInfo(int *samplerate, ChannelConfig *chans, SampleType *type) = 0;
|
|
|
|
virtual size_t read(char *buffer, size_t bytes) = 0;
|
|
virtual std::vector<uint8_t> readAll();
|
|
virtual bool seek(size_t ms_offset, bool ms, bool mayrestart) = 0;
|
|
virtual size_t getSampleOffset() = 0;
|
|
virtual size_t getSampleLength() { return 0; }
|
|
virtual bool open(MusicIO::FileInterface* reader) = 0;
|
|
|
|
SoundDecoder() { }
|
|
virtual ~SoundDecoder() { }
|
|
|
|
protected:
|
|
friend class SoundRenderer;
|
|
|
|
// Make non-copyable
|
|
SoundDecoder(const SoundDecoder &rhs) = delete;
|
|
SoundDecoder& operator=(const SoundDecoder &rhs) = delete;
|
|
};
|
|
|