@@ -50,6 +50,28 @@ trigger_delay_init::
50
50
ret
51
51
52
52
53
+ ;;; Enable delayed cut for the note currently playing
54
+ ;;; (note is stopped after a defined number of steps)
55
+ ;;; ------
56
+ ;;; ix : state for channel
57
+ ;;; [ hl ]: delay
58
+ ;;; [ hl modified ]
59
+ trigger_cut_init: :
60
+ ;; a: delay
61
+ ld a, (hl)
62
+ inc a
63
+ inc hl
64
+
65
+ ;; configure trigger FX for delay
66
+ ld TRIGGER_CUT(ix), a
67
+ xor a
68
+ set BIT_TRIGGER_ACTION_CUT, a
69
+ ld TRIGGER_ACTION(ix), a
70
+ set BIT_FX_TRIGGER, FX(ix)
71
+
72
+ ret
73
+
74
+
53
75
;;; Call an function from the action lookup table
54
76
;;; ------
55
77
;;; hl: function lookup table
@@ -89,6 +111,15 @@ eval_trigger_step::
89
111
jr nz, _trigger_end
90
112
jr _trigger_load_and_clear
91
113
_trigger_post_delay:
114
+
115
+ ;; is the trigger a cut?
116
+ bit BIT_TRIGGER_ACTION_CUT, TRIGGER_ACTION(ix)
117
+ jr z, _trigger_post_cut
118
+ ;; check whether delay is reached
119
+ dec TRIGGER_CUT(ix)
120
+ jr nz, _trigger_end
121
+ jr _trigger_cut_note
122
+ _trigger_post_cut:
92
123
_trigger_end:
93
124
ret
94
125
@@ -115,3 +146,13 @@ _trigger_post_load_vol:
115
146
res BIT_FX_TRIGGER, FX(ix)
116
147
117
148
ret
149
+
150
+ _trigger_cut_note:
151
+ ld bc, #TRIGGER_STOP_NOTE_FUNC
152
+ call trigger_action_function
153
+ xor a
154
+ ld TRIGGER_ACTION(ix), a
155
+ res BIT_FX_TRIGGER, FX(ix)
156
+
157
+ ret
158
+
0 commit comments