feat(Song): Support HOLD definition, allowing using other values than 1 as the hold.

This commit is contained in:
Veikko Sariola
2020-12-07 09:01:53 +02:00
parent 975a171d8c
commit 1a633778bc
95 changed files with 174 additions and 180 deletions

View File

@ -438,14 +438,14 @@ su_calculate_voices_loop: ; do {
inc ecx ; ecx++ // ecx=the first voice of next track
jc su_calculate_voices_loop ; } while bit ecx-1 of bitmask is on
push _CX ; Stack: next_instr ptrnrow
cmp al, HLD ; anything but hold causes action
cmp al, SU_HOLDVALUE ; anything but hold causes action
je short su_update_voices_nexttrack
mov cl, byte [_BP]
mov edi, ecx
add edi, ebx
shl edi, MAX_UNITS_SHIFT + 6 ; each unit = 64 bytes and there are 1<<MAX_UNITS_SHIFT units + small header
do inc dword [,su_synth_obj+su_synthworkspace.voices+su_voice.release,_DI,] ; set the voice currently active to release; notice that it could increment any number of times
cmp al, HLD ; if cl < HLD (no new note triggered)
cmp al, SU_HOLDVALUE ; if cl < HLD (no new note triggered)
jl su_update_voices_nexttrack ; goto nexttrack
inc ecx ; curvoice++
cmp ecx, edx ; if (curvoice >= num_voices)
@ -483,7 +483,7 @@ su_update_voices_trackloop:
movzx eax, byte [_SI] ; eax = current pattern
imul eax, PATTERN_SIZE ; eax = offset to current pattern data
do{movzx eax, byte [}, MANGLE_DATA(su_patterns),_AX,_DX,] ; ecx = note
cmp al, HLD ; anything but hold causes action
cmp al, SU_HOLDVALUE ; anything but hold causes action
je short su_update_voices_nexttrack
inc dword [_DI+su_voice.release] ; set the voice currently active to release; notice that it could increment any number of times
jb su_update_voices_nexttrack ; if cl < HLD (no new note triggered) goto nexttrack

View File

@ -102,14 +102,10 @@ section .text ; yasm throws section redeclaration warnings if strucs are defined
%define SAMPLE_RATE 44100
%endif
%ifndef HLD
%define HLD 1
%endif
%define TOTAL_ROWS (MAX_PATTERNS*PATTERN_SIZE)
%define SAMPLES_PER_ROW (SAMPLE_RATE*4*60/(SU_BPM*16))
%macro BEGIN_SONG 4
%macro BEGIN_SONG 5
%xdefine SU_BPM %1
%if %2 == 1
%define SU_OUTPUT_16BIT
@ -120,6 +116,7 @@ section .text ; yasm throws section redeclaration warnings if strucs are defined
%if %4 == 1
%define INCLUDE_DELAY_MODULATION
%endif
%xdefine SU_HOLDVALUE %5
%endmacro
%macro END_SONG 0
@ -130,6 +127,7 @@ section .text ; yasm throws section redeclaration warnings if strucs are defined
%define OUTPUT_16BIT(val) val
%define CLIP_OUTPUT(val) val
%define DELAY_MODULATION(val) val
%define HOLD(val) val
%macro BEGIN_PATCH 0
SECT_DATA(params)