mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
Change the Go API to have two versions: Render(buffer []float32), which always fill the whole buffer, and RenderTime(buffer []float32,int maxtime), which ends either when the buffer is full, or modulated time is reached.
This commit is contained in:
@ -30,22 +30,15 @@ func TestBridge(t *testing.T) {
|
||||
}},
|
||||
})
|
||||
s.Trigger(0, 64)
|
||||
s.SamplesPerRow = SAMPLES_PER_ROW * 8 // this song is two blocks of 8 rows, release before second block start
|
||||
buffer := make([]float32, 2*su_max_samples)
|
||||
n, rowend, err := s.Render(buffer)
|
||||
if n < su_max_samples/2 {
|
||||
t.Fatalf("render should have filled half of the buffer on first call, %v samples rendered, %v expected", n, su_max_samples/2)
|
||||
}
|
||||
if rowend != true {
|
||||
t.Fatalf("Row end should have been hit (rowend should have been true) on the first call to Render")
|
||||
err := s.Render(buffer[:len(buffer)/2])
|
||||
if err != nil {
|
||||
t.Fatalf("first render gave an error")
|
||||
}
|
||||
s.Release(0)
|
||||
n, rowend, err = s.Render(buffer[(n * 2):])
|
||||
if n < su_max_samples/2 {
|
||||
t.Fatalf("render should have filled second half of the buffer on the second call, %v samples rendered, %v expected", n, su_max_samples/2)
|
||||
}
|
||||
if rowend != true {
|
||||
t.Fatalf("Row end should have been hit (rowend should have been true) on the second call to Render")
|
||||
err = s.Render(buffer[len(buffer)/2:])
|
||||
if err != nil {
|
||||
t.Fatalf("first render gave an error")
|
||||
}
|
||||
_, filename, _, _ := runtime.Caller(0)
|
||||
expectedb, err := ioutil.ReadFile(path.Join(path.Dir(filename), "..", "tests", "expected_output", "test_render_samples.raw"))
|
||||
|
Reference in New Issue
Block a user