package bridge import "fmt" import "unsafe" // #cgo CFLAGS: -I${INCLUDE_PATH} // #cgo LDFLAGS: ${LIBRARY_PATH} // #include import "C" type SynthState = C.SynthState func (s *SynthState) Render(buffer []float32) int { fmt.Printf("Calling Render...\n") var ret = C.su_render_samples(s, C.int(len(buffer))/2, (*C.float)(&buffer[0])) fmt.Printf("Returning from Render...\n") return int(ret) } func (s *SynthState) SetCommands(c [2048]byte) { pk := *((*[2048]C.uchar)(unsafe.Pointer(&c))) s.Commands = pk } func (s *SynthState) SetValues(c [16384]byte) { pk := *((*[16384]C.uchar)(unsafe.Pointer(&c))) s.Values = pk } func (s *SynthState) Trigger(voice int,note int) { fmt.Printf("Calling Trigger...\n") s.Synth.Voices[voice] = C.Voice{} s.Synth.Voices[voice].Note = C.int(note) fmt.Printf("Returning from Trigger...\n") } func (s *SynthState) Release(voice int) { fmt.Printf("Calling Release...\n") s.Synth.Voices[voice].Release = 1 fmt.Printf("Returning from Release...\n") } func (s *SynthState) RowEnd() bool { return s.RowTick == s.RowLen } func (s *SynthState) ResetRow() bool { return s.RowTick == 0 } func NewSynthState() *SynthState { s := new(SynthState) s.RandSeed = 1 return s }