sointu/tests/test_speed.asm
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

37 lines
1.4 KiB
NASM

%define BPM 100
%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
; allocate some extra memory of the output just in case or simulate exactly how many
; samples are outputted. Here the triplets are slightly faster than the original so
; they fit the default MAX_TICKS that is calculated using the simple bpm assumption.
BEGIN_PATTERNS
PATTERN 64, 0, 64, 64, 64, 0, 64, 64, 64, 0, 64, 64, 65, 0, 65, 65,
PATTERN 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; 4-rows
PATTERN 78, 0, 54, 0, 78, 0, 54, 0, 78, 0, 54, 0, 78, 0, 54, 0, ; triplets
END_PATTERNS
BEGIN_TRACKS
TRACK VOICES(1),0,0
TRACK VOICES(1),1,2
END_TRACKS
BEGIN_PATCH
BEGIN_INSTRUMENT VOICES(1) ; Instrument0
SU_ENVELOPE MONO,ATTAC(64),DECAY(64),SUSTAIN(0),RELEASE(64),GAIN(128)
SU_ENVELOPE MONO,ATTAC(64),DECAY(64),SUSTAIN(0),RELEASE(64),GAIN(128)
SU_OSCILLAT MONO,TRANSPOSE(64),DETUNE(32),PHASE(0),COLOR(96),SHAPE(64),GAIN(128), FLAGS(TRISAW)
SU_OSCILLAT MONO,TRANSPOSE(72),DETUNE(64),PHASE(64),COLOR(64),SHAPE(96),GAIN(128), FLAGS(TRISAW)
SU_MULP STEREO
SU_OUT STEREO,GAIN(128)
END_INSTRUMENT
BEGIN_INSTRUMENT VOICES(1) ; Speed changer
SU_LOADNOTE MONO
SU_SPEED
END_INSTRUMENT
END_PATCH
%include "sointu_footer.inc"