Lephisto/src/sound.h

39 lines
1014 B
C

#pragma once
#include <AL/al.h>
#include "physics.h"
#define SOUND_REFERENCE_DIST 500.
#define SOUND_MAX_DIST 1000.
// Virtual voice.
typedef struct alVoice_ {
ALuint source; // Source itself, 0 if not set.
ALuint buffer; // Buffer.
int priority; // Base priority.
double px, py; // Position.
double vx, vy; // Velocity.
unsigned int start; // Time started in ms.
unsigned int flags; // Flags to set properties.
} 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 int looping);
void sound_delVoice(alVoice* voice);
void voice_update(alVoice* voice, double px, double py, double vx, double vy);
void sound_listener(double dir, double px, double py, double vx, double vy);