mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Volume control backend.
This commit is contained in:
parent
f66acdfee2
commit
b5551dc685
|
@ -11,7 +11,7 @@ static const float NUM_FRAMES_STOP_INV = 1.0f/(float)NUM_FRAMES_STOP;
|
|||
static const int NUM_FRAMES_LERP = 512;
|
||||
static const float NUM_FRAMES_LERP_INV = 1.0f/(float)NUM_FRAMES_LERP;
|
||||
|
||||
static const float GLOBAL_VOLUME_SCALE = 0.75f;
|
||||
static float GLOBAL_VOLUME_SCALE = 0.75f;
|
||||
|
||||
static const int64 GLOBAL_SOUND_DELAY = 1000;
|
||||
|
||||
|
@ -211,6 +211,21 @@ bool snd_shutdown()
|
|||
return true;
|
||||
}
|
||||
|
||||
float snd_get_master_volume()
|
||||
{
|
||||
return GLOBAL_VOLUME_SCALE;
|
||||
}
|
||||
|
||||
void snd_set_master_volume(float val)
|
||||
{
|
||||
if(val < 0.0f)
|
||||
val = 0.0f;
|
||||
else if(val > 1.0f)
|
||||
val = 1.0f;
|
||||
|
||||
GLOBAL_VOLUME_SCALE = val;
|
||||
}
|
||||
|
||||
static int snd_alloc_sound()
|
||||
{
|
||||
if(first_free_sound < 0)
|
||||
|
|
|
@ -319,6 +319,8 @@ enum
|
|||
};
|
||||
|
||||
bool snd_init();
|
||||
float snd_get_master_volume();
|
||||
void snd_set_master_volume(float val);
|
||||
int snd_load_wav(const char *filename);
|
||||
int snd_play(int sound, int loop = SND_PLAY_ONCE, float vol = 1.0f, float pan = 0.0f);
|
||||
void snd_stop(int id);
|
||||
|
|
Loading…
Reference in a new issue