43 #ifndef _audiorawdecoder_cpp
44 #define _audiorawdecoder_cpp
46 #ifdef ENABLE_RAW_ENCODE
48 #include "Audio/rawdecoder.h"
59 BitConfiguration(Config)
61 this->RawStream->seekg(0,std::ios_base::end);
62 this->RawStreamSize = this->RawStream->tellg();
63 this->RawStream->seekg(0);
66 RawDecoder::~RawDecoder()
69 void RawDecoder::ClearStreamErrors()
71 if( this->RawStream->eof() ) {
72 this->RawStream->clear( this->RawStream->rdstate() ^ ( std::ios::eofbit | std::ios::failbit ) );
79 Boole RawDecoder::IsValid()
89 Boole RawDecoder::IsSeekingSupported()
96 return this->BitConfiguration;
99 UInt32 RawDecoder::GetFrequency()
const
101 return this->Frequency;
106 return this->RawStream;
109 Boole RawDecoder::IsEndOfStream()
const
111 return ( this->RawStream->eof() || this->RawStream->tellg() >= this->RawStreamSize );
116 this->RawStream->seekg(Position,( Relative ? std::ios_base::cur : std::ios_base::beg ));
122 Int32 Pos =
static_cast<Int32>( Seconds *
static_cast<Real>(this->Frequency) * static_cast<Real>( this->GetSampleSize() ) );
123 return this->SetPosition(Pos,Relative);
126 UInt32 RawDecoder::ReadAudioData(
void* Output,
UInt32 Amount)
128 this->RawStream->read(static_cast<char*>(Output),Amount);
129 return this->RawStream->gcount();
135 Real RawDecoder::GetTotalTime()
const
136 {
return static_cast<Real>( this->RawStreamSize ) / ( static_cast<Real>(this->Frequency) *
static_cast<Real>( this->GetSampleSize() ) ); }
138 Real RawDecoder::GetCurrentTime()
const
139 {
return static_cast<Real>( this->RawStream->tellg() ) / ( static_cast<Real>(this->Frequency) *
static_cast<Real>( this->GetSampleSize() ) ); }
141 UInt32 RawDecoder::GetTotalSize()
const
142 {
return this->RawStreamSize; }
144 UInt32 RawDecoder::GetCompressedSize()
const
145 {
return this->RawStreamSize; }
147 UInt32 RawDecoder::GetCurrentPosition()
const
148 {
return this->RawStream->tellg(); }
150 UInt32 RawDecoder::GetCurrentCompressedPosition()
const
151 {
return this->RawStream->tellg(); }
155 #endif //ENABLE_RAW_ENCODE
int32_t Int32
An 32-bit integer.
bool Boole
Generally acts a single bit, true or false.
float Real
A Datatype used to represent a real floating point number.
uint32_t UInt32
An 32-bit unsigned integer.
Encoding
The encoding to use when reading or writing an audio buffer.
The bulk of the engine components go in this namspace.
Unknown or error condition.
CountedPtr< DataStream > DataStreamPtr
This is a convenience type for a data stream in a counted pointer.
BitConfig
Used to describe the different bit configurations supported by this audio system. ...