mirror of
https://github.com/LMMS/lmms.git
synced 2026-01-23 22:08:02 -05:00
* use c++ std::* math functions This updates usages of sin, cos, tan, pow, exp, log, log10, sqrt, fmod, fabs, and fabsf, excluding any usages that look like they might be part of a submodule or 3rd-party code. There's probably some std math functions not listed here that haven't been updated yet. * fix std::sqrt typo lmao one always sneaks by * Apply code review suggestions - std::pow(2, x) -> std::exp2(x) - std::pow(10, x) -> lmms::fastPow10f(x) - std::pow(x, 2) -> x * x, std::pow(x, 3) -> x * x * x, etc. - Resolve TODOs, fix typos, and so forth Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com> * Fix double -> float truncation, DrumSynth fix I mistakenly introduced a bug in my recent PR regarding template constants, in which a -1 that was supposed to appear outside of an abs() instead was moved inside it, screwing up the generated waveform. I fixed that and also simplified the function by factoring out the phase domain wrapping using the new `ediv()` function from this PR. It should behave how it's supposed to now... assuming all my parentheses are in the right place lol * Annotate magic numbers with TODOs for C++20 * On second thought, why wait? What else is lmms::numbers for? * begone inline Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com> * begone other inline Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com> * Re-inline function in lmms_math.h For functions, constexpr implies inline so this just re-adds inline to the one that isn't constexpr yet * Formatting fixes, readability improvements Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com> * Fix previously missed pow() calls, cleanup Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com> * Just delete ediv() entirely lmao No ediv(), no std::fmod(), no std::remainder(), just std::floor(). It should all work for negative phase inputs as well. If I end up needing ediv() in the future, I can add it then. * Simplify DrumSynth triangle waveform This reuses more work and is also a lot more easy to visualize. It's probably a meaningless micro-optimization, but it might be worth changing it back to a switch-case and just calculating ph_tau and saw01 at the beginning of the function in all code paths, even if it goes unused for the first two cases. Guess I'll see if anybody has strong opinions about it. * Move multiplication inside abs() * Clean up a few more pow(x, 2) -> x * x * Remove numbers::inv_pi, numbers::inv_tau * delete spooky leading 0 Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com> --------- Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com> Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
LB303 Bass Synth - Known bugs, issues, and missing features
-----------------------------------------------------------
2007.02.03 - First release
--------------------------
Important note, in the current incarnation there are many behaviors,
constants, and other items that will be changed. This will result
in a change of the instrument's timbre and functionality. Therefore,
it would be wise to not make any masterpieces with the synth at
this point in time.
BUG:
Fix the awful clicking cause by adjacent notes. This problem seems
to be caused by 'unexhausted buffers' That is, the problem manifests
itself to a greater degree when the user "buffer size" configuration
is increased to over 1024 frames or so. The problem is much less
noticeable when the buffer size is set to 64 frames.
BUG:
The synth does not make accomodations for sampling rates other than
44100. This should be easy to fix, but I haven't gotten around to
it; nor do I have the means to test it.
BUG:
I get segfaults now and then. Granted, I've rarely used LMMS
without also using LB302, so I do not know if the problem is actually
in the Bass Synth. I have gotten the backtraces a few times:
...
audioEngine::renderNextBuffer()
audioEngine::nextAudioBuffer()
QOBject::activate_signal()
??()
and
...
instrumentTrack::play()
notePlayHandle()
instrumentTrack::processOutEvent()
fadeButton::activate()
QSingleShotTimer::start()
qStartTimer()
qKillTimer()
QGList::insertAt()
TODO:
Add accent feature. This isn't as bad as it sounds, but will require
some tweaking to get right.
TODO:
LB302 contains code for a short fixed-length default decay. If a
released note is using a user-defined VCA from the instrument
panel, then LB302 should not do anything special. However, if no
envelope is specified, then LB302 should request enough release-frames
in order to apply the built-in exponential decay.
TODO:
The original TB-303's square wave is not 50% duty cycle. The peaks are
supposed to slope down slightly. It would be nice to be able to
configure this. In fact, each waveform could have a parameter knob to
change some aspect of the wave. See Lb302.cpp:643 for more info.
TODO:
Must decide on proper action to take when a slide note is interrupted
by another slide note. Right now, the slide-from frequency is always
replaced with the prior note. However, we may wish to maintain the
current frequency in order to make the sound more continuous.
TODO:
The default filter's distortion could use some work.
effectLib::distortion<> gets the job done, but the coefficients need
to more closely match that of Lb302Filter3Pole's tanh distortion.
TODO:
Slide decay needs a better knob mapping. sqrt()? Lb302.cpp:588
TODO:
Consider making the slide trigger set the note to slide TO as opposed
to the note to slide FROM. I originally did FROM in order to match
the real 303. However, TO may be more intuitive.
TODO:
Various code refactoring, as well as precomputing some values.
TODO:
Remove one of the sawtooth waveforms in favor of the other?