mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 11:40:44 +00:00
7b0104e9a1
git-svn-id: https://svn.eduke32.com/eduke32@452 1a8010ca-5511-0410-912e-c29ae57300e0
37 lines
1.3 KiB
C++
Executable file
37 lines
1.3 KiB
C++
Executable file
#ifndef __pcmbuffer_hpp__
|
|
#define __pcmbuffer_hpp__
|
|
|
|
#include "buffer.hpp"
|
|
|
|
class PcmBuffer : public Buffer {
|
|
private:
|
|
unsigned int numsamples, maxsamples;
|
|
void *data;
|
|
unsigned int samplerate;
|
|
unsigned int channels;
|
|
unsigned int bytespersample;
|
|
protected:
|
|
public:
|
|
PcmBuffer() : data((void*)0) { }
|
|
virtual ~PcmBuffer();
|
|
|
|
virtual Type GetType() const { return TYPE_PCM; }
|
|
|
|
unsigned int GetBlockSize() const { return channels*bytespersample; }
|
|
unsigned int GetMaxSamples() const { return maxsamples; }
|
|
void * GetData() const { return data; }
|
|
void * GetDataAt(int sample) const { return (void*)((char*)data + (GetBlockSize()*(sample%numsamples))); }
|
|
|
|
unsigned int GetNumSamples() const { return numsamples; }
|
|
unsigned int GetSampleRate() const { return samplerate; }
|
|
unsigned int GetNumChannels() const { return channels; }
|
|
unsigned int GetBytesPerSample() const { return bytespersample; }
|
|
unsigned int GetBitsPerSample() const { return bytespersample * 8; }
|
|
|
|
void SetNumSamples(unsigned int s) { if (s > maxsamples) s = maxsamples; numsamples = s; }
|
|
|
|
bool Allocate(unsigned int nsamp, unsigned int srate, unsigned int chans, unsigned int bps);
|
|
bool ConvertToNByte(int n);
|
|
};
|
|
|
|
#endif
|