Open undisbeliever opened 3 weeks ago
The first piece of feedback running through my head is that there should be a way to disable noise in the middle of a note (as in, prior to key off). That is... a disable_noise
instruction.
I also have a way to handle the noise generator situation between music and SFX, at least so that there is some handling to avoid conflicts:
N
/negative flag is what I'm looking at) means they're not used, since noise is five bits from 0-31.NON
DSP register portion for the music only. The SFX will modify one of the NON
bits if it is in use.I've edited the play_noise
instruction to add a way to disable noise.
Any sound that has a lower priority while noise is being used by more than one instance will have their VxVOL values zeroed out
This sounds possible but also very complicated in terms of managing state. The main difficulty is determining when to restore a channel's volume when noise stops in a different channel. I'm not sure if it is worth the added complexity at the moment.
I'll have to think about this after I've added the play_noise
instruction to the audio-driver.
I was looking at _update_vol_shadow_if_required__inline
(albeit this may or may not turn it into an actual subroutine call in the process) to do the job of zeroing out VxVOL instead of doing a vol + pan calculation if the voice is using noise and it fails a priority check (as well as setting a dirty voice bit), and the process may be simplified if instead of a NON bit variable the music is forced to only have one voice at a time set for using noise, and the voice ID is saved in that memory location, since then the X register can simply be set to the voice ID in question.
On the MML side of things, I think N-
, even without a value, might do the trick for turning off noise on a channel. This should also automatically be done when a SFX or music instance is terminated.
play_pitch
and the pitch modulation instructions sound alright in terms of possible conflicts in MML, because P
takes a number to begin with, whereas PM
has a letter as the second character.
For set_detune_offset
, I'd keep it running during instrument transitions, mostly because the same thing is happening for other commands (thinking of vibrato, early release, etc.).
Updated 22 November 2024
[ ]
play_pitch pppppppp O-pppppp tttttttt
Set PITCH register to p, wait t ticks, key-off if O set.
MML syntax (unsure, might conflict with
PM
pitch-modulation):P<0..16383> [,length]
(with key-off)P<0..16383> [,length] &
(no key-off)[ ]
play_noise u8 noise_frequency
Play noise
MML syntax:
N<0..31> [,length]
MML syntax:
N-
disables noiseNoise is disabled on the next
play_note
instructionNoise is disabled if
noise_frequency
is out-of-bounds (> 31).disable_noise
toplay_noise $ff
disable_noise
into a real bytecode instruction if it is used often enough.CAUTION: There is only 1 noise generator. This command will will change the noise frequency on all channels playing noise.
CAUTION: The instrument is used to determine the length of the noise.
TODO: Still unsure of what to do when 2 channels want to play noise at the same time. (I will figure it out after I code the noise instruction.)
[ ]
enable_pmod
Enable pitch modulation on this channel
MML syntax:
PM
(unsure, might conflict withP
play pitch)Only channels B to F can be pitch modulated.
Channels G & H cannot be pitch-modulated as it conflicts with sound-effect channel ducking.
CAUTION: tad-gui's Play song from cursor feature cannot accurately emulate pmod. (The rust bytecode interpreter does not emulate key-on or envelopes.)
[ ]
disable_pmod
Disable pitch modulation on this channel
MML syntax:
PM0
[ ]
set_detune offset
Adds
offset
to the PITCH register in allplay_note
andportamento
instructionsMML syntax:
D <offset>
(detune)Three bytecode instructions:
set_detune_i16
- Set i16 detune offsetset_detune_p8 arg
- Sets low byte toarg
, sets high byte to 0set_detune_n8 arg
- Sets low byte toarg
, sets high byte to 0xffThe bytecode module will determine which instruction to use.
CAUTION: detune is not disabled when the instrument is changed.
[ ]
disable_detune
Disable detune
MML syntax:
D0
[ ]
MD <cents>
MML commandSimilar to
MP
vibrato, it would calculate the detune offset to use on each play-note instruction.Argument is in cents (1/100th of a semitone).