/*
File Name: SoundManager.h
Created By: Andy Odle
Date: Mar 15, 2010

Description: 
*/

#ifndef SoundManager_h
#define SoundManager_h

#include <vector>
using namespace std;

#ifdef _WIN32
        // OpenAL include files.
        #include "C:/Program Files/OpenAL 1.1 SDK/include/al.h"
        #include "C:/Program Files/OpenAL 1.1 SDK\include/alc.h"
#else
        // OpenAL include files.
        #include "./AL/al.h"
        #include "./AL/alc.h"
#endif

#include "./source/PlatformSpecific/inc/ErrorReport.h"
#include "./source/PlatformSpecific/inc/GeneralPurposeFunctions.h"
#include "./source/inc/Sound.h"
#include "./source/inc/ResourceManager.h"

class SoundManager : public ResourceManager
{
    public:
    
        static SoundManager *soundManager_i();
        
        void Play(Sound *soundToPlay_p);
        void Pause(Sound *soundToPause_p);
        void Restart(Sound *soundToRestart_p);
        void Stop(Sound *soundToStop_p);

        void AssignSource(Sound *tempSound_p, bool loopSound_p = false);

        void InitilizeSoundManager();
        void InitializeSound(Sound *someSound_p);
        void DestorySound(Sound *someSound_p);
        void DestroySoundManager();
    
    private:
    
        SoundManager();
        SoundManager(SoundManager const&) : ResourceManager(){}
        ~SoundManager();
        
        SoundManager &operator=(SoundManager const&){}   

        void InitilizeOpenAL();
        void DeleteOpenAL();     
   
    private:
        
        ALCcontext* context_m; // OpenAL context.
        ALCdevice* device_m; // OpenAL device.
         
        ALfloat listenerPos[2]; // OpenAL listner postion.
        ALfloat listenerVel[2]; // OpenAL listner velociety.
        ALfloat listenerOri[5]; // OpenAL listner orientaiton.
        
        static SoundManager *soundManager_m;
        ErrorReport *errorReport_m;
};

#endif
