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