ws-audio2: music/med (MED / OctaMED MMD0..MMD3): xm family with ProTracker periods, MED effects and tempo modes, play sequences, hold / decay envelopes, IFF multi-octave keymaps; engine: EXT tempo > 255, flags.envRowHold

Synthetic / hybrid / MIDI instruments are silent (listed in meta.unsupported).
This commit is contained in:
4DBug committed 2026-10-31 14:51:33 -05:00
1 parent d418458e2a
commit 3d5cf3130e
8 files changed
+935 -5

No files matched your search

+10 -3
View File
@@ -33,6 +33,7 @@ local EXT = {
AUTO_PORTA_UP = 0x44,
AUTO_PORTA_DOWN = 0x45,
FREQ_ADJUST = 0x46,
TEMPO_256 = 0x47, -- set the tempo to 256 + param (0x48: 512 + param, 0x49: 768 + param)
}
Player.EXT = EXT
@@ -222,6 +223,7 @@ function Player.new(m: any, sampleRate: number, opts: any): any
st2Tempo = flags.st2Tempo or false,
oktSlides = flags.oktSlides or false,
ft2Pan = flags.panLaw == "ft2",
envHold = flags.envRowHold or false,
ord = 0,
row = 0,
tick = 0,
@@ -1648,6 +1650,10 @@ local function fxExt(st: any, c: any, tick: number)
if tick == 0 then
c.hzAdd = param * 80
end
elseif fx >= EXT.TEMPO_256 and fx <= EXT.TEMPO_256 + 2 then
if tick == 0 then
st.tempo = (fx - EXT.TEMPO_256 + 1) * 256 + param
end
end
-- auto slides: every tick (fast portamentos) or every tick but the first
if tick > 0 or st.fastPortas then
@@ -1806,10 +1812,11 @@ local function updateVoice(st: any, v: any)
local envVol, envPan, envPitch = 64, 0, 0
local filterEnv = nil
if ins then
local hold = st.envHold and st.tick == 0 -- MED: the envelopes do not move on a row's first tick
local e = ins.volEnv
if e and e.enabled and v.volEnvOn then
local val, np, ended = updateEnvelope(e, v.volEnvPos, v.keyOn, it)
envVol, v.volEnvPos = val, np
envVol, v.volEnvPos = val, if hold then v.volEnvPos else np
if ended and it then
if val <= 0 then
v.active = false
@@ -1821,12 +1828,12 @@ local function updateVoice(st: any, v: any)
e = ins.panEnv
if e and e.enabled and v.panEnvOn then
local val, np = updateEnvelope(e, v.panEnvPos, v.keyOn, it)
envPan, v.panEnvPos = val, np
envPan, v.panEnvPos = val, if hold then v.panEnvPos else np
end
e = ins.pitchEnv
if e and e.enabled and v.pitchEnvOn then
local val, np = updateEnvelope(e, v.pitchEnvPos, v.keyOn, it)
v.pitchEnvPos = np
v.pitchEnvPos = if hold then v.pitchEnvPos else np
if e.filter then
filterEnv = val
else