From 9f7bbce7614f34f80a274424d733511b9a846117 Mon Sep 17 00:00:00 2001 From: "5684185+vsariola@users.noreply.github.com" <5684185+vsariola@users.noreply.github.com> Date: Thu, 19 Oct 2023 10:32:34 +0300 Subject: [PATCH] refactor(vm): rename Encode to NewBytecode --- vm/bytecode.go | 2 +- vm/compiler/bridge/native_synth.go | 4 ++-- vm/compiler/compiler.go | 2 +- vm/go_synth.go | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vm/bytecode.go b/vm/bytecode.go index 8c36c87..32c08a5 100644 --- a/vm/bytecode.go +++ b/vm/bytecode.go @@ -68,7 +68,7 @@ type bytecodeBuilder struct { Bytecode } -func Encode(patch sointu.Patch, featureSet FeatureSet, bpm int) (*Bytecode, error) { +func NewBytecode(patch sointu.Patch, featureSet FeatureSet, bpm int) (*Bytecode, error) { if patch.NumVoices() > 32 { return nil, fmt.Errorf("Sointu does not support more than 32 concurrent voices; patch uses %v", patch.NumVoices()) } diff --git a/vm/compiler/bridge/native_synth.go b/vm/compiler/bridge/native_synth.go index 8f37d70..ac13a39 100644 --- a/vm/compiler/bridge/native_synth.go +++ b/vm/compiler/bridge/native_synth.go @@ -28,7 +28,7 @@ func Synth(patch sointu.Patch, bpm int) (*NativeSynth, error) { if n := patch.NumDelayLines(); n > 64 { return nil, fmt.Errorf("native bridge has currently a hard limit of 64 delaylines; patch uses %v", n) } - comPatch, err := vm.Encode(patch, vm.AllFeatures{}, bpm) + comPatch, err := vm.NewBytecode(patch, vm.AllFeatures{}, bpm) if err != nil { return nil, fmt.Errorf("error compiling patch: %v", err) } @@ -120,7 +120,7 @@ func (bridgesynth *NativeSynth) Update(patch sointu.Patch, bpm int) error { if n := patch.NumDelayLines(); n > 64 { return fmt.Errorf("native bridge has currently a hard limit of 64 delaylines; patch uses %v", n) } - comPatch, err := vm.Encode(patch, vm.AllFeatures{}, bpm) + comPatch, err := vm.NewBytecode(patch, vm.AllFeatures{}, bpm) if err != nil { return fmt.Errorf("error compiling patch: %v", err) } diff --git a/vm/compiler/compiler.go b/vm/compiler/compiler.go index ec21e7c..8269a39 100644 --- a/vm/compiler/compiler.go +++ b/vm/compiler/compiler.go @@ -87,7 +87,7 @@ func (com *Compiler) Song(song *sointu.Song) (map[string]string, error) { } features := vm.NecessaryFeaturesFor(song.Patch) retmap := map[string]string{} - encodedPatch, err := vm.Encode(song.Patch, features, song.BPM) + encodedPatch, err := vm.NewBytecode(song.Patch, features, song.BPM) if err != nil { return nil, fmt.Errorf(`could not encode patch: %v`, err) } diff --git a/vm/go_synth.go b/vm/go_synth.go index 0014122..1757d40 100644 --- a/vm/go_synth.go +++ b/vm/go_synth.go @@ -88,7 +88,7 @@ success: } func Synth(patch sointu.Patch, bpm int) (sointu.Synth, error) { - bytecode, err := Encode(patch, AllFeatures{}, bpm) + bytecode, err := NewBytecode(patch, AllFeatures{}, bpm) if err != nil { return nil, fmt.Errorf("error compiling %v", err) } @@ -113,7 +113,7 @@ func (s *GoSynth) Release(voiceIndex int) { } func (s *GoSynth) Update(patch sointu.Patch, bpm int) error { - bytecode, err := Encode(patch, AllFeatures{}, bpm) + bytecode, err := NewBytecode(patch, AllFeatures{}, bpm) if err != nil { return fmt.Errorf("error compiling %v", err) }