Commit Graph

13 Commits

Author SHA1 Message Date
5684185+vsariola@users.noreply.github.com
01bf409929 refactor(vm): rename Commands/Values to Opcodes/Operands
The commands and values were not very good names to what the
byte sequences actually are: opcodes and their operands. In
many other places, we were already calling the byte in the Command
stream as Opcode, so a logical name for a sequence of these is
Opcodes. Values is such a generic name that it's not immediately
clear that this sequence is related to the opcodes. Operands is not
perfect but clearly suggests that this sequence is related to
the Opcodes.
2023-10-18 19:53:47 +03:00
5684185+vsariola@users.noreply.github.com
00850c8001 code/text formatting and cleaning up whitespace 2023-09-24 10:47:54 +03:00
5684185+vsariola@users.noreply.github.com
1ac2ad3c75 fix(vm/compiler): invert the logic of the release flag in the voices (closes #102)
This makes all envelopes released by default, instead of attacking. Add also test to demonstrate the buggy behaviour.
2023-09-23 15:56:46 +03:00
vsariola
3e7064e166 refactor(templates, tests): rename C-header defines consistently with Score.go 2021-02-28 16:07:55 +02:00
Veikko Sariola
d0bd877b3f feat(asm&go4k): Rewrote both library & player to use text/template compiler
There is no more plain .asms, both library & player are created from the templates using go text/template package.
2020-12-16 17:23:50 +02:00
Veikko Sariola
efbcf1454e feat(go4k&sointu): Export .h C header files from the songs using go, also automatically during build for the tests.
The header files are automatically generated during build. No need to #define anything; everything is fixed by the .asm file. This adds go as a dependency to run the unit tests, but this is probably not a bad thing, as go is probably needed anyway if one wants to actually start developing Sointu.
2020-12-03 23:43:39 +02:00
Veikko Sariola
eb37d8123d Change include path in CMake file to point to include/ instead of include/sointu/ 2020-11-02 21:37:22 +02:00
Veikko Sariola
e0a793ea6d 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.
2020-10-31 22:05:47 +02:00
Veikko Sariola
8183c698da Separate Synth and SynthState: SynthState is the part that Render changes.
This should make testing easier, as Synth can be assumed to stay the same
during each call. Synth is also the part that we can parse from .asm/.json file
and a Patch can be compiled into a synth. Synth can be eventually made
quite opaque to the user. The user should not need to worry about opcodes
etc.
2020-10-28 19:47:59 +02:00
Veikko Sariola
64afa9fb48 Change the C-API to roughly match the new Go-API.
The parameter order is now so that all the in/out int parameters are in the end of the signature.
2020-10-27 21:58:56 +02:00
Veikko Sariola
6e85ff674a Change the sointu.h api to return -1, 0 or n>0 depending if buffer is full and/or row ended.
test_render_samples_api.c was added to test the api. bridge.go was modified to reflect that there is no need to check for row manually; su_render_samples already returns the information if a row has ended.
2020-10-24 13:00:08 +03:00
Veikko Sariola
95b70018cc Fix all CMake tests passing on MinGW: consider minor (< 1e-6) errors in waveform shape successes.
Such errors are due to floating point rounding errors.
2020-10-22 21:19:14 +03:00
Veikko Sariola
7aac3917b7 Implement a bridge to call Sointu from Go language.
The main interface is render_samples function, which renders several samples in one call,
to limit the number of calls from Go to C. This is compiled into a library, which is then
linked and called from bridge.go.
2020-10-22 21:19:13 +03:00