From e0a793ea6d2b83f0705fd3acadcf1f407922ca30 Mon Sep 17 00:00:00 2001 From: Veikko Sariola Date: Fri, 30 Oct 2020 22:05:26 +0200 Subject: [PATCH] Reorganize the project folder structure and how go packages are organized. Sointu.asm / lib stuff lives at the root folder. There is a folder called "go4k", which is where all go stuff lives. Following the ideas from https://medium.com/@benbjohnson/standard-package-layout-7cdbc8391fc1 the go4k folder is the "domain-model" of the go side, and should have no dependencies. It contains Unit, Instrument, Synth interface etc. Putting go4k under a sub-folder is actually in the spirit of Ben, as go4k adds dependency to the go language. Bridge ties the domain-model to the sointulib through cgo. It returns C.Synth, but makes sure the C.Synth implements the Synth interface, so others are able to use the Synth no matter how it actually is done. MockSynth and WebProxy synth are good prospects for other implementations of Synth. It is a bit fuzzy where methods like "Play" that have no dependencies other than domain model structs should go. They probably should live in the go4k package as well. The file-organization on the Go-side is not at all finalized. But how packages are broken into files is mostly a documentation issue; it does not affect the users of the packages at all. BTW: The name go4k was chosen because Ben advocated naming the subpackages according to the dependency they introduce AND because the prototype of 4klang was called go4k (there are still some defines in the 4klang source revealing this). go4k thus honors our roots but is also not so bad name: it's the main package of a 4k synth tracker, written in go. --- CMakeLists.txt | 13 +- bridge/bridge.go | 191 ------------------ go4k/bridge/bridge.go | 148 ++++++++++++++ {bridge => go4k/bridge}/bridge_test.go | 26 +-- go4k/go4k.go | 49 +++++ {song => go4k}/song.go | 119 +++++------ {song => go4k}/song_test.go | 40 ++-- .../sointu}/introspection_footer.inc | 0 .../sointu}/opcodes/arithmetic_footer.inc | 0 .../sointu}/opcodes/arithmetic_header.inc | 0 .../sointu}/opcodes/effects_footer.inc | 0 .../sointu}/opcodes/effects_header.inc | 0 .../sointu}/opcodes/flowcontrol_footer.inc | 0 .../sointu}/opcodes/flowcontrol_header.inc | 0 .../sointu}/opcodes/sinks_footer.inc | 0 .../sointu}/opcodes/sinks_header.inc | 0 .../sointu}/opcodes/sources_footer.inc | 0 .../sointu}/opcodes/sources_header.inc | 0 include/{ => sointu}/sointu.h | 32 +-- {src => include/sointu}/sointu_footer.inc | 0 {src => include/sointu}/sointu_header.inc | 0 .../sointu}/win32/gmdls_win32_footer.inc | 0 .../sointu}/win64/gmdls_win64_footer.inc | 0 src/sointu.asm => render.asm | 115 +++-------- src/CMakeLists.txt | 12 -- tests/CMakeLists.txt | 5 +- tests/test_add.asm | 4 +- tests/test_add_stereo.asm | 4 +- tests/test_addp.asm | 4 +- tests/test_addp_stereo.asm | 4 +- tests/test_aux.asm | 4 +- tests/test_aux_stereo.asm | 4 +- tests/test_chords.asm | 4 +- tests/test_clip.asm | 4 +- tests/test_clip_stereo.asm | 4 +- tests/test_compressor.asm | 4 +- tests/test_compressor_stereo.asm | 4 +- tests/test_crush.asm | 4 +- tests/test_crush_stereo.asm | 4 +- tests/test_delay.asm | 4 +- tests/test_delay_dampmod.asm | 4 +- tests/test_delay_drymod.asm | 4 +- tests/test_delay_feedbackmod.asm | 4 +- tests/test_delay_flanger.asm | 4 +- tests/test_delay_notetracking.asm | 4 +- tests/test_delay_pregainmod.asm | 4 +- tests/test_delay_reverb.asm | 4 +- tests/test_delay_stereo.asm | 4 +- tests/test_distort.asm | 4 +- tests/test_distort_mod.asm | 4 +- tests/test_distort_stereo.asm | 4 +- tests/test_envelope.asm | 4 +- tests/test_envelope_mod.asm | 4 +- tests/test_envelope_stereo.asm | 4 +- tests/test_filter_band.asm | 4 +- tests/test_filter_freqmod.asm | 4 +- tests/test_filter_high.asm | 4 +- tests/test_filter_low.asm | 4 +- tests/test_filter_peak.asm | 4 +- tests/test_filter_resmod.asm | 4 +- tests/test_filter_stereo.asm | 4 +- tests/test_gain.asm | 4 +- tests/test_gain_stereo.asm | 4 +- tests/test_hold.asm | 4 +- tests/test_hold_mod.asm | 4 +- tests/test_hold_stereo.asm | 4 +- tests/test_in.asm | 4 +- tests/test_in_stereo.asm | 4 +- tests/test_invgain.asm | 4 +- tests/test_invgain_stereo.asm | 4 +- tests/test_loadnote.asm | 4 +- tests/test_loadnote_stereo.asm | 4 +- tests/test_loadval.asm | 4 +- tests/test_loadval_stereo.asm | 4 +- tests/test_mul.asm | 4 +- tests/test_mul_stereo.asm | 4 +- tests/test_mulp.asm | 4 +- tests/test_mulp_stereo.asm | 4 +- tests/test_multiple_instruments.asm | 4 +- tests/test_noise.asm | 4 +- tests/test_noise_stereo.asm | 4 +- tests/test_oscillat_colormod.asm | 4 +- tests/test_oscillat_detunemod.asm | 4 +- tests/test_oscillat_gainmod.asm | 4 +- tests/test_oscillat_gate.asm | 4 +- tests/test_oscillat_lfo.asm | 4 +- tests/test_oscillat_phasemod.asm | 4 +- tests/test_oscillat_pulse.asm | 4 +- tests/test_oscillat_sample.asm | 4 +- tests/test_oscillat_sample_stereo.asm | 4 +- tests/test_oscillat_shapemod.asm | 4 +- tests/test_oscillat_sine.asm | 4 +- tests/test_oscillat_stereo.asm | 4 +- tests/test_oscillat_transposemod.asm | 4 +- tests/test_oscillat_trisaw.asm | 4 +- tests/test_oscillat_unison.asm | 4 +- tests/test_oscillat_unison_stereo.asm | 4 +- tests/test_outaux.asm | 4 +- tests/test_outaux_stereo.asm | 4 +- tests/test_panning.asm | 4 +- tests/test_panning_stereo.asm | 4 +- tests/test_polyphony.asm | 4 +- tests/test_pop.asm | 4 +- tests/test_pop_stereo.asm | 4 +- tests/test_push.asm | 4 +- tests/test_push_stereo.asm | 4 +- tests/test_receive.asm | 4 +- tests/test_receive_stereo.asm | 4 +- tests/test_render_samples.c | 26 +-- tests/test_render_samples_api.c | 37 ++-- tests/test_send.asm | 4 +- tests/test_send_global.asm | 4 +- tests/test_send_stereo.asm | 4 +- tests/test_speed.asm | 4 +- tests/test_xch.asm | 4 +- tests/test_xch_stereo.asm | 4 +- 116 files changed, 530 insertions(+), 635 deletions(-) delete mode 100644 bridge/bridge.go create mode 100644 go4k/bridge/bridge.go rename {bridge => go4k/bridge}/bridge_test.go (64%) create mode 100644 go4k/go4k.go rename {song => go4k}/song.go (55%) rename {song => go4k}/song_test.go (52%) rename {src => include/sointu}/introspection_footer.inc (100%) rename {src => include/sointu}/opcodes/arithmetic_footer.inc (100%) rename {src => include/sointu}/opcodes/arithmetic_header.inc (100%) rename {src => include/sointu}/opcodes/effects_footer.inc (100%) rename {src => include/sointu}/opcodes/effects_header.inc (100%) rename {src => include/sointu}/opcodes/flowcontrol_footer.inc (100%) rename {src => include/sointu}/opcodes/flowcontrol_header.inc (100%) rename {src => include/sointu}/opcodes/sinks_footer.inc (100%) rename {src => include/sointu}/opcodes/sinks_header.inc (100%) rename {src => include/sointu}/opcodes/sources_footer.inc (100%) rename {src => include/sointu}/opcodes/sources_header.inc (100%) rename include/{ => sointu}/sointu.h (71%) rename {src => include/sointu}/sointu_footer.inc (100%) rename {src => include/sointu}/sointu_header.inc (100%) rename {src => include/sointu}/win32/gmdls_win32_footer.inc (100%) rename {src => include/sointu}/win64/gmdls_win64_footer.inc (100%) rename src/sointu.asm => render.asm (50%) delete mode 100644 src/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 3650cf9..70d348e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,8 +30,17 @@ enable_language(ASM_NASM) # By putting them there, we can pass the same compile definitions to C and ASM set(CMAKE_ASM_NASM_COMPILE_OBJECT " -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o ") -# The compiled VSTi is here -add_subdirectory(src) +# Sointu as a header-only library +set(HEADERLIB sointuinterface) +add_library(${HEADERLIB} INTERFACE) +target_include_directories(${HEADERLIB} INTERFACE ${PROJECT_SOURCE_DIR}/include/sointu) + +# Sointu as static library +set(STATICLIB sointu) +add_library(${STATICLIB} render.asm) +set_target_properties(${STATICLIB} PROPERTIES LINKER_LANGUAGE C) +target_link_libraries(${STATICLIB} ${HEADERLIB}) +target_compile_definitions(${STATICLIB} PUBLIC SU_USE_INTROSPECTION) # We should put examples here # add_subdirectory(examples) diff --git a/bridge/bridge.go b/bridge/bridge.go deleted file mode 100644 index a767999..0000000 --- a/bridge/bridge.go +++ /dev/null @@ -1,191 +0,0 @@ -package bridge - -import ( - "errors" -) - -// #cgo CFLAGS: -I"${SRCDIR}/../include" -// #cgo LDFLAGS: "${SRCDIR}/../build/src/libsointu.a" -// #include -import "C" - -// SynthState contains the entire state of sointu sound engine -type Synth C.Synth // hide C.Synth, explicit cast is still possible if needed - -type SynthState C.SynthState // hide C.Synthstate, explicit cast is still possible if needed - -// Opcode is a single byte, representing the virtual machine commands used in Sointu -type Opcode byte - -// Unit includes command (filter, oscillator, envelope etc.) and its parameters -type Unit struct { - Command Opcode - Params []byte -} - -// Instrument includes a list of units consisting of the instrument, and the number of polyphonic voices for this instrument -type Instrument struct { - NumVoices int - Units []Unit -} - -type Patch []Instrument - -func (p Patch) TotalVoices() int { - ret := 0 - for _, i := range p { - ret += i.NumVoices - } - return ret -} - -var ( // cannot be const as the rhs are not known at compile-time - Add = Opcode(C.su_add_id) - Addp = Opcode(C.su_addp_id) - Pop = Opcode(C.su_pop_id) - Loadnote = Opcode(C.su_loadnote_id) - Mul = Opcode(C.su_mul_id) - Mulp = Opcode(C.su_mulp_id) - Push = Opcode(C.su_push_id) - Xch = Opcode(C.su_xch_id) - Distort = Opcode(C.su_distort_id) - Hold = Opcode(C.su_hold_id) - Crush = Opcode(C.su_crush_id) - Gain = Opcode(C.su_gain_id) - Invgain = Opcode(C.su_invgain_id) - Filter = Opcode(C.su_filter_id) - Clip = Opcode(C.su_clip_id) - Pan = Opcode(C.su_pan_id) - Delay = Opcode(C.su_delay_id) - Compres = Opcode(C.su_compres_id) - Advance = Opcode(C.su_advance_id) - Speed = Opcode(C.su_speed_id) - Out = Opcode(C.su_out_id) - Outaux = Opcode(C.su_outaux_id) - Aux = Opcode(C.su_aux_id) - Send = Opcode(C.su_send_id) - Envelope = Opcode(C.su_envelope_id) - Noise = Opcode(C.su_noise_id) - Oscillat = Opcode(C.su_oscillat_id) - Loadval = Opcode(C.su_loadval_id) - Receive = Opcode(C.su_receive_id) - In = Opcode(C.su_in_id) -) - -// Stereo returns the stereo version of any (mono or stereo) opcode -func (o Opcode) Stereo() Opcode { - return Opcode(byte(o) | 1) // set lowest bit -} - -// Mono returns the mono version of any (mono or stereo) opcode -func (o Opcode) Mono() Opcode { - return Opcode(byte(o) & 0xFE) // clear lowest bit -} - -// Render tries to fill the buffer with samples rendered by Sointu. -// Use this version if you are not interested in time modulation. Will always -// fill the buffer. -// Parameters: -// buffer float32 slice to fill with rendered samples. Stereo signal, so -// should have even length. -// Returns an error if something went wrong. -func (synth *Synth) Render(state *SynthState, buffer []float32) error { - if len(buffer)%1 == 1 { - return errors.New("Render writes stereo signals, so buffer should have even length") - } - maxSamples := len(buffer) / 2 - state.RandSeed += 1 // if you initialize with empty struct, you will get randseed 1 which is sointu default behavior - errcode := C.su_render((*C.Synth)(synth), (*C.SynthState)(state), (*C.float)(&buffer[0]), C.int(maxSamples)) - state.RandSeed -= 1 - if errcode > 0 { - return errors.New("Render failed") - } - return nil -} - -// RenderTime renders until the buffer is full or the modulated time is reached, whichever -// happens first. -// Parameters: -// buffer float32 slice to fill with rendered samples. Stereo signal, so -// should have even length. -// maxtime how long nominal time to render in samples. Speed unit might modulate time -// so the actual number of samples rendered depends on the modulation and if -// buffer is full before maxtime is reached. -// Returns a tuple (int, int, error), consisting of: -// samples number of samples rendered in the buffer -// time how much the time advanced -// error potential error -// In practice, if nsamples = len(buffer)/2, then time <= maxtime. If maxtime was reached -// first, then nsamples <= len(buffer)/2 and time >= maxtime. Note that it could happen that -// time > maxtime, as it is modulated and the time could advance by 2 or more, so the loop -// exit condition would fire when the time is already past maxtime. -// Under no conditions, nsamples >= len(buffer)/2 i.e. guaranteed to never overwrite the buffer. -func (synth *Synth) RenderTime(state *SynthState, buffer []float32, maxtime int) (int, int, error) { - if len(buffer)%1 == 1 { - return -1, -1, errors.New("RenderTime writes stereo signals, so buffer should have even length") - } - samples := C.int(len(buffer) / 2) - time := C.int(maxtime) - state.RandSeed += 1 // if you initialize with empty struct, you will get randseed 1 which is sointu default behavior - errcode := int(C.su_render_time((*C.Synth)(synth), (*C.SynthState)(state), (*C.float)(&buffer[0]), &samples, &time)) - state.RandSeed -= 1 - if errcode > 0 { - return -1, -1, errors.New("RenderTime failed") - } - return int(samples), int(time), nil -} - -func Compile(patch Patch) (*Synth, error) { - totalVoices := 0 - commands := make([]Opcode, 0) - values := make([]byte, 0) - polyphonyBitmask := 0 - for _, instr := range patch { - if len(instr.Units) > 63 { - return nil, errors.New("An instrument can have a maximum of 63 units") - } - if instr.NumVoices < 1 { - return nil, errors.New("Each instrument must have at least 1 voice") - } - for _, unit := range instr.Units { - commands = append(commands, unit.Command) - values = append(values, unit.Params...) - } - commands = append(commands, Advance) - totalVoices += instr.NumVoices - for k := 0; k < instr.NumVoices-1; k++ { - polyphonyBitmask = (polyphonyBitmask << 1) + 1 - } - polyphonyBitmask <<= 1 - } - if totalVoices > 32 { - return nil, errors.New("Sointu does not support more than 32 concurrent voices") - } - if len(commands) > 2048 { // TODO: 2048 could probably be pulled automatically from cgo - return nil, errors.New("The patch would result in more than 2048 commands") - } - if len(values) > 16384 { // TODO: 16384 could probably be pulled automatically from cgo - return nil, errors.New("The patch would result in more than 16384 values") - } - s := new(Synth) - for i := range commands { - s.Commands[i] = (C.uchar)(commands[i]) - } - for i := range values { - s.Values[i] = (C.uchar)(values[i]) - } - s.NumVoices = C.uint(totalVoices) - s.Polyphony = C.uint(polyphonyBitmask) - return s, nil -} - -func (s *SynthState) Trigger(voice int, note byte) { - cs := (*C.SynthState)(s) - cs.SynthWrk.Voices[voice] = C.Voice{} - cs.SynthWrk.Voices[voice].Note = C.int(note) -} - -func (s *SynthState) Release(voice int) { - cs := (*C.SynthState)(s) - cs.SynthWrk.Voices[voice].Release = 1 -} diff --git a/go4k/bridge/bridge.go b/go4k/bridge/bridge.go new file mode 100644 index 0000000..8567e59 --- /dev/null +++ b/go4k/bridge/bridge.go @@ -0,0 +1,148 @@ +package bridge + +import ( + "errors" + "fmt" + + "github.com/vsariola/sointu/go4k" +) + +// #cgo CFLAGS: -I"${SRCDIR}/../../include/sointu" +// #cgo LDFLAGS: "${SRCDIR}/../../build/libsointu.a" +// #include +import "C" + +type opTableEntry struct { + opcode C.int + parameterList []string +} + +var opcodeTable = map[string]opTableEntry{ + "add": opTableEntry{C.su_add_id, []string{}}, + "addp": opTableEntry{C.su_addp_id, []string{}}, + "pop": opTableEntry{C.su_pop_id, []string{}}, + "loadnote": opTableEntry{C.su_loadnote_id, []string{}}, + "mul": opTableEntry{C.su_mul_id, []string{}}, + "mulp": opTableEntry{C.su_mulp_id, []string{}}, + "push": opTableEntry{C.su_push_id, []string{}}, + "xch": opTableEntry{C.su_xch_id, []string{}}, + "distortion": opTableEntry{C.su_distort_id, []string{"drive"}}, + "hold": opTableEntry{C.su_hold_id, []string{"holdfreq"}}, + "crush": opTableEntry{C.su_crush_id, []string{"resolution"}}, + "gain": opTableEntry{C.su_gain_id, []string{"gain"}}, + "invgain": opTableEntry{C.su_invgain_id, []string{"invgain"}}, + "filter": opTableEntry{C.su_filter_id, []string{"frequency", "resonance", "flags"}}, + "clip": opTableEntry{C.su_clip_id, []string{}}, + "pan": opTableEntry{C.su_pan_id, []string{"panning"}}, + "delay": opTableEntry{C.su_delay_id, []string{"pregain", "dry", "feedback", "depth", "damp", "delay", "count"}}, + "compressor": opTableEntry{C.su_compres_id, []string{"attack", "release", "invgain", "threshold", "ratio"}}, + "speed": opTableEntry{C.su_speed_id, []string{}}, + "out": opTableEntry{C.su_out_id, []string{"gain"}}, + "outaux": opTableEntry{C.su_outaux_id, []string{"outgain", "auxgain"}}, + "aux": opTableEntry{C.su_aux_id, []string{"gain", "channel"}}, + "send": opTableEntry{C.su_send_id, []string{"amount", "port"}}, + "envelope": opTableEntry{C.su_envelope_id, []string{"attack", "decay", "sustain", "release", "gain"}}, + "noise": opTableEntry{C.su_noise_id, []string{"shape", "gain"}}, + "oscillator": opTableEntry{C.su_oscillat_id, []string{"transpose", "detune", "phase", "color", "shape", "gain", "flags"}}, + "loadval": opTableEntry{C.su_loadval_id, []string{"value"}}, + "receive": opTableEntry{C.su_receive_id, []string{}}, + "in": opTableEntry{C.su_in_id, []string{"channel"}}, +} + +// Render renders until the buffer is full or the modulated time is reached, whichever +// happens first. +// Parameters: +// buffer float32 slice to fill with rendered samples. Stereo signal, so +// should have even length. +// maxtime how long nominal time to render in samples. Speed unit might modulate time +// so the actual number of samples rendered depends on the modulation and if +// buffer is full before maxtime is reached. +// Returns a tuple (int, int, error), consisting of: +// samples number of samples rendered in the buffer +// time how much the time advanced +// error potential error +// In practice, if nsamples = len(buffer)/2, then time <= maxtime. If maxtime was reached +// first, then nsamples <= len(buffer)/2 and time >= maxtime. Note that it could happen that +// time > maxtime, as it is modulated and the time could advance by 2 or more, so the loop +// exit condition would fire when the time is already past maxtime. +// Under no conditions, nsamples >= len(buffer)/2 i.e. guaranteed to never overwrite the buffer. +func (synth *C.Synth) Render(buffer []float32, maxtime int) (int, int, error) { + if len(buffer)%1 == 1 { + return -1, -1, errors.New("RenderTime writes stereo signals, so buffer should have even length") + } + samples := C.int(len(buffer) / 2) + time := C.int(maxtime) + errcode := int(C.su_render(synth, (*C.float)(&buffer[0]), &samples, &time)) + if errcode > 0 { + return -1, -1, errors.New("RenderTime failed") + } + return int(samples), int(time), nil +} + +func Synth(patch go4k.Patch) (*C.Synth, error) { + totalVoices := 0 + commands := make([]byte, 0) + values := make([]byte, 0) + polyphonyBitmask := 0 + for insid, instr := range patch { + if len(instr.Units) > 63 { + return nil, errors.New("An instrument can have a maximum of 63 units") + } + if instr.NumVoices < 1 { + return nil, errors.New("Each instrument must have at least 1 voice") + } + for unitid, unit := range instr.Units { + if val, ok := opcodeTable[unit.Type]; ok { + if unit.Stereo { + commands = append(commands, byte(val.opcode+1)) + } else { + commands = append(commands, byte(val.opcode)) + } + for _, paramname := range val.parameterList { + if pval, ok := unit.Parameters[paramname]; ok { + values = append(values, byte(pval)) + } else { + return nil, fmt.Errorf("Unit parameter undefined: %v (at instrument %v, unit %v)", paramname, insid, unitid) + } + } + } else { + return nil, fmt.Errorf("Unknown unit type: %v (at instrument %v, unit %v)", unit.Type, insid, unitid) + } + } + commands = append(commands, byte(C.su_advance_id)) + totalVoices += instr.NumVoices + for k := 0; k < instr.NumVoices-1; k++ { + polyphonyBitmask = (polyphonyBitmask << 1) + 1 + } + polyphonyBitmask <<= 1 + } + if totalVoices > 32 { + return nil, errors.New("Sointu does not support more than 32 concurrent voices") + } + if len(commands) > 2048 { // TODO: 2048 could probably be pulled automatically from cgo + return nil, errors.New("The patch would result in more than 2048 commands") + } + if len(values) > 16384 { // TODO: 16384 could probably be pulled automatically from cgo + return nil, errors.New("The patch would result in more than 16384 values") + } + s := new(C.Synth) + for i := range commands { + s.Commands[i] = (C.uchar)(commands[i]) + } + for i := range values { + s.Values[i] = (C.uchar)(values[i]) + } + s.NumVoices = C.uint(totalVoices) + s.Polyphony = C.uint(polyphonyBitmask) + s.RandSeed = 1 + return s, nil +} + +func (s *C.Synth) Trigger(voice int, note byte) { + s.SynthWrk.Voices[voice] = C.Voice{} + s.SynthWrk.Voices[voice].Note = C.int(note) +} + +func (s *C.Synth) Release(voice int) { + s.SynthWrk.Voices[voice].Release = 1 +} diff --git a/bridge/bridge_test.go b/go4k/bridge/bridge_test.go similarity index 64% rename from bridge/bridge_test.go rename to go4k/bridge/bridge_test.go index e3ff3d2..c5a8618 100644 --- a/bridge/bridge_test.go +++ b/go4k/bridge/bridge_test.go @@ -8,7 +8,8 @@ import ( "runtime" "testing" - "github.com/vsariola/sointu/bridge" + "github.com/vsariola/sointu/go4k" + "github.com/vsariola/sointu/go4k/bridge" ) const BPM = 100 @@ -21,30 +22,29 @@ const su_max_samples = SAMPLES_PER_ROW * TOTAL_ROWS // const bufsize = su_max_samples * 2 func TestBridge(t *testing.T) { - patch := []bridge.Instrument{ - bridge.Instrument{1, []bridge.Unit{ - bridge.Unit{bridge.Envelope, []byte{64, 64, 64, 80, 128}}, - bridge.Unit{bridge.Envelope, []byte{95, 64, 64, 80, 128}}, - bridge.Unit{bridge.Out.Stereo(), []byte{128}}, + patch := []go4k.Instrument{ + go4k.Instrument{1, []go4k.Unit{ + go4k.Unit{"envelope", false, map[string]int{"attack": 64, "decay": 64, "sustain": 64, "release": 80, "gain": 128}}, + go4k.Unit{"envelope", false, map[string]int{"attack": 95, "decay": 64, "sustain": 64, "release": 80, "gain": 128}}, + go4k.Unit{"out", true, map[string]int{"gain": 128}}, }}} - synth, err := bridge.Compile(patch) + synth, err := bridge.Synth(patch) if err != nil { t.Fatalf("bridge compile error: %v", err) } - var state bridge.SynthState - state.Trigger(0, 64) + synth.Trigger(0, 64) buffer := make([]float32, 2*su_max_samples) - err = synth.Render(&state, buffer[:len(buffer)/2]) + err = go4k.Render(synth, buffer[:len(buffer)/2]) if err != nil { t.Fatalf("first render gave an error") } - state.Release(0) - err = synth.Render(&state, buffer[len(buffer)/2:]) + synth.Release(0) + err = go4k.Render(synth, buffer[len(buffer)/2:]) if err != nil { t.Fatalf("first render gave an error") } _, filename, _, _ := runtime.Caller(0) - expectedb, err := ioutil.ReadFile(path.Join(path.Dir(filename), "..", "tests", "expected_output", "test_render_samples.raw")) + expectedb, err := ioutil.ReadFile(path.Join(path.Dir(filename), "..", "..", "tests", "expected_output", "test_render_samples.raw")) if err != nil { t.Fatalf("cannot read expected: %v", err) } diff --git a/go4k/go4k.go b/go4k/go4k.go new file mode 100644 index 0000000..fbe53a9 --- /dev/null +++ b/go4k/go4k.go @@ -0,0 +1,49 @@ +package go4k + +import ( + "errors" + "math" +) + +// Unit is e.g. a filter, oscillator, envelope and its parameters +type Unit struct { + Type string + Stereo bool + Parameters map[string]int +} + +// Instrument includes a list of units consisting of the instrument, and the number of polyphonic voices for this instrument +type Instrument struct { + NumVoices int + Units []Unit +} + +// Patch is simply a list of instruments used in a song +type Patch []Instrument + +func (p Patch) TotalVoices() int { + ret := 0 + for _, i := range p { + ret += i.NumVoices + } + return ret +} + +type Track struct { + NumVoices int + Sequence []byte +} + +type Synth interface { + Render(buffer []float32, maxtime int) (int, int, error) + Trigger(voice int, note byte) + Release(voice int) +} + +func Render(synth Synth, buffer []float32) error { + s, _, err := synth.Render(buffer, math.MaxInt32) + if s != len(buffer)/2 { + return errors.New("synth.Render should have filled the whole buffer") + } + return err +} diff --git a/song/song.go b/go4k/song.go similarity index 55% rename from song/song.go rename to go4k/song.go index b24cc9d..82e6dda 100644 --- a/song/song.go +++ b/go4k/song.go @@ -1,38 +1,41 @@ -package song +package go4k -import ( - "errors" - - "github.com/vsariola/sointu/bridge" -) - -type Track struct { - NumVoices int - Sequence []byte -} +import "errors" type Song struct { - BPM int - Patterns [][]byte - Tracks []Track - Patch bridge.Patch - Samples int // -1 means calculate automatically, but you can also set it manually + BPM int + Patterns [][]byte + Tracks []Track + SongLength int // in samples, 0 means calculate automatically from BPM and Track lengths, but can also set manually + Patch Patch } -func NewSong(bpm int, patterns [][]byte, tracks []Track, patch bridge.Patch) (*Song, error) { - s := new(Song) - s.BPM = bpm - s.Patterns = patterns - s.Tracks = tracks - s.Patch = patch - err := s.Validate() - if err != nil { - return nil, err +func (s *Song) PatternRows() int { + return len(s.Patterns[0]) +} + +func (s *Song) SequenceLength() int { + return len(s.Tracks[0].Sequence) +} + +func (s *Song) TotalRows() int { + return s.PatternRows() * s.SequenceLength() +} + +func (s *Song) SamplesPerRow() int { + return 44100 * 60 / (s.BPM * 4) +} + +func (s *Song) FirstTrackVoice(track int) int { + ret := 0 + for _, t := range s.Tracks[:track] { + ret += t.NumVoices } - s.Samples = -1 - return s, nil + return ret } +// TBD: Where shall we put methods that work on pure domain types and have no dependencies +// e.g. Validate here func (s *Song) Validate() error { if s.BPM < 1 { return errors.New("BPM should be > 0") @@ -62,66 +65,42 @@ func (s *Song) Validate() error { return nil } -func (s *Song) PatternRows() int { - return len(s.Patterns[0]) -} - -func (s *Song) SequenceLength() int { - return len(s.Tracks[0].Sequence) -} - -func (s *Song) TotalRows() int { - return s.PatternRows() * s.SequenceLength() -} - -func (s *Song) SamplesPerRow() int { - return 44100 * 60 / (s.BPM * 4) -} - -func (s *Song) FirstTrackVoice(track int) int { - ret := 0 - for _, t := range s.Tracks[:track] { - ret += t.NumVoices - } - return ret -} - -func (s *Song) Render(synth *bridge.Synth, state *bridge.SynthState) ([]float32, error) { - err := s.Validate() +func Play(synth Synth, song Song) ([]float32, error) { + err := song.Validate() if err != nil { return nil, err } - curVoices := make([]int, len(s.Tracks)) + curVoices := make([]int, len(song.Tracks)) for i := range curVoices { - curVoices[i] = s.FirstTrackVoice(i) + curVoices[i] = song.FirstTrackVoice(i) } - samples := s.Samples - if samples < 0 { - samples = s.TotalRows() * s.SamplesPerRow() + samples := song.SongLength + if samples <= 0 { + samples = song.TotalRows() * song.SamplesPerRow() } buffer := make([]float32, samples*2) totaln := 0 - rowtime := 44100 * 60 / (s.BPM * 4) - for row := 0; row < s.TotalRows(); row++ { - patternRow := row % s.PatternRows() - pattern := row / s.PatternRows() - for t := range s.Tracks { - patternIndex := s.Tracks[t].Sequence[pattern] - note := s.Patterns[patternIndex][patternRow] + rowtime := song.SamplesPerRow() + for row := 0; row < song.TotalRows(); row++ { + patternRow := row % song.PatternRows() + pattern := row / song.PatternRows() + for t := range song.Tracks { + patternIndex := song.Tracks[t].Sequence[pattern] + note := song.Patterns[patternIndex][patternRow] if note == 1 { // anything but hold causes an action. continue // TODO: can hold be actually something else than 1? } - state.Release(curVoices[t]) + synth.Release(curVoices[t]) if note > 1 { curVoices[t]++ - first := s.FirstTrackVoice(t) - if curVoices[t] >= first+s.Tracks[t].NumVoices { + first := song.FirstTrackVoice(t) + if curVoices[t] >= first+song.Tracks[t].NumVoices { curVoices[t] = first } - state.Trigger(curVoices[t], note) + synth.Trigger(curVoices[t], note) } } - samples, _, _ := synth.RenderTime(state, buffer[2*totaln:], rowtime) + samples, _, _ := synth.Render(buffer[2*totaln:], rowtime) totaln += samples } return buffer, nil diff --git a/song/song_test.go b/go4k/song_test.go similarity index 52% rename from song/song_test.go rename to go4k/song_test.go index a889919..125428d 100644 --- a/song/song_test.go +++ b/go4k/song_test.go @@ -1,4 +1,4 @@ -package song_test +package go4k_test import ( "bytes" @@ -8,8 +8,9 @@ import ( "runtime" "testing" - "github.com/vsariola/sointu/bridge" - "github.com/vsariola/sointu/song" + "github.com/vsariola/sointu/go4k" + "github.com/vsariola/sointu/go4k/bridge" + // TODO: test the song using a mocks instead ) const BPM = 100 @@ -21,29 +22,24 @@ const su_max_samples = SAMPLES_PER_ROW * TOTAL_ROWS // const bufsize = su_max_samples * 2 -func TestSongRender(t *testing.T) { - patch := []bridge.Instrument{ - bridge.Instrument{1, []bridge.Unit{ - bridge.Unit{bridge.Envelope, []byte{32, 32, 64, 64, 128}}, - bridge.Unit{bridge.Oscillat, []byte{64, 64, 0, 96, 64, 128, 0x40}}, - bridge.Unit{bridge.Mulp, []byte{}}, - bridge.Unit{bridge.Envelope, []byte{32, 32, 64, 64, 128}}, - bridge.Unit{bridge.Oscillat, []byte{72, 64, 64, 64, 96, 128, 0x40}}, - bridge.Unit{bridge.Mulp, []byte{}}, - bridge.Unit{bridge.Out.Stereo(), []byte{128}}, - }}} +func TestPlayer(t *testing.T) { + patch := go4k.Patch{go4k.Instrument{1, []go4k.Unit{ + go4k.Unit{"envelope", false, map[string]int{"attack": 32, "decay": 32, "sustain": 64, "release": 64, "gain": 128}}, + go4k.Unit{"oscillator", false, map[string]int{"transpose": 64, "detune": 64, "phase": 0, "color": 96, "shape": 64, "gain": 128, "flags": 0x40}}, + go4k.Unit{"mulp", false, map[string]int{}}, + go4k.Unit{"envelope", false, map[string]int{"attack": 32, "decay": 32, "sustain": 64, "release": 64, "gain": 128}}, + go4k.Unit{"oscillator", false, map[string]int{"transpose": 72, "detune": 64, "phase": 64, "color": 64, "shape": 96, "gain": 128, "flags": 0x40}}, + go4k.Unit{"mulp", false, map[string]int{}}, + go4k.Unit{"out", true, map[string]int{"gain": 128}}, + }}} patterns := [][]byte{{64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0}} - tracks := []song.Track{song.Track{1, []byte{0}}} - song, err := song.NewSong(100, patterns, tracks, patch) - if err != nil { - t.Fatalf("NewSong failed: %v", err) - } - synth, err := bridge.Compile(patch) + tracks := []go4k.Track{go4k.Track{1, []byte{0}}} + song := go4k.Song{100, patterns, tracks, 0, patch} + synth, err := bridge.Synth(patch) if err != nil { t.Fatalf("Compiling patch failed: %v", err) } - var state bridge.SynthState - buffer, err := song.Render(synth, &state) + buffer, err := go4k.Play(synth, song) if err != nil { t.Fatalf("Render failed: %v", err) } diff --git a/src/introspection_footer.inc b/include/sointu/introspection_footer.inc similarity index 100% rename from src/introspection_footer.inc rename to include/sointu/introspection_footer.inc diff --git a/src/opcodes/arithmetic_footer.inc b/include/sointu/opcodes/arithmetic_footer.inc similarity index 100% rename from src/opcodes/arithmetic_footer.inc rename to include/sointu/opcodes/arithmetic_footer.inc diff --git a/src/opcodes/arithmetic_header.inc b/include/sointu/opcodes/arithmetic_header.inc similarity index 100% rename from src/opcodes/arithmetic_header.inc rename to include/sointu/opcodes/arithmetic_header.inc diff --git a/src/opcodes/effects_footer.inc b/include/sointu/opcodes/effects_footer.inc similarity index 100% rename from src/opcodes/effects_footer.inc rename to include/sointu/opcodes/effects_footer.inc diff --git a/src/opcodes/effects_header.inc b/include/sointu/opcodes/effects_header.inc similarity index 100% rename from src/opcodes/effects_header.inc rename to include/sointu/opcodes/effects_header.inc diff --git a/src/opcodes/flowcontrol_footer.inc b/include/sointu/opcodes/flowcontrol_footer.inc similarity index 100% rename from src/opcodes/flowcontrol_footer.inc rename to include/sointu/opcodes/flowcontrol_footer.inc diff --git a/src/opcodes/flowcontrol_header.inc b/include/sointu/opcodes/flowcontrol_header.inc similarity index 100% rename from src/opcodes/flowcontrol_header.inc rename to include/sointu/opcodes/flowcontrol_header.inc diff --git a/src/opcodes/sinks_footer.inc b/include/sointu/opcodes/sinks_footer.inc similarity index 100% rename from src/opcodes/sinks_footer.inc rename to include/sointu/opcodes/sinks_footer.inc diff --git a/src/opcodes/sinks_header.inc b/include/sointu/opcodes/sinks_header.inc similarity index 100% rename from src/opcodes/sinks_header.inc rename to include/sointu/opcodes/sinks_header.inc diff --git a/src/opcodes/sources_footer.inc b/include/sointu/opcodes/sources_footer.inc similarity index 100% rename from src/opcodes/sources_footer.inc rename to include/sointu/opcodes/sources_footer.inc diff --git a/src/opcodes/sources_header.inc b/include/sointu/opcodes/sources_header.inc similarity index 100% rename from src/opcodes/sources_header.inc rename to include/sointu/opcodes/sources_header.inc diff --git a/include/sointu.h b/include/sointu/sointu.h similarity index 71% rename from include/sointu.h rename to include/sointu/sointu.h index ae7840f..584d21a 100644 --- a/include/sointu.h +++ b/include/sointu/sointu.h @@ -30,14 +30,11 @@ typedef struct SynthWorkspace { struct Voice Voices[32]; } SynthWorkspace; -typedef struct SynthState { +typedef struct Synth { struct SynthWorkspace SynthWrk; struct DelayWorkspace DelayWrks[64]; // let's keep this as 64 for now, so the delays take 16 meg. If that's too little or too much, we can change this in future. unsigned int RandSeed; unsigned int GlobalTick; -} SynthState; - -typedef struct Synth { unsigned char Commands[32 * 64]; unsigned char Values[32 * 64 * 8]; unsigned int Polyphony; @@ -59,35 +56,14 @@ typedef struct Synth { extern void CALLCONV su_load_gmdls(void); #endif -// int su_render(Synth* synth,SynthState* synthState, float* buffer, int samples): -// Renders 'samples' number of 'samples' to the 'buffer', using 'synth'. -// Modifies 'synthState' and fills the 'buffer'. -// -// Parameters: -// synth pointer to the synthesizer used. Won't get modified by the call. -// synthState pointer to current synthState. RandSeed should be > 0 e.g. 1 -// buffer audio sample buffer, L R L R ... -// samples maximum number of samples to be rendered. WARNING: buffer -// should have a length of 2 * samples as the audio is stereo. -// -// Returns error code: -// 0 everything ok -// (returns always 0 as no errors are implemented yet) -int CALLCONV su_render(Synth* synth,SynthState* synthState, float* buffer, int samples); - -// int su_render_time(Synth* synth,SynthState* synthState, float* buffer, int* samples, int* time): +// int su_render(Synth* synth, float* buffer, int* samples, int* time): // Renders samples until 'samples' number of samples are reached or 'time' number of // modulated time ticks are reached, whichever happens first. 'samples' and 'time' are // are passed by reference as the function modifies to tell how many samples were // actually rendered and how many time ticks were actually advanced. // // Parameters: -// synth pointer to the synthesizer used. Won't get modified by the call. -// synthState pointer to current synthState. RandSeed should be > 0 e.g. 1 -// Also synthState->SamplesPerRow cannot be 0 or nothing will be -// rendered; either set it to INT32_MAX to always render full -// buffer, or something like SAMPLE_RATE * 60 / (BPM * 4) for -// having 4 rows per beat. +// synth pointer to the synthesizer used. RandSeed should be > 0 e.g. 1 // buffer audio sample buffer, L R L R ... // samples pointer to the maximum number of samples to be rendered. // buffer should have a length of 2 * maxsamples as the audio @@ -104,7 +80,7 @@ int CALLCONV su_render(Synth* synth,SynthState* synthState, float* buffer, int s // Returns error code: // 0 everything ok // (no actual errors implemented yet) -int CALLCONV su_render_time(Synth* synth,SynthState* synthState, float* buffer, int* samples, int* time); +int CALLCONV su_render(Synth* synth, float* buffer, int* samples, int* time); // Arithmetic opcode ids extern const int su_add_id; diff --git a/src/sointu_footer.inc b/include/sointu/sointu_footer.inc similarity index 100% rename from src/sointu_footer.inc rename to include/sointu/sointu_footer.inc diff --git a/src/sointu_header.inc b/include/sointu/sointu_header.inc similarity index 100% rename from src/sointu_header.inc rename to include/sointu/sointu_header.inc diff --git a/src/win32/gmdls_win32_footer.inc b/include/sointu/win32/gmdls_win32_footer.inc similarity index 100% rename from src/win32/gmdls_win32_footer.inc rename to include/sointu/win32/gmdls_win32_footer.inc diff --git a/src/win64/gmdls_win64_footer.inc b/include/sointu/win64/gmdls_win64_footer.inc similarity index 100% rename from src/win64/gmdls_win64_footer.inc rename to include/sointu/win64/gmdls_win64_footer.inc diff --git a/src/sointu.asm b/render.asm similarity index 50% rename from src/sointu.asm rename to render.asm index dd877d9..8a5f76e 100644 --- a/src/sointu.asm +++ b/render.asm @@ -25,14 +25,11 @@ USE_OUT section .text -struc su_synth_state +struc su_synth .synthwrk resb su_synthworkspace.size .delaywrks resb su_delayline_wrk.size * 64 .randseed resd 1 - .globaltime resd 1 -endstruc - -struc su_synth + .globaltime resd 1 .commands resb 32 * 64 .values resb 32 * 64 * 8 .polyphony resd 1 @@ -41,35 +38,25 @@ endstruc SECT_TEXT(sursampl) -EXPORT MANGLE_FUNC(su_render_time,20) +EXPORT MANGLE_FUNC(su_render,16) %if BITS == 32 ; stdcall - pushad ; push registers - mov eax, [esp + 4 + 32] ; eax = &synth - mov ecx, [esp + 8 + 32] ; ecx = &synthState - mov edx, [esp + 12 + 32] ; edx = &buffer - mov esi, [esp + 16 + 32] ; esi = &samples - mov ebx, [esp + 20 + 32] ; ebx = &time + pushad ; push registers + mov ecx, [esp + 4 + 32] ; ecx = &synthState + mov edx, [esp + 8 + 32] ; edx = &buffer + mov esi, [esp + 12 + 32] ; esi = &samples + mov ebx, [esp + 16 + 32] ; ebx = &time %else - %ifidn __OUTPUT_FORMAT__,win64 - ; win64 ABI parameter order: RCX, RDX, R8, R9; rest in stack (right-to-left, note shadow space!) - ; here: rcx = &synth, rdx = &synthstate, r8 = &buffer, r9 = &bufsize, stack1 = &time + %ifidn __OUTPUT_FORMAT__,win64 ; win64 ABI: rcx = &synth, rdx = &buffer, r8 = &bufsize, r9 = &time push_registers rdi, rsi, rbx, rbp ; win64 ABI: these registers are non-volatile - mov rbx, [rsp + 0x28 + PUSH_REG_SIZE(4)] ; rbx = &time, note the shadow space so &time is at rsp + 0x28 - mov rax, rcx - mov rcx, rdx - mov rdx, r8 - mov rsi, r9 - %else - ; System V ABI parameter order: RDI, RSI, RDX, RCX, R8, R9; rest in stack (right-to-left) - ; here: rdi = &synth, rsi = &synthstate, rdx = &buffer, rcx = &samples, r8 = &time + mov rsi, r8 ; rsi = &samples + mov rbx, r9 ; rbx = &time + %else ; System V ABI: rdi = &synth, rsi = &buffer, rdx = &samples, rcx = &time push_registers rbx, rbp ; System V ABI: these registers are non-volatile - mov rax, rdi - mov rbx, r8 - xchg rcx, rsi + mov rbx, rcx ; rbx points to time + xchg rsi, rdx ; rdx points to buffer, rsi points to samples + mov rcx, rdi ; rcx = &Synthstate %endif %endif - ; _AX = &synth, _BX == &time, _CX == &synthstate, _DX == &buf, _SI == &samples, - push _AX ; push the pointer to synth to stack push _SI ; push the pointer to samples push _BX ; push the pointer to time xor eax, eax ; samplenumber starts at 0 @@ -78,9 +65,9 @@ EXPORT MANGLE_FUNC(su_render_time,20) push _SI ; push bufsize push _DX ; push bufptr push _CX ; this takes place of the voicetrack - mov eax, [_CX + su_synth_state.randseed] + mov eax, [_CX + su_synth.randseed] push _AX ; randseed - mov eax, [_CX + su_synth_state.globaltime] + mov eax, [_CX + su_synth.globaltime] push _AX ; global tick time mov ebx, dword [_BX] ; zero extend dereferenced pointer push _BX ; the nominal rowlength should be time_in @@ -93,24 +80,23 @@ su_render_samples_loop: jge su_render_samples_time_finish ; goto finish inc eax ; time++ inc dword [_SP + PTRSIZE*6] ; samples++ - mov _CX, [_SP + PTRSIZE*3] ; _CX = &synthstate - mov _BP, [_SP + PTRSIZE*9] ; _BP = &synth + mov _CX, [_SP + PTRSIZE*3] push _AX ; push rowtick - mov eax, [_BP + su_synth.polyphony] + mov eax, [_CX + su_synth.polyphony] push _AX ;polyphony - mov eax, [_BP + su_synth.numvoices] + mov eax, [_CX + su_synth.numvoices] push _AX ;numvoices - lea _DX, [_CX + su_synth_state.synthwrk] - lea COM, [_BP + su_synth.commands] - lea VAL, [_BP + su_synth.values] - lea WRK, [_DX + su_synthworkspace.voices] ; _BP and WRK are actually the same thing so here _BP gets overwritten - lea _CX, [_CX + su_synth_state.delaywrks - su_delayline_wrk.filtstate] + lea _DX, [_CX+ su_synth.synthwrk] + lea COM, [_CX+ su_synth.commands] + lea VAL, [_CX+ su_synth.values] + lea WRK, [_DX + su_synthworkspace.voices] + lea _CX, [_CX+ su_synth.delaywrks - su_delayline_wrk.filtstate] call MANGLE_FUNC(su_run_vm,0) pop _AX pop _AX mov _DI, [_SP + PTRSIZE*5] ; edi containts buffer ptr mov _CX, [_SP + PTRSIZE*4] - lea _SI, [_CX + su_synth_state.synthwrk + su_synthworkspace.left] + lea _SI, [_CX + su_synth.synthwrk + su_synthworkspace.left] movsd ; copy left channel to output buffer movsd ; copy right channel to output buffer mov [_SP + PTRSIZE*5], _DI ; save back the updated ptr @@ -126,8 +112,8 @@ su_render_samples_time_finish: pop _BX pop _DX pop _CX - mov [_CX + su_synth_state.randseed], edx - mov [_CX + su_synth_state.globaltime], ebx + mov [_CX + su_synth.randseed], edx + mov [_CX + su_synth.globaltime], ebx pop _BX pop _BX pop _DX @@ -135,12 +121,11 @@ su_render_samples_time_finish: pop _SI ; pop the pointer to samples mov dword [_SI], edx ; *samples = samples rendered mov dword [_BX], eax ; *time = time ticks rendered - pop _AX ; pop the synth pointer xor eax, eax ; TODO: set eax to possible error code, now just 0 %if BITS == 32 ; stdcall mov [_SP + 28],eax ; we want to return eax, but popad pops everything, so put eax to stack for popad to pop popad - ret 20 + ret 16 %else %ifidn __OUTPUT_FORMAT__,win64 pop_registers rdi, rsi, rbx, rbp ; win64 ABI: these registers are non-volatile @@ -149,45 +134,3 @@ su_render_samples_time_finish: %endif ret %endif - -EXPORT MANGLE_FUNC(su_render,16) -%if BITS == 32 ; stdcall - mov eax, 0x7FFFFFFF ; don't care about time, just try to fill the buffer - push eax - push esp - lea eax, [esp + 24] - push eax - push dword [esp + 24] - push dword [esp + 24] - push dword [esp + 24] -%else - %ifidn __OUTPUT_FORMAT__,win64 - ; win64 ABI parameter order: RCX, RDX, R8, R9; rest in stack (right-to-left, note shadow space!) - ; here: rcx = &synth, rdx = &synthstate, r8 = &buffer, r9 = samples - ; put the values in shadow space and get pointers to them - mov [_SP+0x8],r9 - lea r9, [_SP+0x8] - mov [_SP+0x10], dword 0x7FFFFFFF ; don't care about time, just try to fill the buffer - lea r10, [_SP+0x10] - mov [_SP+0x20], r10 - %else - ; System V ABI parameter order: RDI, RSI, RDX, RCX, R8, R9; rest in stack (right-to-left) - ; here: rdi = &synth, rsi = &synthstate, rdx = &buffer, rcx = samples - push rcx - mov rcx, _SP ; pass a pointer to samples instead of direct value - mov r8, 0x7FFFFFFF ; don't care about time, just try to fill the buffer - push r8 - mov r8, _SP ; still, we have to pass a pointer to time, so pointer to stack - %endif -%endif - call MANGLE_FUNC(su_render_time,20) -%if BITS == 32 ; stdcall - pop ecx - ret 16 -%else - %ifnidn __OUTPUT_FORMAT__,win64 ; win64 ABI: rdx = bufsize, r8 = &buffer, rcx = &synthstate - pop rcx - pop r8 - %endif - ret -%endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index 94221c8..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -set(LIB sointu) - -set(SOURCES sointu.asm) - -# Headers -include_directories(${PROJECT_SOURCE_DIR}/include) - -# Library target -add_library(${LIB} ${SOURCES}) -set_target_properties(${LIB} PROPERTIES LINKER_LANGUAGE C) -target_link_libraries(${LIB}) -target_compile_definitions(${LIB} PUBLIC SU_USE_INTROSPECTION) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0f6975e..63b8e4a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -21,6 +21,7 @@ function(regression_test testname) add_test(${testname} ${testname}) target_compile_definitions(${testname} PUBLIC TEST_NAME="${testname}" SU_USE_INTROSPECTION SU_USE_PLAYER) + target_link_libraries(${testname} ${HEADERLIB}) set (rawinput ${CMAKE_CURRENT_SOURCE_DIR}/expected_output/${testname}.raw) set (rawoutput ${CMAKE_CURRENT_BINARY_DIR}/expected_output/${testname}.raw) @@ -151,8 +152,8 @@ regression_test(test_chords "ENVELOPE;VCO_SINE") regression_test(test_speed "ENVELOPE;VCO_SINE") regression_test(test_render_samples ENVELOPE "" test_render_samples.c) -target_link_libraries(test_render_samples sointu) +target_link_libraries(test_render_samples ${STATICLIB}) add_executable(test_render_samples_api test_render_samples_api.c) -target_link_libraries(test_render_samples_api sointu) +target_link_libraries(test_render_samples_api ${STATICLIB}) add_test(test_render_samples_api test_render_samples_api) diff --git a/tests/test_add.asm b/tests/test_add.asm index a28efe8..4731a1f 100644 --- a/tests/test_add.asm +++ b/tests/test_add.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0, @@ -19,4 +19,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_add_stereo.asm b/tests/test_add_stereo.asm index 94fad79..48f04db 100644 --- a/tests/test_add_stereo.asm +++ b/tests/test_add_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0, @@ -24,4 +24,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_addp.asm b/tests/test_addp.asm index 2d7b633..6a85f8c 100644 --- a/tests/test_addp.asm +++ b/tests/test_addp.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -22,4 +22,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_addp_stereo.asm b/tests/test_addp_stereo.asm index 511d126..6824d42 100644 --- a/tests/test_addp_stereo.asm +++ b/tests/test_addp_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -21,4 +21,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_aux.asm b/tests/test_aux.asm index ba75997..f65245c 100644 --- a/tests/test_aux.asm +++ b/tests/test_aux.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -19,4 +19,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_aux_stereo.asm b/tests/test_aux_stereo.asm index 62a81e5..f54144b 100644 --- a/tests/test_aux_stereo.asm +++ b/tests/test_aux_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -25,4 +25,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_chords.asm b/tests/test_chords.asm index 991aa53..b68d8d6 100644 --- a/tests/test_chords.asm +++ b/tests/test_chords.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 0, 0, 68, 0, 0, 0, 66, 0, 0, 0, 69, 0, 0, 0, @@ -25,4 +25,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_clip.asm b/tests/test_clip.asm index e68097c..3f33c38 100644 --- a/tests/test_clip.asm +++ b/tests/test_clip.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -24,4 +24,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_clip_stereo.asm b/tests/test_clip_stereo.asm index b78280b..9a83a06 100644 --- a/tests/test_clip_stereo.asm +++ b/tests/test_clip_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -24,4 +24,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_compressor.asm b/tests/test_compressor.asm index d6755da..775363b 100644 --- a/tests/test_compressor.asm +++ b/tests/test_compressor.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, @@ -39,4 +39,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_compressor_stereo.asm b/tests/test_compressor_stereo.asm index d0033cc..a48b99e 100644 --- a/tests/test_compressor_stereo.asm +++ b/tests/test_compressor_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, @@ -39,4 +39,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_crush.asm b/tests/test_crush.asm index 62549a7..ac3405c 100644 --- a/tests/test_crush.asm +++ b/tests/test_crush.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -24,4 +24,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_crush_stereo.asm b/tests/test_crush_stereo.asm index 47c198d..4326d97 100644 --- a/tests/test_crush_stereo.asm +++ b/tests/test_crush_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -23,4 +23,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_delay.asm b/tests/test_delay.asm index 85ef90f..06bab0e 100644 --- a/tests/test_delay.asm +++ b/tests/test_delay.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -25,4 +25,4 @@ BEGIN_DELTIMES DELTIME 11025 END_DELTIMES -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_delay_dampmod.asm b/tests/test_delay_dampmod.asm index 8ebc4b0..e8b0c3d 100644 --- a/tests/test_delay_dampmod.asm +++ b/tests/test_delay_dampmod.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -27,4 +27,4 @@ BEGIN_DELTIMES DELTIME 11025 END_DELTIMES -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_delay_drymod.asm b/tests/test_delay_drymod.asm index b44f32a..91bd5c8 100644 --- a/tests/test_delay_drymod.asm +++ b/tests/test_delay_drymod.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -27,4 +27,4 @@ BEGIN_DELTIMES DELTIME 11025 END_DELTIMES -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_delay_feedbackmod.asm b/tests/test_delay_feedbackmod.asm index 040a408..5ac75ad 100644 --- a/tests/test_delay_feedbackmod.asm +++ b/tests/test_delay_feedbackmod.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -27,4 +27,4 @@ BEGIN_DELTIMES DELTIME 11025 END_DELTIMES -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_delay_flanger.asm b/tests/test_delay_flanger.asm index 228d27e..3dddbad 100644 --- a/tests/test_delay_flanger.asm +++ b/tests/test_delay_flanger.asm @@ -1,7 +1,7 @@ %define BPM 100 %define INCLUDE_DELAY_MODULATION -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 80, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0 @@ -28,4 +28,4 @@ BEGIN_DELTIMES DELTIME 1000 END_DELTIMES -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_delay_notetracking.asm b/tests/test_delay_notetracking.asm index 4f25b85..226d2e6 100644 --- a/tests/test_delay_notetracking.asm +++ b/tests/test_delay_notetracking.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -31,4 +31,4 @@ BEGIN_DELTIMES DELTIME 10787 END_DELTIMES -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_delay_pregainmod.asm b/tests/test_delay_pregainmod.asm index 2f54fce..4d77dea 100644 --- a/tests/test_delay_pregainmod.asm +++ b/tests/test_delay_pregainmod.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -27,4 +27,4 @@ BEGIN_DELTIMES DELTIME 11025 END_DELTIMES -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_delay_reverb.asm b/tests/test_delay_reverb.asm index 78c4303..542662c 100644 --- a/tests/test_delay_reverb.asm +++ b/tests/test_delay_reverb.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -25,4 +25,4 @@ BEGIN_DELTIMES DELTIME 1116,1188,1276,1356,1422,1492,1556,1618 END_DELTIMES -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_delay_stereo.asm b/tests/test_delay_stereo.asm index 0d60db2..250bcc5 100644 --- a/tests/test_delay_stereo.asm +++ b/tests/test_delay_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -26,4 +26,4 @@ BEGIN_DELTIMES DELTIME 21025 END_DELTIMES -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_distort.asm b/tests/test_distort.asm index 3bacc0c..3a15013 100644 --- a/tests/test_distort.asm +++ b/tests/test_distort.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -20,4 +20,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_distort_mod.asm b/tests/test_distort_mod.asm index ce722ad..20a90dc 100644 --- a/tests/test_distort_mod.asm +++ b/tests/test_distort_mod.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -23,4 +23,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_distort_stereo.asm b/tests/test_distort_stereo.asm index b0d8d0f..5bda97f 100644 --- a/tests/test_distort_stereo.asm +++ b/tests/test_distort_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -18,4 +18,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_envelope.asm b/tests/test_envelope.asm index 74b5346..ebaced4 100644 --- a/tests/test_envelope.asm +++ b/tests/test_envelope.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -18,4 +18,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_envelope_mod.asm b/tests/test_envelope_mod.asm index 69cb933..810ab65 100644 --- a/tests/test_envelope_mod.asm +++ b/tests/test_envelope_mod.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD,HLD, HLD, HLD, 0, 0, 0, 0, 0, @@ -24,4 +24,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_envelope_stereo.asm b/tests/test_envelope_stereo.asm index 349f825..405b671 100644 --- a/tests/test_envelope_stereo.asm +++ b/tests/test_envelope_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -17,4 +17,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_filter_band.asm b/tests/test_filter_band.asm index b5d23ac..fdf4636 100644 --- a/tests/test_filter_band.asm +++ b/tests/test_filter_band.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -21,4 +21,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_filter_freqmod.asm b/tests/test_filter_freqmod.asm index 6253e6e..66881e2 100644 --- a/tests/test_filter_freqmod.asm +++ b/tests/test_filter_freqmod.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -23,4 +23,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_filter_high.asm b/tests/test_filter_high.asm index 765ef75..fbd016a 100644 --- a/tests/test_filter_high.asm +++ b/tests/test_filter_high.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -21,4 +21,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_filter_low.asm b/tests/test_filter_low.asm index 0df4438..96c5070 100644 --- a/tests/test_filter_low.asm +++ b/tests/test_filter_low.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -21,4 +21,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_filter_peak.asm b/tests/test_filter_peak.asm index 5b46d0d..1dfcc83 100644 --- a/tests/test_filter_peak.asm +++ b/tests/test_filter_peak.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -21,4 +21,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_filter_resmod.asm b/tests/test_filter_resmod.asm index 121a2da..cd086b7 100644 --- a/tests/test_filter_resmod.asm +++ b/tests/test_filter_resmod.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -23,4 +23,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_filter_stereo.asm b/tests/test_filter_stereo.asm index 74458f9..1757615 100644 --- a/tests/test_filter_stereo.asm +++ b/tests/test_filter_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -21,4 +21,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_gain.asm b/tests/test_gain.asm index f11c57b..d3102ad 100644 --- a/tests/test_gain.asm +++ b/tests/test_gain.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -19,4 +19,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_gain_stereo.asm b/tests/test_gain_stereo.asm index 2d14d03..1adb09a 100644 --- a/tests/test_gain_stereo.asm +++ b/tests/test_gain_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -20,4 +20,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_hold.asm b/tests/test_hold.asm index dfe347e..ba3c707 100644 --- a/tests/test_hold.asm +++ b/tests/test_hold.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -20,4 +20,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_hold_mod.asm b/tests/test_hold_mod.asm index b4e74b1..31603c4 100644 --- a/tests/test_hold_mod.asm +++ b/tests/test_hold_mod.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -23,4 +23,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_hold_stereo.asm b/tests/test_hold_stereo.asm index b66a004..2703e06 100644 --- a/tests/test_hold_stereo.asm +++ b/tests/test_hold_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -19,4 +19,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_in.asm b/tests/test_in.asm index fa94f84..75233aa 100644 --- a/tests/test_in.asm +++ b/tests/test_in.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -24,4 +24,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_in_stereo.asm b/tests/test_in_stereo.asm index d54de09..0b4aa78 100644 --- a/tests/test_in_stereo.asm +++ b/tests/test_in_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -23,4 +23,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_invgain.asm b/tests/test_invgain.asm index 939cc50..bbbd931 100644 --- a/tests/test_invgain.asm +++ b/tests/test_invgain.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -20,4 +20,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_invgain_stereo.asm b/tests/test_invgain_stereo.asm index 39e22cd..14c4888 100644 --- a/tests/test_invgain_stereo.asm +++ b/tests/test_invgain_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -19,4 +19,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_loadnote.asm b/tests/test_loadnote.asm index 1042681..f6184b4 100644 --- a/tests/test_loadnote.asm +++ b/tests/test_loadnote.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0 @@ -18,4 +18,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_loadnote_stereo.asm b/tests/test_loadnote_stereo.asm index 16d8bb2..8200db5 100644 --- a/tests/test_loadnote_stereo.asm +++ b/tests/test_loadnote_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0 @@ -17,4 +17,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_loadval.asm b/tests/test_loadval.asm index 9ec94ee..c572146 100644 --- a/tests/test_loadval.asm +++ b/tests/test_loadval.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -18,4 +18,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_loadval_stereo.asm b/tests/test_loadval_stereo.asm index 0abbd19..3004f05 100644 --- a/tests/test_loadval_stereo.asm +++ b/tests/test_loadval_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -17,4 +17,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_mul.asm b/tests/test_mul.asm index 7ee55e6..5b1dc91 100644 --- a/tests/test_mul.asm +++ b/tests/test_mul.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -19,4 +19,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_mul_stereo.asm b/tests/test_mul_stereo.asm index 6980724..948df3c 100644 --- a/tests/test_mul_stereo.asm +++ b/tests/test_mul_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -24,4 +24,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_mulp.asm b/tests/test_mulp.asm index a736925..9904c3c 100644 --- a/tests/test_mulp.asm +++ b/tests/test_mulp.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -22,4 +22,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_mulp_stereo.asm b/tests/test_mulp_stereo.asm index 7a6e802..96c9bef 100644 --- a/tests/test_mulp_stereo.asm +++ b/tests/test_mulp_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -21,4 +21,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_multiple_instruments.asm b/tests/test_multiple_instruments.asm index d78ec07..cd33b4e 100644 --- a/tests/test_multiple_instruments.asm +++ b/tests/test_multiple_instruments.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64,HLD,HLD,HLD,HLD,HLD,HLD,HLD, 0, 0, 0,0,0,0,0,0, @@ -25,4 +25,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_noise.asm b/tests/test_noise.asm index 763a5c8..0dfa6d9 100644 --- a/tests/test_noise.asm +++ b/tests/test_noise.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -22,4 +22,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_noise_stereo.asm b/tests/test_noise_stereo.asm index 1abf06e..672ae17 100644 --- a/tests/test_noise_stereo.asm +++ b/tests/test_noise_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -20,4 +20,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_oscillat_colormod.asm b/tests/test_oscillat_colormod.asm index 87657cd..bf5689d 100644 --- a/tests/test_oscillat_colormod.asm +++ b/tests/test_oscillat_colormod.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 80, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0 @@ -22,4 +22,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_oscillat_detunemod.asm b/tests/test_oscillat_detunemod.asm index 0984f78..54bf97b 100644 --- a/tests/test_oscillat_detunemod.asm +++ b/tests/test_oscillat_detunemod.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 80, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0 @@ -22,4 +22,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_oscillat_gainmod.asm b/tests/test_oscillat_gainmod.asm index 512ad24..520a00d 100644 --- a/tests/test_oscillat_gainmod.asm +++ b/tests/test_oscillat_gainmod.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 80, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0 @@ -22,4 +22,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_oscillat_gate.asm b/tests/test_oscillat_gate.asm index e179258..3b8f46b 100644 --- a/tests/test_oscillat_gate.asm +++ b/tests/test_oscillat_gate.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -21,4 +21,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_oscillat_lfo.asm b/tests/test_oscillat_lfo.asm index 8233891..715e770 100644 --- a/tests/test_oscillat_lfo.asm +++ b/tests/test_oscillat_lfo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -21,4 +21,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_oscillat_phasemod.asm b/tests/test_oscillat_phasemod.asm index 642d917..223c2a0 100644 --- a/tests/test_oscillat_phasemod.asm +++ b/tests/test_oscillat_phasemod.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 80, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0 @@ -22,4 +22,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_oscillat_pulse.asm b/tests/test_oscillat_pulse.asm index cedf5b3..70914b1 100644 --- a/tests/test_oscillat_pulse.asm +++ b/tests/test_oscillat_pulse.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -21,4 +21,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_oscillat_sample.asm b/tests/test_oscillat_sample.asm index dd60c71..436a75f 100644 --- a/tests/test_oscillat_sample.asm +++ b/tests/test_oscillat_sample.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 0,0,0,0,0,0,0,0, @@ -39,4 +39,4 @@ BEGIN_SAMPLE_OFFSETS SAMPLE_OFFSET START(1680142),LOOPSTART(1483),LOOPLENGTH(95) ; name VIOLN70, unitynote 58 (transpose to 2), data length 1579 END_SAMPLE_OFFSETS -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_oscillat_sample_stereo.asm b/tests/test_oscillat_sample_stereo.asm index c3f2e4b..7dd5a40 100644 --- a/tests/test_oscillat_sample_stereo.asm +++ b/tests/test_oscillat_sample_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 0,0,0,0,0,0,0,0, @@ -36,4 +36,4 @@ BEGIN_SAMPLE_OFFSETS SAMPLE_OFFSET START(1678611),LOOPSTART(1341),LOOPLENGTH(106) ; name VIOLN68, unitynote 56 (transpose to 4), data length 1448 END_SAMPLE_OFFSETS -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_oscillat_shapemod.asm b/tests/test_oscillat_shapemod.asm index 7f4ec1f..d21d4fa 100644 --- a/tests/test_oscillat_shapemod.asm +++ b/tests/test_oscillat_shapemod.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 80, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0 @@ -22,4 +22,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_oscillat_sine.asm b/tests/test_oscillat_sine.asm index 3ccccb4..40f2c72 100644 --- a/tests/test_oscillat_sine.asm +++ b/tests/test_oscillat_sine.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -21,4 +21,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_oscillat_stereo.asm b/tests/test_oscillat_stereo.asm index e1f41fe..eac9e82 100644 --- a/tests/test_oscillat_stereo.asm +++ b/tests/test_oscillat_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -20,4 +20,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_oscillat_transposemod.asm b/tests/test_oscillat_transposemod.asm index 96f7444..272abcb 100644 --- a/tests/test_oscillat_transposemod.asm +++ b/tests/test_oscillat_transposemod.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 80, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0 @@ -22,4 +22,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_oscillat_trisaw.asm b/tests/test_oscillat_trisaw.asm index ba3ce79..f17c3e5 100644 --- a/tests/test_oscillat_trisaw.asm +++ b/tests/test_oscillat_trisaw.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -21,4 +21,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_oscillat_unison.asm b/tests/test_oscillat_unison.asm index bdec2b0..0e149a0 100644 --- a/tests/test_oscillat_unison.asm +++ b/tests/test_oscillat_unison.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -20,4 +20,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_oscillat_unison_stereo.asm b/tests/test_oscillat_unison_stereo.asm index eb64734..9450c4b 100644 --- a/tests/test_oscillat_unison_stereo.asm +++ b/tests/test_oscillat_unison_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0, @@ -19,4 +19,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_outaux.asm b/tests/test_outaux.asm index b2db10b..535cfdc 100644 --- a/tests/test_outaux.asm +++ b/tests/test_outaux.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -23,4 +23,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_outaux_stereo.asm b/tests/test_outaux_stereo.asm index 695d69a..cf5ce4c 100644 --- a/tests/test_outaux_stereo.asm +++ b/tests/test_outaux_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -24,4 +24,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_panning.asm b/tests/test_panning.asm index 97bf8bf..9bde0e8 100644 --- a/tests/test_panning.asm +++ b/tests/test_panning.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -18,4 +18,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_panning_stereo.asm b/tests/test_panning_stereo.asm index eab2a9b..a47be20 100644 --- a/tests/test_panning_stereo.asm +++ b/tests/test_panning_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -19,4 +19,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_polyphony.asm b/tests/test_polyphony.asm index 527c7ed..32d78d0 100644 --- a/tests/test_polyphony.asm +++ b/tests/test_polyphony.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, 68, HLD, 32, HLD, HLD, HLD, 75, HLD, 78, HLD, HLD, 0, 0, 0, @@ -29,4 +29,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_pop.asm b/tests/test_pop.asm index d14a59a..d872c37 100644 --- a/tests/test_pop.asm +++ b/tests/test_pop.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -20,4 +20,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_pop_stereo.asm b/tests/test_pop_stereo.asm index 202b624..b9e3bef 100644 --- a/tests/test_pop_stereo.asm +++ b/tests/test_pop_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -21,4 +21,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_push.asm b/tests/test_push.asm index 7fda88f..07bff2d 100644 --- a/tests/test_push.asm +++ b/tests/test_push.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -20,4 +20,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_push_stereo.asm b/tests/test_push_stereo.asm index 24871be..4df4c98 100644 --- a/tests/test_push_stereo.asm +++ b/tests/test_push_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -21,4 +21,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_receive.asm b/tests/test_receive.asm index 2288762..3cbb62d 100644 --- a/tests/test_receive.asm +++ b/tests/test_receive.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -23,4 +23,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_receive_stereo.asm b/tests/test_receive_stereo.asm index b5b09a6..3cfef03 100644 --- a/tests/test_receive_stereo.asm +++ b/tests/test_receive_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -22,4 +22,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_render_samples.c b/tests/test_render_samples.c index 8ee4351..2f31c28 100644 --- a/tests/test_render_samples.c +++ b/tests/test_render_samples.c @@ -1,7 +1,7 @@ #include #include #include -#include "../include/sointu.h" +#include "sointu.h" #if UINTPTR_MAX == 0xffffffff // are we 32-bit? #if defined(__clang__) || defined(__GNUC__) @@ -21,7 +21,6 @@ const int su_max_samples = SAMPLES_PER_ROW * TOTAL_ROWS; void CALLCONV su_render_song(float* buffer) { Synth* synth; - SynthState* synthState; const unsigned char commands[] = { su_envelope_id, // MONO su_envelope_id, // MONO su_out_id + 1, // STEREO @@ -30,23 +29,26 @@ void CALLCONV su_render_song(float* buffer) { 95, 64, 64, 80, 128, // envelope 2 128}; int retval; + int samples; + int time; // initialize Synth synth = (Synth*)malloc(sizeof(Synth)); + memset(synth, 0, sizeof(Synth)); memcpy(synth->Commands, commands, sizeof(commands)); memcpy(synth->Values, values, sizeof(values)); synth->NumVoices = 1; synth->Polyphony = 0; - // initialize SynthState - synthState = (SynthState*)malloc(sizeof(SynthState)); - memset(synthState, 0, sizeof(SynthState)); - synthState->RandSeed = 1; + synth->RandSeed = 1; // triger first voice - synthState->SynthWrk.Voices[0].Note = 64; - retval = su_render(synth, synthState, buffer, su_max_samples / 2); - synthState->SynthWrk.Voices[0].Release++; + synth->SynthWrk.Voices[0].Note = 64; + samples = su_max_samples / 2; + time = INT32_MAX; + retval = su_render(synth, buffer, &samples, &time); + synth->SynthWrk.Voices[0].Release++; buffer = buffer + su_max_samples; - retval = su_render(synth, synthState, buffer, su_max_samples / 2); + samples = su_max_samples / 2; + time = INT32_MAX; + retval = su_render(synth, buffer, &samples, &time); free(synth); - free(synthState); - return; + return; } diff --git a/tests/test_render_samples_api.c b/tests/test_render_samples_api.c index 1003a16..86658f7 100644 --- a/tests/test_render_samples_api.c +++ b/tests/test_render_samples_api.c @@ -2,7 +2,7 @@ #include #include #include -#include "../include/sointu.h" +#include #define BPM 100 #define SAMPLE_RATE 44100 @@ -12,7 +12,6 @@ const int su_max_samples = SAMPLES_PER_ROW * TOTAL_ROWS; int main(int argc, char* argv[]) { Synth* synth; - SynthState* synthState; float* buffer; const unsigned char commands[] = { su_envelope_id, // MONO su_envelope_id, // MONO @@ -32,53 +31,50 @@ int main(int argc, char* argv[]) { memcpy(synth->Values, values, sizeof(values)); synth->NumVoices = 1; synth->Polyphony = 0; - // initialize SynthState - synthState = (SynthState*)malloc(sizeof(SynthState)); - memset(synthState, 0, sizeof(SynthState)); - synthState->RandSeed = 1; + synth->RandSeed = 1; // initialize Buffer buffer = (float*)malloc(2 * sizeof(float) * su_max_samples); // triger first voice - synthState->SynthWrk.Voices[0].Note = 64; + synth->SynthWrk.Voices[0].Note = 64; totalrendered = 0; - // First check that when we render using su_render_time with 0 time + // First check that when we render using su_render with 0 time // we get nothing done samples = su_max_samples; time = 0; - errcode = su_render_time(synth, synthState, buffer, &samples, &time); + errcode = su_render(synth, buffer, &samples, &time); if (errcode != 0) { - printf("su_render_time returned error"); + printf("su_render returned error"); goto fail; } if (samples > 0) { - printf("su_render_time rendered samples, despite it should not"); + printf("su_render rendered samples, despite it should not"); goto fail; } if (time > 0) { - printf("su_render_time advanced time, despite it should not"); + printf("su_render advanced time, despite it should not"); goto fail; } - // Then check that when we render using su_render_time with 0 samples, + // Then check that when we render using su_render with 0 samples, // we get nothing done samples = 0; time = INT32_MAX; - errcode = su_render_time(synth, synthState, buffer, &samples, &time); + errcode = su_render(synth, buffer, &samples, &time); if (errcode != 0) { - printf("su_render_time returned error"); + printf("su_render returned error"); goto fail; } if (samples > 0) { - printf("su_render_time rendered samples, despite it should not"); + printf("su_render rendered samples, despite it should not"); goto fail; } if (time > 0) { - printf("su_render_time advanced time, despite it should not"); + printf("su_render advanced time, despite it should not"); goto fail; } // Then check that each time we call render, only SAMPLES_PER_ROW @@ -88,7 +84,7 @@ int main(int argc, char* argv[]) { // check that buffer full samples = 1; time = INT32_MAX; - su_render_time(synth, synthState, &buffer[totalrendered*2], &samples, &time); + su_render(synth, &buffer[totalrendered*2], &samples, &time); totalrendered += samples; if (samples != 1) { @@ -102,7 +98,7 @@ int main(int argc, char* argv[]) { } samples = SAMPLES_PER_ROW - 1; time = INT32_MAX; - su_render_time(synth, synthState, &buffer[totalrendered * 2], &samples, &time); + su_render(synth, &buffer[totalrendered * 2], &samples, &time); totalrendered += samples; if (samples != SAMPLES_PER_ROW - 1) { @@ -115,7 +111,7 @@ int main(int argc, char* argv[]) { goto fail; } if (i == 8) - synthState->SynthWrk.Voices[0].Release++; + synth->SynthWrk.Voices[0].Release++; } if (totalrendered != su_max_samples) { @@ -125,7 +121,6 @@ int main(int argc, char* argv[]) { retval = 0; finish: free(synth); - free(synthState); free(buffer); return retval; fail: diff --git a/tests/test_send.asm b/tests/test_send.asm index 8f9ee8c..802c1f4 100644 --- a/tests/test_send.asm +++ b/tests/test_send.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -23,4 +23,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_send_global.asm b/tests/test_send_global.asm index 3006a7e..9c0c23d 100644 --- a/tests/test_send_global.asm +++ b/tests/test_send_global.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -27,4 +27,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_send_stereo.asm b/tests/test_send_stereo.asm index daee44d..fc89f25 100644 --- a/tests/test_send_stereo.asm +++ b/tests/test_send_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -23,4 +23,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_speed.asm b/tests/test_speed.asm index 718d047..910b50d 100644 --- a/tests/test_speed.asm +++ b/tests/test_speed.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" ; warning: crashes ahead. Now that the bpm could be changed and even modulated by other ; signals, there is no easy way to figure out how many ticks your song is. Either @@ -33,4 +33,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_xch.asm b/tests/test_xch.asm index ed3727b..44905ea 100644 --- a/tests/test_xch.asm +++ b/tests/test_xch.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -19,4 +19,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc" diff --git a/tests/test_xch_stereo.asm b/tests/test_xch_stereo.asm index 6f2c947..e2ca928 100644 --- a/tests/test_xch_stereo.asm +++ b/tests/test_xch_stereo.asm @@ -1,6 +1,6 @@ %define BPM 100 -%include "../src/sointu_header.inc" +%include "sointu_header.inc" BEGIN_PATTERNS PATTERN 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0 @@ -23,4 +23,4 @@ BEGIN_PATCH END_INSTRUMENT END_PATCH -%include "../src/sointu_footer.inc" +%include "sointu_footer.inc"