Skip to content

Commit

Permalink
nullsound: big refactor and new pipeline processing (#2)
Browse files Browse the repository at this point in the history
Another round of refactoring to add the FX pipeline processing
to ADPCM-A and ADPCM-B.
Added support for trigger and slide effects to the ADPCM-B channels,
as well as portamento and pitch/detune.
nsstool is updated to support all those new opcodes.
  • Loading branch information
dciabrin committed Dec 10, 2024
1 parent b036db8 commit 4ebd2f8
Show file tree
Hide file tree
Showing 10 changed files with 694 additions and 606 deletions.
2 changes: 1 addition & 1 deletion nullsound/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ all: nullsound.lib linkcheck.map
-include ../Makefile.config

INCLUDE_FILES=helpers ports ym2610
OBJS=entrypoint bios-commands adpcm ym2610 stream timer nss-fm nss-adpcm nss-ssg fx-vibrato fx-slide fx-vol-slide fx-trigger volume
OBJS=entrypoint bios-commands adpcm ym2610 stream timer nss-fm nss-adpcm-a nss-ssg nss-adpcm-b fx-vibrato fx-slide fx-vol-slide fx-trigger volume
LIB=nullsound.lib

VERSION=@version@
Expand Down
23 changes: 11 additions & 12 deletions nullsound/buffers.s
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,20 @@ ssg_tune::
.dw 0x0077, 0x0070, 0x006a, 0x0064, 0x005e, 0x0059, 0x0054, 0x004f, 0x004b, 0x0047, 0x0043, 0x003f, 0, 0, 0, 0
.dw 0x003b, 0x0038, 0x0035, 0x0032, 0x002f, 0x002c, 0x002a, 0x0027, 0x0025, 0x0023, 0x0021, 0x001f, 0, 0, 0, 0

;;; Vibrato - Semitone distance table
;;; SSG frequency half-distance table
;;; ------
;;; each element in the table holds the distance to the previous semitone
;;; in the note table. The vibrato effect oscillate between one semi-tone
;;; up and down of the current note of the SSG channel.
;;; The half-distance between a semitone's SSG frequency and the next semitone's SSG frequency.
;;; This is used to compute fractional SSG frequency values from fixed-point note.
ssg_semitone_distance::
;; C-n, C#n, D-n, D#n, E-n, F-n, F#n, G-n, G#n, A-n, A#n, B-n, C-(n+1)
.db 0xe3, 0xd7, 0xca, 0xbf, 0xb5, 0xaa, 0xa1, 0x97, 0x8f, 0x88, 0x7f, 0x79, 0x71, 0, 0, 0
.db 0xe3, 0xd7, 0xca, 0xbf, 0xb5, 0xaa, 0xa1, 0x97, 0x8f, 0x88, 0x7f, 0x79, 0x71, 0, 0, 0
.db 0x71, 0x6c, 0x65, 0x60, 0x5a, 0x55, 0x50, 0x4c, 0x48, 0x43, 0x40, 0x3c, 0x39, 0, 0, 0
.db 0x39, 0x36, 0x32, 0x30, 0x2d, 0x2b, 0x28, 0x26, 0x24, 0x21, 0x20, 0x1e, 0x1d, 0, 0, 0
.db 0x1d, 0x1b, 0x19, 0x18, 0x16, 0x16, 0x14, 0x13, 0x12, 0x10, 0x10, 0x0f, 0x0f, 0, 0, 0
.db 0x0f, 0x0d, 0x0d, 0x0c, 0x0b, 0x0b, 0x0a, 0x09, 0x09, 0x08, 0x08, 0x08, 0x07, 0, 0, 0
.db 0x07, 0x07, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0, 0, 0
.db 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0, 0, 0
.db 0x6b, 0x65, 0x5f, 0x5a, 0x55, 0x50, 0x4b, 0x47, 0x44, 0x3f, 0x3c, 0x38, 0, 0, 0, 0
.db 0x6b, 0x65, 0x5f, 0x5a, 0x55, 0x50, 0x4b, 0x47, 0x44, 0x3f, 0x3c, 0x38, 0, 0, 0, 0
.db 0x36, 0x32, 0x30, 0x2d, 0x2a, 0x28, 0x26, 0x24, 0x21, 0x20, 0x1e, 0x1c, 0, 0, 0, 0
.db 0x1b, 0x19, 0x18, 0x16, 0x15, 0x14, 0x13, 0x12, 0x10, 0x10, 0x0f, 0x0e, 0, 0, 0, 0
.db 0x0d, 0x0c, 0x0c, 0x0b, 0x0b, 0x0a, 0x09, 0x09, 0x08, 0x08, 0x07, 0x07, 0, 0, 0, 0
.db 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0, 0, 0, 0
.db 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0, 0, 0, 0
.db 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0, 0, 0, 0

;;; Convert note flat representation to <octave,semitone> representation
;;; ------
Expand Down
Loading

0 comments on commit 4ebd2f8

Please sign in to comment.