cAudio
2.3.0
3d Audio Engine
|
5 #include "cRawDecoder.h"
9 cRawDecoder::cRawDecoder(IDataSource* stream,
unsigned int frequency,
AudioFormats format) : IAudioDecoder(stream), Frequency(frequency), Format(format)
14 cRawDecoder::~cRawDecoder()
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;
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);
93 if(Format == EAF_8BIT_MONO)
95 else if(Format == EAF_8BIT_STEREO)
97 else if(Format == EAF_16BIT_MONO)
117 return cAudioString(_CTEXT(
"cRawDecoder"));
AudioFormats
Enumeration of audio formats supported by the engine.
virtual bool setPosition(int position, bool relative)
Sets the position in the stream to read from.
virtual bool isSeekingSupported()
Returns whether seeking is supported.
virtual AudioFormats getFormat()
Returns the format of the audio data.
Main namespace for the entire cAudio library.
virtual cAudioString getType() const
Returns the IAudioDecoderType.
virtual int read(void *output, int size)=0
Reads out a section of the data stream.
virtual float getTotalTime()
If seeking is supported, will return the length of the audio steam in seconds. Returns a negative num...
virtual int getSize()=0
Returns the total size of the data stream.
virtual int getCurrentCompressedPosition()
Returns the position in the compressed (original) audio stream before decoding.
virtual bool isValid()
Returns whether the stream is valid for this codec.
virtual int getCurrentPos()=0
Returns the current location in the data stream.
virtual int getFrequency()
Returns the frequency (sample rate) of the audio data.
virtual int getCurrentPosition()
If available, returns the current position in the decoded audio stream in bytes. Returns a negative n...
virtual bool seek(int amount, bool relative)=0
Seek to a position in the data stream.
virtual int getTotalSize()
If available, returns the total decoded size of the audio stream. Returns a negative number if this c...
IDataSource * Stream
Pointer to the data source to take audio data from.
virtual bool seek(float seconds, bool relative)
If seeking is supported, will seek the stream to seconds.
virtual int getCompressedSize()
Returns the compressed (original) size of the audio stream, before decoding.
virtual float getCurrentTime()
If seeking is supported, will return the current position in the stream in seconds....
virtual int readAudioData(void *output, int amount)
Reads a section of data out of the audio stream.