Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Envelope Generator - Don't divide by zero #3381

Merged
merged 1 commit into from
Jul 20, 2017

Conversation

zonkmachine
Copy link
Member

@zonkmachine zonkmachine commented Feb 23, 2017

Some think it's rude so I cleaned up EnvelopeAndLfoParameters.cpp a bit. I caught this because the new reverb went NaN and things shut down when I turned up the decay.
I made const f_cnt_t minimumFrames and didn't touch the knob values even though you could give them saner minimum values but you would still need to set some of the f_cnt_t variables in EnvelopeAndLfoParameters::updateSampleVars() so I went this way instead.

In the LFO m_lfoAttackFrames also use minimumFrames.

@zonkmachine zonkmachine changed the title Envelopedividezero Envelope Generator - Don't divide by zero Feb 23, 2017
@zonkmachine
Copy link
Member Author

removed from In Progress in Release 1.2.0 RC3

Removing from RC3 project as this is nothing new and needs more time.

@Umcaruje
Copy link
Member

@zonkmachine is this targeted for 1.2?

@zonkmachine
Copy link
Member Author

@zonkmachine is this targeted for 1.2?

No. I don't think we should do any changes for 1.2 concerning NaN's and 0 divisions etc. It's not one bug and it's not introduced in 1.2 . It sucks a bit but I won't have time to work on this now.

@zonkmachine zonkmachine added this to the 1.3.0 milestone Apr 12, 2017
@zonkmachine
Copy link
Member Author

zonkmachine commented Jul 18, 2017

It's not one bug...

I had a second go at this as #3687 made debugging so much easier. The ones in the envelope seems clearly defined and straight forward to just give a minimum frame of 1.

This one is ready to be merged into master. It should clear up a couple of the NaN oriented bugs for sure.
It also makes debugging with the new WANT_DEBUG_FPE flag more practical as you currently can't start lmms with any instruments because it will give a floating point error as soon as
EnvelopeAndLfoParameters::updateSampleVars() is run.

We perform division with some Envelope and LFO variables so they mustn't
be zero. They are given a minimum value of one frame ( f_cnt_t ).
Since LMMS#3687 we have a compile flag to turn on debugging of floating point
operations. This will currently not let you pass the Envelope/LFO
initiation and this is also fixed by this PR.
@zonkmachine
Copy link
Member Author

Some final adjustments. To test this commit I suggest compiling with and without WANT_DEBUG_FPE to see the difference.

I intend to merge this in a day.

@zonkmachine zonkmachine merged commit 6f1b11f into LMMS:master Jul 20, 2017
@zonkmachine zonkmachine deleted the envelopedividezero branch July 20, 2017 00:47
sdasda7777 pushed a commit to sdasda7777/lmms that referenced this pull request Jun 28, 2022
We perform division with some Envelope and LFO variables so they mustn't
be zero. They are given a minimum value of one frame ( f_cnt_t ).
Since LMMS#3687 we have a compile flag to turn on debugging of floating point
operations. This will currently not let you pass the Envelope/LFO
initiation and this is also fixed by this PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants