5#include "cRawDecoder.h"
9 cRawDecoder::cRawDecoder(IDataSource* stream,
unsigned int frequency,
AudioFormats format) : IAudioDecoder(stream), Frequency(frequency), Format(format)
14 cRawDecoder::~cRawDecoder()
24 int cRawDecoder::getFrequency()
29 bool cRawDecoder::isSeekingSupported()
34 bool cRawDecoder::isValid()
39 int cRawDecoder::readAudioData(
void* output,
int amount)
41 return Stream->read(output,amount);
44 bool cRawDecoder::setPosition(
int position,
bool relative)
46 Stream->seek(position,relative);
50 bool cRawDecoder::seek(
float seconds,
bool relative)
53 if(Format == EAF_8BIT_MONO)
55 else if(Format == EAF_8BIT_STEREO)
57 else if(Format == EAF_16BIT_MONO)
62 int amountToSeek = seconds * (float)Frequency * (
float)SampleSize;
63 return setPosition(amountToSeek, relative);
66 float cRawDecoder::getTotalTime()
69 if(Format == EAF_8BIT_MONO)
71 else if(Format == EAF_8BIT_STEREO)
73 else if(Format == EAF_16BIT_MONO)
77 return (
float)Stream->getSize() / ((float)Frequency * (
float)SampleSize);
80 int cRawDecoder::getTotalSize()
82 return Stream->getSize();
85 int cRawDecoder::getCompressedSize()
87 return Stream->getSize();
90 float cRawDecoder::getCurrentTime()
93 if(Format == EAF_8BIT_MONO)
95 else if(Format == EAF_8BIT_STEREO)
97 else if(Format == EAF_16BIT_MONO)
102 return (
float)Stream->getCurrentPos() / ((float)Frequency * (
float)SampleSize);
105 int cRawDecoder::getCurrentPosition()
107 return Stream->getCurrentPos();
110 int cRawDecoder::getCurrentCompressedPosition()
112 return Stream->getCurrentPos();
115 cAudioString cRawDecoder::getType()
const
117 return cAudioString(_CTEXT(
"cRawDecoder"));
Main namespace for the entire cAudio library.
AudioFormats
Enumeration of audio formats supported by the engine.