2132eea8bf
Changed the 3d tutorial to use the move convenience function in order to have proper doppler effects. Added relative seek ability to cAudio source. Updated decoders to have a flag if the data they are working with is valid for their decoder (isValid). Added reference counting to IAudio, IAudioDecoder, and IDataSource Added better error checking in cAudio sources and they will do a better job of detecting if they are invalid. Fixed the spelling on cWavAudioDecoderFactory.h Ogg decoder support for the isValid check. Time seek ability added to cRawDecoder Rewrote cWavDecoder. It will now read slightly malformed wav files (and conforms to the wav spec), no longer has a bug where 8 bit mono audio samples will play twice as fast as 16 bit mono samples, proper bounds checking to make sure only the audio data is sent to the audio source, and time seeking abilities. The decoder does not support channels over 2, compressed wavs, wavs with more than 1 data or fmt block, or any other blocks that may be present in a wav file. All unsupported blocks will be ignored.
69 lines
1.1 KiB
C++
69 lines
1.1 KiB
C++
#ifndef CAUDIOMUTEX_H
|
|
#define CAUDIOMUTEX_H
|
|
|
|
#include "../include/cAudioDefines.h"
|
|
|
|
#ifdef CAUDIO_MAKE_THREAD_SAFE
|
|
#ifdef _WIN32
|
|
#include <windows.h> //Basic windows include
|
|
#else
|
|
#include <pthread.h> //Assumed linux system
|
|
#endif
|
|
#endif
|
|
|
|
namespace cAudio
|
|
{
|
|
//Basic mutex class used for internal thread locking
|
|
#ifdef CAUDIO_MAKE_THREAD_SAFE
|
|
class cAudioMutex
|
|
{
|
|
public:
|
|
cAudioMutex();
|
|
~cAudioMutex();
|
|
|
|
void lock();
|
|
void unlock();
|
|
private:
|
|
void initialize();
|
|
#ifdef _WIN32
|
|
CRITICAL_SECTION criticalSection;
|
|
#else
|
|
pthread_mutex_t Mutex;
|
|
#endif
|
|
bool Initialized;
|
|
};
|
|
#else
|
|
//Dud class to disable the mutex
|
|
class cAudioMutex
|
|
{
|
|
public:
|
|
cAudioMutex();
|
|
~cAudioMutex();
|
|
|
|
void lock();
|
|
void unlock();
|
|
private:
|
|
void initialize();
|
|
bool Initialized;
|
|
};
|
|
#endif
|
|
|
|
#ifdef CAUDIO_MAKE_THREAD_SAFE
|
|
class cAudioMutexBasicLock
|
|
{
|
|
public:
|
|
cAudioMutexBasicLock(cAudioMutex& mutex) : Mutex(&mutex)
|
|
{
|
|
Mutex->lock();
|
|
}
|
|
~cAudioMutexBasicLock()
|
|
{
|
|
Mutex->unlock();
|
|
}
|
|
protected:
|
|
cAudioMutex* Mutex;
|
|
};
|
|
#endif
|
|
};
|
|
|
|
#endif //! CAUDIOMUTEX_H
|