@@ -134,10 +134,11 @@ var (
134
134
)
135
135
136
136
const (
137
- floating = `// Code generated by go generate; DO NOT EDIT.
137
+ floating = `package signal
138
+
139
+ // Code generated by go generate; DO NOT EDIT.
138
140
// This file was generated by robots at
139
141
// {{ .Timestamp }}
140
- package signal
141
142
142
143
import "math"
143
144
@@ -150,7 +151,7 @@ type {{ .Name }} struct {
150
151
// {{ .Name }} allocates a new sequential {{ .Builtin }} signal buffer.
151
152
func (a Allocator) {{ .Name }}() Floating {
152
153
return {{ .Name }}{
153
- buffer: make([]{{ .Builtin }}, 0 , a.Channels*a.Capacity),
154
+ buffer: make([]{{ .Builtin }}, a.Channels*a.Length , a.Channels*a.Capacity),
154
155
channels: channels(a.Channels),
155
156
}
156
157
}
@@ -175,7 +176,7 @@ func (p *Pool) Put{{ .Name }}(s Floating) {
175
176
panic("pool put {{ .Builtin }} invalid type")
176
177
}
177
178
mustSameCapacity(s.Capacity(), p.allocator.Capacity)
178
- p.{{ .Pool }}.Put(s.Reset( ))
179
+ p.{{ .Pool }}.Put(s.Slice(0, p.allocator.Length ))
179
180
}
180
181
181
182
@@ -233,11 +234,6 @@ func (s {{ .Name }}) Slice(start, end int) Floating {
233
234
return s
234
235
}
235
236
236
- // Reset sets length of the buffer to zero.
237
- func (s {{ .Name }}) Reset() Floating {
238
- return s.Slice(0, 0)
239
- }
240
-
241
237
// Append appends data from src buffer to the end of the buffer.
242
238
func (s {{ .Name }}) Append(src Floating) Floating {
243
239
mustSameChannels(s.Channels(), src.Channels())
@@ -307,10 +303,11 @@ func WriteStriped{{ .Name }}(src [][]{{ .Builtin }}, dst Floating) Floating {
307
303
return dst
308
304
}`
309
305
310
- signed = `// Code generated by go generate; DO NOT EDIT.
306
+ signed = `package signal
307
+
308
+ // Code generated by go generate; DO NOT EDIT.
311
309
// This file was generated by robots at
312
310
// {{ .Timestamp }}
313
- package signal
314
311
315
312
import "math"
316
313
@@ -324,7 +321,7 @@ type {{ .Name }} struct {
324
321
// {{ .Name }} allocates a new sequential {{ .Builtin }} signal buffer.
325
322
func (a Allocator) {{ .Name }}(bd BitDepth) Signed {
326
323
return {{ .Name }}{
327
- buffer: make([]{{ .Builtin }}, 0 , a.Capacity*a.Channels),
324
+ buffer: make([]{{ .Builtin }}, a.Channels*a.Length , a.Capacity*a.Channels),
328
325
channels: channels(a.Channels),
329
326
bitDepth: limitBitDepth(bd, {{ .MaxBitDepth }}),
330
327
}
@@ -350,7 +347,7 @@ func (p *Pool) Put{{ .Name }}(s Signed) {
350
347
panic("pool put {{ .Builtin }} invalid type")
351
348
}
352
349
mustSameCapacity(s.Capacity(), p.allocator.Capacity)
353
- p.{{ .Pool }}.Put(s.Reset( ))
350
+ p.{{ .Pool }}.Put(s.Slice(0, p.allocator.Length ))
354
351
}
355
352
356
353
func (s {{ .Name }}) setBitDepth(bd BitDepth) Signed {
@@ -412,11 +409,6 @@ func (s {{ .Name }}) Slice(start, end int) Signed {
412
409
return s
413
410
}
414
411
415
- // Reset sets length of the buffer to zero.
416
- func (s {{ .Name }}) Reset() Signed {
417
- return s.Slice(0, 0)
418
- }
419
-
420
412
// Append appends [0:Length] data from src to current buffer and returns new
421
413
// Signed buffer. Both buffers must have same number of channels and bit depth,
422
414
// otherwise function will panic. If current buffer doesn't have enough capacity,
@@ -494,10 +486,11 @@ func WriteStriped{{ .Name }}(src [][]{{ .Builtin }}, dst Signed) Signed {
494
486
}
495
487
`
496
488
497
- unsigned = `// Code generated by go generate; DO NOT EDIT.
489
+ unsigned = `package signal
490
+
491
+ // Code generated by go generate; DO NOT EDIT.
498
492
// This file was generated by robots at
499
493
// {{ .Timestamp }}
500
- package signal
501
494
502
495
import "math"
503
496
@@ -511,7 +504,7 @@ type {{ .Name }} struct {
511
504
// {{ .Name }} allocates a new sequential {{ .Builtin }} signal buffer.
512
505
func (a Allocator) {{ .Name }}(bd BitDepth) Unsigned {
513
506
return {{ .Name }}{
514
- buffer: make([]{{ .Builtin }}, 0 , a.Capacity*a.Channels),
507
+ buffer: make([]{{ .Builtin }}, a.Channels*a.Length , a.Capacity*a.Channels),
515
508
channels: channels(a.Channels),
516
509
bitDepth: limitBitDepth(bd, BitDepth64),
517
510
}
@@ -537,7 +530,7 @@ func (p *Pool) Put{{ .Name }}(s Unsigned) {
537
530
panic("pool put {{ .Builtin }} invalid type")
538
531
}
539
532
mustSameCapacity(s.Capacity(), p.allocator.Capacity)
540
- p.{{ .Pool }}.Put(s.Reset( ))
533
+ p.{{ .Pool }}.Put(s.Slice(0, p.allocator.Length ))
541
534
}
542
535
543
536
func (s {{ .Name }}) setBitDepth(bd BitDepth) Unsigned {
@@ -599,11 +592,6 @@ func (s {{ .Name }}) Slice(start, end int) Unsigned {
599
592
return s
600
593
}
601
594
602
- // Reset sets length of the buffer to zero.
603
- func (s {{ .Name }}) Reset() Unsigned {
604
- return s.Slice(0, 0)
605
- }
606
-
607
595
// Append appends data from src to current buffer and returns new
608
596
// Unsigned buffer. Both buffers must have same number of channels and bit depth,
609
597
// otherwise function will panic. If current buffer doesn't have enough capacity,
@@ -680,10 +668,11 @@ func WriteStriped{{ .Name }}(src [][]{{ .Builtin }}, dst Unsigned) Unsigned {
680
668
return dst
681
669
}`
682
670
683
- fixedTests = `// Code generated by go generate; DO NOT EDIT.
671
+ fixedTests = `package signal_test
672
+
673
+ // Code generated by go generate; DO NOT EDIT.
684
674
// This file was generated by robots at
685
675
// {{ .Timestamp }}
686
- package signal_test
687
676
688
677
import (
689
678
"testing"
@@ -720,10 +709,11 @@ func Test{{ .Name }}(t *testing.T) {
720
709
},
721
710
))
722
711
}`
723
- floatingTests = `// Code generated by go generate; DO NOT EDIT.
712
+ floatingTests = `package signal_test
713
+
714
+ // Code generated by go generate; DO NOT EDIT.
724
715
// This file was generated by robots at
725
716
// {{ .Timestamp }}
726
- package signal_test
727
717
728
718
import (
729
719
"testing"
0 commit comments