2010-02-09 05:18:39 +01:00
|
|
|
// Copyright (c) 2008-2010 Raynaldo (Wildicv) Rivera, Joshua (Dark_Kilauea) Jones
|
|
|
|
// This file is part of the "cAudio Engine"
|
|
|
|
// For conditions of distribution and use, see copyright notice in cAudio.h
|
|
|
|
|
2009-06-21 05:24:30 +02:00
|
|
|
#ifndef CFILESOURCE_H
|
|
|
|
#define CFILESOURCE_H
|
|
|
|
|
|
|
|
#include "../include/IDataSource.h"
|
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
namespace cAudio
|
|
|
|
{
|
|
|
|
|
|
|
|
class cFileSource : public IDataSource
|
|
|
|
{
|
|
|
|
public:
|
2010-02-13 06:48:19 +01:00
|
|
|
cFileSource(const char* filename);
|
2009-06-21 05:24:30 +02:00
|
|
|
~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:
|
2009-08-08 07:51:32 +02:00
|
|
|
//!Hold if valid
|
|
|
|
bool Valid;
|
|
|
|
//!Holds file size
|
2009-06-21 05:24:30 +02:00
|
|
|
int Filesize;
|
2009-08-08 07:51:32 +02:00
|
|
|
//!File stream
|
|
|
|
FILE* pFile;
|
2009-06-21 05:24:30 +02:00
|
|
|
private:
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //! CFILESOURCE_H
|