Remove Organya-sleeping
Turns out that 'Sleep' call is ran on the *main* thread. I have absolutely no idea why the game does this.
This commit is contained in:
parent
7b1661dcf9
commit
bc165d0f0a
3 changed files with 1 additions and 25 deletions
|
@ -20,4 +20,3 @@ void AudioBackend_SetSoundPan(AudioBackend_Sound *sound, long pan);
|
||||||
|
|
||||||
void AudioBackend_SetOrganyaCallback(void (*callback)(void));
|
void AudioBackend_SetOrganyaCallback(void (*callback)(void));
|
||||||
void AudioBackend_SetOrganyaTimer(unsigned int milliseconds);
|
void AudioBackend_SetOrganyaTimer(unsigned int milliseconds);
|
||||||
void AudioBackend_SleepOrganya(unsigned int milliseconds);
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ static unsigned long output_frequency;
|
||||||
|
|
||||||
static void (*organya_callback)(void);
|
static void (*organya_callback)(void);
|
||||||
static unsigned int organya_callback_timer_master;
|
static unsigned int organya_callback_timer_master;
|
||||||
static unsigned int organya_sleep_timer;
|
|
||||||
|
|
||||||
static void MixSoundsAndUpdateOrganya(long *stream, size_t frames_total)
|
static void MixSoundsAndUpdateOrganya(long *stream, size_t frames_total)
|
||||||
{
|
{
|
||||||
|
@ -32,19 +31,6 @@ static void MixSoundsAndUpdateOrganya(long *stream, size_t frames_total)
|
||||||
// Instead, we can just do this.
|
// Instead, we can just do this.
|
||||||
unsigned int frames_done = 0;
|
unsigned int frames_done = 0;
|
||||||
|
|
||||||
// Don't process Organya when it's meant to be sleeping
|
|
||||||
const unsigned int frames_to_do = MIN(organya_sleep_timer, frames_total - frames_done);
|
|
||||||
|
|
||||||
if (frames_to_do != 0)
|
|
||||||
{
|
|
||||||
SoftwareMixerBackend_LockMixerMutex();
|
|
||||||
Mixer_MixSounds(stream, frames_to_do);
|
|
||||||
SoftwareMixerBackend_UnlockMixerMutex();
|
|
||||||
|
|
||||||
frames_done += frames_to_do;
|
|
||||||
organya_sleep_timer -= frames_to_do;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (frames_done != frames_total)
|
while (frames_done != frames_total)
|
||||||
{
|
{
|
||||||
static unsigned long organya_callback_timer;
|
static unsigned long organya_callback_timer;
|
||||||
|
@ -203,12 +189,3 @@ void AudioBackend_SetOrganyaTimer(unsigned int milliseconds)
|
||||||
|
|
||||||
SoftwareMixerBackend_UnlockOrganyaMutex();
|
SoftwareMixerBackend_UnlockOrganyaMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioBackend_SleepOrganya(unsigned int milliseconds)
|
|
||||||
{
|
|
||||||
SoftwareMixerBackend_LockOrganyaMutex();
|
|
||||||
|
|
||||||
organya_sleep_timer = (milliseconds * output_frequency) / 1000; // convert milliseconds to audio frames
|
|
||||||
|
|
||||||
SoftwareMixerBackend_UnlockOrganyaMutex();
|
|
||||||
}
|
|
||||||
|
|
|
@ -868,7 +868,7 @@ void StopOrganyaMusic(void)
|
||||||
memset(key_on, 0, sizeof(key_on));
|
memset(key_on, 0, sizeof(key_on));
|
||||||
memset(key_twin, 0, sizeof(key_twin));
|
memset(key_twin, 0, sizeof(key_twin));
|
||||||
|
|
||||||
AudioBackend_SleepOrganya(100);
|
//Sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetOrganyaFadeout(void)
|
void SetOrganyaFadeout(void)
|
||||||
|
|
Loading…
Add table
Reference in a new issue