@@ -108,7 +108,7 @@ _state_adpcm_b_end:
108108 .area CODE
109109
110110
111- ;;; context: channel action functions for FM
111+ ;;; context: channel action functions for ADPCM-B
112112state_b_action_funcs::
113113 . dw adpcm_b_configure_note_on
114114 . dw adpcm_b_configure_vol
@@ -454,18 +454,25 @@ _b_cfg_note_update:
454454 ld NOTE(ix) , a
455455 ld NOTE16 + 1 (ix) , a
456456 ld NOTE16(ix) , # 0
457- ;; do not stop the current note if a legato is in progress
457+ ;; legato have a special treatment below, otherwise prepare
458+ ;; state for playing a new note from the start
458459 bit BIT_FX_LEGATO , NOTE_FX(ix)
459460 jr z , _b_post_cfg_note_update
461+ ;; legato is like regular note start when no note is playing...
462+ bit BIT_PLAYING , PIPELINE(ix)
463+ jr z , _b_cfg_start_new_note
464+ ;; ... otherwise it just consist in reloading a note frequency
460465 set BIT_LOAD_NOTE , PIPELINE(ix)
461466 jr _b_cfg_note_end
462467_b_post_cfg_note_update:
463468 res BIT_NOTE_STARTED , PIPELINE(ix)
464469_b_cfg_note_prepare_ym2610:
465- ;; stop playback on the channel, and let the pipeline restart it
470+ ;; stop playback on the current channel, and let the pipeline
471+ ;; restart the ADPCM-B note from start, including its macro state
466472 ld b , #REG_ADPCM_B_START_STOP
467473 ld c , # 1 ; reset flag (clears start and repeat in YM2610)
468474 call ym2610_write_port_a
475+ _b_cfg_start_new_note:
469476 ld a , PIPELINE(ix)
470477 or #(STATE_PLAYING|STATE_LOAD_NOTE)
471478 ld PIPELINE(ix) , a
@@ -496,7 +503,7 @@ _b_cfg_vol_end:
496503
497504
498505;;; ADPCM_B_NOTE_ON
499- ;;; Emit a specific note (frequency) on an FM channel
506+ ;;; Emit a specific note (frequency) on the ADPCM-B channel
500507;;; ------
501508;;; [ hl ]: note
502509adpcm_b_note_on::
0 commit comments