Commit Graph
69 Commits
Author SHA1 Message Date
Veikko Sariola bca34febcb feat(CI): Also run tests on win64.
win32 builds were giving errors so the tests are only ran on win64.
2020-11-12 21:26:24 +02:00
Veikko Sariola 6d883f43ab fix(test_renderer): Add include <string.h> as linux builds were giving warnings for implicit declaration of memset. 2020-11-12 19:50:59 +02:00
Veikko Sariola 1b1dabafb8 fix(asm): Change the scaling to 29 in the speed unti (29 increments = double speed).
The old speed scaling of 24 was ill-chosen so that triplets resulted in a minor buffer overflow error. This was never caught by anyone until Visual Studio 2019 in debug mode. Presumably all compilers allocate some extra space so this didn't matter. Now 29 increments = double speed and speeds with alternating 52 and 81 result in triplets that are just slightly faster then ordinary bpm i.e. the buffer will be slightly underrun, which probably is unnoticable to the user.
2020-11-12 19:46:37 +02:00
Veikko Sariola c39f434c6b feat(CI&go4k): Run go tests in cloud, skipping sample tests if on another platform than Windows. 2020-11-12 13:29:30 +02:00
Veikko Sariola 68f97d301d feat(CI): Run ctests in the cloud during push. 2020-11-12 12:59:14 +02:00
Veikko Sariola cf6a5f6c0d fix(libsointu): Do not include samples at all when building on other than windows. 2020-11-12 12:58:50 +02:00
Veikko Sariola f7017892a5 refactor(asm&go4k): Remove special treatment from stereo parameters; it's now just one parameter in the Unit map. 2020-11-10 20:45:41 +02:00
Veikko Sariola 01c39ffc15 format(tests): Autoformat all tests using the new asmfmt command. 2020-11-10 20:08:13 +02:00
Veikko Sariola 90bb1aa61f feat(cmd/asmfmt): Implement a command line utility to import and re-export a song, effectively formatting it always identically. 2020-11-10 20:05:16 +02:00
Veikko Sariola 377132321f feat(go4k): Implement .asm exporting. 2020-11-10 20:05:03 +02:00
Veikko Sariola 5ceab766cc refactor(asm&go4k): Remove double SU_SEND macros, voice(0) corresponding to local send and voice(n) corresponding to global. 2020-11-10 00:53:06 +02:00
Veikko Sariola 1c0ac08450 refactor(asm&go4k): Rename OSCILLAT and COMPRES macros to OSCILLATOR and COMPRESS.
Now the macro names correspond 1 - 1 to the unit names in go-side, allowing easier parsing.
2020-11-10 00:29:35 +02:00
Veikko Sariola 788b3721fd Add missing sendpop to UnitTypes. 2020-11-10 00:20:57 +02:00
Veikko Sariola ae334a5dfe refactor(asm&go4k): Remove FLAGS from all units; they were the source of difficulty in parsing and fragile.
All units now take parameters according to flags. Only non-numeric parameter anymore is oscillator type.
2020-11-10 00:18:56 +02:00
Veikko Sariola e36aea59a5 feat(go4k): Algorithm to construct small delay times tables by abusing overlapping of different delay times.
The problem of finding a string that contains all particular substrings is the "shortest superstring problem"; it is NP-hard and analogous to traveling salesman problem. We use simple greedy search instead of trying to find true optimum. But even with these algorithm, units that use exactly the same delay times will always appear only once in the delay times table.
2020-11-09 22:29:10 +02:00
Veikko Sariola ccb6434fac Implement compile definition RUNTIME_TABLES, which enables putting the pointers to delay and sample tables to stack.
Useful for the eventual API to be able to modify the delay and sample tables during runtime.
2020-11-02 23:10:33 +02:00
Veikko Sariola c7c752cd73 Change the stack rewind in the end of render to be slightly less fragile, anticipating putting more stuff in the stack.
Specifically, we will soon put the su_sample_offsets and su_delay_times table addresses to stack in the render_samples, to avoid hard coding them in the api call.
2020-11-02 23:10:33 +02:00
Veikko Sariola dc88b885e9 Fix warnings when built using nasm.
Nasm gives warnings about labels without colons in the end; these were particularly prevalent in struc members: ".size" has be ".size:". Nasm also wasn't happy with extra trailing commas when calling macros.
2020-11-02 22:31:22 +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 23e8bc0c5f Remove bridge.newSynthState & add 1 to RandSeed during Render calls, so now an empty struct corresponds to the Sointu default behavior. 2020-10-28 20:03:21 +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 5f4b85b0a4 Change the Go API to have two versions: Render(buffer []float32), which always fill the whole buffer, and RenderTime(buffer []float32,int maxtime), which ends either when the buffer is full, or modulated time is reached. 2020-10-27 17:26:08 +02:00
Veikko Sariola 470ba28592 Change the Render function in bridge.go to return a tuple of: number of samples rendered; bool indicating if rowend was reached; and a possible error.
The callbacks are gone; the row looping is the job of the user which is probably better for everyone.
2020-10-26 08:30:43 +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 SariolaandVeikko 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
Veikko Sariola af14cd310b Change .asm files that are actually only ever included into .inc-files, and rename all files as _header.inc & _footer.inc, depending where they are included. 2020-10-21 11:01:09 +03:00
Veikko Sariola 45e554a9f9 Fix yasm warnings about flags being ignored on section redeclaration. 2020-05-27 13:17:28 +03:00
Veikko Sariola 6f7fed4c6b Move jnc *_mono, ..., *_mono: code from function bodies to the stereofilter helper. 2020-05-20 08:49:23 +03:00
Veikko SariolaandVeikko Sariola dc99157fbb Implement unison oscillators: multiple versions of slightly detuned oscillators that are added up to make a signal. 2020-05-19 22:52:21 +03:00
Veikko Sariola adc4a6e45f Implement sample-based oscillators, with sample import from gm.dls. 2020-05-19 18:29:47 +03:00
Veikko Sariola 77b989d88d Optimize size. 2020-05-18 16:25:20 +03:00
Veikko Sariola 666fd385d1 Fix bug in SEND STEREO. 2020-05-18 16:23:49 +03:00
Veikko Sariola f06810d956 Optimize size. 2020-05-17 01:24:38 +03:00
Veikko Sariola 3b33b4e4d2 Improve README. 2020-05-16 23:27:30 +03:00
Veikko Sariola d87d2e22cf Implement new effect: bit-crusher.
Maybe a combined hold/bit-crusher effect is needed someday.
2020-05-16 23:27:29 +03:00
Veikko Sariola 6a0a2fc36c Optimize the implementations of gain and invgain. 2020-05-16 23:23:05 +03:00
Veikko Sariola ac5b4dd496 Make clip opcode working and add regression tests to it. 2020-05-16 22:49:59 +03:00
Veikko Sariola 5760f78201 Implement gain and inverse gain effects, for the moments when you just need them. 2020-05-16 22:29:08 +03:00
Veikko Sariola e966bc0084 Improve README. 2020-05-16 21:57:32 +03:00
Veikko Sariola 87264c443c Add tests for opcode stereo variants, squashing several bugs in the process. Implement receive opcode to test stereo sending. 2020-05-16 21:23:41 +03:00
Veikko Sariola f9388b028a Rename test files to represent better the new opcodes they correspond to. 2020-05-16 18:32:56 +03:00
Veikko Sariola 5c1b87f254 Improve comments for UpdateInstrument 2020-05-04 20:19:58 +03:00
Veikko SariolaandVeikko Sariola f97cea2a17 Refactor 4klang to use cross-platform defines and 4klang.asm & .inc to work more like .c and .h. 2020-04-30 13:36:22 +03:00
Veikko Sariola 09c497fef6 Add regression tests for delay modulations. 2020-04-25 11:29:14 +03:00
Veikko Sariola 7170b049d3 Add regression tests for VCF opcode and its modulations. 2020-04-24 22:51:42 +03:00
Veikko Sariola 4b9b1710eb Add regression tests for delay (DLL) opcode. 2020-04-23 20:06:41 +03:00
Veikko Sariola a49fba060c Add regression tests for distortion, including sample-and-hold and modulations. 2020-04-18 21:21:21 +03:00
Veikko Sariola 41222b09a7 Move all raw audio files related to tests into subfolders, to have slightly more clean folder structure and to avoid mixing source files and data files. 2020-04-18 19:47:16 +03:00
Veikko Sariola 886ee85a09 Improve CMakeLists.txt for tests, so it is easier to define test prerequirements.
Also added a few missing prerequirements.
2020-04-18 13:16:33 +03:00
Veikko Sariola d9f4def1d4 Add regression tests for vco modulations (cm, dm, fm, gm, pm, sm and tm) 2020-04-17 19:36:09 +03:00
Veikko Sariola cc2babde9c Add regression test for envelope modulation. 2020-04-17 18:21:37 +03:00
Veikko Sariola 462521518f Add regression tests for FST and FSTG opcodes. 2020-04-16 22:05:50 +03:00
Veikko Sariola 9c7db45a46 Rewrote parts of the test renderer to read the whole data from disk in one fread. 2020-04-16 14:05:17 +03:00
Veikko Sariola 374be5256e Add regression test for VCO opcode, lfo variant. 2020-04-16 13:37:30 +03:00
Veikko Sariola 83e3ab165e Add test for 16-bit output, also moving the testname for test_renderer into compiler definition to avoid rewriting it everytime. 2020-04-15 23:17:03 +03:00
Veikko Sariola cff4538b8c Make the CMakeLists.txt for the tests a slightly more sensible; the data files are copied after every build if they are newer. 2020-04-15 21:43:22 +03:00
Veikko Sariola d6798bdae3 Add regression test for VCO opcode (oscillator) for testing stereo sound creation. 2020-04-14 23:37:15 +03:00
Veikko Sariola 34a98ebc4a Add regression test for VCO opcode (oscillator): gate, noise, pulse and trisaw variants. 2020-04-14 23:11:10 +03:00
Veikko Sariola 38499e01bb Add regression test for VCO opcode (oscillator), sine wave variant. 2020-04-14 22:23:09 +03:00
Veikko Sariola 35b2df2a2f Require CMake version 3.15, as the Visual Studio statically linking runtime policy was introduced in it. 2020-04-14 21:44:45 +03:00
Veikko Sariola ce81ef5ef9 Add regression test for FOP opcode, loadnote variant. 2020-04-14 21:44:05 +03:00
Veikko Sariola 398543d67c Add regression tests for FOP opcode: add, addp2, mul, mulp2, push and xchg variants. 2020-04-14 18:08:57 +03:00
Veikko Sariola e790549d27 Add regression test to test fop opcode / addp, mulp and pop variants. 2020-04-13 19:10:46 +03:00
Veikko Sariola 08518a9527 Add regression test to test multiple instruments. 2020-04-13 17:50:09 +03:00
Veikko Sariola b1ba5e9e6b Add regression test to test panning opcode. 2020-04-13 17:34:46 +03:00
Veikko Sariola f33da76d1e Add regression test to test load opcode. 2020-04-13 17:18:26 +03:00
Veikko Sariola 1f0fdfc30e Improve and rename envelope test. The test focuses on GO4k_ENV opcode only and does not use panning. 2020-04-13 16:53:11 +03:00