Commit Graph

2396 Commits

Author SHA1 Message Date
Sotonye Atemie
ea02b3aba0 Do not set Qt::WA_OpaquePaintEvent (#7643)
Attempts to fix child widgets -- such as clips from the song editor -- drawing on top on other
2025-02-19 19:24:27 -05:00
Fawn
e328a136fc Use C++20 std::numbers, std::lerp() (#7696)
* use c++20 concepts and numbers for lmms_constants.h

* replace lmms::numbers::sqrt2 with std::numbers::sqrt2

* replace lmms::numbers::e with std::numbers::e
Also replace the only use of lmms::numbers::inv_e with a local constexpr instead

* remove lmms::numbers::pi_half and lmms::numbers::pi_sqr
They were only used in one or two places each

* replace lmms::numbers::pi with std::numbers::pi

* add #include <numbers> to every file touched so far
This is probably not needed for some of these files. I'll remove those later

* Remove lmms::numbers

Rest in peace lmms::numbers::tau, my beloved

* Add missing #include <numbers>

* replace stray use of F_EPSILON with approximatelyEqual()

* make many constants inline constexpr
A lot of the remaining constants in lmms_constants.h are specific to
SaProcessor. If they are only used there, shouldn't they be in SaProcessor.h?

* ok then, it's allowed to be signed

* remove #include "lmms_constants.h" for files that don't need it
- And also move F_EPSILON into lmms_math.h
- And also add an overload for fast_rand() to specify a higher and lower bound
- And a bunch of other nonsense

* ok then, it's allowed to be inferred

* ok then, it can accept an integral

* fix typo

* appease msvc

* appease msvc again

* Replace linearInterpolate with std::lerp()

As well as time travel to undo several foolish decisions and squash tiny
commits together

* Fix msvc constexpr warnings

* Fix msvc float to double truncation warning

* Apply two suggestions from code review

Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>

* Apply suggestions from code review

Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>

* fix silly mistake

* Remove SlicerT's dependence on lmms_math.h

* Allow more type inference on fastRand() and fastPow10f()

* Apply suggestions from code review

Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>

* Clean up fastRand() a little bit more

---------

Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
2025-02-13 13:15:08 -05:00
Tres Finocchiaro
e615046d78 Add VST64 targets for Linux ARM64 (#7687)
Initial support for winegcc on ARM64
2025-02-13 01:23:37 -05:00
Dalton Messmer
7d271e4f39 Fix vcpkg builds (#7702)
* Try to fix MSVC linker error related to lilv

* Remove temporary workaround

* Temporary debugging messages

* oops

* Temporary debugging

* Try to find FluidSynth using Config mode first

* Try again to fix lilv

* Fix FluidSynth installed with vcpkg on Windows

* Fix lilv from vcpkg

* Remove debug flag

* Fix for when lilv is not found (*-NOTFOUND evaluates to false)

* Use lowercase package name for lv2

* Try using only pkg_check_modules for lv2

* Use Lilv::lilv

* Add pkg-config guard back in

* Fix package name

Co-authored-by: Tres Finocchiaro <tres.finocchiaro@gmail.com>

* Fix Lilv_INCLUDE_DIRS

* Rename vcpkg cache key

---------

Co-authored-by: Tres Finocchiaro <tres.finocchiaro@gmail.com>
2025-02-12 20:19:13 -05:00
Fawn
4a089a19dc Update math functions to C++ standard library (#7685)
* 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>
2025-02-08 23:50:02 -05:00
Cas Pascal
786088baec Improve performance when rendering sample waveforms (#7366)
This PR attempts a number of improvements to the sample rendering (in the song editor, automation editor, AudioFileProcessor, SlicerT, etc) in LMMS:

Thumbnails: Samples are aggregated into a set of thumbnails of multiple resolutions. The smallest larger thumbnail is then chosen for rendering during sample drawing. Each set of thumbnails is stored with its sample file metadata in an unordered_map, so that duplicate samples will use the same set of thumbnails.

Partial rendering: additionally, this PR only renders the portions of the sample clips visible to the viewer to save rendering time.

* Experimental sample thumbnail

* Rename some classes and type aliases. Make some type declarations explicit

* Use a combination of audioFile name and shared_ptrs to track samples; refactor some loops

* That weird line at the end of the sample is now gone

* Small changes to the code; Add comments

* Add missing word to comment; Fix typo

* Track `SharedSampleThumbnailList`s instead

* Major refactor; implement thumbnailing for SlicerT, AFP and Automation editor

* Code clean up, renames and documenting

* Add the namespace lmms comments

* More code updates and documentation

* Fix error in comment

* Comment out `qDebug`s

* Fix formatting

* Use alternative initialization of `SampleThumbnailVisualizeParameters`

* Remove commented code

* Fix style and simplify code

* Use auto

* Draw lines using floating point

* Merge the classes into one nested class
+ Replace while loop with std::find_if

* Fix comparison of different signedness

* Include memory header

* Fix a logic error when selecting samples; Rename a const

* Fix more issues with signedness

* Fix sample drawing error in `visualizeOriginal`

* Only render regions in view of the sample

* Allow partial repaints of sample clips

* Remove unused variable

* Limit most of the painting to the visible region

* Revert back to using rect() in some places

* Partial rendering for AutomationEditor

* Don't redraw painted regions; allowHighResolution; remove `visualizeOriginal`; Remove s_sampleThumbnailCacheMap

* Add s_sampleThumbnailCacheMap back for testing convenience

* Minor change to the way `thumbnailSizeDivisor` is calculated

* Extend update region by an amount

* forgot about this

* Adapt to master; Redesign VisualizeParameters; Don't rely entirely on needsUpdate()

* Don't try to preserve painted regions

* Allow for a bit more thumbnails; Fix incorrect rendering when vertically scrolling

* Fix missing include statement

* Remove the unused variable

* Code optimization; Remove RMS member from Bit; Rename viewRect to drawRect

* More code optimizations

* Fix formatting

* Use begin instead of cbegin

* Improve generation of thumbnails

* Improve expressiveness of the draw code

* Add support for reversing

* Fix drawing code

* Fix draw code (part 2)

* Apply more fixes and simplifications

* Undo some out of scope changes

* Remove SampleWaveform

* Improve documentation

* Use size_t for some counters

* Change width parameter to be size_t

* Remove temporary aggregated peak variable

* Bump up AggregationPerZoomStep to 10

* Zoom out only requested range of thumbnail instead of clipping it separately

* Rename targetSampleWidth to targetThumbnailWidth

* Handle reversing for AFP; Iterate in reverse instead of reversing the entire thumbnail

* Change names to be more accurate

* Improve implementation of sample thumbnail cache map

* Move AggregationPerZoomStep back down to 2, do not cap smallest thumbnail width to display width
To improve performance with especially long
samples (~20 minutes)

* Simplify sample thumbnail cache handling in constructor

* Call drawLines instead of drawLine in a loop

QPainter::drawLine calls drawLines with a line count of 1. Therefore, calling drawLine in a loop means we are simply calling drawLines a lot more times than necessary.

* Bump up AggregationPerZoomStep to 10 again
Thought using 2 would help performance (when rendering). Maybe it does, but it's still quite slow when rendering a bunch of thumbnails at once.

* Fix off-by-one error when constructing Thumbnail from buffer

* Fix crash when viewport is not in bounds

* Apply performance improvements

Performance in the zoomOut function was bad because of the dynamic memory allocation. Huge chunks of memory were being allocated quite often, casuing a ton of cache misses and all around slower performance. To fix this, all the necessary downsampling is now done within the for loop and handled one pixel after another, instead of all at once.

To further avoid allocations in the draw call, the change to use drawLines has been reverted.

We now pass VisualizeParameters by value (it is only 64 bytes, which will fit quite nicely in a cache line, which is more benefical than reaching for that data by reference to some other part of the code).

After applying these changes, we are now practically only bounded by the painting done by Qt (according to profiling done by Valgrind). Proper use of OpenGL could resolve this issue, which should finally make the performance quite optimal in  variety of situations.

* Apply minor changes

Update copyright and unused functions. Move in newly created thumbnail into the cache instead of copying it.

* Use C++20's designated initializers

* Create param right before visualizing

* Fix regressions with reversing

* Fix incorrect rendering in AFP and SlicerT

* Move MaxSampleThumbnailCacheSize and AggregationPerZoomStep into implementation file

* Remove static keyword

* Remove getter and setter for peak data

---------

Co-authored-by: Sotonye Atemie <sakertooth@gmail.com>
2025-02-08 20:05:19 -05:00
firewall1110
516b8dbca8 Fix dropout with SID instrument when used for the first time (#7673)
Co-authored-by: Sotonye Atemie <sakertooth@gmail.com>
2025-02-03 19:02:06 -05:00
Fawn
9aa937d391 Use templates for common geometric constants (#7558)
* add templates for common geometric constants

* oops missed one

* LD_2PI -> LD_PI

i re-added the wrong constant ffs

* CamelCase names and also verify compilation without -DLMMS_MINIMAL

* C++20 stuff

Updated to account for `<numbers>` and C++20:
- Marked all `lmms_constants.h` constants with an exact equivalent in `<numbers>` as deprecated
- Removed all `lmms_constants.h` constants where no variant is currently in use
- Using `inline constexpr`
- Using `std::floating_point` concept instead of `typename`

* add lmms::numbers namespace

* Remove panning_constants.h

Moves the four constants in panning_constants.h into panning.h, then
removes panning.h.

* Use std::exp(n) instead of powf(numbers::e, n)

* Use C++ std math functions

Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>

* Use overloaded std math functions

An attempt to fix compiler warnings on some platforms

* Remove uses of __USE_XOPEN

And also update two functions I missed from the previous commit

* Missed a few

* Fix ANOTHER std math function use

Of course there's another one

---------

Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
2025-02-03 11:52:13 -05:00
Sotonye Atemie
77ca0f8994 Improve mono compatibility with LADSPA plugins (#7674) 2025-01-31 00:58:37 -05:00
Michael Gregorius
501011e573 Vectorscope render fix (#7652)
* Fix rendering for Vectorscope

The rendering of the Vectorscope is broken on Wayland if the size of the
Vectorscope is increased. This is caused by using a `QImage` to render
the scope traces which is then scaled up.

Introduce a new way to paint the vector scope (goniometer) which simply
paints lines or points that progressively get dimmer and which does not
make use of a QImage anymore.

It supports the following features:
* Log mode
* Zooming
* Rendering the drawing performance
* Selecting a different color for the traces

It does not support:
* HQ Mode: The new implementation provides a performance that's
  equivalent to Non-HQ mode and look similar or better than the HQ mode.
* Blurring of old data
* Persistence: Might be implemented by using a factor for the dimming

Rendering of the samples/trances uses the composition mode "Plus" so
that overlapping elements will appear like adding brightness. Painting
the grid and lines is done using the normal composition mode "Source
Over" so that it simply replaces existing pixels.

Painting of the lines/points and the grids and lines is done in a
"signal space", i.e. a transform where elements in the interval of
[-1, 1] feel "natural". The text is painted in "widget space".

* Remove old implementation

Remove HQ mode and persistence. Also remove the legacy option again.
This removes the models, loading, saving and the GUI controls.

Remove all unnecessary members from `VectorView`, adjust the
constructor. Move the implementation of `paintLinesMode` into
`paintEvent`. Remove methods `paintLegacyMode` and `paintLinesMode`.

* Move colors into VectorView

Move the colors out of `VecControls` into `VectorView` as they are
related to presentation.

* Remove friend relationship to VectorView

Remove a friend relationship to `VectorView` from `VecControls` by
introducing  const getters for the models.

* Remove VectorView::m_visible

Remove the unnecessary member `m_visible` from `VectorView`. It was not
initialized and only written to but never read.

* Make Vectorscope themeable

Make the Vectorscope themeable by introducing Qt properties for the
relevant colors.

The default theme gets the values from the code whereas the classic
theme gets a trace with amber color.

* Rename m_colorFG

Rename `m_colorFG` to `m_colorTrace`. Adjust the Qt property
accordingly.

Remove local variable `traceColor` from paint method and use member
`m_colorTrace` directly.

* Remove m_colorOutline

Remove unused member `m_colorOutline`.

* Fix horizontal lines on silence

Fix the horizontal lines that are rendered on silence. They seem to be
produced when rendering lines that start and end at the same point.

Therefore we only draw a point if the current and last point are the
same.

* Add some margin to the VectorView

Add some margin to the rendering of the `VectorView` so that the circle
does not touch the bounary of the widget.

* Clean up the layout of the Vectorscope

Clean up the layout of the Vectorscope. The checkboxes are not put on
top of the vector view anymore but are organized in a horizontal layout
beneath it. This gives a much tidier look.
2025-01-22 22:40:17 +01:00
Rossmaxx
80a46d3c76 Add gprof profiling support. (#7547) 2025-01-20 11:20:04 +05:30
Petar Katić
99ab0e2070 Update Zyn submodule (#7625) 2024-12-19 09:52:58 -05:00
saker
248b6b92d9 Downgrade RemoteVstPlugin build back to C++17 (#7624) 2024-12-18 16:20:34 -05:00
Dalton Messmer
c21a7cd487 Upgrade to C++20 (#7554)
* Compile in C++20 mode

* Fix implicit lambda captures of `this` by `[=]`

Those implicit captures were deprecated in C++20

* Silence MSVC atomic std::shared_ptr warning

Unfortunately std::atomic<std::shared_ptr> (P0718R2) is not supported by
GCC until GCC 12 and still is not supported by Clang or Apple Clang, so
it looks like we will continue using std::atomic_load for the time being

* Use C++20 in RemoteVstPlugin

* Simplification

* Add comment

* Fix bitwise operations between different enumeration types

* Revert "Fix bitwise operations between different enumeration types"

This reverts commit d45792cd72.

* Use a helper function to combine keys and modifiers

* Remove AnalyzeTemporaryDtors from .clang-tidy

AnalyzeTemporaryDtors was deprecated in clang-tidy 16 and fully removed
in clang-tidy 18

* Use C++20 in .clang-format

* Use bitwise OR

Prevents issues if any enum flags in `args` have bits in common
2024-11-22 23:11:39 -05:00
Arash Partow
bf54568ac6 Update ExprTk (#7571) 2024-11-22 10:15:46 -05:00
Rossmaxx
26d5241dd7 Optimise usage of pow using fast equivalent and exp2 (#7548)
* replace std::pow with better performing equivalents

* revert one instance where I swapped to fastPow10f

* Negative slope instead of multiplying -1

Co-authored-by: saker <sakertooth@gmail.com>

---------

Co-authored-by: saker <sakertooth@gmail.com>
2024-11-21 14:29:51 +05:30
Kapandaria
ada836c989 Fix crash on Xpressive when using integrate function (#7499)
* Fixed a bug in the integrate function, that was caused by warning fixes session.

* Xpressive - fixed code style issues.
2024-11-08 16:15:34 -05:00
Dalton Messmer
e36463ce77 Update macOS CI (#7572)
* Use macOS 13

See: https://github.com/actions/runner-images/issues/10721

* Upgrade to XCode 15.2

XCode 15.2 is the default on macOS 13

* Fix unqualified call to std::move warning

* Fix sprintf deprecated warnings

* Upgrade macOS 14 ARM64 builds to XCode 15.4

See: https://github.com/actions/runner-images/issues/10703

* Fix unused lambda capture warnings in Fader.cpp

* Fix unused variable warnings

* Fix formatting warning

Cannot format `const void*` as a string

* Force lambda conversion to function pointer
2024-11-06 17:46:12 -05:00
cyberrumor
b5de1d50e1 Fix PeakController attack/decay, use linear interpolation between samples (#7566)
Historically, the PeakController has had issues like attack/decay knobs
acting like on/off switches, and audio artifacts like buzzing or
clicking. This patch aims to address those issues.

The PeakController previously used lerp (linear interpolation) when
looping through the sample buffer, which was in updateValueBuffer. This
lerp utilized attack/decay values from control knobs. This is not the
correct place to utilize attack/decay because the only temporal data
available to the function is the frame and sample size. Therefore the
coefficient should simply be the sample rate instead.

Between each sample, processImpl would set m_lastSample to the RMS
without any sort of lerp. This resulted in m_lastSample producing
stair-like patterns over time, rather than a smooth line.

For context, m_lastSample is used to set the value of whatever is
connected to the PeakController. The basic lerp formula is:

m_lastSample = m_lastSample + ((1 - attack) * (RMS - m_lastSample))

This is useful because an attack of 0 sets m_lastSample to RMS, whereas
an attack of 1 would set m_lastSample to m_lastSample. This means our
attack/decay knobs can be used on a range from "snap to the next value
immediately" to "never stray from the last value".

* Remove attack/decay from PeakController frame lerp.
* Set frame lerp coefficient to 100.0 / sample_rate to fix buzzing.
* Add lerp between samples for PeakController to fix stairstep bug.
* The newly added lerp utilizes (1 - attack or decay) as the
  coefficient, which means the knobs actually do something now.
2024-10-28 15:01:08 -04:00
Dalton Messmer
e6776bcfe5 Remove usage of QTextCodec in Hydrogen Import plugin (#7562)
* Remove QTextCodec

QTextCodec was removed from Qt6 and is only available through the
Qt5Compat module.

QTextCodec was only used by the HydrogenImport plugin when importing old
Hydrogen files that were saved using TinyXML before it supported UTF-8.
HydrogenImport would use QTextCodec to try to get the current encoding
from the locale, and then use that as a best guess for interpreting the
XML data in the unspecified encoding it was saved in. None of this was
ever reliable, since the encoding of the computer that saved the
Hydrogen file might not be the same as the computer running LMMS and
importing that file.

There is no good solution here, so I decided to simply assume the old
Hydrogen files are UTF-8 encoded. The worst that can happen is someone's
ancient Hydrogen files containing non-ASCII text of some random encoding
becomes mojibake'd after importing into LMMS, which is something that
already could have happened.

* Clean up a little
2024-10-23 13:17:14 -04:00
Johannes Lorenz
97b61bbd9a Make PluginView::isResizable a virtual (#7541)
Remove the member `PluginView::m_isResizable` and it's associated method `setResizable`. Turn `isResizable` into a virtual method.

The reasoning is that whether or not an effect can be resized depends on its implementation. Therefore does not make sense to have a method like `setResizable`. If the underlying implementation does not support resizing then it would not make sense to call `setResizable(true)`. So `isResizable` now describes the underlying ability of a plugin to resize. It's then up to the clients of that method to decide how to treat the result of `isResizable`, i.e. if they want to make use of the ability to resize or not.
2024-10-12 10:39:42 +02:00
Lisa Magdalena Riedler
0363ee6d16 fix various AudioFileProcessor bugs (#7533)
* fix out-of-bounds crash in AudioFileProcessor

by correctly setting m_from and m_to without them interfering with each other

* fixed flattened wave caused by inaccurate math

see PR for before/after

* simply stop drawing AFP waveform when there's no more data

this fixes the single point at the end of waveforms that sometimes shows up

* fixed seemingly insignificant type confusion (?)

execution seemed fine but my debugger started freaking out,
and if gdb is telling me I got a negative-sized vector,
I'd rather fix this issue than speculate "it's probably fine"

* fixed data offset for AFP waveform vis

the data itself isn't reversed, so we have to account for that
2024-10-06 11:26:57 +02:00
Dalton Messmer
121d608c3a Reintroduce fast math functions (#7495)
* Add fast fma functions

* Use fast fma functions

* Add fast pow function

* Use fast pow function

* Fix build

* Remove fastFma

* Avoid UB in fastPow

On GCC with -O1 or -O2 optimizations, this new implementation generates
identical assembly to the old union-based implementation
2024-10-01 14:35:15 -04:00
Rossmaxx
729593c022 Fix hardcoded fonts scaling issues (#7493)
* changed font sizes to better values

* rename gui_templates.h to FontHelper.h

* replace hardcoded values with constants

* make knob labels use small font

* code review from michael

* more consolidation

* Fix text problem in Vectorscope

Fix a problem with cutoff text in Vectorscope. During the constructor
call of `LedCheckBox` the method `LedCheckBox::onTextUpdated` is
triggered which sets a fixed size that fits the pixmap and the text.
After instantiating the two instances in `VecControlsDialog` the
constructor then set a minimum size which overrode the fixed size that
was previously set. This then led to text that was cutoff.

---------

Co-authored-by: Michael Gregorius <michael.gregorius.git@arcor.de>
2024-09-28 13:18:02 +05:30
Dalton Messmer
18252088ba Refactor Effect processing (#7484)
* Move common effect processing code to wrapper method

- Introduce `processImpl` and `sleepImpl` methods, and adapt each effect
plugin to use them
- Use double for RMS out sum in Compressor and LOMM
- Run `checkGate` for GranularPitchShifterEffect
- Minor changes to LadspaEffect
- Remove dynamic allocations and VLAs from VstEffect's process method
- Some minor style/formatting fixes

* Fix VstEffect regression

* GranularPitchShifterEffect should not call `checkGate`

* Apply suggestions from code review

Co-authored-by: saker <sakertooth@gmail.com>

* Follow naming convention for local variables

* Add `MAXIMUM_BUFFER_SIZE` and use it in VstEffect

* Revert "GranularPitchShifterEffect should not call `checkGate`"

This reverts commit 67526f0ffe.

* VstEffect: Simplify setting "Don't Run" state

* Rename `sleepImpl` to `processBypassedImpl`

* Use `MAXIMUM_BUFFER_SIZE` in SetupDialog

* Pass `outSum` as out parameter; Fix LadspaEffect mutex

* Move outSum calculations to wrapper method

* Fix Linux build

* Oops

* Apply suggestions from code review

Co-authored-by: Johannes Lorenz <1042576+JohannesLorenz@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: saker <sakertooth@gmail.com>

---------

Co-authored-by: saker <sakertooth@gmail.com>
Co-authored-by: Johannes Lorenz <1042576+JohannesLorenz@users.noreply.github.com>
2024-09-20 20:00:36 -04:00
saker
01294192c8 Fix Lb302 silence (#7504)
This problem seem to arise due to casting _n->framesLeft() and _n->offset() from an unsigned type (size_t) to a signed type (int). The fix is to use size_t as the type for std::max across the board.
2024-09-18 11:25:47 -04:00
DanielKauss
7d35d4225e SlicerT UI update (#7453)
* Update SlicerT UI

* Style review

Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com>

* Style fixes

---------

Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com>
2024-09-17 11:35:01 +05:30
Lost Robot
588aab3389 Replace Compressor infinite ratio icons (#7501) 2024-09-15 21:40:05 +05:30
Grzegorz Pruchniakowski
b81f806d63 Fix: unnecessary space in Update EqControlsDialog.cpp (#7485)
* Fix: unnecessary space in Update EqControlsDialog.cpp

Fix: unnecessary space in Update EqControlsDialog.cpp

Greetings,
Gootector

* Style fix from Ross

---------

Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com>
2024-09-03 18:00:28 +05:30
Rossmaxx
35f350eeff Remove Noise class from flanger (#7473) 2024-08-28 15:46:48 -04:00
Rossmaxx
a992019626 Cleanup lmms_math.h (#7382)
* simplified fraction and absfraction functions

* removed unused fastSqrt() and fastPow()  
functions

* unused absMin() and absMax()

* move roundAt to math header

* Code review from saker

Co-authored-by: saker <sakertooth@gmail.com>

* use std::trunc()

* fixup after fixing merge conflicts

* remove unused fastFma and fastFmal functions.

* remove lmms_basics include, not needed

* use signedPowf from lmms_math in NES

* removed fastRand function, unused

* remove unused sinc function

* cleanup signedPowf

* code review

* further simplify random number math

* removed static from lmms_math file

---------

Co-authored-by: saker <sakertooth@gmail.com>
2024-08-28 12:48:56 +05:30
szeli1
5e697f01c8 Fix zooming and sliding of the waveform view in AudioFileProcessor (#7377) 2024-08-19 13:20:19 -04:00
Rossmaxx
828cefb4ea Remove typeInfo struct from lmms_basics.h (#7380)
* remove typeInfo struct from lmms_basics.h

* Code review

Co-authored-by: saker <sakertooth@gmail.com>

* converted epsilon to a constant

* renamed to approximatelyEqual and moved to top

---------

Co-authored-by: saker <sakertooth@gmail.com>
2024-08-07 07:33:10 +05:30
saker
5b366cfe3c Revert "Switch to libsamplerate's callback API in Sample (#7361)" (#7410)
This reverts commit 2f5f12aaae.
2024-08-04 11:01:26 -04:00
Johannes Lorenz
0d3c43d237 Fixup of #7381 (#7401)
Fixup of commit 9c0fc8fc69
2024-07-28 15:54:17 +02:00
Dominic Clark
627209ad1d Apply warning flags to RemoteVstPlugin too (#7389) 2024-07-27 17:23:34 +01:00
saker
2f5f12aaae Switch to libsamplerate's callback API in Sample (#7361) 2024-07-24 18:50:47 -04:00
Dominic Clark
851c884f58 Re-enable disabled GCC warnings where possible (#7379) 2024-07-21 22:34:34 +01:00
Petar Katić
9c0fc8fc69 Made it so ZynAddSubFx isn't lowpassed by default (#7381)
In this repo, the only changes made are updating the according submodule
and changing the FREQ knob in ZynAddSubFx's LMMS GUI.
2024-07-20 13:06:51 +02:00
saker
1420a1f7e8 Define fpp_t and f_cnt_t to be of size_t (#7363)
Defines `fpp_t` and `f_cnt_t` to be of `size_t` within `lmms_basics.h`.  Most of the codebase used `fpp_t` to represent the size of an array of sample frames, which is incorrect, given that `fpp_t` was only 16 bits when sizes greater than 32767 are very possible. `f_cnt_t` was defined as `size_t` as well for consistency.

---------

Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
2024-07-09 06:27:33 -04:00
Michael Gregorius
0384813ae4 Fix buzz in Monstro's 2nd oscillator (#7334) (#7368)
Fix a buzzing sound in Monstro's 2nd oscillator. It was introduced with
commit c2f2b7e0d7.

The problem was caused by checking if `len_r` is not equal to 0 instead of
checking `pd_r`.
2024-07-05 20:17:44 +05:30
FyiurAmron
edf6bf8dfe Remove mingw-std-threads from 3rd party deps and use native libs/headers instead (#7283)
* Remove mingw-std-threads from 3rd party deps

 and use native libs/headers instead

* switch MinGW to POSIX in CI
2024-06-30 15:49:06 -04:00
Michael Gregorius
286e62adf5 Simplify sample frame operations (make it a class) (#7156)
* Remove the struct StereoSample

Remove the struct `StereoSample`. Let `AudioEngine::getPeakValues` return a `sampleFrame` instead.

Adjust the calls in `Mixer`  and `Oscilloscope`.

* Simplify AudioEngine::getPeakValues

* Remove surroundSampleFrame

Some code assumes that `surroundSampleFrame` is interchangeable with `sampleFrame`. Thus, if the line `#define LMMS_DISABLE_SURROUND` is commented out in `lmms_basics.h` then the code does not compile anymore because `surroundSampleFrame` now is defined to be an array with four values instead of two. There also does not seem to be any support for surround sound (four channels instead of two) in the application. The faders and mixers do not seem to support more that two channels and the instruments and effects all expect a `sampleFrame`, i.e. stereo channels. It therefore makes sense to remove the "feature" because it also hinders the improvement of `sampleFrame`, e.g. by making it a class with some convenience methods that act on `sampleFrame` instances.

All occurrences of `surroundSampleFrame` are replaced with `sampleFrame`.

The version of `BufferManager::clear` that takes a `surroundSampleFrame` is removed completely.

The define `SURROUND_CHANNELS` is removed. All its occurrences are replaced with `DEFAULT_CHANNELS`.

Most of the audio devices classes, i.e. classes that inherit from `AudioDevice`, now clamp the configuration parameter between two values of `DEFAULT_CHANNELS`. This can be improved/streamlined later.

`BYTES_PER_SURROUND_FRAME` has been removed as it was not used anywhere anyway.

* Make sampleFrame a class

Make `sampleFrame` a class with several convenience methods. As a first step and demonstration adjust the follow methods to make use of the new functionality:
* `AudioEngine::getPeakValues`: Much more concise now.
* `lmms::MixHelpers::sanitize`: Better structure, better readable, less dereferencing and juggling with indices.
* `AddOp`, `AddMultipliedOp`, `multiply`: Make use of operators. Might become superfluous in the future.

* More operators and methods for sampleFrame

Add some more operators and methods to `sampleFrame`:
* Constructor which initializes both channels from a single sample value
* Assignment operator from a single sample value
* Addition/multiplication operators
* Scalar product

Adjust some more plugins to the new functionality of `sampleFrame`.

* Adjust DelayEffect to methods in sampleFrame

* Use composition instead of inheritance

Using inheritance was the quickest way to enable adding methods to `sampleFrame` without having to reimpement much of `std::array`s interface.

This is changed with this commit. The array is now a member of `sampleFrame` and the interface is extended with the necessary methods `data` and the index operator.

An `average` method was added so that no iterators need to be implemented (see changes in `SampleWaveform.cpp`).

* Apply suggestions from code review

Apply Veratil's suggestions from the code review

Co-authored-by: Kevin Zander <veratil@gmail.com>

* Fix warnings: zeroing non-trivial type

Fix several warnings of the following form:

Warnung: »void* memset(void*, int, size_t)« Säubern eines Objekts von nichttrivialem Typ »class lmms::sampleFrame«; use assignment or value-initialization instead [-Wclass-memaccess]

* Remove unnecessary reinterpret_casts

Remove some unnecessary reinterpret_casts with regards to `sampleFrame` buffers.

`PlayHandle::m_playHandleBuffer` already is a `sampleFrame*` and does not need a reinterpret_cast anymore.

In `LadspaEffect::processAudioBuffer` the `QVarLengthArray` is now directly initialized as an array of `sampleFrame` instances.

I guess in both places the `sampleFrame` previously was a `surroundSampleFrame` which has been removed.

* Clean up zeroSampleFrames code

* Fix warnings in RemotePlugin

Fix some warnings related to calls to `memcpy` in conjunction with`sampleFrame` which is now a class.

Add the helper functions `copyToSampleFrames` and `copyFromSampleFrames` and use them. The first function copies data from a `float` buffer into a `sampleFrame` buffer and the second copies vice versa.

* Rename "sampleFrame" to "SampleFrame"

Uppercase the name of `sampleFrame` so that it uses UpperCamelCase convention.

* Move SampleFrame into its own file

Move the class `SampleFrame` into its own class and remove it from `lmms_basics.h`.

Add forward includes to all headers where possible or include the `SampleFrame` header if it's not just referenced but used.

Add include to all cpp files where necessary.

It's a bit surprising that the `SampleFrame` header does not need to be included much more often in the implementation/cpp files. This is an indicator that it seems to be included via an include chain that at one point includes one of the headers where an include instead of a forward declaration had to be added in this commit.

* Return reference for += and *=

Return a reference for the compound assignment operators `+=` and `-=`.

* Explicit float constructor

Make the  constructor that takes a `float` explicit.

Remove the assignment operator that takes a `float`. Clients must use the
explicit `float` constructor and assign the result.

Adjust the code in "BitInvader" accordingly.

* Use std::fill in zeroSampleFrames

* Use zeroSampleFrames in sanitize

* Replace max with absMax

Replace `SampleFrame::max` with `SampleFrame::absMax`.

Use `absMax` in `DelayEffect::processAudioBuffer`. This should also fix
a buggy implementation of the peak computation.

Add the function `getAbsPeakValues`. It  computes the absolute peak
values for a buffer.

Remove `AudioEngine::getPeakValues`. It's not really the business of the
audio engine. Let `Mixer` and `Oscilloscope` use `getAbsPeakValues`.

* Replace scalarProduct

Replace the rather mathematical method `scalarProduct` with
`sumOfSquaredAmplitudes`. It was always called on itself anyway.

* Remove comment/TODO

* Simplify sanitize

Simplify the `sanitize` function by getting rid of the `bool found` and
by zeroing the buffer as soon as a problem is found.

* Put pointer symbols next to type

* Code review adjustments

* Remove "#pragme once"
* Adjust name of include guard
* Remove superfluous includes (leftovers from previous code changes)

---------

Co-authored-by: Kevin Zander <veratil@gmail.com>
2024-06-30 20:21:19 +02:00
Lost Robot
a0fbd7e7b4 Initialize LOMM arrays (#7355)
Fixes LOMM distortion and delay bug.
2024-06-30 17:07:38 +05:30
Lost Robot
f2fbcecc50 Fix bad Granular Pitch Shifter init values (#7354) 2024-06-26 22:18:24 -07:00
Lost Robot
9a0db6a17c Fix pitch shifter glide 0 division (#7348) 2024-06-26 11:41:54 -07:00
Lost Robot
6634cec127 Add Granular Pitch Shifter effect (#7328) 2024-06-26 11:00:27 +05:30
Lost Robot
1036144738 Fix uninitialized compressor values (#7343) 2024-06-24 09:17:48 -07:00
Dominic Clark
a1f7753a94 Fix MSVC warnings up to level 2 (#7329)
* Fix MSVC warnings up to /W2

* Fix large shift UB warning
2024-06-22 02:05:14 -04:00
Dominic Clark
e76a99ee76 Suppress warnings in third-party code (#7319) 2024-06-17 22:48:04 +01:00