Commit Graph

2374 Commits

Author SHA1 Message Date
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
Rossmaxx
43fbcca9cb Modernize compiler and linker flags (#7255) 2024-06-02 10:52:51 +01:00
FyiurAmron
e82e3f573a update veal submodule 2024-05-30 00:53:51 +02:00
Oskar Wallgren
0a93e1777b Bump SWH submodule to fix a crash with Reverse Delay (#7277) 2024-05-24 14:24:10 -04:00
Tres Finocchiaro
c66af602ad Fix fftw linking when cross-compiling (#7276) 2024-05-22 23:52:53 -04:00
Tres Finocchiaro
a66d212221 Fix native linux VST on ARM64 (#7257) 2024-05-16 15:05:12 -04:00
Rossmaxx
36786dd83d Enable LADSPA plugins on MSVC (#6973)
Co-authored-by: Tres Finocchiaro <tres.finocchiaro@gmail.com>
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
2024-05-13 08:44:42 +01:00
Dominic Clark
95e5f97150 Revamp resource embedding (#7241) 2024-05-12 17:38:14 +01:00
Alexander Medvedev
acdf05f347 Update zynaddsubfx (#7250)
Update instrument submodule
2024-05-11 15:40:54 -04:00
Dalton Messmer
d71116b82a Update Linux CI to Ubuntu 20.04 (#7015)
- Switch to Ubuntu 20.04 Docker image ghcr.io/lmms/linux.gcc:20.04
- Linux packages have migrated from Docker Hub to https://github.com/orgs/lmms/packages
- Built using the Dockerfiles from Update Linux images lmms-ci-docker#15
- Updated the veal submodule to the latest commit on the default ladspa branch
- Fixed an error when catching a polymorphic type with GCC 9. See: LMMS/veal@0ae9287
- Added GCC flag -Wno-format-truncation for ZynAddSubFx build.
- Adds GCC flag -Wno-format-overflow for calf/veal build.

Closes #6993
2024-05-08 13:06:54 -04:00
Tres Finocchiaro
acefd06f9b Bump veal submodule (#6771)
- Add MSVC support
- Sync upstream changes
2024-05-08 01:06:03 -04:00
saker
20102c4ae4 Replace processingSampleRate with outputSampleRate in Lb302 (#7239) 2024-05-05 05:44:25 -04:00
saker
9b6e33aa5c Remove global oversampling (#7228)
Oversampling can have many different effects to the audio signal such as latency, phase issues, clipping, smearing, etc, so this should really be an option on a per-plugin basis, not globally across all of LMMS (which, in some places, shouldn't really need to oversample at all but were oversampled anyways).
2024-05-05 04:37:43 -04:00
Michael Gregorius
9bdc8adf33 Inform effects about changes in enabled model (#7237)
Add the virtual method `Effect::onEnabledChanged` which can be overridden by effects so that they can react to state changes with regards to being enabled or bypassed. The call of this methods is connected to state changes of the enabled model in the constructor of `Effect`.

Implement the method in `DualFilterEffect` by resetting the history of the two filters. This is done to prevent pops that have been reported in #4612.
2024-05-05 10:05:22 +02:00
Michael Gregorius
c0a4df49a2 Lb302: Consistent decay in time (#7230)
The previous implementation of Lb302`s decay used a fixed decay factor that was multiplied with the signal until the minimum threshold of 1/65536 was crossed. This fixed factor resulted in different lengths in time for different sample rates.

This is fixed by computing the decay factor by taking the sample rate into account as well. The new static method `computeDecayFactor` computes the factor that is needed to make a signal decay from 1 to a given attenuation over a given time.

The parameters used in the call to that method in `Lb302Synth::process` have been fine-tuned such that, at a sample rate of 44.1 kHz, they result in a factor very close to the previous hard-coded factor of 0.99897516.
2024-04-29 16:47:17 +02:00
Michael Gregorius
86363819c5 Fix Kicker's release stage (#7226)
When applying its release stage Kicker did not take the frames before the release into account but instead always applied the release to the full buffer. This potentially lead to a jump in the attenuation values instead of a clean linear decay.

See #7225 for more details.
2024-04-27 21:17:12 +02:00
Michael Gregorius
5c0db46a60 Streamline instrument flags (#7227)
## Instrument flags as a property of an instrument
The instruments flags (single streamed, MIDI based, not bendable) are properties of an instrument that do not change over time. Therefore the flags are made a property of the instrument which is initialized at construction time.

Adjust the constructors of all instruments which overrode the `flags` method to pass their flags into the `Instrument` constructor.

## Add helper methods for flags
Add helper methods for the flags. This makes the code more concise and readable and clients do not need to know the technical details on how to evaluate a flag.

## Remove the flags methods
Remove the flags methods to make it an implementation detail on how the flags are managed.
2024-04-27 17:45:55 +02:00
Rossmaxx
6c846684cd Replace call QT5_WRAP_UI with CMAKE_AUTOUIC (#7200) 2024-04-27 16:21:09 +01:00
Michael Gregorius
71dd300f43 Instrument release time in milliseconds (#7217)
Make instruments report their release time in milliseconds so that it becomes independent of the sample rate and sounds the same at any sample rate.

Technically this is done by removing the virtual keyword from `desiredReleaseFrames` so that it cannot be overridden anymore. The method now only serves to compute the number of frames from the given release time in milliseconds.

A new virtual method `desiredReleaseTimeMs` is added which instruments can override. The default returns 0 ms just like the default implementation previously returned 0 frames.

The method `computeReleaseTimeMsByFrameCount` is added for instruments that still use a hard coded release in frames. As of now this is only `SidInstrument`.

Add the helper method `getSampleRate` to `Instrument`.

Adjust several instruments to report their release times in milliseconds. The times are computed by taking the release in frames and assuming a sample rate of 44.1 kHz. In most cases the times are rounded to a "nice" next value, e.g.:
*  64 frames -> 1.5 ms (66 frames)
* 128 frames -> 3.0 ms (132 frames)
* 512 frames -> 12. ms (529 frames)
* 1000 frames -> 23 ms (1014 samples)

In parentheses the number of frames are shown which result from the rounded number of milliseconds when converted back assuming a sample rate of 44.1 kHz. The difference should not be noticeable in existing projects.

Remove the overrides for instruments that return the same value as the base class `Instrument` anyway. These are:
* GigPlayer
* Lb302
* Sf2Player

For `MonstroInstrument` the implementation is adjusted to behave in a very similar way. First the maximum of the envelope release times is computed. These are already available in milliseconds. Then the maximum of that value and 1.5 ms is taken and returned as the result.
2024-04-24 20:23:36 +02:00
Kevin Zander
62e2a39a7e SlicerT::findSlices - check if lower_bound did not find anything 2024-04-23 17:02:23 -05:00
Dominic Clark
bda042e1eb Add native system semaphore and Windows shared memory (#7212) 2024-04-20 23:21:29 +01:00
Rossmaxx
df11a98902 Bump Qt minimum version to 5.9 (#7204)
* bump qt minimum version to 5.9

* cleanup cmake checks

* Remove the obsoleted check.

* Missed this while removing the check.
2024-04-17 21:51:58 -04:00
Michael Gregorius
d2c2a80506 Update CMT submodule / Upgrade code for CMT delays (#7206)
## Bump CMT to d8bf8084aa3
Bump the CMT submodule to commit d8bf8084aa3 which contains the underlying fixes for issue #5167.

The CMT delay uses `sprintf` calls to generate the technical names and display names of the delays. These calls are locale dependent. As a consequence for example the feedback delay might have been saved either as "fbdelay_0.1s" (point) or "fbdelay_0,1s" (comma) in a save file.

The CMT fix makes sure that all delays use points in their names and thus that they now always report the same name strings.

## Add upgrade routine for CMT delays
Add an upgrade routine for CMT delays which works in conjunction with the upgraded CMT submodule. Because the delays will now always report their name with points old save files which might contain versions with the comma must be upgraded to a name with a point.
2024-04-14 18:03:39 +02:00