From f542f75202089c9a168da309bf314fd42dcf5d1c Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Wed, 5 Jul 2017 18:15:53 -0400 Subject: [PATCH] fix bounds check --- audio/example/sin/main.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/audio/example/sin/main.go b/audio/example/sin/main.go index 881f9b9..e018294 100644 --- a/audio/example/sin/main.go +++ b/audio/example/sin/main.go @@ -5,8 +5,6 @@ import ( "fmt" - "os" - "github.com/faiface/pixel/audio" ) @@ -17,10 +15,7 @@ type sine struct { } func (s *sine) Stream(samples [][2]float64) (n int, ok bool) { - if len(samples) == 0 { - os.Exit(-1) - } - for i := 0; i < len(samples)-2; i += 2 { + for i := 0; i < len(samples)-1; i += 2 { val := math.Sin(math.Pi*s.time*s.freq) / 1.1 s.time += 1 / s.rate valI := int16((1 << 15) * val)