Fix reached macOS UI primitives and audio fade behavior

This commit is contained in:
shen
2026-09-24 00:31:51 -07:00
parent 330ec9745b
commit 400973da11
14 changed files with 439 additions and 66 deletions
@@ -171,14 +171,20 @@ void CSoundManager::SetMusicVolumeGrade(int iGrade)
void CSoundManager::SaveVolume()
{
m_fBackupMusicVolume = m_fMusicVolume;
m_fBackupSoundVolume = m_fSoundVolume;
if (m_isSoundDisable)
return;
const float musicVolume = m_fMusicVolume;
const float soundVolume = m_fSoundVolume;
SetMusicVolume(0.0f);
SetSoundVolume(0.0f);
m_fBackupMusicVolume = musicVolume;
m_fBackupSoundVolume = soundVolume;
m_isSoundDisable = TRUE;
}
void CSoundManager::RestoreVolume()
{
m_isSoundDisable = FALSE;
SetMusicVolume(m_fBackupMusicVolume);
SetSoundVolume(m_fBackupSoundVolume);
}
@@ -251,8 +257,13 @@ void CSoundManager::PlayCharacterSound3D(float fx, float fy, float fz, const cha
PlaySound3D(fx, fy, fz, c_szFileName, 1);
}
void CSoundManager::SetSoundVolume3D(int, float)
void CSoundManager::SetSoundVolume3D(int index, float volume)
{
AudioCommand cmd;
cmd.type = AudioCommand::SetSoundVolume3D;
cmd.id = index;
cmd.volume = volume;
PushAudioCommand(cmd);
}
void CSoundManager::StopAllSound3D()
@@ -274,9 +285,16 @@ void CSoundManager::PlayMusic(const char * c_szFileName)
PushAudioCommand(cmd);
}
void CSoundManager::FadeInMusic(const char * c_szFileName, float)
void CSoundManager::FadeInMusic(const char * c_szFileName, float speed)
{
PlayMusic(c_szFileName);
if (!c_szFileName || !c_szFileName[0])
return;
AudioCommand cmd;
cmd.type = AudioCommand::FadeInMusic;
cmd.filename = c_szFileName;
cmd.volume = m_fMusicVolume;
cmd.speed = speed;
PushAudioCommand(cmd);
}
void CSoundManager::FadeOutMusic(const char * c_szFileName, float fSpeed)
@@ -288,9 +306,14 @@ void CSoundManager::FadeOutMusic(const char * c_szFileName, float fSpeed)
PushAudioCommand(cmd);
}
void CSoundManager::FadeLimitOutMusic(const char * c_szFileName, float, float fSpeed)
void CSoundManager::FadeLimitOutMusic(const char * c_szFileName, float limit, float speed)
{
FadeOutMusic(c_szFileName, fSpeed);
AudioCommand cmd;
cmd.type = AudioCommand::FadeLimitOutMusic;
cmd.filename = c_szFileName ? c_szFileName : "";
cmd.volume = __ConvertRatioVolumeToApplyVolume(limit);
cmd.speed = speed;
PushAudioCommand(cmd);
}
void CSoundManager::FadeOutAllMusic()