mirror of
https://github.com/vsariola/sointu.git
synced 2025-05-28 03:10:24 -04:00
Make clip opcode working and add regression tests to it.
This commit is contained in:
parent
5760f78201
commit
ac5b4dd496
@ -24,7 +24,7 @@ su_op_distort_mono:
|
|||||||
%ifdef SU_INCLUDE_WAVESHAPER
|
%ifdef SU_INCLUDE_WAVESHAPER
|
||||||
su_waveshaper:
|
su_waveshaper:
|
||||||
fxch ; x a
|
fxch ; x a
|
||||||
call MANGLE_FUNC(su_clip_op,0)
|
call su_clip
|
||||||
fxch ; a x' (from now on just called x)
|
fxch ; a x' (from now on just called x)
|
||||||
fld st0 ; a a x
|
fld st0 ; a a x
|
||||||
fsub dword [c_0_5] ; a-.5 a x
|
fsub dword [c_0_5] ; a-.5 a x
|
||||||
@ -193,15 +193,22 @@ su_op_filter_skipneghighpass:
|
|||||||
; Input: st0 : x
|
; Input: st0 : x
|
||||||
; Output: st0 : min(max(x,-1),1)
|
; Output: st0 : min(max(x,-1),1)
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
%if CLIP_ID > -1
|
|
||||||
%define SU_INCLUDE_CLIP
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%ifdef SU_INCLUDE_CLIP
|
|
||||||
|
|
||||||
SECT_TEXT(suclip)
|
SECT_TEXT(suclip)
|
||||||
|
|
||||||
EXPORT MANGLE_FUNC(su_clip_op,0)
|
%if CLIP_ID > -1
|
||||||
|
EXPORT MANGLE_FUNC(su_op_clip,0)
|
||||||
|
%ifdef INCLUDE_STEREO_CLIP
|
||||||
|
jnc su_op_clip_mono
|
||||||
|
call su_stereo_filterhelper
|
||||||
|
%define INCLUDE_STEREO_FILTERHELPER
|
||||||
|
su_op_clip_mono:
|
||||||
|
%endif
|
||||||
|
%define SU_INCLUDE_CLIP
|
||||||
|
; flow into su_doclip
|
||||||
|
%endif ; CLIP_ID > -1
|
||||||
|
|
||||||
|
%ifdef SU_INCLUDE_CLIP
|
||||||
|
su_clip:
|
||||||
fld1 ; 1 x a
|
fld1 ; 1 x a
|
||||||
fucomi st1 ; if (1 <= x)
|
fucomi st1 ; if (1 <= x)
|
||||||
jbe short su_clip_do ; goto Clip_Do
|
jbe short su_clip_do ; goto Clip_Do
|
||||||
|
@ -61,7 +61,7 @@ c_32767 dd 32767.0
|
|||||||
mov ecx, 2
|
mov ecx, 2
|
||||||
%%loop: ; loop over two channels, left & right
|
%%loop: ; loop over two channels, left & right
|
||||||
fld dword [edi]
|
fld dword [edi]
|
||||||
call MANGLE_FUNC(su_clip_op,0)
|
call su_clip
|
||||||
fmul dword [c_32767]
|
fmul dword [c_32767]
|
||||||
push eax
|
push eax
|
||||||
fistp dword [esp]
|
fistp dword [esp]
|
||||||
|
@ -89,10 +89,14 @@ regression_test(test_oscillat_gainmod "VCO_SINE;ENVELOPE;FOP_MULP;FOP_PUSH;SEND"
|
|||||||
regression_test(test_distort ENVELOPE)
|
regression_test(test_distort ENVELOPE)
|
||||||
regression_test(test_distort_mod "VCO_SINE;ENVELOPE;SEND")
|
regression_test(test_distort_mod "VCO_SINE;ENVELOPE;SEND")
|
||||||
regression_test(test_distort_stereo ENVELOPE)
|
regression_test(test_distort_stereo ENVELOPE)
|
||||||
|
|
||||||
regression_test(test_hold ENVELOPE HOLD)
|
regression_test(test_hold ENVELOPE HOLD)
|
||||||
regression_test(test_hold_mod "VCO_SINE;ENVELOPE;SEND")
|
regression_test(test_hold_mod "VCO_SINE;ENVELOPE;SEND")
|
||||||
regression_test(test_hold_stereo HOLD)
|
regression_test(test_hold_stereo HOLD)
|
||||||
|
|
||||||
|
regression_test(test_clip "VCO_SINE;ENVELOPE;FOP_MULP;INVGAIN" CLIP)
|
||||||
|
regression_test(test_clip_stereo CLIP)
|
||||||
|
|
||||||
regression_test(test_filter_band "VCO_SINE;ENVELOPE;FOP_MULP")
|
regression_test(test_filter_band "VCO_SINE;ENVELOPE;FOP_MULP")
|
||||||
regression_test(test_filter_low "VCO_SINE;ENVELOPE;FOP_MULP")
|
regression_test(test_filter_low "VCO_SINE;ENVELOPE;FOP_MULP")
|
||||||
regression_test(test_filter_high "VCO_SINE;ENVELOPE;FOP_MULP")
|
regression_test(test_filter_high "VCO_SINE;ENVELOPE;FOP_MULP")
|
||||||
|
BIN
tests/expected_output/test_clip.raw
Normal file
BIN
tests/expected_output/test_clip.raw
Normal file
Binary file not shown.
BIN
tests/expected_output/test_clip_stereo.raw
Normal file
BIN
tests/expected_output/test_clip_stereo.raw
Normal file
Binary file not shown.
28
tests/test_clip.asm
Normal file
28
tests/test_clip.asm
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
%define BPM 100
|
||||||
|
%define USE_SECTIONS
|
||||||
|
|
||||||
|
%include "../src/sointu.inc"
|
||||||
|
|
||||||
|
SU_BEGIN_PATTERNS
|
||||||
|
PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0,
|
||||||
|
SU_END_PATTERNS
|
||||||
|
|
||||||
|
SU_BEGIN_TRACKS
|
||||||
|
TRACK VOICES(1),0
|
||||||
|
SU_END_TRACKS
|
||||||
|
|
||||||
|
SU_BEGIN_PATCH
|
||||||
|
SU_BEGIN_INSTRUMENT VOICES(1) ; Instrument0
|
||||||
|
SU_ENVELOPE MONO, ATTAC(32),DECAY(32),SUSTAIN(128),RELEASE(64),GAIN(128)
|
||||||
|
SU_ENVELOPE MONO, ATTAC(32),DECAY(32),SUSTAIN(128),RELEASE(64),GAIN(128)
|
||||||
|
SU_OSCILLAT MONO, TRANSPOSE(64),DETUNE(64),PHASE(0),COLOR(96),SHAPE(64),GAIN(128), FLAGS(SINE)
|
||||||
|
SU_OSCILLAT MONO, TRANSPOSE(72),DETUNE(64),PHASE(64),COLOR(64),SHAPE(96),GAIN(128), FLAGS(SINE)
|
||||||
|
SU_MULP STEREO
|
||||||
|
SU_INVGAIN STEREO,INVGAIN(64)
|
||||||
|
SU_CLIP MONO
|
||||||
|
SU_GAIN STEREO,GAIN(64)
|
||||||
|
SU_OUT STEREO,GAIN(128)
|
||||||
|
SU_END_INSTRUMENT
|
||||||
|
SU_END_PATCH
|
||||||
|
|
||||||
|
%include "../src/sointu.asm"
|
28
tests/test_clip_stereo.asm
Normal file
28
tests/test_clip_stereo.asm
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
%define BPM 100
|
||||||
|
%define USE_SECTIONS
|
||||||
|
|
||||||
|
%include "../src/sointu.inc"
|
||||||
|
|
||||||
|
SU_BEGIN_PATTERNS
|
||||||
|
PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0,
|
||||||
|
SU_END_PATTERNS
|
||||||
|
|
||||||
|
SU_BEGIN_TRACKS
|
||||||
|
TRACK VOICES(1),0
|
||||||
|
SU_END_TRACKS
|
||||||
|
|
||||||
|
SU_BEGIN_PATCH
|
||||||
|
SU_BEGIN_INSTRUMENT VOICES(1) ; Instrument0
|
||||||
|
SU_ENVELOPE MONO, ATTAC(32),DECAY(32),SUSTAIN(128),RELEASE(64),GAIN(128)
|
||||||
|
SU_ENVELOPE MONO, ATTAC(32),DECAY(32),SUSTAIN(128),RELEASE(64),GAIN(128)
|
||||||
|
SU_OSCILLAT MONO, TRANSPOSE(64),DETUNE(64),PHASE(0),COLOR(96),SHAPE(64),GAIN(128), FLAGS(SINE)
|
||||||
|
SU_OSCILLAT MONO, TRANSPOSE(72),DETUNE(64),PHASE(64),COLOR(64),SHAPE(96),GAIN(128), FLAGS(SINE)
|
||||||
|
SU_MULP STEREO
|
||||||
|
SU_INVGAIN STEREO,INVGAIN(64)
|
||||||
|
SU_CLIP STEREO
|
||||||
|
SU_GAIN STEREO,GAIN(64)
|
||||||
|
SU_OUT STEREO,GAIN(128)
|
||||||
|
SU_END_INSTRUMENT
|
||||||
|
SU_END_PATCH
|
||||||
|
|
||||||
|
%include "../src/sointu.asm"
|
Loading…
Reference in New Issue
Block a user