Gah... I'm pulling my hair out trying to find bugs in my audio emulation.
When a channel's correspond bit is written to as zero on register $4015, the channel length counter and audio is disabled - right? Bit 1 -> 0, set length counter to 0 and disable channel audio output and even handling. What about from 0 -> 1, re-enabling it? Is anything re-enabled or reloaded?
For audio channels with envelope support, if LC = 00b and then the 4th reg of that corresponding channel is written to, then envelope volume is reset to 15 and the decay counter is reloaded as well - correct? What about writes to any other registers of such channel? As in; writing to the first register of the channel immediately resets the envelope decay counter(and volume back to max) and length counter reloaded (assuming LC=00b).
Between the nesdev wiki and the apu_ref.txt doc, I'm not sure I got all the behaviors down correctly :/
Edit:
Ok, one specific example: Megaman 2 Metalman stage. The noise channel gets written to every frame. $00 -> $400c, $0f -> $4015, and $03 -> $400e. But the noise channel doesn't appear to restart the volume/audio at all per frame. About every 5 frame, $07 is written to $4015 (and then on the next frame back to $0f. So disables the channel for a frame then re-enables it next frame and waits a series of frames before doing it again). And the length counter is set to $FE ticks (LLLL L--- is $08).
When a channel's correspond bit is written to as zero on register $4015, the channel length counter and audio is disabled - right? Bit 1 -> 0, set length counter to 0 and disable channel audio output and even handling. What about from 0 -> 1, re-enabling it? Is anything re-enabled or reloaded?
For audio channels with envelope support, if LC = 00b and then the 4th reg of that corresponding channel is written to, then envelope volume is reset to 15 and the decay counter is reloaded as well - correct? What about writes to any other registers of such channel? As in; writing to the first register of the channel immediately resets the envelope decay counter(and volume back to max) and length counter reloaded (assuming LC=00b).
Between the nesdev wiki and the apu_ref.txt doc, I'm not sure I got all the behaviors down correctly :/
Edit:
Ok, one specific example: Megaman 2 Metalman stage. The noise channel gets written to every frame. $00 -> $400c, $0f -> $4015, and $03 -> $400e. But the noise channel doesn't appear to restart the volume/audio at all per frame. About every 5 frame, $07 is written to $4015 (and then on the next frame back to $0f. So disables the channel for a frame then re-enables it next frame and waits a series of frames before doing it again). And the length counter is set to $FE ticks (LLLL L--- is $08).