feat!: rewrote the GUI and model for better testability

The Model was getting unmaintanable mess. This is an attempt to refactor/rewrite the Model so that data of certain type is exposed in standardized way, offering certain standard manipulations for that data type, and on the GUI side, certain standard widgets to tied to that data.

This rewrite closes #72, #106 and #120.
This commit is contained in:
5684185+vsariola@users.noreply.github.com
2023-10-24 13:35:43 +03:00
parent 6d3c65e11d
commit d92426a100
53 changed files with 5992 additions and 4507 deletions

View File

@ -40,7 +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}
buffer, err := sointu.Play(bridge.NativeSynther{}, song)
buffer, err := sointu.Play(bridge.NativeSynther{}, song, nil)
if err != nil {
t.Fatalf("Render failed: %v", err)
}
@ -95,7 +95,7 @@ func TestAllRegressionTests(t *testing.T) {
if err != nil {
t.Fatalf("could not parse the .yml file: %v", err)
}
buffer, err := sointu.Play(bridge.NativeSynther{}, song)
buffer, err := sointu.Play(bridge.NativeSynther{}, song, nil)
buffer = buffer[:song.Score.LengthInRows()*song.SamplesPerRow()] // extend to the nominal length always.
if err != nil {
t.Fatalf("Play failed: %v", err)

View File

@ -14,13 +14,8 @@ func flattenSequence(t sointu.Track, songLength int, rowsPerPattern int, release
notes := make([]int, sumLen)
k := 0
for i := 0; i < songLength; i++ {
patIndex := t.Order.Get(i)
var pattern sointu.Pattern = nil
if patIndex >= 0 && patIndex < len(t.Patterns) {
pattern = t.Patterns[patIndex]
}
for j := 0; j < rowsPerPattern; j++ {
note := int(pattern.Get(j))
note := int(t.Note(sointu.SongPos{OrderRow: i, PatternRow: j}))
if releaseFirst && i == 0 && j == 0 && note == 1 {
note = 0
}