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.
46 lines
1.0 KiB
C++
46 lines
1.0 KiB
C++
#ifndef CFILESOURCE_H
|
|
#define CFILESOURCE_H
|
|
|
|
#include "../include/IDataSource.h"
|
|
#include <string>
|
|
#include <iostream>
|
|
#include <fstream>
|
|
|
|
namespace cAudio
|
|
{
|
|
|
|
class cFileSource : public IDataSource
|
|
{
|
|
public:
|
|
cFileSource(const std::string& filename);
|
|
~cFileSource();
|
|
|
|
//!Returns whether the source is valid (in case of an error, like the file couldn't be found)
|
|
virtual bool isValid();
|
|
|
|
//!Get the current location in the data stream
|
|
virtual int getCurrentPos();
|
|
|
|
//!Get the total size of the data stream
|
|
virtual int getSize();
|
|
|
|
//!Read out a section of the data stream
|
|
virtual int read(void* output, int size);
|
|
|
|
//!Seek to a position in the data stream
|
|
virtual bool seek(int amount, bool relative);
|
|
|
|
protected:
|
|
//!Hold if valid
|
|
bool Valid;
|
|
//!Holds file size
|
|
int Filesize;
|
|
//!File stream
|
|
FILE* pFile;
|
|
private:
|
|
};
|
|
|
|
};
|
|
|
|
#endif //! CFILESOURCE_H
|