refactor(sointu): Change the signature of Play to accept SynthService instead of Synth

This is more logical as every single use of Play started with compiling the patch of a song with a SynthService.
This commit is contained in:
vsariola
2021-08-30 22:22:04 +03:00
parent a9b90c4db8
commit a8f8911f03
5 changed files with 22 additions and 39 deletions

View File

@ -40,11 +40,7 @@ func TestOscillatSine(t *testing.T) {
}}}
tracks := []sointu.Track{{NumVoices: 1, Order: []int{0}, Patterns: []sointu.Pattern{{64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0}}}}
song := sointu.Song{BPM: 100, RowsPerBeat: 4, Score: sointu.Score{RowsPerPattern: 16, Length: 1, Tracks: tracks}, Patch: patch}
synth, err := bridge.Synth(patch)
if err != nil {
t.Fatalf("Compiling patch failed: %v", err)
}
buffer, _, err := sointu.Play(synth, song)
buffer, _, err := sointu.Play(bridge.BridgeService{}, song, false)
if err != nil {
t.Fatalf("Render failed: %v", err)
}
@ -99,11 +95,7 @@ func TestAllRegressionTests(t *testing.T) {
if err != nil {
t.Fatalf("could not parse the .yml file: %v", err)
}
synth, err := bridge.Synth(song.Patch)
if err != nil {
t.Fatalf("Compiling patch failed: %v", err)
}
buffer, _, err := sointu.Play(synth, song)
buffer, _, err := sointu.Play(bridge.BridgeService{}, song, false)
buffer = buffer[:song.Score.LengthInRows()*song.SamplesPerRow()*2] // extend to the nominal length always.
if err != nil {
t.Fatalf("Play failed: %v", err)