1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Fix semi random volume jumps

This commit is contained in:
N00byKing 2022-06-09 21:46:40 +02:00 committed by Misa Elizabeth Kai
parent f0aa1a8cae
commit c077500d16

View file

@ -165,6 +165,7 @@ end:
vlog_error("Unable to queue sound buffer"); vlog_error("Unable to queue sound buffer");
return; return;
} }
FAudioVoice_SetVolume(voices[i], volume, FAUDIO_COMMIT_NOW);
if (FAudioSourceVoice_Start(voices[i], 0, FAUDIO_COMMIT_NOW)) if (FAudioSourceVoice_Start(voices[i], 0, FAUDIO_COMMIT_NOW))
{ {
vlog_error("Unable to start voice processing"); vlog_error("Unable to start voice processing");
@ -229,10 +230,10 @@ end:
static void SetVolume(int soundVolume) static void SetVolume(int soundVolume)
{ {
float adj_vol = (float) soundVolume / VVV_MAX_VOLUME; volume = (float) soundVolume / VVV_MAX_VOLUME;
for (size_t i = 0; i < VVV_MAX_CHANNELS; i++) for (size_t i = 0; i < VVV_MAX_CHANNELS; i++)
{ {
FAudioVoice_SetVolume(voices[i], adj_vol, FAUDIO_COMMIT_NOW); FAudioVoice_SetVolume(voices[i], volume, FAUDIO_COMMIT_NOW);
} }
} }
@ -242,8 +243,10 @@ end:
bool valid; bool valid;
static FAudioSourceVoice** voices; static FAudioSourceVoice** voices;
static float volume;
}; };
FAudioSourceVoice** SoundTrack::voices = NULL; FAudioSourceVoice** SoundTrack::voices = NULL;
float SoundTrack::volume;
class MusicTrack class MusicTrack
{ {