Conversation
|
Figured I'd run some un-rigorous Updated for commit 03cca1b Before, with mutex/dynamically allocated vector: After, with atomic ringbuffer/statically allocated array: Project file used for said benchmarks: torture.mmp.xml |
|
|
Maybe add them to a new |
Makes the following changes to the Lb302 plugin: - Use non-static data member initializers where possible - Find suitable homes for several loose constants - Use std::numbers::pi instead of M_PI - Use std::array and std::unique_ptr instead of manual memory management - Change some plain-old-data classes with only public members to structs - Change some ints to more descriptive types such as f_cnt_t, fpp_t, etc - Attempt to conform any lines I touched to current code conventions
This should be the last of the functions from `<cmath>`
Begone, SIGNAL() SLOT() macro magic!!
...and move them to be inside the classes that own them
- Remove Lb302Note as it is just function parameters with extra steps - Clean up Lb302Synth::initNote() - Clean up Lb302Synth::process() - Move the GET_INC() helper to an anon namespace, rename to phaseInc() - Make computeDecayFactor() a lambda next to its only callsite
To avoid implicit casts, it's all supposed to be floats
Also don't bother checking for __ARM_ACLE
Also don't drop notes when the queue is full, busy-wait a limited number of iterations to see if space gets freed up
- Rename CACHELINE to lmms::hardware_destructive_interference_size - Move lmms::hardware_destructive_interference_size and busy_wait_hint() to Hardware.h
e21515b to
1b563ed
Compare
include/Hardware.h
Outdated
| #endif | ||
|
|
||
|
|
||
| #if defined(__x86_64__) || defined(_M_AMD64) || defined(__i386__) || defined(_M_IX86) |
There was a problem hiding this comment.
I would use the host architecture macros from lmmsconfig.h instead
There was a problem hiding this comment.
Mostly resolved as of 6fccf95 (MSVC is a pain in the ass as usual)
| float vcf_c0 = 0.f; // c0=e1 on retrigger; c0*=ed every sample; cutoff=e0+c0 | ||
| float vcf_e0 = 0.f; // e0 and e1 for interpolation | ||
| float vcf_e1 = 0.f; | ||
| float vcf_rescoeff; //!< Resonance coefficient [0.30, 9.54] |
There was a problem hiding this comment.
These could be renamed to follow the naming conventions for data members
There was a problem hiding this comment.
For stuff like this where it's all vcf_foo, vcf_bar, with coefficient names that are supposed to be lowercase, I'm considering sticking them all in a POD struct like so:
struct
{
float c0 = 0.f; // c0 = e[1] on retrigger; c0 *='ed every sample; cutoff = e[0] + c0
std::array<float, 2> e = { 0.f, 0.f }; // e[0] and e[1] for interpolation
float resCoeff; //!< Resonance coefficient [0.30, 9.54]
} m_vcf;| float vcf_d1, // d1 and d2 are added back into the sample with | ||
| vcf_d2; // vcf_a and b as coefficients. IIR2 resonance | ||
| // loop. | ||
| protected: |
There was a problem hiding this comment.
The data members of this class could also be renamed to follow the conventions
| float kfcn; | ||
| float kp; | ||
| float kp1; | ||
| float kp1h; | ||
| float kres; | ||
| float ay1 = 0.f; | ||
| float ay2 = 0.f; | ||
| float aout = 0.f; | ||
| float lastin = 0.f; | ||
| float value; |
plugins/Lb302/Lb302.h
Outdated
| static constexpr float DIST_RATIO = 4.f; | ||
| static constexpr fpp_t ENVINC = 64; //!< Envelope Recalculation period | ||
| static constexpr float vca_attack = 1.f - 0.96406088f; //!< Amp attack | ||
| static constexpr float vca_a0 = 0.5f; //!< Initial amplifier coefficient |
There was a problem hiding this comment.
| static constexpr float DIST_RATIO = 4.f; | |
| static constexpr fpp_t ENVINC = 64; //!< Envelope Recalculation period | |
| static constexpr float vca_attack = 1.f - 0.96406088f; //!< Amp attack | |
| static constexpr float vca_a0 = 0.5f; //!< Initial amplifier coefficient | |
| static constexpr float s_distRatio = 4.f; | |
| static constexpr fpp_t s_envInc = 64; //!< Envelope Recalculation period | |
| static constexpr float s_vcaAttack = 1.f - 0.96406088f; //!< Amp attack | |
| static constexpr float s_vcaA0 = 0.5f; //!< Initial amplifier coefficient |
Following the conventions for private static data members.
The other data members in this class could also be updated.
There was a problem hiding this comment.
Fixed static members in ac820f4, the rest still todo.
- #include <new> *before* testing macro defined within it (lol) - Make #ifdef chain for hardware_destructive_interference_size more readable - Use LMMS_HOST_* macros from lmmsconfig.h where possible - Move #includes for busy_wait_hint() to top of file - Make busy_wait_hint() a function rather than a macro - Minor formatting changes
15 is the only allowed value, so that is used regardless of whatever is passed in
d3615aa to
7e031da
Compare
|
Edit: Bug introduced in 1b563ed, is fixed by 0fc7d88. Hooray for |
- Restored a line that resets the slide-from note when a slide is done, the accidental removal of which was the cause of a weird bug - Actually remove initSlide() and initNote() which were supposed to be fully inlined
788dda5 to
0fc7d88
Compare
- Remove redundant `db24Toggled()` calls on init and preset load - Move filter envelope decay stuff that does not require `recalcFilter()` from `filterChanged()` into new slot `decayChanged()`
Makes the following changes to the Lb302 plugin for increased maintainability and readability:
std::numbers::piinstead ofM_PIstd::arrayandstd::unique_ptrinstead of manual memory managementclasses with only public members tostructsints tof_cnt_t,fpp_t, etc. to better communicate their purpose and avoid weird implicit casting nonsensefloats tosample_twhere appropriate to better communicate their purposestd::floats end infand are notdoubles to appease MSVCSIGNALandSLOTmacros to whatever they should be post-Qt6 upgradestruct/classmember layout for better localityThe above list is not comprehensive and is destined to expand.