#pragma once
#include <AL/al.h>
#include "physics.h"

#define VOICE_LOOPING   (1<<10) /* Voice loops. */
#define VOICE_STATIC    (1<<11) /* Voice isn't relative. */

struct alVoice;
typedef struct alVoice alVoice;

/* Sound subsystem. */
int sound_init(void);
void sound_exit(void);
void sound_update(void);

/* Sound manupulation functions. */
ALuint sound_get(char* name);
void sound_volume(const double vol);

/* Voice manipulation function. */
alVoice* sound_addVoice(int priority, double px, double py,
    double vx, double vy, const ALuint buffer, const unsigned int flags);

void sound_delVoice(alVoice* voice); /* Delete voice. */

void voice_update(alVoice* voice, double px, double py, double vx, double vy);
void voice_buffer(alVoice* voice, const ALuint buffer, const unsigned int flags);
void voice_stop(alVoice* voice);

/* Listener manipulation. */
void sound_listener(double dir, double px, double py, double vx, double vy);

