28a22c7f73
Updated tutorials to fix minor bugs and pathing issues. Also fixed crash bug on failure to create the audio object. Added msvc projects for all tutorials. Updated the listener class to be self contained and only handle stuff related to the OpenAL listener. It does NOT init OpenAL anymore, that has been moved to cAudioManager. Extended the listener class to support all settings that native OpenAL supports. Cleaned up cFileSource and fixed a crash bug on NULL file handle Fixed returning bad audio buffer chunk sizes from the cOggDecoder on errors in the ogg stream Seeking can now be down in fractions of a second now, changed the seconds field from int to float Fixed various odd formatting. Fixed potential crash bug in cMemorySource if memory could not be allocated. cMemorySource will no longer clear the buffer you give to it before filling it with data. This prevents an overwrite from happening in case of error but the user should provide a zeroed buffer to cMemorySource anyway for safety. Relative seeking is now supported by cOggDecoder.
53 lines
1.4 KiB
C++
53 lines
1.4 KiB
C++
#ifndef COGGDECODER_H_INCLUDED
|
|
#define COGGDECODER_H_INCLUDED
|
|
|
|
#include "../include/IAudioDecoder.h"
|
|
#include <ogg/ogg.h>
|
|
#include <vorbis/codec.h>
|
|
#include <vorbis/vorbisenc.h>
|
|
#include <vorbis/vorbisfile.h>
|
|
|
|
namespace cAudio
|
|
{
|
|
|
|
class cOggDecoder : public IAudioDecoder
|
|
{
|
|
public:
|
|
|
|
cOggDecoder(IDataSource* stream);
|
|
~cOggDecoder();
|
|
|
|
//!Retruns the format of the audio data
|
|
virtual AudioFormats getFormat();
|
|
|
|
//!Returns the frequency of the audio data
|
|
virtual int getFrequency();
|
|
|
|
//!Returns whether seeking is supported
|
|
virtual bool isSeekingSupported();
|
|
|
|
//!Reads a section of data out of the audio stream
|
|
virtual int readAudioData(void* output, int amount);
|
|
|
|
//!Sets the position to read data out of
|
|
virtual bool setPosition(int position, bool relative);
|
|
|
|
//!If seeking is supported, will seek the stream to seconds
|
|
virtual bool seek(float seconds,bool relative);
|
|
|
|
protected:
|
|
//!Callbacks used for read memory
|
|
ov_callbacks vorbisCallbacks;
|
|
//!some formatting data
|
|
vorbis_info* vorbisInfo;
|
|
//!User Comments
|
|
vorbis_comment* vorbisComment;
|
|
//!Stream handle
|
|
OggVorbis_File oggStream;
|
|
bool seekable;
|
|
};
|
|
|
|
}
|
|
|
|
#endif //! COGGDECODER_H_INCLUDED
|