75ece68dcf
Made cAudio, cAudioCapture, cAudioManager and other classes thread safe. Made cAudioManager use a seperate update thread by default. Added cAudioSleep, a cross-platform sleep() function Moved global defines to cAudioDefines Added defines to disable thread safety or the internal update thread if the user wishes it Updated tutorials to reflect the changes made
40 lines
1002 B
C++
40 lines
1002 B
C++
#ifndef CRAWAUDIODECODERFACOTRY_H_INCLUDED
|
|
#define CRAWAUDIODECODERFACOTRY_H_INCLUDED
|
|
|
|
#include "../include/IAudioDecoderFactory.h"
|
|
#include "cRawDecoder.h"
|
|
#include "../Headers/cMutex.h"
|
|
|
|
namespace cAudio
|
|
{
|
|
|
|
class cRawAudioDecoderFactory : public IAudioDecoderFactory
|
|
{
|
|
public:
|
|
cRawAudioDecoderFactory() {}
|
|
~cRawAudioDecoderFactory() {}
|
|
|
|
IAudioDecoder* CreateAudioDecoder(IDataSource* stream)
|
|
{
|
|
Mutex.lock();
|
|
IAudioDecoder* decoder = new cRawDecoder(stream, 22050, EAF_16BIT_MONO);
|
|
Mutex.unlock();
|
|
return decoder;
|
|
}
|
|
|
|
IAudioDecoder* CreateAudioDecoder(IDataSource* stream, unsigned int frequency = 22050, AudioFormats format = EAF_16BIT_MONO)
|
|
{
|
|
Mutex.lock();
|
|
IAudioDecoder* decoder = new cRawDecoder(stream, frequency, format);
|
|
Mutex.unlock();
|
|
return decoder;
|
|
}
|
|
protected:
|
|
cAudioMutex Mutex;
|
|
private:
|
|
};
|
|
|
|
};
|
|
|
|
#endif //! CRAWAUDIODECODERFACOTRY_H_INCLUDED
|