// Filename: audio/SoundManager.h
// Author: Jorge Bernadas (JB)
// Date of Creation: 12/07/2006
// Version: 1.0
//
// TODO(): Add general comment here!
#ifndef BASE_AUDIO_SOUND_MANAGER_H__
#define BASE_AUDIO_SOUND_MANAGER_H__

#pragma comment(lib, "lib/OpenAl32.lib")
#pragma comment(lib, "lib/Alut.lib")

#include "../../al/al.h"
#include "../../al/alc.h"
#include "../../al/alut.h"

#include "string"
#include "map"

//#include "sound.h"
class Sound;

class SoundManager {
public:
  ~SoundManager();

  // method to create and destroy the sound manager
  bool Create();
  void Destroy();

  // methods to set the actual listener position
  void SetListenerPosition(float posX, float posY, float posZ,
                           float lookX, float lookY, float lookZ,
                           float upX, float upY, float upZ);

  // method to get a sound given a filename
  Sound* GetSound(const char* filename);

  // method to get the sound manager unique instance
  static SoundManager& instance() {
    return instance_;
  }

protected:
  // method to check if the manager was created
  bool IsManagerCreated() const;

  // method to clear all loaded sounds
  void UnloadAllSounds();

private:
  // device and context for the sound manager
	ALCdevice* device_;
	ALCcontext* context_;
	ALuint defaultDevice_;

  // loaded sounds and unique instance of the sound manager
  std::map<std::string, Sound*> sounds_;
  static SoundManager instance_;

  // declare default constructor private
  SoundManager();
  //DISALLOW_COPY_AND_ASSIGN(SoundManager);
};

#endif // BASE_AUDIO_SOUND_MANAGER_H__
