#ifndef SOUNDSYSTEM_H
#define SOUNDSYSTEM_H

#include "miniaudio.h"

#define MAX_SOUNDS 64

typedef int SoundHandle;

class SoundSystem
{
public:
	SoundSystem();
	~SoundSystem();

	void Init();
	void Shutdown();

	SoundHandle LoadSound(const char* filename);

	void Play(SoundHandle handle, bool bLoop);
	void Play3D(SoundHandle handle, float x, float y, float z, bool bLoop);
	void Stop(SoundHandle handle);

	bool IsPlaying(SoundHandle handle);

	void SetMasterVolume(float volume);
	float GetMasterVolume();

	void SetListenerPosition(float _x, float _y, float _z);
	void SetListenerDirection(float _x, float _y, float _z);

private:
	ma_sound m_sounds[MAX_SOUNDS];
	ma_engine m_engine;
	int m_dwSoundsNum;
	bool m_inited;
};

extern SoundSystem g_soundSystem;

#endif // !SOUNDSYSTEM_H
