Description:
Make sound preview use the new volume. Plays the sound at the new volume, not the old volume. Uses nullables, which I'm a little unsure of how well they'll work out in practice. I think this is a reasonable place to experiment.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r654:fa8826446e55 -

@@ -55,10 +55,11
55 in ReadMessages<PlaySoundMessage>()) {
55 in ReadMessages<PlaySoundMessage>()) {
56 var sound = sounds[message.SoundName];
56 var sound = sounds[message.SoundName];
57
57
58 var volume = message.Volume ?? this.volume;
59
58 if (!muted) {
60 if (!muted) {
59 sound.Play(this.volume, this.pitch, this.pan);
61 sound.Play(volume, this.pitch, this.pan);
60 }
62 }
61
62 }
63 }
63
64
64 }
65 }
@@ -2,11 +2,14
2
2
3 using Encompass;
3 using Encompass;
4
4
5 #nullable enable
6
5 namespace isometricparkfna.Messages
7 namespace isometricparkfna.Messages
6 {
8 {
7 public struct PlaySoundMessage : IMessage
9 public struct PlaySoundMessage : IMessage
8 {
10 {
9 public string SoundName;
11 public string SoundName;
12 public float? Volume;
10
13
11 }
14 }
12 }
15 }
@@ -158,7 +158,7
158 ImGui.DragFloat("##Sfx", ref newSoundEffectVolume, 0.005f, 0.0f, 1.0f, "%.2f");
158 ImGui.DragFloat("##Sfx", ref newSoundEffectVolume, 0.005f, 0.0f, 1.0f, "%.2f");
159
159
160 if ((newSoundEffectVolume != prevSoundEffectVolume) && ImGui.IsItemDeactivatedAfterEdit()) {
160 if ((newSoundEffectVolume != prevSoundEffectVolume) && ImGui.IsItemDeactivatedAfterEdit()) {
161 bridgeEngine.playSoundMessages.Add(new PlaySoundMessage { SoundName = "Bell" });
161 bridgeEngine.playSoundMessages.Add(new PlaySoundMessage { SoundName = "Bell", Volume = newSoundEffectVolume});
162 prevSoundEffectVolume = newSoundEffectVolume;
162 prevSoundEffectVolume = newSoundEffectVolume;
163 }
163 }
164
164
You need to be logged in to leave comments. Login now