mirror of
https://github.com/vsariola/sointu.git
synced 2025-05-28 03:10:24 -04:00
The working principle is similar as before with x86, but instead of outputting .asm, it outputs .wat. This can be compiled into .wasm by using the wat2wasm assembler.
29 lines
519 B
Go
29 lines
519 B
Go
package compiler
|
|
|
|
import (
|
|
"github.com/vsariola/sointu"
|
|
)
|
|
|
|
type CompilerMacros struct {
|
|
Clip bool
|
|
Library bool
|
|
|
|
Sine int // TODO: how can we elegantly access global constants in template, without wrapping each one by one
|
|
Trisaw int
|
|
Pulse int
|
|
Gate int
|
|
Sample int
|
|
Compiler
|
|
}
|
|
|
|
func NewCompilerMacros(c Compiler) *CompilerMacros {
|
|
return &CompilerMacros{
|
|
Sine: sointu.Sine,
|
|
Trisaw: sointu.Trisaw,
|
|
Pulse: sointu.Pulse,
|
|
Gate: sointu.Gate,
|
|
Sample: sointu.Sample,
|
|
Compiler: c,
|
|
}
|
|
}
|