2009-12-22 12:22:32 +00:00
|
|
|
#ifndef MANGLE_STREAM_AUDIERECLIENT_H
|
|
|
|
#define MANGLE_STREAM_AUDIERECLIENT_H
|
|
|
|
|
|
|
|
#include <audiere.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
2010-06-03 18:13:27 +00:00
|
|
|
#include "../stream.hpp"
|
2010-01-01 15:39:11 +00:00
|
|
|
|
2009-12-22 12:22:32 +00:00
|
|
|
namespace Mangle {
|
|
|
|
namespace Stream {
|
|
|
|
|
|
|
|
/** @brief An Audiere::File that wraps a Mangle::Stream input.
|
|
|
|
|
|
|
|
This lets Audiere read sound files from any generic archive or
|
|
|
|
file manager that supports Mangle streams.
|
|
|
|
*/
|
2009-12-31 14:37:01 +00:00
|
|
|
class AudiereFile : public audiere::RefImplementation<audiere::File>
|
2009-12-22 12:22:32 +00:00
|
|
|
{
|
2009-12-31 14:37:01 +00:00
|
|
|
StreamPtr inp;
|
|
|
|
|
2009-12-22 12:22:32 +00:00
|
|
|
public:
|
2009-12-31 14:37:01 +00:00
|
|
|
AudiereFile(StreamPtr _inp)
|
|
|
|
: inp(_inp) {}
|
2009-12-22 12:22:32 +00:00
|
|
|
|
|
|
|
/// Read 'count' bytes, return bytes successfully read
|
|
|
|
int read(void *buf, int count)
|
|
|
|
{ return inp->read(buf,count); }
|
|
|
|
|
|
|
|
/// Seek, relative to specified seek mode. Returns true if successful.
|
2009-12-24 10:08:18 +00:00
|
|
|
bool seek(int pos, audiere::File::SeekMode mode);
|
2009-12-22 12:22:32 +00:00
|
|
|
|
|
|
|
/// Get current position
|
|
|
|
int tell()
|
|
|
|
{ assert(inp->hasPosition); return inp->tell(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
}} // namespaces
|
|
|
|
#endif
|