Previously, the autoscroll state of the song editor and piano roll (continuous, stepped, none) was not saved. This can be an issue for users who want to permanently set their autoscroll settings, without having to change them every time they start up LMMS.
This PR adds an option in the settings window to change the default autoscroll state.
* Renamed lmms_basics.h to LmmsTypes.h and scoped it down for that purpose.
* Shifted the LMMS_STRINGIFY macro to it's own header.
* Removed the debug.h header file and use cmake to handle the macro logic.
* Remove some unused headers and include directives
* Use dbFS scale for the faders
Make the faders use a linear dbFS scale. They now also change position on first click and can then be dragged.
The `Fader` class now has a new property called `m_faderMinDb`. It's the minimum value before the amplification drops down fully to 0. It is needed because we cannot represent a scale from -inf to maxDB.
Rename `knobPosY` to `calculateKnobPosYFromModel` and move the implementation into the cpp file. The method now first converts the model's current amplification value to dbFS and then computes a ratio based on that values and the minimum and maximum dbFS values.
Add the method `setVolumeByLocalPixelValue` which takes a local y coordinate of the widget and sets the amplification of the model based on a dbFS scale.
Adjust `mousePressEvent` and `mouseMoveEvent` so that they mostly take the local y coordinate of the event and use that to adjust the model via `setVolumeByLocalPixelValue`.
Remove `m_moveStartPoint` and `m_startValue` and they are not needed anymore.
* Apply curve to faders
Apply a curve, i.e. the cube function and its inverse, to the fader
positions to that we have more space to work with in the "interesting"
areas around 0 dB and less space in the area where we tend to "-inf dB".
Set the minimum dB value of the fader to -120 dB to increase the potential
headroom.
* Support for dB models
Add support for models that are in dB.
There's a new member `m_modelIsLinear` which can be set via the
constructor. The default value in the constructor is `true`.
Add the method `modelIsLinear` which can be used to query the parameter.
It is used in `calculateKnobPosYFromModel` and
`setVolumeByLocalPixelValue`. Both methods got extended to deal with
models in dB. They were also refactored to extract code that is common
for both cases.
Ensure that the constructor of `Fader` is called with `false` for
`CrossoverEQControlDialog` and `EqFader` because these use models that
are in dB.
* Show current dB value of fader in tool tip
Show the current value of the fader in its tool tip. Please note that
this value is always shown in dB because the goal should be to get rid
of the linear values for the faders.
Some of the code is extracted into the new method
`Fader::getModelValueAsDbString` which is shared by
`Fader::modelValueChanged` (also new) and `Fader::updateTextFloat`.
Please note that `getModelValueAsDbString` will use "dB" instead of
"dBFS" as the unit and that it will format "-inf dB" instead of "-∞ dB".
These changes will also be visible in the text float that is used to
show the new values as the fader is being dragged.
* Let users enter values in dB
Let users enter values in dB in the dialog that opens with a double
click.
The minimum value that can be entered is the minimum value that the
fader allows to set, i.e. -120 dB. The maximum value is the maximum
value of the model converted to dB. As of now this is ~6 dB. The
current value is converted to dB. If it corresponds to "-inf dB", i.e.
if the amplification is 0 then the minimum value is used.
* Remove option "Display volume as dBFS"
Remove the option "Display volume as dBFS" from the settings dialog and
the check box option "Volume as dBFS" from the "View" menu. Volumes are
now always treated as dB, i.e. all evaluations of the property
"displaydbfs" have been removed which results in assuming that this
option is always true.
The upgrade code in `ConfigManager::upgrade_1_1_91` was left as is.
However, a note was added which informs the reader that the value of
"displaydbfs" is not evaluated anymore.
* Extend Fader::wheelEvent
Extend `Fader::wheelEvent` for the case where the model is not a dB
model (`modelIsLinear() == true`), e.g. for the mixer faders. In that
case it works as follows. Each step increments or decrements by 1 dB if
no modifier is pressed. With "Shift" pressed the increment value is 3 dB.
With "STRG" ("CTRL") pressed the increment value is reduced to 0.1 dB. If
the value goes below the minimum positive dB value that is allowed by the
fader then the fader is set to "-inf dB", i.e. zero amplification. If the
fader is set to "-inf dB" and the users want to increase the value then
it is first set to the minimum positive value that is allowed by the
fader.
If the model is a dB model then the same behavior as before is used.
Although it should be considered to adjust this case as well. These
models are used by the faders of the Crossover Equalizer, Equalizer,
Compressor and Delay and they are not very usable with the mouse wheel.
* Adjust the wheel behavior for faders with dB models
Make the faders of the Crossover Equalizer, Equalizer, Compressor and
Delay behave like the mixer faders, i.e. step in sizes of 3 dB, 1dB and
0.1 dB depending on whether a modifier key is pressed or not.
Extract some common code to do so and add some `const` keywords.
* Less "jumpy" knobs
Implement a more stable knob behavior.
Remove the jumping behavior if the users directly click on a volume
knob. By storing the offset from the knob center and taking it into
account during the changes it now also feels like the users are
dragging the knob.
Changes to the amplification are now only applied when the mouse is
moved. This makes the double click behavior much more stable, i.e. if
users click on the knob when it is at 0 dB the dialog will also show
0 dB and not something like 0.3 dB because the first click is already
registered as a change of volume.
If the users click next to the knob the amplification will still be
changed immediately to that value.
## Technical details
To make the knobs more stable a variable called `m_knobCenterOffset` was
introduced. It stores the offset of the click from the knob center so
that this value can be taken into account for in the method
`setVolumeByLocalPixelValue`.
* Make MSVC happy
Add an indication that a float value is assigned to a float variable.
* Introduce constexpr for scaling exponent
Introduce the `constexpr c_dBScalingExponent` which describes the
scaling exponent that's used to scale the dB scale in both directions.
This will simplify potential adjustments by keeping the values
consistent everywhere.
* Draw fader ticks
Draw fader ticks in case the model is a linear one. This means that for
now they should only be painted for the mixer faders but not for the
faders of the Compressor, Delay, etc.
Extract the computation of the scaled ratio between the maximum model dB
value and the minimum supported fader dB value into the new private
method `computeScaledRatio`. This is necessary because it is needed to
paint the fader knob at the correct position (using the knob bottom as
the reference) and to paint the fader ticks at the correct position
(using the knob center).
Introduce the private method `paintFaderTicks` which paints the fader
ticks.
Note: to paint some non-evenly spaced fader ticks replace the `for`
expression in `paintFaderTicks` with something like the following:
```
for (auto & i : {6.f, 0.f, -6.f, -12.f, -24.f, -36.f, -48.f, -60.f, -72.f, -84.f, -96.f, -108.f, -120.f})
```
* Fader adjustments via keyboard
Allow the adjustment of the faders via the keyboard. Using the up or
plus key will increment the fader value whereas the down or minus key
will decrement it. The same key modifiers as for the wheel event apply:
* No modifier: adjust by 1 dB
* Shift: adjust by 3 dB
* Control: adjust by 0.1 dB
Due to the very similar behavior of the mouse wheel and key press
handling some common functionality was factored out:
* Determinination of the (absolute) adjustment delta value by
insprecting the modifier keys of an event. Factored into
`determineAdjustmentDelta`.
* Adjustment of the model by a given dB delta value. Factored into
`adjustModelByDBDelta`.
* Move the fader of the selected channel
Move the fader of the selected channel instead of the fader that has
focus when the up/plus or down/minus keys are pressed. Doing so also
feels more natural because users can already change the selected
channel via the left and right keys and now they can immediately adjust
the volume of the currently selected channel while doing so.
Key events are now handled in `MixerView::keyPressEvent` instead of
`Fader::keyPressEvent` and the latter is removed. `MixerChannelView`
now has a method called `fader` which provides the associated fader.
This is needed so that the event handler of `MixerView` can act upon
the currently selected fader.
## Changes in Fader
The `Fader` class provides two new public methods.
The `adjust` method takes the modifier key(s) and the adjustment
direction and then decides internally how the modifier keys are mapped
to increment values. This is done to keep the mapping between modifier
keys and increment values consistent across different clients, e.g. the
key event of the `MixerView` and the wheel event of the `Fader` itself.
The direction is provided by the client because the means to determine
the direction can differ between clients and cases, e.g. a wheel event
determines the direction differently than a key event does.
The method `adjustByDecibelDelta` simply adjusts the fader by the given
delta amount. It currently is not really used in a public way but it
still makes sense to provide this functionality in case a parent class
or client wants to manipulate the faders by its very own logic.
Because the `Fader` class does not react itself to key press events
anymore the call to `setFocusPolicy` is removed again.
* Enter fader value when space key pressed
Let the users enter the fader value via dialog when the space key is
pressed.
Extract the dialog logic into the new method `adjustByDialog` and call
it from `MixerView::keyPressEvent`.
Make `Fader::mouseDoubleClickEvent` delegate to `adjustByDialog` and
also fix the behavior by accepting the event.
* More prominent fader ticks around 0 dB
Make the fader ticks around 0 dB more prominent but drawing them
slightly wider and with a more opaque color.
* Work around a Qt bug
Work around a Qt bug in conjunction with the scroll wheel and the Alt
key. Simply return 0 for the fader delta as soon as Alt is pressed.
* Fix wheel events without any modifier
Fix the handling of wheel events without any modifier key being pressed.
Commit ff435d551b accidentally tested against Alt using a logical OR
instead of an AND.
* Code review changes
First set of code review changes:
* Use Doxygen style documentation comments
* Remove comment about `displaydbfs` from upgrade routine
* White-space changes for touched lines.
* Make minimum dB value a constexpr
Make the minimum dB value a constexpr in the implementation file because
currently it's an implementation detail that should not be of any
interest to any other client.
So `m_faderMinDb` becomes `c_faderMinDb`.
* More flexible painting of fader ticks
Paint the fader ticks in a more systematic and flexible way. This also
removes some "magic numbers", e.g. by using `c_faderMinDb` instead of
`-120.f` as the lower limit.
The upper limit, i.e. the "starting point" is now also computed using
the maximum value of the model so that the fader will still paint
correctly if it ever changes.
* Make the zero indicator bolder
Make the zero indicator tick of the fader bolder.
* Make rendering of fader ticks a preference
Make rendering of fader ticks a preference which is off by default.
Introduce the new option "Show fader ticks" to the setup dialog and save
it to the UI attribute `showfaderticks`.
The configuration value is currently evaluated in `Fader::paintEvent`.
If this leads to performance problems it might be better to introduce a
boolean member to the `Fader` class which caches that value.
* Move constexprs to anonymous namespace
Many, many years ago (93a456c), high quality mode was merely disabled after it was noted that it can be problematic rather than being completely removed. Remove it from the codebase so we can get rid of some code and clean things up a bit.
* Don't auto-quantize notes when recording MIDI input.
* Add midi:autoquantize to config file and a widget to set it in the MIDI settings.
* Quantize notes during recording if midi:autoquantize is enabled.
* Apply suggestions from code review: Formatting
Style formatting
Co-authored-by: saker <sakertooth@gmail.com>
* Cache the auto quantization setting in a PianoRoll member variable, and update it on ConfigManager::valueChanged()
* Apply suggestions from code review: Formatting & temp variable
One formatting change, and reusing an existing variable instead of introducting a new local one.
Co-authored-by: saker <sakertooth@gmail.com>
Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
* Update src/gui/modals/SetupDialog.cpp
Good catch.
Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
* Fix logic bug in PianoRoll's midi/autoquantize value observer.
* Use '!' instead of 'not' to please MSVC.
* autoquantize: Add an explicit check for consistency with the rest of the PR, and give the setting a default value in SetupDialog constructor.
* Integrate MIDI auto-quantize checkbox into the resizable layout, and add a tool tip.
---------
Co-authored-by: saker <sakertooth@gmail.com>
Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
This displays a warning dialog if the users requests unusual
buffersizes:
- buffersizes less than 32
- buffersizes which are not a (natural number) power of 2
This commit also replaces some `setGeometry` stuff by `QBoxLayout`.
Remove the temporary class `AudioDeviceSetupGroupWidget` and move its
functionality into `AudioDeviceSetupWidget`. This means to let
`AudioDeviceSetupWidget` inherit from `QGroupBox` instead of
`TabWidget`.
Adjust all inheriting classes accordingly. Adjust usages in SetupDialog.
The result should be that even the cases for `LMMS_HAVE_SOUNDIO` and
`LMMS_HAVE_SNDIO` should compile again. Although their layout might look
weird.
Adjust the dialogs of most audio driver settings dialogs by showing them
in a QGroupBox and adjusting their layouts. All dialogs now use
`QFormLayout` to layout their labels and input widgets.
Technical details
------------------
Introduce `AudioDeviceSetupGroupWidget` which is intended to
functionally replace `AudioDeviceSetupWidget` in the long run. This is
likely a temporary replacement in the sense that
`AudioDeviceSetupGroupWidget` will be renamed to
`AudioDeviceSetupWidget` once the latter has been replaced everywhere.
Both classes are very similar and the only difference is that the former
inherits from `QGroupBox` instead of `TabWidget`.
Adjust the using of AswMap so that it is now defined as a map from
`QString` to `AudioDeviceSetupGroupWidget`.
Use `QFormLayout` to layout the widgets of the setup dialogs instead of
hard coding geometries and placement.
TODOs
------
Adjust the widgets for the SoundIO and SndIo cases. These will be a bit
more effort as they are not compiled on my machine.
Adjust the plugins group to also use a QGroupBox and QCheckBoxes. This
finishes the "Performance" page and also finally enables the removal of
the local variables `XDelta` and `YDelta` as well as the lambda
`addLedCheckBox`.
Other changes
--------------
Add a TODO to some unused code for some advanced setting.
Fix layout of the main widget and the buttons widget. Remove an
erroneous ",1" after a statement.
Make the setup dialog resizable and use widgets that dynamically adjust
to the font size set by the user.
Current status of the tabs:
* General: Done
* Performance: Plugins group needs adjustments
* Audio: Individual settings dialogs need adjustments
* MIDI: Not started yet
* Paths: Done
The "Autosave" and "Buffer size" tabs have been slightly redesigned so
that the revert/reset button is next to the slider.
Technical details
------------------
Setting a fixed size has been removed from the setup dialog so that it
can be resized.
The settings widget (`settings_w`) now has a layout to which the sub
dialogs are added. This is done so that the layout sizes are propagated
upwards, i.e. all widgets along the chain now have a layout so that size
hints are determined correctly.
Instances of `TabWidget` are replaced with instances of `QGroupBox`.
Each group box has a layout to which its children, e.g. check boxes, are
added. These group boxes are then added to the layouts of their parents.
Doing so also removes the need to count how many instances have been
added and calculations on where to put the children.
Instances of `LedCheckBox` are replaced with instances of `QCheckBox`.
This is done in the new helper lambda `addCheckBox`. It's very similar
to the previously used `addLedCheckBox` but creates a `QCheckBox`
instead of a `LedCheckBox`. It returns the created `QCheckBox` as a
result. If a layout is provided the created check box is also added to
the layout before it is returned.
The helper lambda `addPathEntry` has been adjusted to create a
`QGroupBox` and to put all its children in a layout.
The helper method `labelWidget` has been adjusted to not set the font
size of the label.
The method `TabBar::addTab` had to be extended with a new default
parameter which controls if the added widget is fixed to the size of
it's parent or not. In the case of the setup dialog we do not want this.
So far the method is only used by the setup dialog and the
`LadspaBrowser` class. So once the `LadspaBrowser` has been made
resizable the default parameter can be removed again and treated as
always being set to false.
Add `QCheckBox` to the `style.css` so that it does not get a green font
due to the palette magic that's done.
* Add confirm removal on mixer channels
Add confirm removal popup when the user calls the action "remove channel" on a mixer channel that is in use (receives audio from other channel or track). Set a config variable to keep track if the user don't want to be asked again. Adding a scroll on settings-general tab because there weren't enough space on the area.
* Core Mixer function channel in use
New core Mixer function to check if a given channel is in use (receives audio)
---------
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: saker <sakertooth@Gmail.com>
This PR places all LMMS symbols into namespaces to eliminate any potential future name collisions between LMMS and third-party modules.
Also, this PR changes back `LmmsCore` to `Engine`, reverting c519921306 .
Co-authored-by: allejok96 <allejok96@gmail.com>
* Update ringbuffer submodule to fix includes
* Remove cyclic includes
* Remove Qt include prefixes
* Include C++ versions of C headers
E.g.: assert.h -> cassert
* Move CLIP_BORDER_WIDTH into ClipView
This allows to remove includes to TrackView.h in ClipView cpp files.
* Elliminate useless includes
This improves the include structure by elliminating includes that are
not used. Most of this was done by using `include-what-you-use` with
`CMAKE_C_INCLUDE_WHAT_YOU_USE` and `CMAKE_CXX_INCLUDE_WHAT_YOU_USE`
set to (broken down here):
```
include-what-you-use;
-Xiwyu;--mapping_file=/usr/share/include-what-you-use/qt5_11.imp;
-Xiwyu;--keep=*/xmmintrin.h;
-Xiwyu;--keep=*/lmmsconfig.h;
-Xiwyu;--keep=*/weak_libjack.h;
-Xiwyu;--keep=*/sys/*;
-Xiwyu;--keep=*/debug.h;
-Xiwyu;--keep=*/SDL/*;
-Xiwyu;--keep=*/alsa/*;
-Xiwyu;--keep=*/FL/x.h;
-Xiwyu;--keep=*/MidiApple.h;
-Xiwyu;--keep=*/MidiWinMM.h;
-Xiwyu;--keep=*/AudioSoundIo.h
```
* Fixup: Remove empty #if-#ifdef pairs
* Remove LMMS_HAVE_STD(LIB|INT)_H
* Added messagebox when user tries to delete track
* Code review refactorings
* Update Track.h
* Changed message box title to "Confirm removal"
* Merge changes from master
* Add option to disable warning
* Default to showing warning if no config found
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: Spekular <Spekular@users.noreply.github.com>
* Changes the toggleSolo method
- Changes the toggleSolo method so it doesn't mute automation tracks (keeps their original state)
* Stop restoring Automation Track's mute values
- Since Automation Tracks are not affected by enabling solo on other tracks, there's no need (and it's even counter intuitive) to restore their previous mute value.
- Reduces a line by using "else if".
* Saves two lines merging 2 conditionals in 1
* Adds the new solo behavior as a new LED button
To allow the user choosing between the old solo behavior and the new one, a new LED button was added which will be used to enable the solo keeping the automation tracks states, while the red LED will enable the solo with the current behavior.
Changes to the code:
- Added a purple LED image that will be used on the new button.
- Increased the default width of the widget that holds the mute and solo buttons so the third one fits.
- Changed the positioning of the LEDs on both the standard and compact track modes to accomodate them.
- Added a new model called m_soloAutomationsModel, which is connected to the new LED button (m_soloAutomationsBtn). This will dictate the behavior of the toggleSolo method.
- The red LED calls the toggleSolo method as before. The purple LED will change the m_soloAutomationsModel value and toggle the red LED, which will then call toggleSolo. But since the value of m_soloAutomationsModel will be different, the new behavior will be used on the method.
* Revert "Adds the new solo behavior as a new LED button"
This reverts commit fdbc8b2712.
After consulting fellow users and devs about this change to the PR, it was decided that adding a third button for the new solo behavior was not the best approach. This reverts the commit so we go back to just changing the solo behavior. Later an option can be added on LMMS settings to choose between the old and new behaviors.
* Adds an option to use the legacy solo behavior
This commit adds an option on LMMS settings (saved to the config file) to go back to the legacy behavior of the track solo button. The option can be found on Settings>General>"Use solo legacy behavior"
Changes to the code:
- Since there's a change to the configuration file, an upgrade method was created (upgrade_1_3_0) to add the value to the config XML if it isn't already present (safety check).
- An attribute is added to the DOM structure of the app configuration under the "app" tag, called "sololegacybehavior", which can be either 0 or 1.
- Changes were made to include/SetupDialog.h, include/ConfigManager.h and src/core/ConfigManager.cpp to implement this new configuration option.
- The toggleSolo method was changed to behave according to the value of the "sololegacybehavior" configuration.
* Changes the description of the solo setting
Changes the description of the solo setting on the Setup Dialog from "Use solo legacy behavior" to "Mute automation tracks during solo" since the latter is more descriptive and new users wouldn't be confused about what the legacy behavior was.
* Merges "if"s and "if-else"s where possible
A conditional could be merged by using the "||" logical operator and there was a "if" nested inside an "else" that could be merged into a single "if-else".
Very small code format change (keeping code block curly braces in separate lines).
* Uses default value instead of upgrading ConfigFile
Instead of using an upgrade method on the ConfigManager class to set a value to the sololegacybehavior parameter, we now use a default value on every call to ConfigManager::value that requests it.
* Removes repetitive method call
To make the loop more efficient, a local variable was created to hold the behavior of the solo selected in the setup dialog, instead of calling the ConfigManager::value method repeated times.
Observation:
Since no code was added/removed from ConfigManager.cpp, it was restored to its original state. There's however a TAB character in a blank line on line 145, which was there at the beginning of this PR but removed during it. It was written again in this commit to remove ConfigManager.cpp from the "Files changed" list.
* Saves one line of code and adds a comment
Moved AudioDevice::setupWidget into its own class AudioDeviceSetupWidget
which logically should belong to the GUI (unfortunately the include
structure does not make this obvious).
For the ALSA driver there is an implementation AudioAlsaSetupWidget
which provides a combo box for selection of the card and device.
All other driver widgets have been changed to inherit from
AudioAlsaSetupWidget but have not been changed otherwise.
SetupDialog has been adjusted to keep a map of AudioAlsaSetupWidgets
now.
Wrapped the path selection widgets in a Scroll Area, to allow for
the addition of addition paths.
Where multipue paths are allowed the icon has been changed to refect this.
Reordered the list.