Commit Graph

381 Commits

Author SHA1 Message Date
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
c153239710 feat(go4k): Document all the UnitTypes in a 'constant' table. Tells what parameters each unit takes. 2020-11-08 20:49:38 +02:00
Veikko Sariola
bcbb5aaf19 feat: Delays and samples are now working through the bridge.
One should call bridge.Init() once during the initialization of the program to load the static sample table. On linux, bridge.Init() does nothing.
2020-11-08 16:03:10 +02:00
Veikko Sariola
e65b08d2b3 fix(tracker): Change the "flags" parameter to "type", because this is what the bridge nowadays expects. 2020-11-08 14:19:54 +02:00
Veikko Sariola
05899fc185 Merge branch 'draft/go-tracker' 2020-11-08 14:15:29 +02:00
Veikko Sariola
d5886c0920 Change unison to be in the range of 0 - 3.
With this change, forgetting to initialize unison results in the default behaviour: 0 means one oscillator, 3 means four oscillators in unison.
2020-11-08 10:17:43 +02:00
Matias Lahti
b1ac141ea5 fix(tracker/sequencer): add a way to exit the sequencer loop 2020-11-08 04:27:52 +02:00
Matias Lahti
d30388a09a fix(tracker): fix invalid println 2020-11-08 04:22:00 +02:00
Matias Lahti
5e45e4f1f4 feat(tracker): hook up audio to tracker, we have liftoff
audio still a bit crackly; should probably decouple actual row ticking and rendering of audio (but how does that work with tempo ops?)

sequencer goroutine is a bit weird, too, should rethink
2020-11-08 04:17:21 +02:00
Matias Lahti
175bbb7743 fix(tracker/track): re-enable clipping of tracks 2020-11-08 02:48:52 +02:00
Matias Lahti
7a434f69fd fix(go/audio): fix audio.Player interface to have erroring Close()
not sure if this is actually required, though? shouldn't we just try to close and disregard errors?
2020-11-08 02:41:42 +02:00
Matias Lahti
9b6249a1a7 feat(tracker): implement basic tracker keys 2020-11-08 02:36:24 +02:00
Matias Lahti
77949bdc17 feat(tracker): implement basic track display 2020-11-08 02:24:27 +02:00
Matias Lahti
90c3536f3e feat(tracker): implement some basic styled ui building blocks 2020-11-08 01:20:53 +02:00
Veikko Sariola
910bf42da9
Update README.md 2020-11-07 21:31:24 +02:00
Veikko Sariola
9209aa1cba Implement .asm parsing in go4k, and run succesfully almost all tests/ through the bridge.
Delays and samples are not implemented yet and thus the tests are skipped, as these require parsing the delay and sample tables also. Various macronames were changed to be more sensible and consistent i.e. ATTAC was changed to ATTACK. GatesLow and GatesHigh was removed for the time being and the tracker will just have to know they are the SHAPE and COLOR parameters. SU_SPEED was changed to take a parameter so the parser picks it up.
2020-11-07 21:05:55 +02:00
Matias Lahti
64fe28a240 feat(tracker): create initial tracker skeleton using Gio 2020-11-07 19:50:37 +02:00
Matias Lahti
5eb7cef889 style(go/audio/oto): change error messages to be consistent 2020-11-07 19:38:58 +02:00
Matias Lahti
6e141f36c7 fix(go/audio/oto): clean up forgotten debug prints 2020-11-07 19:37:33 +02:00
Matias Lahti
551a7cb6c0 feat(sointu-player): implement a basic commandline tool to play songs 2020-11-07 19:34:46 +02:00
Matias Lahti
fa772ddd77 feat(go/audio): implement basic audio output with oto
splitting implementation into a separate package to potentially allow for other sorts of output, too.
2020-11-07 19:33:39 +02:00
Matias Lahti
41ce5d1efe Merge remote-tracking branch 'upstream/master' into draft/go-tracker 2020-11-07 17:27:11 +02:00
Veikko Sariola
f584138572 Remove expressions from parameters, so the future .asm parser does not need expression evaluator. 2020-11-04 23:31:08 +02:00
Veikko Sariola
df83001a64 Change delay macros to use FLAGS(NOTETRACKING) and FLAGS(NONE)
Previously it was + NOTETRACKING. This new way of using FLAGS(...) is more consistent with other macros, making the .asm format easier to parse.
2020-11-04 23:29:16 +02:00
Veikko Sariola
d99cfd92d9 Change LOCALPORT and GLOBALPORT macros so that SU_SEND commands are easier to parse.
The new format is to give either 5 or 6 parameters to SU_SEND, corresponding to local and global send, respectively. For example, a global send:
        SU_SEND     MONO,AMOUNT(128),VOICE(2),UNIT(0),PORT(1),FLAGS(SEND_POP)

The SU_SEND macro does the address packing into word.
2020-11-04 23:11:51 +02:00
Veikko Sariola
4eaa54ecee
Update LICENSE: Fix whitespace. 2020-11-02 23:14:01 +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
b94bb79366
Update README.md 2020-11-02 22:43:15 +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
Matias Lahti
9544a130ab feat(song): add basic JSON marshaling/unmarshaling tests to make sure everything gets marshalled properly
TBD: should the various []bytes be marshaled in a different way? Go defaults to base64-encoded strings but creating just plain JSON arrays with bytes could be more friendly to both humans and computers.
2020-11-02 16:36:54 +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
7a9ac3489b Add polyphonism support to bridge.go 2020-10-26 13:06:50 +02:00
Veikko Sariola
1d07b4f192 Change the .asm song format so it's a bit easier to parse, by replacing PORT and GLOBALPORT macros with LOCALPORT and GLOBALPORT.
The LOCALPORT and GLOBALPORT just get numeric parameters (unit, port) and (voice, unit, port), respectively, which should be now quite intuitive as most of the time the port index is one of the parameters visible in the .asm file. Only a few units have extra ports beyond transformed variables. Overall, this should make the parsing of the .asm files a lot easier.
2020-10-26 12:55:15 +02:00
Veikko Sariola
f495b0575a Fix bug in song.go: the note was pulled from the song data incorrectly. 2020-10-26 12:55:14 +02:00