Skip to content

Commit

Permalink
Replace util.Clamp with min
Browse files Browse the repository at this point in the history
Progress can never be below 0.
  • Loading branch information
MarkKremer committed Aug 1, 2024
1 parent 683c624 commit 9f62cfe
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions effects/transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"math"

"github.com/gopxl/beep"
"github.com/gopxl/beep/internal/util"
)

// TransitionFunc defines a function used in a transition to describe the progression curve
Expand Down Expand Up @@ -58,7 +57,7 @@ func (t *TransitionStreamer) Stream(samples [][2]float64) (n int, ok bool) {
for i := 0; i < n; i++ {
pos := t.pos + i
progress := float64(pos) / float64(t.len)
progress = util.Clamp(progress, 0.0, 1.0)
progress = min(progress, 1.0)
value := t.transitionFunc(progress)
gain := t.startGain + (t.endGain-t.startGain)*value

Expand Down

0 comments on commit 9f62cfe

Please sign in to comment.