Skip to content

Commit

Permalink
dont store volume and pitch in state
Browse files Browse the repository at this point in the history
  • Loading branch information
KurtGokhan committed Jun 1, 2024
1 parent c8120f1 commit d93e9f6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Runtime/Styling/StyleState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ private class AudioState
public bool Loaded;
public bool Loading;
public UnityEngine.AudioClip Clip;
public float Volume;
public float Pitch;
public bool ShouldStart;
public int CurrentLoop = 0;
}
Expand Down Expand Up @@ -668,12 +666,14 @@ private bool UpdateAudio()

var state = audioStates[i] = audioStates[i] ?? new AudioState();

var curVolume = volume.Get(i, 1);
var curPitch = pitch.Get(i, 1);

Action tryPlayClip = () => {
if (state.Loaded && state.ShouldStart)
{
state.ShouldStart = false;
Context.PlayAudio(state.Clip, state.Volume, state.Pitch);
Context.PlayAudio(state.Clip, curVolume, curPitch);
}
};

Expand All @@ -687,8 +687,6 @@ private bool UpdateAudio()

clip.Get(i, AudioReference.None).Get(Context, (cl) => {
state.Clip = cl;
state.Volume = volume.Get(i, 1);
state.Pitch = pitch.Get(i, 1);
state.Loaded = true;
state.Loading = false;

Expand Down

0 comments on commit d93e9f6

Please sign in to comment.