Added correct file endings and renamed cwav to cWav and eAudio to EAudio
This commit is contained in:
parent
0c3df1d430
commit
1d677cbce1
|
@ -15,19 +15,19 @@ namespace cAudio
|
|||
|
||||
class cAudioManager : public IAudioManager
|
||||
{
|
||||
public:
|
||||
public:
|
||||
//!Inits the audio manager calling the alut/etc start ups
|
||||
virtual void init(int argc,char* argv[]);
|
||||
//!Shuts everything down
|
||||
virtual void shutDown();
|
||||
//!Shuts everything down
|
||||
virtual void shutDown();
|
||||
//!Creates the cAudio object
|
||||
virtual IAudio* createFromFile(const std::string& identifier,const std::string& file,bool stream = false);
|
||||
virtual IAudio* createFromFile(const std::string& identifier,const std::string& file,bool stream = false);
|
||||
//!Loads ogg from memory or virtual file system
|
||||
virtual IAudio* createFromMemory(const std::string& identifier, const char* data, size_t length, std::string ext);
|
||||
//!Loads raw audio from memory.
|
||||
//!Loads raw audio from memory.
|
||||
virtual IAudio* createFromRaw(const std::string& identifier,const char* data, size_t length, unsigned int frequency, AudioFormats format);
|
||||
|
||||
//!Register Audio Codec
|
||||
|
||||
//!Register Audio Codec
|
||||
virtual bool registerAudioDecoder(IAudioDecoderFactory* factory, std::string extension);
|
||||
//!Unregister Audio Codec (allows you to prevent an file type from being playable with new sound sources)
|
||||
//!Note that all current sound sources will still continue to use any currently allocated decoders.
|
||||
|
@ -38,15 +38,15 @@ namespace cAudio
|
|||
//!Returns a registered audio decoder factory
|
||||
virtual IAudioDecoderFactory* getAudioDecoderFactory(std::string extension);
|
||||
|
||||
//!Allows you to set the listener position (DEPRECIATED! USE getListener() INSTEAD!)
|
||||
//!Allows you to set the listener position (DEPRECIATED! USE getListener() INSTEAD!)
|
||||
virtual void setListenerPos(float x,float y,float z);
|
||||
//!Set Listener Orientation (DEPRECIATED! USE getListener() INSTEAD!)
|
||||
//!Set Listener Orientation (DEPRECIATED! USE getListener() INSTEAD!)
|
||||
virtual void setListenerOrientation(float ux,float uy,float uz);
|
||||
//!Updates the cAudio playback
|
||||
//!Updates the cAudio playback
|
||||
virtual void update();
|
||||
//!Gets you the cAudio object you want
|
||||
//!Gets you the cAudio object you want
|
||||
virtual IAudio *getSound(std::string identifier);
|
||||
//!Releases "ALL" cAudio objects
|
||||
//!Releases "ALL" cAudio objects
|
||||
virtual void release();
|
||||
|
||||
virtual IListener* getListener() { return &initlistener; }
|
||||
|
@ -60,14 +60,14 @@ namespace cAudio
|
|||
protected:
|
||||
cAudioManager(){ }
|
||||
|
||||
private:
|
||||
private:
|
||||
//!Global cAudioManager
|
||||
static cAudioManager m_cAudioManager;
|
||||
static cAudioManager m_cAudioManager;
|
||||
//!The map that holds the cAudio objects
|
||||
std::map<std::string, IAudio*> audiomap;
|
||||
std::map<std::string, IAudio*> audiomap;
|
||||
//!Decoder map that holds all decoders by file extension
|
||||
std::map<std::string, IAudioDecoderFactory*> decodermap;
|
||||
//!The listener object
|
||||
//!The listener object
|
||||
cListener initlistener;
|
||||
//!The audio capture instance
|
||||
cAudioCapture initCapture;
|
||||
|
|
|
@ -16,7 +16,7 @@ class cOggAudioDecoderFactory : public IAudioDecoderFactory
|
|||
IAudioDecoder* CreateAudioDecoder(IDataSource* stream)
|
||||
{
|
||||
return new cOggDecoder(stream);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
private:
|
||||
|
|
|
@ -35,13 +35,13 @@ namespace cAudio
|
|||
//!If seeking is supported, will seek the stream to seconds
|
||||
virtual bool seek(float seconds,bool relative);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
//!Callbacks used for read memory
|
||||
ov_callbacks vorbisCallbacks;
|
||||
ov_callbacks vorbisCallbacks;
|
||||
//!some formatting data
|
||||
vorbis_info* vorbisInfo;
|
||||
vorbis_info* vorbisInfo;
|
||||
//!User Comments
|
||||
vorbis_comment* vorbisComment;
|
||||
vorbis_comment* vorbisComment;
|
||||
//!Stream handle
|
||||
OggVorbis_File oggStream;
|
||||
bool seekable;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "../Headers/cListener.h"
|
||||
#include <AL/al.h>
|
||||
|
||||
#include "../Headers/cListener.h"
|
||||
#include <AL/al.h>
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
void cListener::setPosition(const cVector3 pos)
|
||||
|
|
|
@ -28,26 +28,26 @@ cMemorySource::cMemorySource(const void* data, int size, bool copy) : Data(NULL)
|
|||
cMemorySource::~cMemorySource()
|
||||
{
|
||||
delete[] Data;
|
||||
}
|
||||
}
|
||||
|
||||
//!Returns true if the DataStream is valid
|
||||
bool cMemorySource::isValid()
|
||||
{
|
||||
return Valid;
|
||||
}
|
||||
|
||||
|
||||
//!Returns the current position of the data stream.
|
||||
int cMemorySource::getCurrentPos()
|
||||
{
|
||||
return Pos;
|
||||
}
|
||||
|
||||
|
||||
//!Returns the data stream size
|
||||
int cMemorySource::getSize()
|
||||
{
|
||||
return Size;
|
||||
}
|
||||
|
||||
|
||||
//!Read current Data Stream Data
|
||||
int cMemorySource::read(void* output, int size)
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ int cMemorySource::read(void* output, int size)
|
|||
return copied;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//!Seek the data stream
|
||||
bool cMemorySource::seek(int amount, bool relative)
|
||||
{
|
||||
|
|
|
@ -69,13 +69,13 @@ namespace cAudio
|
|||
{
|
||||
return vorbisInfo->rate;
|
||||
}
|
||||
|
||||
|
||||
//!Returns if vorbis file is seekable
|
||||
bool cOggDecoder::isSeekingSupported()
|
||||
{
|
||||
return (ov_seekable(&oggStream)!=0);
|
||||
}
|
||||
|
||||
|
||||
//!Reads the vorbis data
|
||||
int cOggDecoder::readAudioData(void* output, int amount)
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ namespace cAudio
|
|||
int result = ov_read(&oggStream,(char*)output,amount,0,2,1,&temp);
|
||||
return (result < 0) ? 0 : result;
|
||||
}
|
||||
|
||||
|
||||
//!Sets the postion for vorbis data reader
|
||||
bool cOggDecoder::setPosition(int position, bool relative)
|
||||
{
|
||||
|
@ -94,7 +94,7 @@ namespace cAudio
|
|||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//!Seeks the vorbis data
|
||||
bool cOggDecoder::seek(float seconds, bool relative)
|
||||
{
|
||||
|
|
|
@ -1,53 +1,53 @@
|
|||
#include "../Headers/cRawDecoder.h"
|
||||
|
||||
namespace cAudio{
|
||||
|
||||
cRawDecoder::cRawDecoder(IDataSource* stream, unsigned int frequency, AudioFormats format) : IAudioDecoder(stream), Frequency(frequency), Format(format)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
cRawDecoder::~cRawDecoder()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//!Returns wav channel format
|
||||
AudioFormats cRawDecoder::getFormat()
|
||||
{
|
||||
return Format;
|
||||
}
|
||||
|
||||
//!Returns wav data frequency
|
||||
int cRawDecoder::getFrequency()
|
||||
{
|
||||
return Frequency;
|
||||
}
|
||||
|
||||
//!Returns if seeking is supported
|
||||
bool cRawDecoder::isSeekingSupported()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//!Reads wav data
|
||||
int cRawDecoder::readAudioData(void* output, int amount)
|
||||
{
|
||||
return Stream->read(output,amount);
|
||||
}
|
||||
|
||||
//!Sets data reader position
|
||||
bool cRawDecoder::setPosition(int position, bool relative)
|
||||
{
|
||||
#include "../Headers/cRawDecoder.h"
|
||||
|
||||
namespace cAudio{
|
||||
|
||||
cRawDecoder::cRawDecoder(IDataSource* stream, unsigned int frequency, AudioFormats format) : IAudioDecoder(stream), Frequency(frequency), Format(format)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
cRawDecoder::~cRawDecoder()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//!Returns wav channel format
|
||||
AudioFormats cRawDecoder::getFormat()
|
||||
{
|
||||
return Format;
|
||||
}
|
||||
|
||||
//!Returns wav data frequency
|
||||
int cRawDecoder::getFrequency()
|
||||
{
|
||||
return Frequency;
|
||||
}
|
||||
|
||||
//!Returns if seeking is supported
|
||||
bool cRawDecoder::isSeekingSupported()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//!Reads wav data
|
||||
int cRawDecoder::readAudioData(void* output, int amount)
|
||||
{
|
||||
return Stream->read(output,amount);
|
||||
}
|
||||
|
||||
//!Sets data reader position
|
||||
bool cRawDecoder::setPosition(int position, bool relative)
|
||||
{
|
||||
Stream->seek(position,relative);
|
||||
return true;
|
||||
}
|
||||
|
||||
//!Seeks wav data
|
||||
bool cRawDecoder::seek(float seconds,bool relative)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//!Seeks wav data
|
||||
bool cRawDecoder::seek(float seconds,bool relative)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,87 +1,87 @@
|
|||
#include "../Headers/cWavDecoder.h"
|
||||
|
||||
namespace cAudio{
|
||||
|
||||
cWavDecoder::cWavDecoder(IDataSource* stream) : IAudioDecoder(stream)
|
||||
{
|
||||
Stream->seek(4,false);
|
||||
Stream->read(&mChunkSize,4);
|
||||
Stream->seek(16,false);
|
||||
Stream->read(&mSubChunk1Size,4);
|
||||
Stream->read(&mFormat,sizeof(short));
|
||||
Stream->read(&mChannels,sizeof(short));
|
||||
Stream->read(&mSampleRate,sizeof(int));
|
||||
Stream->read(&mByteRate,sizeof(int));
|
||||
Stream->read(&mBlockAlign,sizeof(short));
|
||||
Stream->read(&mBitsPerSample,sizeof(short));
|
||||
Stream->seek(40,false);
|
||||
Stream->read(&mDataSize,sizeof(int));
|
||||
Stream->seek(44,false);
|
||||
|
||||
//Double the sampleRate to fix a bug with half-time speed
|
||||
mSampleRate += mSampleRate;
|
||||
}
|
||||
|
||||
cWavDecoder::~cWavDecoder()
|
||||
{
|
||||
mChunkSize = 0;
|
||||
mSubChunk1Size = 0;
|
||||
mFormat = 0;
|
||||
mChannels = 0;
|
||||
mSampleRate = 0;
|
||||
mByteRate = 0;
|
||||
mBlockAlign = 0;
|
||||
mBitsPerSample = 0;
|
||||
mDataSize = 0;
|
||||
}
|
||||
|
||||
//!Returns wav channel format
|
||||
AudioFormats cWavDecoder::getFormat()
|
||||
{
|
||||
if(mChannels = 1)
|
||||
return EAF_16BIT_MONO;
|
||||
else
|
||||
return EAF_16BIT_STEREO;
|
||||
|
||||
}
|
||||
|
||||
//!Returns wav data frequency
|
||||
int cWavDecoder::getFrequency()
|
||||
{
|
||||
return mSampleRate;
|
||||
}
|
||||
|
||||
//!Returns if seeking is supported
|
||||
bool cWavDecoder::isSeekingSupported()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//!Reads wav data
|
||||
int cWavDecoder::readAudioData(void* output, int amount)
|
||||
{
|
||||
return Stream->read(output,amount);
|
||||
|
||||
}
|
||||
|
||||
//!Sets data reader position
|
||||
bool cWavDecoder::setPosition(int position, bool relative)
|
||||
{
|
||||
//Safety to avoid reading the header as audio data
|
||||
if(!relative && position < 44)
|
||||
position = 44;
|
||||
|
||||
#include "../Headers/cWavDecoder.h"
|
||||
|
||||
namespace cAudio{
|
||||
|
||||
cWavDecoder::cWavDecoder(IDataSource* stream) : IAudioDecoder(stream)
|
||||
{
|
||||
Stream->seek(4,false);
|
||||
Stream->read(&mChunkSize,4);
|
||||
Stream->seek(16,false);
|
||||
Stream->read(&mSubChunk1Size,4);
|
||||
Stream->read(&mFormat,sizeof(short));
|
||||
Stream->read(&mChannels,sizeof(short));
|
||||
Stream->read(&mSampleRate,sizeof(int));
|
||||
Stream->read(&mByteRate,sizeof(int));
|
||||
Stream->read(&mBlockAlign,sizeof(short));
|
||||
Stream->read(&mBitsPerSample,sizeof(short));
|
||||
Stream->seek(40,false);
|
||||
Stream->read(&mDataSize,sizeof(int));
|
||||
Stream->seek(44,false);
|
||||
|
||||
//Double the sampleRate to fix a bug with half-time speed
|
||||
mSampleRate += mSampleRate;
|
||||
}
|
||||
|
||||
cWavDecoder::~cWavDecoder()
|
||||
{
|
||||
mChunkSize = 0;
|
||||
mSubChunk1Size = 0;
|
||||
mFormat = 0;
|
||||
mChannels = 0;
|
||||
mSampleRate = 0;
|
||||
mByteRate = 0;
|
||||
mBlockAlign = 0;
|
||||
mBitsPerSample = 0;
|
||||
mDataSize = 0;
|
||||
}
|
||||
|
||||
//!Returns wav channel format
|
||||
AudioFormats cWavDecoder::getFormat()
|
||||
{
|
||||
if(mChannels = 1)
|
||||
return EAF_16BIT_MONO;
|
||||
else
|
||||
return EAF_16BIT_STEREO;
|
||||
|
||||
}
|
||||
|
||||
//!Returns wav data frequency
|
||||
int cWavDecoder::getFrequency()
|
||||
{
|
||||
return mSampleRate;
|
||||
}
|
||||
|
||||
//!Returns if seeking is supported
|
||||
bool cWavDecoder::isSeekingSupported()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//!Reads wav data
|
||||
int cWavDecoder::readAudioData(void* output, int amount)
|
||||
{
|
||||
return Stream->read(output,amount);
|
||||
|
||||
}
|
||||
|
||||
//!Sets data reader position
|
||||
bool cWavDecoder::setPosition(int position, bool relative)
|
||||
{
|
||||
//Safety to avoid reading the header as audio data
|
||||
if(!relative && position < 44)
|
||||
position = 44;
|
||||
|
||||
Stream->seek(position,relative);
|
||||
return true;
|
||||
}
|
||||
|
||||
//!Seeks wav data
|
||||
bool cWavDecoder::seek(float seconds,bool relative)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//!Seeks wav data
|
||||
bool cWavDecoder::seek(float seconds,bool relative)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@
|
|||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\eAudioFormats.h"
|
||||
RelativePath=".\include\EAudioFormats.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
@ -315,7 +315,7 @@
|
|||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Source\cwavdecoder.cpp"
|
||||
RelativePath=".\Source\cWavdecoder.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
|
|
|
@ -20,27 +20,27 @@
|
|||
namespace cAudio
|
||||
{
|
||||
class IAudio;
|
||||
class IAudioDecoderFactory;
|
||||
class IAudioDecoderFactory;
|
||||
|
||||
class IAudioManager
|
||||
{
|
||||
public:
|
||||
//!Inits the audio manager calling the alut/etc start ups
|
||||
virtual void init(int argc,char* argv[]) = 0;
|
||||
//!Inits the audio manager calling the alut/etc start ups
|
||||
virtual void init(int argc,char* argv[]) = 0;
|
||||
//!Shuts everything down
|
||||
virtual void shutDown() = 0;
|
||||
//!Updates the cAudio playback
|
||||
virtual void update() = 0;
|
||||
virtual void shutDown() = 0;
|
||||
//!Updates the cAudio playback
|
||||
virtual void update() = 0;
|
||||
//!Returns an IAudio object by its "name" and 0 if the name is not found
|
||||
virtual IAudio *getSound(std::string identifier) = 0;
|
||||
//!Releases "ALL" cAudio objects (but does not shutdown the manager)
|
||||
virtual void release() = 0;
|
||||
virtual IAudio *getSound(std::string identifier) = 0;
|
||||
//!Releases "ALL" cAudio objects (but does not shutdown the manager)
|
||||
virtual void release() = 0;
|
||||
|
||||
//!Creates the cAudio object
|
||||
virtual IAudio* createFromFile(const std::string& identifier,const std::string& file,bool stream = false) = 0;
|
||||
//!Loads audio from memory or virtual file system
|
||||
virtual IAudio* createFromMemory(const std::string& identifier,const char* data, size_t length, std::string ext) = 0;
|
||||
//!Loads raw audio from memory.
|
||||
virtual IAudio* createFromFile(const std::string& identifier,const std::string& file,bool stream = false) = 0;
|
||||
//!Loads audio from memory or virtual file system
|
||||
virtual IAudio* createFromMemory(const std::string& identifier,const char* data, size_t length, std::string ext) = 0;
|
||||
//!Loads raw audio from memory.
|
||||
virtual IAudio* createFromRaw(const std::string& identifier,const char* data, size_t length, unsigned int frequency, AudioFormats format) = 0;
|
||||
|
||||
//!Register Audio Codec
|
||||
|
@ -53,9 +53,9 @@ namespace cAudio
|
|||
//!Returns a registered audio decoder factory
|
||||
virtual IAudioDecoderFactory* getAudioDecoderFactory(std::string extension) = 0;
|
||||
|
||||
//!Allows you to set the listener position (DEPRECIATED! USE getListener() INSTEAD!)
|
||||
virtual void setListenerPos(float x,float y,float z) = 0;
|
||||
//!set the listeners orientation (DEPRECIATED! USE getListener() INSTEAD!)
|
||||
//!Allows you to set the listener position (DEPRECIATED! USE getListener() INSTEAD!)
|
||||
virtual void setListenerPos(float x,float y,float z) = 0;
|
||||
//!set the listeners orientation (DEPRECIATED! USE getListener() INSTEAD!)
|
||||
virtual void setListenerOrientation(float ux,float uy,float uz) = 0;
|
||||
|
||||
//!Returns an interface for the listener
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace cAudio
|
|||
{
|
||||
public:
|
||||
IListener() {}
|
||||
virtual ~IListener() {}
|
||||
virtual ~IListener() {}
|
||||
|
||||
//!Sets the position of the listener
|
||||
//!Note that this will automatically set velocity to 0
|
||||
|
|
Loading…
Reference in New Issue