32 #ifndef __CU_AUDIO_DECODER_H__
33 #define __CU_AUDIO_DECODER_H__
102 virtual bool init(
const char* file) {
103 return init(std::string(file));
117 virtual bool init(
const std::string& file) = 0;
128 #pragma mark Attributes
136 double getDuration()
const {
return (
double)_frames/(double)_rate; }
187 #pragma mark Decoding
212 virtual Sint32
pagein(
float* buffer) = 0;
232 virtual void setPage(Uint64 page) = 0;
242 return _frames % _pagesize == 0 ? _lastpage : _lastpage+1;
261 Sint32
decode(
float* buffer);
double getDuration() const
Definition: CUAudioDecoder.h:136
Sint32 decode(float *buffer)
void rewind()
Definition: CUAudioDecoder.h:248
virtual bool init(const char *file)
Definition: CUAudioDecoder.h:102
Uint64 _currpage
Definition: CUAudioDecoder.h:73
Uint32 getPageSize() const
Definition: CUAudioDecoder.h:184
std::string _file
Definition: CUAudioDecoder.h:67
Uint64 _lastpage
Definition: CUAudioDecoder.h:75
~AudioDecoder()
Definition: CUAudioDecoder.h:89
Definition: CUAudioDecoder.h:55
virtual Sint32 pagein(float *buffer)=0
Uint64 getPageCount() const
Definition: CUAudioDecoder.h:241
Uint32 _pagesize
Definition: CUAudioDecoder.h:70
std::string getFile() const
Definition: CUAudioDecoder.h:174
Uint64 getLength() const
Definition: CUAudioDecoder.h:152
bool ready()
Definition: CUAudioDecoder.h:195
Uint32 getChannels() const
Definition: CUAudioDecoder.h:165
Uint8 _channels
Definition: CUAudioDecoder.h:58
Uint32 _rate
Definition: CUAudioDecoder.h:61
Definition: CUAction.h:51
virtual void setPage(Uint64 page)=0
Uint32 getSampleRate() const
Definition: CUAudioDecoder.h:143
Uint64 getPage() const
Definition: CUAudioDecoder.h:221
Uint64 _frames
Definition: CUAudioDecoder.h:64