draft multicore processing

This commit is contained in:
5684185+vsariola@users.noreply.github.com
2025-10-21 20:07:06 +03:00
parent c583156d1b
commit 7f03664870
13 changed files with 302 additions and 25 deletions

View File

@ -18,7 +18,8 @@ type NativeSynther struct {
type NativeSynth C.Synth
func (s NativeSynther) Name() string { return "Native" }
func (s NativeSynther) Name() string { return "Native" }
func (s NativeSynther) SupportsParallelism() bool { return false }
func (s NativeSynther) Synth(patch sointu.Patch, bpm int) (sointu.Synth, error) {
synth, err := Synth(patch, bpm)
@ -67,6 +68,8 @@ func Synth(patch sointu.Patch, bpm int) (*NativeSynth, error) {
return (*NativeSynth)(s), nil
}
func (s *NativeSynth) Close() {}
// Render renders until the buffer is full or the modulated time is reached, whichever
// happens first.
// Parameters:

View File

@ -86,6 +86,7 @@ func TestRenderSamples(t *testing.T) {
if err != nil {
t.Fatalf("bridge compile error: %v", err)
}
defer synth.Close()
synth.Trigger(0, 64)
buffer := make(sointu.AudioBuffer, su_max_samples)
err = buffer[:len(buffer)/2].Fill(synth)
@ -162,6 +163,7 @@ func TestStackUnderflow(t *testing.T) {
if err != nil {
t.Fatalf("bridge compile error: %v", err)
}
defer synth.Close()
buffer := make(sointu.AudioBuffer, 1)
err = buffer.Fill(synth)
if err == nil {
@ -178,6 +180,7 @@ func TestStackBalancing(t *testing.T) {
if err != nil {
t.Fatalf("bridge compile error: %v", err)
}
defer synth.Close()
buffer := make(sointu.AudioBuffer, 1)
err = buffer.Fill(synth)
if err == nil {
@ -211,6 +214,7 @@ func TestStackOverflow(t *testing.T) {
if err != nil {
t.Fatalf("bridge compile error: %v", err)
}
defer synth.Close()
buffer := make(sointu.AudioBuffer, 1)
err = buffer.Fill(synth)
if err == nil {
@ -228,6 +232,7 @@ func TestDivideByZero(t *testing.T) {
if err != nil {
t.Fatalf("bridge compile error: %v", err)
}
defer synth.Close()
buffer := make(sointu.AudioBuffer, 1)
err = buffer.Fill(synth)
if err == nil {