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 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; |
- #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()`
| INCLUDE(BuildPlugin) | ||
|
|
||
| IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU") | ||
| ADD_COMPILE_OPTIONS(-Wno-interference-size) |
There was a problem hiding this comment.
GCC complains and I need it to not do that
Unrelated to this commit, but I just realized there's an ancient README. That may be worth reviewing and either updating or deleting it, depending on its contents.
|
@sakertooth from #8280:
Replying here since discussion of this PR belongs in this PR.
// Instrument.h:76
// if the plugin doesn't play each note, it can create an instrument-
// play-handle and re-implement this method, so that it mixes its
// output buffer only once per audio engine period
virtual void play( SampleFrame* _working_buffer );
// to be implemented by actual plugin
virtual void playNote( NotePlayHandle * /* _note_to_play */,
SampleFrame* /* _working_buf */ )
{
}
This is a good suggestion. As of 6aec972, I've moved the |
Also update/fix some comments
Each call to My idea was that maybe you can remove the This is somewhat hard to explain (and also might not work), but this is just a idea I had that sprung into my mind to remove that seemingly redundant void InstrumentPlayHandle::play(SampleFrame* working_buffer)
{
InstrumentTrack * instrumentTrack = m_instrument->instrumentTrack();
// ensure that all our nph's have been processed first
auto nphv = NotePlayHandle::nphsOfInstrumentTrack(instrumentTrack, true);
bool nphsLeft;
do
{
nphsLeft = false;
for (const auto& handle : nphv)
{
if (handle->state() != ThreadableJob::ProcessingState::Done && !handle->isFinished())
{
nphsLeft = true;
const_cast<NotePlayHandle*>(handle)->process();
}
}
}
while (nphsLeft);
m_instrument->play(working_buffer);
// Process the audio buffer that the instrument has just worked on...
const fpp_t frames = Engine::audioEngine()->framesPerPeriod();
instrumentTrack->processAudioBuffer(working_buffer, frames, nullptr);
}
|
|
There's probably a better approach but would probably mean a larger refactor, but its rather plausible to think that the |
I wasn't aware of this! That's good to know. The queue ( If this can be done without Edit:
To fix this, I'd want to refactor |
Yeah I would recommend not doing anything like this here (might not work and also blurs the responsibilities of this PR), but its something to think about. We might consider also removing |
Also remove some old commented-out code and TODOs that were no longer relevant
5445a4c to
147c154
Compare
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.