mirror of
https://github.com/vsariola/sointu.git
synced 2026-02-09 17:20:16 -05:00
refactor(asmformat): .asm starts and stops with BEGIN_SONG and END_SONG which define all the magic defines and BPMs.
Now, every setting is visible to the user, so no need to guess magic defines.
This commit is contained in:
@ -292,7 +292,7 @@ EXPORT MANGLE_FUNC(su_power,0)
|
||||
; Stack : sample row pushad output_ptr
|
||||
;-------------------------------------------------------------------------------
|
||||
%macro output_sound 0
|
||||
%ifndef OUTPUT_16BIT
|
||||
%ifndef SU_OUTPUT_16BIT
|
||||
%ifndef SU_CLIP_OUTPUT ; The modern way. No need to clip; OS can do it.
|
||||
mov _DI, [_SP+su_stack.bufferptr - su_stack.output_sound] ; edi containts ptr
|
||||
mov _SI, PTRWORD su_synth_obj + su_synthworkspace.left
|
||||
@ -316,6 +316,7 @@ EXPORT MANGLE_FUNC(su_power,0)
|
||||
cmp ecx,2
|
||||
jl %%loop
|
||||
mov dword [_SP+su_stack.bufferptr - su_stack.output_sound], _SI ; save esi back to stack
|
||||
%define SU_INCLUDE_CLIP
|
||||
%endif
|
||||
%else ; 16-bit output, always clipped. This is a bit legacy method.
|
||||
mov _SI, [_SP+su_stack.bufferptr - su_stack.output_sound] ; esi points to the output buffer
|
||||
@ -335,6 +336,7 @@ EXPORT MANGLE_FUNC(su_power,0)
|
||||
loop %%loop
|
||||
mov [_SP+su_stack.bufferptr - su_stack.output_sound], _SI ; save esi back to stack
|
||||
%define USE_C_32767
|
||||
%define SU_INCLUDE_CLIP
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
%ifndef SOINTU_INC
|
||||
%define SOINTU_INC
|
||||
|
||||
; You will have to define a BPM for your song, e.g.
|
||||
; %define BPM 100
|
||||
|
||||
%macro EXPORT 1
|
||||
global %1
|
||||
%1:
|
||||
@ -77,10 +74,6 @@
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%ifdef OUTPUT_16BIT
|
||||
%define SU_INCLUDE_CLIP
|
||||
%endif
|
||||
|
||||
%assign CUR_ID 2
|
||||
%define CMDS ; CMDS is empty at first, no commands defined
|
||||
%define OPCODES MANGLE_FUNC(su_op_advance,0),
|
||||
@ -114,7 +107,29 @@ section .text ; yasm throws section redeclaration warnings if strucs are defined
|
||||
%endif
|
||||
|
||||
%define TOTAL_ROWS (MAX_PATTERNS*PATTERN_SIZE)
|
||||
%define SAMPLES_PER_ROW (SAMPLE_RATE*4*60/(BPM*16))
|
||||
%define SAMPLES_PER_ROW (SAMPLE_RATE*4*60/(SU_BPM*16))
|
||||
|
||||
%macro BEGIN_SONG 4
|
||||
%xdefine SU_BPM %1
|
||||
%if %2 == 1
|
||||
%define SU_OUTPUT_16BIT
|
||||
%endif
|
||||
%if %3 == 1
|
||||
%define SU_CLIP_OUTPUT
|
||||
%endif
|
||||
%if %4 == 1
|
||||
%define INCLUDE_DELAY_MODULATION
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro END_SONG 0
|
||||
%include "sointu/footer.inc"
|
||||
%endmacro
|
||||
|
||||
%define BPM(val) val
|
||||
%define OUTPUT_16BIT(val) val
|
||||
%define CLIP_OUTPUT(val) val
|
||||
%define DELAY_MODULATION(val) val
|
||||
|
||||
%macro BEGIN_PATCH 0
|
||||
SECT_DATA(params)
|
||||
|
||||
Reference in New Issue
Block a user