Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/SamsamTS/Memoria
Browse files Browse the repository at this point in the history
  • Loading branch information
SamsamTS committed Aug 30, 2023
2 parents ae362ad + fbbda05 commit 526d50a
Show file tree
Hide file tree
Showing 31 changed files with 504 additions and 335 deletions.
2 changes: 1 addition & 1 deletion Assembly-CSharp/Assembly-CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@
<Compile Include="Global\Movie\MovieAudioPlayer.cs" />
<Compile Include="Global\Movie\MovieMaterialProcessor.cs" />
<Compile Include="Global\Movie\MovieTestScript.cs" />
<Compile Include="Global\MusicPlayer.cs" />
<Compile Include="Global\Sound\MusicPlayer.cs" />
<Compile Include="Global\NameSettingUI.cs" />
<Compile Include="Global\NewIconAnimation.cs" />
<Compile Include="Global\NGUIDebug.cs" />
Expand Down
75 changes: 32 additions & 43 deletions Assembly-CSharp/Global/AllSoundDispatchPlayer.cs

Large diffs are not rendered by default.

251 changes: 180 additions & 71 deletions Assembly-CSharp/Global/Config/ConfigUI.cs

Large diffs are not rendered by default.

14 changes: 4 additions & 10 deletions Assembly-CSharp/Global/Movie/MovieAudioPlayer.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
using System;
using Memoria;

public class MovieAudioPlayer : MusicPlayer
{
public void PlayMusic(String soundName, Int32 fadeIn = 0)
{
Int32 soundIndex = SoundMetaData.GetSoundIndex(soundName, SoundProfileType.MovieAudio);
SoundLib.Log("PlayMuvieAudio movieName: " + soundName);
if (soundIndex != -1)
{
base.PlayMusic(soundIndex, fadeIn, SoundProfileType.MovieAudio);
}
}

public SoundProfile GetActiveSoundProfile()
{
return this.activeSoundProfile;
}

public override Single Volume => Configuration.Audio.MovieVolume / 100f;

}
14 changes: 4 additions & 10 deletions Assembly-CSharp/Global/SFX/SfxSoundPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@

public class SfxSoundPlayer : SoundPlayer
{
public void SetVolume(Int32 volume)
{
this.playerVolume = volume / 100f;
this.UpdatePlayingSoundVolume();
}

private void UpdatePlayingSoundVolume()
public void UpdateVolume()
{
foreach (Int32 key in this.playingDict.Keys)
{
SoundProfile soundProfile = this.playingDict[key];
if (this.residentSoundDatabase.Read(soundProfile.SoundIndex) != null)
{
ISdLibAPIProxy.Instance.SdSoundSystem_SoundCtrl_SetVolume(soundProfile.SoundID, soundProfile.SoundVolume * this.playerVolume, 0);
ISdLibAPIProxy.Instance.SdSoundSystem_SoundCtrl_SetVolume(soundProfile.SoundID, soundProfile.SoundVolume * this.Volume, 0);
}
}
}
Expand Down Expand Up @@ -145,7 +139,7 @@ public SoundProfile PlaySfxSound(Int32 soundIndexInSpecialEffect, Single soundVo
ISdLibAPIProxy.Instance.SdSoundSystem_SoundCtrl_Start(soundProfile.SoundID, 0);
if (ISdLibAPIProxy.Instance.SdSoundSystem_SoundCtrl_IsExist(soundProfile.SoundID) != 0)
{
ISdLibAPIProxy.Instance.SdSoundSystem_SoundCtrl_SetVolume(soundProfile.SoundID, soundProfile.SoundVolume * this.playerVolume, 0);
ISdLibAPIProxy.Instance.SdSoundSystem_SoundCtrl_SetVolume(soundProfile.SoundID, soundProfile.SoundVolume * this.Volume, 0);
SoundLib.Log("Panning: " + soundProfile.Panning);
ISdLibAPIProxy.Instance.SdSoundSystem_SoundCtrl_SetPanning(soundProfile.SoundID, soundProfile.Panning, 0);
Int32 fastForwardFactor = HonoBehaviorSystem.Instance.GetFastForwardFactor();
Expand Down Expand Up @@ -398,7 +392,7 @@ private Int32 GetSoundIndex(Int32 specialEffectID, Int32 soundIndexInSpecialEffe

private Int32 playingAtFrameCount;

private Single playerVolume = 1f;
public override Single Volume => Configuration.Audio.SoundVolume / 100f;

private SoundProfile loadingSoundProfile;
}
13 changes: 6 additions & 7 deletions Assembly-CSharp/Global/Sound/Effect/SoundEffectPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

public class SoundEffectPlayer : SoundPlayer
{
public void SetVolume(Single volume)
public void UpdateVolume()
{
SoundDatabase[] array = new SoundDatabase[]
{
Expand All @@ -21,7 +21,7 @@ public void SetVolume(Single volume)
Int32 soundID = value.SoundID;
if (this.playedEffectSet.Contains(soundID))
{
ISdLibAPIProxy.Instance.SdSoundSystem_SoundCtrl_SetVolume(soundID, volume, 0);
ISdLibAPIProxy.Instance.SdSoundSystem_SoundCtrl_SetVolume(soundID, value.SoundVolume * this.Volume, 0);
SoundLib.Log("Set volume to soundID: " + soundID + " finished");
}
else
Expand All @@ -30,7 +30,6 @@ public void SetVolume(Single volume)
}
}
}
this.playerVolume = volume;
}

public void StopAllSoundEffects()
Expand Down Expand Up @@ -141,7 +140,7 @@ public void PlaySoundEffect(Int32 soundIndex, Single soundVolume = 1f, Single pa
}
if (soundProfile != null)
{
soundProfile.SoundVolume = soundVolume * this.playerVolume;
soundProfile.SoundVolume = soundVolume;
soundProfile.Panning = panning;
soundProfile.Pitch = pitch;
this.activeSoundEffect = soundProfile;
Expand All @@ -165,7 +164,7 @@ public void PlaySoundEffect(Int32 soundIndex, Single soundVolume = 1f, Single pa
{
soundProfile = SoundMetaData.GetSoundProfile(soundIndex, type);
}
soundProfile.SoundVolume = soundVolume * this.playerVolume;
soundProfile.SoundVolume = soundVolume;
soundProfile.Panning = panning;
soundProfile.Pitch = pitch;
if (soundProfile == null)
Expand Down Expand Up @@ -201,7 +200,7 @@ private void LoadOnTheFlySoundResourceCallback(SoundDatabase soundDatabase, Bool
private void PlaySoundEffect(SoundProfile soundProfile)
{
base.CreateSound(soundProfile);
base.StartSound(soundProfile, 1f);
base.StartSound(soundProfile, Volume);
this.playedEffectSet.Add(soundProfile.SoundID);
soundProfile.SoundProfileState = SoundProfileState.Released;
this.gameSoundDatabase.Update(soundProfile);
Expand Down Expand Up @@ -275,5 +274,5 @@ public override void Update()

private SoundProfile activeSoundEffect;

private Single playerVolume = 1f;
public override Single Volume => Memoria.Configuration.Audio.SoundVolume / 100f;
}
Loading

0 comments on commit 526d50a

Please sign in to comment.