hydrogen-music / hydrogen

The advanced drum machine for Linux, macOS, and Windows
http://www.hydrogen-music.org
GNU General Public License v2.0
1.03k stars 172 forks source link

Tolerate negative length notes (impossibly early release) #1870

Closed cme closed 10 months ago

cme commented 11 months ago

The AudioEngine could (and still can in rare circumstances) calculate the length of a note as negative. Previously this would have caused the ADSR implementation to write past the beginning of the buffer as pre-Release states would assume that Release must be in the future.

Instead, detect an early Release point and move directly to the Release state.

theGreatWhiteShark commented 11 months ago

All checks have failed

I did also see this locally. ADSRTest::testBufferChunks() seems to pass negative parameters at the end of its loop too.

cme commented 11 months ago

All checks have failed

I did also see this locally. ADSRTest::testBufferChunks() seems to pass negative parameters at the end of its loop too.

The test can also enter in 'idle' state, which I didn't account for!