caudio/include/IAudioDecoder.h

46 lines
1.3 KiB
C
Raw Normal View History

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 IAUDIODECODER_H
#define IAUDIODECODER_H
#include "IRefCounted.h"
2009-06-21 05:24:30 +02:00
#include "IDataSource.h"
2010-02-09 06:33:32 +01:00
#include "EAudioFormats.h"
2009-06-21 05:24:30 +02:00
namespace cAudio
{
class IAudioDecoder : public IRefCounted
{
public:
IAudioDecoder(IDataSource* stream) : Stream(stream) { if(Stream) Stream->grab(); }
virtual ~IAudioDecoder() { if(Stream) Stream->drop(); }
2009-06-21 05:24:30 +02:00
//!Returns the format of the audio data
virtual AudioFormats getFormat() = 0;
2009-06-21 05:24:30 +02:00
//!Returns the frequency of the audio data
virtual int getFrequency() = 0;
2009-06-21 05:24:30 +02:00
//!Returns whether seeking is supported
virtual bool isSeekingSupported() = 0;
2009-06-21 05:24:30 +02:00
//!Returns whether the stream is valid for this codec
virtual bool isValid() = 0;
2009-06-21 05:24:30 +02:00
//!Reads a section of data out of the audio stream
virtual int readAudioData(void* output, int amount) = 0;
2009-06-21 05:24:30 +02:00
//!Sets the position to read data out of
virtual bool setPosition(int position, bool relative) = 0;
2009-06-21 05:24:30 +02:00
//!If seeking is supported, will seek the stream to seconds
virtual bool seek(float seconds, bool relative) = 0;
protected:
IDataSource* Stream;
};
2009-06-21 05:24:30 +02:00
};
#endif //! IAUDIODECODER_H