mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
feat(sointu, vm): implement pure-Go interpreter for bytecode
The old "native" compiler bridged version is now started with cmd/sointu-nativetrack, while the new pure-Go bytecode implemented bytecode interpreter is started with cmd/sointu-track Thus, you do not need any of the CMake / cgo stuff to run cmd/sointu-track
This commit is contained in:
21
cmd/sointu-nativetrack/main.go
Normal file
21
cmd/sointu-nativetrack/main.go
Normal file
@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/vsariola/sointu/oto"
|
||||
"github.com/vsariola/sointu/tracker/gioui"
|
||||
"github.com/vsariola/sointu/vm/compiler/bridge"
|
||||
)
|
||||
|
||||
func main() {
|
||||
audioContext, err := oto.NewContext()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer audioContext.Close()
|
||||
synthService := bridge.BridgeService{}
|
||||
gioui.Main(audioContext, synthService)
|
||||
}
|
@ -24,6 +24,7 @@ func main() {
|
||||
help := flag.Bool("h", false, "Show help.")
|
||||
directory := flag.String("o", "", "Directory where to output all files. The directory and its parents are created if needed. By default, everything is placed in the same directory where the original song file is.")
|
||||
play := flag.Bool("p", false, "Play the input songs (default behaviour when no other output is defined).")
|
||||
unreleased := flag.Bool("u", false, "Start song with all oscillators unreleased.")
|
||||
//start := flag.Float64("start", 0, "Start playing from part; given in the units defined by parameter `unit`.")
|
||||
//stop := flag.Float64("stop", -1, "Stop playing at part; given in the units defined by parameter `unit`. Negative values indicate render until end.")
|
||||
//units := flag.String("unit", "pattern", "Units for parameters start and stop. Possible values: second, sample, pattern, beat. Warning: beat and pattern do not take SPEED modulations into account.")
|
||||
@ -86,6 +87,11 @@ func main() {
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not create synth based on the patch: %v", err)
|
||||
}
|
||||
if !*unreleased {
|
||||
for i := 0; i < 32; i++ {
|
||||
synth.Release(i)
|
||||
}
|
||||
}
|
||||
buffer, err := sointu.Play(synth, song) // render the song to calculate its length
|
||||
if err != nil {
|
||||
return fmt.Errorf("sointu.Play failed: %v", err)
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/vsariola/sointu/oto"
|
||||
"github.com/vsariola/sointu/tracker/gioui"
|
||||
"github.com/vsariola/sointu/vm/compiler/bridge"
|
||||
"github.com/vsariola/sointu/vm"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -16,6 +16,6 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
defer audioContext.Close()
|
||||
synthService := bridge.BridgeService{}
|
||||
synthService := vm.SynthService{}
|
||||
gioui.Main(audioContext, synthService)
|
||||
}
|
||||
|
Reference in New Issue
Block a user