28a22c7f73
Updated tutorials to fix minor bugs and pathing issues. Also fixed crash bug on failure to create the audio object. Added msvc projects for all tutorials. Updated the listener class to be self contained and only handle stuff related to the OpenAL listener. It does NOT init OpenAL anymore, that has been moved to cAudioManager. Extended the listener class to support all settings that native OpenAL supports. Cleaned up cFileSource and fixed a crash bug on NULL file handle Fixed returning bad audio buffer chunk sizes from the cOggDecoder on errors in the ogg stream Seeking can now be down in fractions of a second now, changed the seconds field from int to float Fixed various odd formatting. Fixed potential crash bug in cMemorySource if memory could not be allocated. cMemorySource will no longer clear the buffer you give to it before filling it with data. This prevents an overwrite from happening in case of error but the user should provide a zeroed buffer to cMemorySource anyway for safety. Relative seeking is now supported by cOggDecoder.
58 lines
1.6 KiB
C++
58 lines
1.6 KiB
C++
|
|
#ifndef IAUDIOMANAGER_H
|
|
#define IAUDIOMANAGER_H
|
|
#include <string>
|
|
#include "IListener.h"
|
|
|
|
#ifndef CAUDIO_STATIC_LIB
|
|
|
|
#ifdef CAUDIO_EXPORTS
|
|
#define CAUDIO_API __declspec(dllexport)
|
|
#else
|
|
#define CAUDIO_API//! __declspec(dllimport)
|
|
#endif // CAUDIO_EXPORTS
|
|
|
|
#else
|
|
#define CAUDIO_API
|
|
#endif // CAUDIO_STATIC_LIB
|
|
|
|
namespace cAudio
|
|
{
|
|
class IAudio;
|
|
class IAudioDecoderFactory;
|
|
|
|
class IAudioManager
|
|
{
|
|
public:
|
|
//!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;
|
|
//!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;
|
|
//!Register Audio Codec
|
|
virtual void registerAudioDecoder(IAudioDecoderFactory* factory, std::string extension) = 0;
|
|
//!Allows you to set the listener position
|
|
virtual void setListenerPos(float x,float y,float z) = 0;
|
|
//!set the listeners orientation
|
|
virtual void setListenerOrientation(float ux,float uy,float uz) = 0;
|
|
//!Updates the cAudio playback
|
|
virtual void update() = 0;
|
|
//!Gets you the cAudio object you want
|
|
virtual IAudio *getSound(std::string identifier) = 0;
|
|
//!Releases "ALL" cAudio objects
|
|
virtual void release() = 0;
|
|
|
|
virtual IListener* getListener() = 0;
|
|
|
|
virtual ~IAudioManager() {}
|
|
protected:
|
|
private:
|
|
};
|
|
|
|
CAUDIO_API IAudioManager* getAudioManager(void);
|
|
}
|
|
#endif //! IAUDIOMANAGER_H
|