Commit Graph

887 Commits

Author SHA1 Message Date
DanielKauss
c779521730 Add slicer plugin (#6857)
* extremly basic slicer, note playback and gui works

* very simple peak detection working

* basic phase vocoder implementation, no effects yet

* phase vocoder slight rewrite

* pitch shifting works more or less

* basic timeshift working

* PV timeshift working (no pitch shift)

* basic functions work (UI, editing, playback)

* slice editor Ui working

* fundamental  functionality done

* Everything basic works fully

* cleanup and code guidelines

* more file cleanup

* Tried fixing multi slice playback (still broken)

* remove includes, add license

* code factoring issues

* more code factoring

* fixed multinote playback and bpm check

* UI performance improvments + code style

* initial UI changes + more code style

* threadsafe(maybe) + UI finished

* preparing for dinamic timeshifting

* dynamic timeshifting start

* realtime time scaling (no stereo)

* stereo added, very slow

* playback performance improvments

* Roxas new UI start

* fixed cmake

* Waveform UI finished

* Roxas UI knobs + layout

* Spectral flux onset detection

* build + PV fixes

* clang-format formatting

* slice snap + better defaults

* windows build fixes

* windows build fixes part 2

* Fixed slice bug + Waveform code cleanup

* UI button text + reorder + file cleanup

* Added knob colors

* comments + code cleanup

* var names fit convention

* PV better windowing

* waveform zoom

* Minor style fixes.

* Initial artistic rebalancing of the plugin artwork.

* PV phase ghosting fix

* Use base note as keyboard slice start

* Good draft of Artwork, renamed bg to artwork

* Removed soft glow.

* Fixed load crashes + findSlices cleanup

* Added sync button

* added pitch shifting, sometimes crashes

* pitch fixes

* MacOs build fixes

* use linear interpolation

* copyright + div by 0 fixes

* Fixed rare crash + name changes + license

* review: memcpy, no array, LMMS header, name change

* static constexpr added

* static vars to public + LMMS guards

* remove references in classes

* remove constexpr and parent pointer in waveform

* std::array for fft

* fixed wrong name in style

* remove c style casts

* use src_process

* use note vector for return

* Moved PhaseVocoder into core

* removed PV from plugin

* remove pointers in waveform

* clang-format again

* Use std:: + review suggestions

Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
Co-authored-by: saker <sakertooth@gmail.com>

* More review changes

* new signal slot + more review

* Fixed pitch shifting

* Fixed buffer overflow in PV

* Fixed mouse bug + better empty screen

* Small editor refactor + improvments

* Editor playback visual + small fixes

* Roxas UI improvments

* initial timeshift removing

* Remove timeshift + slice refactor

* Removed unused files

* Fix export bug

* Fix zoom bug

* Review changes SakerTooth#2

* Remove most comments

* Performance + click to load

* update PlaybackState + zerocross snapping

* Fix windows build issue

* Review + version

* Fixed fade out bug

* Use cosine interpolation

* Apply suggestions from code review

Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>

* More review changes

* Renamed files

* Full sample only at base note

* Fix memory leak

Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>

* Style fixes

---------

Co-authored-by: Katherine Pratt <consolegrl@gmail.com>
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
Co-authored-by: saker <sakertooth@gmail.com>
2023-11-11 18:09:38 -05:00
Lost Robot
89c98a77a5 LOMM (upward/downward multiband compressor) (#6925) 2023-11-10 07:10:44 -08:00
Michael Gregorius
c6ed4a274a First version of a new dynamic LADSPA control dialog (#2068)
Introduce a new version of the LADSPA control dialog which uses "bar controllers" and arranges them in a grid layout. Long parameter names are elided long if needed. The new dialog is implemented in the class `LadspaMatrixControlDialog`.

Note: it is still possible to reactivate the old dialog as it has not been removed yet. You can do so in `plugins/LadspaEffect/LadspaControls.h` by replacing the implementation of `createView()` with the following:
```
gui::EffectControlDialog* createView() override
{
	return new gui::LadspaControlDialog( this );
}
```

Introduce the new base class `FloatModelEditorBase`. It serves as the base widget for widgets that manipulate a float model and provides some base functionalities like context menus, edit dialogs, mouse handling, etc. Currently `BarModelEditor` and `Knob` inherit from `FloatModelEditorBase`. Therefore lots of code was moved from `Knob` to `FloatModelEditorBase`.

`BarModelEditor` supports style sheets. See the changes in style.css for the available options and their usage.
 
Extend `LedCheckBox` so that it adds support to render the text with the default font in the default size. The class now supports two modes:
* Legacy mode
* Non-legacy mode

Legacy mode is the default and renders the LedCheckBox as before. The font is set to 7 pixels and all the text is rendered with a shadow.

Non-legacy mode uses the current font to render the text. The text is rendered without a shadow and the pixmap is centered vertically to the left side of the text. Non-legacy mode is currently only used in the context of the matrix LADSPA dialog. Toggle options are rendered using it as well as the "Link Channels" button.

Add `TempoSyncBarModelEditor` which adds a tempo sync option to a `BarModelEditor`. Please note that the code was mostly copied and adjusted from the `TempoSyncKnob` class. It was not attempted yet to unify some of the code because with the current design it seems to be a road to "inheritance hell". A better solution might be to refactor the code so that it becomes more composable.

What follows are the individual commit messages of the 64 commits that have been squashed into a single merge commit.

* First version of a new dynamic LADSPA control dialog

The new dialog shows the LADSPA controls in a matrix layout. Each row
corresponds to a LADSPA parameter. Each parameter can have several
channels which can be linked. Each channel has its own row of controls.

The class LadspaMatrixControlView was added by copying and modifying
LadspaControlView to get rid of the link buttons which are associated
with some controls and some labels.

* Remove trailing whitespaces

* Merge fix

* Use the new connect syntax

* Remove empty destructors

* Use override keyword

* Reformat a bit

* Use nullptr

* Use range-based loops

* Add BarModelEditor and improve layouts

Add the new class `BarModelEditor` which is intended to become a new way
to adjust values of float models.

Simplify the layout in `LadspaMatrixControlDialog` by removing some
nested layouts. Remove the "Parameters" column.

Adjust `LadspaMatrixControlView` to implement the following changes:
* Show the name of the control next to toggle buttons (`LedCheckBox`).
* Use the new `BarModelEditor` for integer and float types.
* SHow the name of the control next to time based parameters that use
`TempoSyncKnob`.

The names are shown so that the "Parameters" column can be removed.

Technical details
------------------
The class `LadspaMatrixControlDialog` now creates a widget that contains
the matrix layout with the controls. This widget is then added to a
scroll area. The layout is populated in the new method
`arrangeControls`.

Add some helper methods to `LadspaMatrixControlDialog` which retrieve
the `LadspaControls` instance and the number of channels.

Add the implementation of `BarModelEditor` to `src/gui/CMakeLists.txt`.

TODOs
------
Extract common code out of the `Knob` class so that it can be reused by
`BarModelEditor`.

* Use factory to create LADSPA control widgets

Replace the class `LadspaMatrixControlView` with the factory class
`LadspaWidgetFactory`. The former was a widget that wrapped the widget
representation of a LADSPA control in yet another widget with a layout.
The factory simply returns the configured widget so that it can be
incorporated directly in layouts or other widgets.

Adjust `LadspaMatrixControlDialog` so that it uses the
`LadspaWidgetFactory` instead of the `LadspaMatrixControlView`.

* Initial version of FloatModelEditorBase

Create an initial version of `FloatModelEditorBase`. It is intended to
become the base widget for all widgets that manipulate a float model and
provides some base functionalities like context menus, edit dialogs,
mouse handling, etc.

The initial version is a copy of `Knob`. The enum and its values have
been suffixed with "Temp" as they will be removed later anyway. Same
applies for the function `convertPixmapToGrayScaleTemp`.

* Remove Knob related code from FloatModelEditorBase

First removal of Knob related code from FloatModelEditorBase.

* Remove setHtmlLabel

* Remove enum for knob types

* Remove label related code

Remove setLabel and the members m_label and m_isHtmlLabel.

* Remove several Qt properties

* Remove angle related members and methods

* Remove unused members and includes

* Clean up includes

* Make BarModelEditor inherit from FloatModelEditorBase

Make `BarModelEditor` inherit from `FloatModelEditorBase` so that it
inherits all shared functionality. Currently the class mostly implements
size related methods and overrides the paint method.

* Move LadspaWidgetFactory to LadspaEffect

Move the class `LadspaWidgetFactory` to the project LadspaEffect to make
it hopefully compile with mingw32 and mingw64.

Interestingly the code compiled and worked under Linux and MacOS.

* Code adjustments after scripted checks

Add an include guard and an additional `#pragme once`. Add comments to
closing namespace scopes.

* Export BarModelEditor

Export BarModelEditor so that for example the LadspaEffect project/
plugin can use it.

* Improve rendering of bar model editor

Increase the margin from 2 to 3 so that we have a more prominent border
around the filled area.

Fix a problem in the rendering code which led to situations where the
bar was drawn to the left of the start position for small values.

Return a more exact minimum size hint.

* Elide long parameter names

Elide long parameter names if needed.

* Enable horizontal direction of manipulation

Extend `FloatModelEditorBase` so that it also allows manipulation of the
values when the mouse is moved in horizontal directions. The default is
to use the vertical direction.

Make use of this new feature in `BarModelEditor` which now reacts to
horizontal movements when changing values.

* Represent enum parameters using the bar widget

The implementation of the current LADSPA dialog in master uses knobs to
represent enum parameters. Therefore it should also work with the new
bar widget.

This gets rid of many labels with the parameter name followed by
"(unsupported)".

* Remove TODO in LadspaWidgetFactory

* Render text of LedCheckBox with default font

Extend LedCheckBox so that it adds support to render the text with the
default font in the default size. The class now supports two modes:
* Legacy mode
* Non-legacy mode

Legacy mode is the default and renders the LedCheckBox as before. The
font is set to 7 pixels and all the text is rendered with a shadow.

Non-legacy mode uses the current font to render the text. The text is
rendered without a shadow and the pixmap is centered vertically to the
left side of the text.

The non-legacy mode is currently only used in the context of the matrix
LADSPA dialog. Toggle options are rendered using it as well as the "Link
Channels" button.

* Use "yellow" LEDs for bool parameters

Use "yellow" LEDs (which are actually blue) for dynamically added bool
parameters so that the dialog is consistent with regards to the LED
colors. The "Link Channels" button also uses a "yellow" LED.

* Fix Qt5 builds

Fix the Qt5 builds which do not know horizontalAdvance as a member of
FontMetrics.

Also refactor LedCheckBox::onTextUpdated to make it more compact.

* Style sheets for BarModelEditor

Add style sheets options for BarModelEditor. See the changes in
style.css for the available options and their usage.

The members that can be manipulated by the style sheet options are
initialized accoriding to the palette so that the BarModelEditor should
also render something useful if no style is set.

Adjust the paintEvent method to use the style sheet brushes and colors.

* Layout optimizations

Set the vertical scroll bar to always show so that the controls do not
move around if the scroll bar is hidden or shown.

Set the margin of the grid layout to 0 so that the whole dialog becomes
tighter.

* Get rid of initial scroll bars

Make sure that the widget is shown without a scrollbar whenever possible
using the following rules.

If the widget fits on the workspace we use the height of the widget as
the minimum size of the scroll area. This will ensure that the scrollbar
is not shown initially (and never will be).

If the widget is larger than the workspace then we want it to mostly
cover the workspace. In that case the minimum height is set to 90 % of
the workspace.

* Switch to a green theme

Switch to a green theme to better match the default theme.

* Adjust classic theme

Adjust the classic theme so that it renders the bars in a legible way.

* Fixes for CodeFactor

Remove virtual keyword from methods that are marked as override.

Remove whitespaces that make CodeFactor unhappy. One of these fixes
includes moving the implementation of
LadspaMatrixControlDialog::isResizable into the cpp file.

* CodeFactor is still unhappy

Remove a blank line after the constructor.

* Center align time based controls

Align time based controls, i.e. knobs, in the center.

The implementation defeats the purpose of the widget factory a bit but
it makes the design look nicer.

* Fix build

Fix the build by adjusting the enums. I added the changes while writing
the commit message for the merge commit but they did not make it.

* Attempt at CodeFactor warning

Try to make the last CodeFactor warning disappear.

* Add bar controller with tempo sync option

Add `TempoSyncBarModelEditor` which adds a tempo sync option to a `BarModelEditor`. Please note that the code was mostly copied and adjusted from the `TempoSyncKnob` class. It was not attempted yet to unify some of the code because with the current design it seems to be a road to "inheritance hell". A better solution might be to refactor the code so that it is more composable.

Another option might be to move the tempo sync functionality into a class like `FloatModelEditorBase`. Although this would not be a 100% right place either because `TempoSyncKnobModel` inherits from `FloatModel`. In that case we'd have specialized code in a generic base class.

Adjust `LadspaWidgetFactory` so that it now returns an instance of a `TempoSyncBarModelEditor` instead of a `TempoSyncKnob`.

Remove the extra layout code from `LadspaMatrixControlDialog.cpp` as most things are bar editors now.

Adjust `TempoSyncKnobModel` so we do not have to make `TempoSyncBarModelEditor` a friend of it.

* Another attempt to please CodeFactor

Have another attempt to fix CodeFactor's complaints about `LadspaMatrixControlDialog.h`.

* Coding conventions, blanks and blank lines

Remove lots of unnecessary white space. Remove blank lines. Remove leading underscores from parameters.

Remove line breaks in `TempoSyncBarModelEditor.cpp` to make the code more readable. Remove repeated method calls by introducing local variables.

* Break down complex method

Break down the complex method `TempoSyncBarModelEditor::updateDescAndIcon` by delegating to the new methods `updateTextDescription` and `updateIcon`.

* Another attempt to please CodeFactor

Another attempt to fix `LadspaMatrixControlDialog.h` to please CodeFactor.

* Work on TODOs

The TODO "Assumes that all processors are equal..." has been turned into a comment when we start iterating over the channels. If the channels are not of the same structure this would likely also have been a problem in the old implementation.

The TODO "Use a factory..." has been removed as this is already done.

The include of `FloatModelEditorBase.h` in LadspaWidgetFactory has been removed.

* Modifier keys for mouse wheel adjustments

Integrate the changes of commit 7000afb2ea into `FloatModelEditorBase`.

This commit added modifier keys for mouse wheel adjustments to the `Knob` class. The port to `FloatModelEditorBase` results in the bar control now also supporting different scales of adjustments that can be switched with the Shift, Ctrl and Alt keys.

* Show current value on mouse over

Integrate the changes of commit fcdf4c0568 into `FloatModelEditorBase`. This commit lets users show the current value of a float model when the mouse is moved over the control.

* Make Knob inherit from FloatModelEditorBase

Make `Knob` inherit from `FloatModelEditorBase`. This is mostly a continuation for the changes introduced with commit c63d86f.

The idea is that `FloatModelEditorBase` contains the underlying functionality and logic to deal with float models. `Knob` and other classes then only override the presentation aspects. This way `Knob` and `BarModelEditor` can share the same functionality but can differ in how they present the data.

Technical details
------------------
Remove all methods that are already defined in `FloatModelEditorBase` from `Knob`. These are all methods that are defined in the same way in `FloatModelEditorBase`. The method `paintEvent` is not removed because it is overridden by `Knob` as it has its own presentation.

Remove forward declaration of `QPixmap` from `FloatModelEditorBase` as it was not used. Remove unused function `convertPixmapToGrayScaleTemp` from `FloatModelEditorBase`.

* Cleanup includes in Knob class

* Code style changes in FloatModelEditorBase

`FloatModelEditorBase` is a new class/file. Therefore we can do some extensive code cleanup on the code that was initially copied from `Knob`.

Adjust whitespace for methods and some if-statements. Remove underscores from parameter names. Use only two blank lines between method definitions.

* Cleanup include for FloatModelEditorBase

* Show effect name as title of dialog

Add the effect name as the title in the content of the window. This improves the structure of the dialog as it is now clearer from the content itself to which effect the controls belong to.

This duplicates the information from the window title. However, the window title is rather small and the larger font in the content makes it easier to find an effect in a set of opened dialogs.

* Revert "Show effect name as title of dialog"

This reverts commit 8ce0d366d0.

* Fix problem with LedCheckBox in grid layout

The LedCheckBox does not play nice when being used in a grid layout as it disables the resizing behavior of every column it appears in.

The solution is to wrap it into the layout of a parent widget that knows how to behave.

* Reduce minimum width of BarModelEditor

Reduce the minimum width of `BarModelEditor` from 200 to 50.

---------

Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
2023-10-29 11:16:39 +01:00
Rossmaxx
732e5cc3c9 fixed broken 21pink LCD display (#6914) 2023-10-15 11:38:03 +02:00
Bimal Poudel
84aca0a2d2 Wrap resource urls in double quotes (#6898) 2023-10-10 20:56:46 +01:00
IanCaio
999c10e4b3 Adds feature to edit tangents of Cubic Hermite progressions (#5924)
Enables the editing of a node's tangents of Cubic Hermite progressions.

* First commit

	This commit introduces the use of AutomationNodes instead of just floats for keeping the automation values. The AutomationNodes will give more flexibility when it comes to storing extra information about the values (and make it possible to have multiple progression types in the future). Now the tangents are stored on the node, requiring one less timeMap on the automation pattern. Some methods had to be changed for that, since before they used const_iterator, which wouldn't allow us to change the tangent values.

TODO:
	- Check TODO comments that were added in places of the code I had some doubts about.
	- Maybe change the timeMap to hold pointers to AutomationNodes and not actual instances.
	- In some pieces of the code, I check if the AutomationNode already exists before setting its value or creating another node. I think that's unnecessary since if I create another node and assign it to the current existing one it could just clone its value. (That would not be valid for pointers to AutomationNodes, so that's something to consider when deciding between the two).
	- I still didn't find a good solution for renaming QMap::iterator method from "value()" to something else, so now we have lines that look a bit odd like "it.value().getValue()", because value() is actually returning the node, and getValue() is getting the node's automation value.

* Implements inValue/outValue on Automation Nodes

	This commit is a big change in comparison to the previous one. Automation nodes now have a inValue and outValue instead of a single value. The inValue represents the core value of the node, which is used for incoming progressions. The outValue represents the value of the node for progressions starting from that node on. In practice, the true value of the node is the inValue and outValue represents a way of creating discrete jumps in a node's position.
	By default inValue and outValue are the same. The user will then be allowed to change the outValue to create those discrete jumps. Because their values might be different, we now need two tangents for a single node: One for the curve coming before the node and one for the curve coming after the node. So instead of a single tangent variable, we now have inTangent and outTangent. If inValue and outValue are the same, so are inTangent and outTangent, but if they are different both are calculated according to the curve before and after the node.
	On the Automation Editor, the inValue of the node is represented by our default blue circle, while the outValue is represented by a red circle with 80% alpha (we should add a variable to the Automation Editor class to hold the color of this second circle in the future).
	Lots of comments were added on the modified files to explain the existing methods where changes were required (not only explaining the logic of the methods but the reason behind using inValue or outValue on them). Lots of TODO comments were also added as placeholders for changes that could or should be done before the finishing of this PR (or after it).
	For now only the logic for the nodes was added, but there's still no way for the user to change outValues (on the next commit a small placeholder shortcut will be added to do that for testing purposes).
	The drawing of the notes detuning on the piano roll was updated to account for the discrete jumps.
	The drawing of the pattern TCO was updated to account for the discrete jumps.
	The drawing of the pattern on the AutomationEditor was updated to account for the discrete jumps.

	IMPORTANT:
		- There were changes to the loadSettings and saveSettings of AutomationPatterns, to account for inValues and outValues, but I didn't create an upgrade routine yet.

	Some behavior that is important to mention:
		- Most operations on nodes (drawing, moving, X/Y flipping, and even selection copy/paste, apparently not fully finished) ignore the outValue, basically reseting it to the inValue. So when an user moves a node with a discrete jump, for example, that discrete jump will be lost and the user will need to set it again. Obviously in the future we might want to keep that information, but that isn't a critical issue, just a behavior that can be improved later by upgrading the code.
		- Later on we might want to connect a signal to the AutomationNode class, so it calls generateTangents when node data is changed.
		- When an object is disconnected from an automation pattern and it has to rescale the values so they fit the new range of values (max and min) the outValue is reset, meaning all discrete jumps are lost. This behavior will be changed in the future.

	Things that I think are also important noting:
		- Mainly in the src/gui/editor/AutomationEditor.cpp file there were lots of codes that apparently are related to a feature that is not yet finished (moving/cutting/copying/pasting selections of automation values). This doesn't sound good unless it's currently being worked on. I tried my best to update the current code to comply to the use of AutomationNodes so their developing can be picked up from a unbroken state. As with other operations involving AutomationNodes, they only account for the inValue discarding any discrete jumps that were present.
		- I added comments on some logic that seemed flawed in the src/gui/editor/AutomationEditor.cpp file so it can be reviewed. It's beyond the scope of this PR, but since I had to read and change a lot on that file I thought it was pertinent to at least comment those observations.

* Fixes and refactor code on AutomationEditor.cpp

	While implementing the automation nodes, I noticed AutomatinEditor.cpp had some issues regarding flawed logic, code style convention, code that could comply to DRY paradigm, conditions that resulted in Undefined Behavior and unused legacy code. That's probably due to how old some changes are, they probably reflect a much different state of LMMS's code base. To make the transition to automation nodes a better one and avoid having to rework everything later I'm using the fact I have to get in touch with most of this code to try to fix some things.

	This commit starts refactoring AutomationEditor::mousePressEvent and AutomationEditor::mouseMoveEvent. There are still things to be improved on both but I'll slowly commit them so I can have better versioning control of the PR.

	Some changes worth noting:
		- A new action was created in the AutomationEditor class for drawing lines, since its logic was too mixed up with the logic of drawing and dragging a single node.
		- Changed most variable names to fit the current code style (just very few left to change).
		- Improved comments explaining the code.
		- Created a separate method for checking if the mouse position is sitting over an existing node (previously this code was repeated inside the event method and it had flaws on its logic, most of the times returning that the user didn't click a node even when he/she clicked one). Method is called getNodeAt(x,y,r), r being the "radius" to be considered (not actually a radius, the area is actually a square).

	Some changes that are still planned:
		- Removing legacy code for features that weren't finished (select and move selection) if it's agreed.
		- Adding some logic to the DRAW_LINE action so it can be even improved.
		- Not forgetting the main focus of the PR, adding a way for the user to edit the outValue of nodes.

* Avoids unnecessary check in putValue

	When adding a value to a particular time, instead of checking if there's a node there already and manually setting its value, we just assign it with a new AutomationNode. QMap silently removes the existing node and adds the new one.

* Adds upgrade routine for the automation nodes

	Adds an upgrade method for the change in the automation nodes settings. The "value" attribute of the <time> element is deleted and assigned to the "inValue" and "outValue" attributes.

	Now older project files can be loaded properly.

* Allows dragging outValues on the Automation Editor

	This commit introduces a way for the user to drag outValues on the Automation Editor, by Alt+clicking the outValue red node and dragging up and down.

	A new action was added for that purpose, called MOVE_OUTVALUE. When the user clicks a outValue sphere with the Alt modifier, m_action is set to MOVE_OUTVALUE, and the time position of the node being affected is stored on m_draggedOutValueKey. That is later used on the mouseMoveEvent to update the outValue of the node.

	Removed repeated code on the mouseReleaseEvent and removed excessive blank lines after a method.

	Things to keep in mind when testing through this commit's build:
		- Creating/Moving an automation node resets the outValue
		- When the outValue is changed, generateTangents isn't called automatically. So you'll notice that after adding another automation node the curves change (that's because after the new node being added the tangents are then recalculated).

	Still lots of work ahead!

* Small fix inside AutomationPattern.cpp

	Unnecessary loop was removed with call to appropriate method.

* Creates separate files for AutomationNode

	Creates a separate header and source file for the AutomationNode class.

* Adds more members to AutomationNode

	Adds 2 new members to the AutomationNode class:
		m_pattern - A pointer to the pattern this node belongs to
		m_key - The time position (timeMap key) of this node

	The constructors (and places they were used) were updated accordingly. AutomationNode was also made a friend class of AutomationPattern so it can access private/protected methods from its pointer. This will be later used to allow AutomationNode's to call generateTangents once their values are updated.

	Small fix on a code block related to moving selections inside the mouseMoveEvent from AutomationEditor.

* Removes unused code from AutomationEditor

	This commit removes code that was not currently used in the AutomationEditor. Most of it was related to a feature I believe was once functional but broke along the way, but the code was not cleaned up in an effort to fix it later. The feature allowed selecting and moving/cutting/copying/pasting/removing values from the automation pattern. It added up to lots of lines of code, which so far I was keeping up to date to the changes. However, I believe (and others devs agree) that rewritting this code later might be a better approach than trying to fix what we currently have, so I'm removing the obsolete code. The git history will allow us to reference back to it when implementing the feature again and this will make it harder for this PR to introduce bugs because a certain affected feature couldn't be tested.

	It also makes reviewing easier, for there are less affected code to cover.

For reviewing purposes:
	I used a single commit for removing the mentioned code, so its diff in relation to the previous commit should give a good idea of everything that was removed.

* Changes to the outValues now update the tangents

	The methods that change the inValue and outValue of nodes now also generate new tangents for the previous, current and next nodes (the ones affected), so now when the user drags the node outValue the curve is updated accordingly.

* Keeps discrete jumps when flipping patterns

	Adds a method to the automation node that returns the valueOffset between inValue and outValue. AutomationPattern::putValue now has an extra parameter called outValueOffset (defaults to 0), so when it adds a node to the timeMap the outValue is set according to this offset. flipY() will calculate the offset and invert it, so the discrete jumps are kept but flipped vertically as well. flipX() doesn't need to calculate this offset because it uses the outValue itself.

Obs:
	I believe cleanObjects() was meant to be called everytime AutomationPattern::flipX() is called, but it was inside a conditional that would only call it on some situations. I moved it outside of the conditional.

* Allows reseting outValues on the AutomationEditor

	User can now reset the outValue of nodes on a very analogous way to removing nodes but with the Alt key pressed. Alt + right clicking over the node (or dragging over an area), or Alt + clicking on it on Erase mode (or dragging over an area) will reset the outValues of the nodes.
	To do that, two new actions were created: ERASE_VALUES (for the regular node removing) and RESET_OUTVALUES (for the outValues reseting). Those are checked for in the moveMouseEvent, which acts accordingly. The removePoints() method was removed and two new methods were added instead: removeNodes() and resetNodes(), which will remove nodes on a tick range or reset them respectivately.

	The AutomationNode.h and AutomationNode.cpp files were fixed to fit the current code style conventions. The other files were kept as is, so they can be changed all at once at the end of the PR.

	Change requests made by Veratil were done.

* Makes so dragging nodes keep the outValue

	This commit makes a small change to setDragValue. When starting the drag (m_dragging == false), it checks if the time position being dragged already has a node. If it does, then the offset between inValue and offValue is stored on m_dragOutValueOffset so it can be used on the putValue calls, keeping the offset. If there isn't a node in the time position, m_dragOutValueOffset is set to 0.

* Fixes code style on modified code

	Fixes the modified code to comply to current code style convention.

	I tried to keep the changes exclusive to the lines modified by this PR (to keep the diff cleaner), but I might have fixed a couple of other because either they were hard to differentiate on the current diff or because they were too close in context. But still, tried to keep changes mostly to the lines actually changed by the PR.

* Adds a QProperty for the node outValue color

	Adds a CSS property for the outValue color and renames the one used for the inValue color so they are consistent.

	Colors were added to classic and default themes. The original inValue colors were kept, but to fit with the outValue node they had a little bit of transparency added.

* Adds doxygen comments on methods

	Adds doxygen comments explaining methods that were either introduced by this PR or which had parameters modified by this PR.

	Changes valueAt(timeMap::iterator, int offset) method, so it can handle offsets equal to 0 properly. This method is currently never used with an offset of 0 (because this case scenario is handled before this method is called), but it was a simply modification so I just added the conditional to make it possible to use an offset of 0.

* Refactor flipX and flipY methods

	AutomationPattern::flipX and AutomationPattern::flipY had some issues to the logic that caused UBs (from accessing an iterator past QMap::end()) and possibly misbehaviors when flipping an empty pattern.
	Both were refactored to fix those noted issues.

* Add a new edit mode to Automation Editor

	Adds another editing mode to Automation Editor (DRAW_OUTVALUES), specific to deal with node outValues. The Pixmap being used is the same as the DRAW edit mode for now.

	The way it works now:

DRAW Mode (Shortcut SHIFT+D)
	Shift + Left click = Draws lines of nodes
	Left click = Draws/Drag node
	Right click = Remove nodes

ERASE Mode (Shortcut SHIFT+E)
	Left click = Remove nodes
	Right click = Reset outValues

DRAW_OUTVALUES Mode (Shortcut SHIFT+C)
	Left click = Drags outValue
	Right click = Reset outValues

	Now using a switch statement on the events to make things more organized.

* Improves the Draw OutValue edit mode

	Now, instead of only being able to change an outValue by clicking over the sphere representing it, the user can also click on any time on the pattern: If the quantized time of the place he clicked has a node, the outValue of its node will be set to the value where the mouse click happened and the outValue will start being dragged. Very similar to the way it works for the node itself on the draw mode.

* Adds mutex to AutomationPattern

	Adds a recursive mutex to the AutomationPattern class and locks it on every method that access the member variables. Also rename the mutex from the AutomationEditor class and add locks to some methods that didn't have it before (except on methods that don't access member variables).

* Veratil's review changes

	Applies changes requested by Veratil:
		- Replaces NULL with nullptr where necessary on AutomationEditor.cpp
		- Fixes spacing on the mutex commit (plus some other places)
		- Changes some if blocks to one liners
		- Replace while with do-while on some places, since the condition was already checked for earlier on the method.
		- Moves getNodeAt call a level up on the block, since it's called on both conditionals below.
		- Fixes identation on some code inside AutomationEditor::mousePressEvent.
		- Adds explicits blocks on a switch statement. Even though this was not necessary for that particular one (because there was no variable declaration inside it) it helps keeping it consistent with another switch statement that happened earlier.

I also added a break statement to the last case of a switch (even though it was not needed, it's safer to avoid mistakes in the future with new cases being added).

* Changes the inValue sphere to be draw first

	The red sphere representing the outValue was drawed after the blue sphere representing the inValue. Because of that, if they had the same value the red sphere would be on top. For the user, it makes more sense to be able to see the blue sphere representing the input value on top instead. This commit changes the order of the drawing.

* Changes comments and variables names

	Fixes some comments pointed out on Spekular's review. Changes the AutomationNode's variable m_key to m_pos (leaving a comment on the header reminding that it matches the timeMap key). Removes comments related to removed code. Fixes code style on a pointer declaration.

* Changes QProperty variables to use MEMBER

	Instead of creating a getter and setter for each QProperty, we use MEMBER instead and access those variables directly.

* Overloads some AutomationNode's operators

	Overloads compound assignment operators +=, -=, *= and /= for AutomationNodes, making it so they affect the inValue and outValue of the node being assigned. Changes AutomationPattern::flipY() so it uses the new operators.

* Improves getNodeAt method

	Makes the AutomationEditor::getNodeAt method more efficient, by exiting if the node we are checking is already past the position we given (since the nodes are ordered in the timeMap, all subsequent nodes will also be past the position). Now instead of returning the last node that is inside the coordinates, it returns the first.
	Also improves AutomationEditor::mousePressEvent to avoid getNodeAt being called twice unnecessarily.

* Changes behavior of setDragValue

	Now, instead of keeping the offset between the inValue and outValue while dragging a node, setDragValue will either keep the current outValue intact, or move it together with the inValue if they are the same.
	The putValue method now doesn't have an offset parameter. If we want to put a node with an outValue different from the inValue we use putValues instead.

* Moves getNodeAt to an upper level, reducing lines

	Creates a boolean before the m_editMode switch, that will be true if the action being processed affects outValues and false if it affects inValues. That way we can move the statement clickedNode=getNodeAt() before the switch-case, reducing repeated lines.

* Changes icon of Draw OutValue edit mode

	Changes the icon for the Draw OutValue tool and toolbar action, so it's different from the Draw mode. Just a placeholder until a visual artist come up with something better or we change the controls.

* Removes unnecessary non-const methods

	Some getter methods had declarations for both const and
non-const object types, when just the const one were needed (no changes
to the object are made). The unnecessary ones were removed.
	Also fixes formatting on operator /= method.

* Fixes formatting and doxygen comments

	Fixes doxygen comments on AutomationPattern.cpp and
AutomationEditor.cpp (also changes one so it uses the same format as the
rest of the file).
	Fixes some formatting issues (removal of excessive tabs,
changing some statements to be one line instead of multiple lines,
fixing of spacing, use of one line ifs, removal of unnecessary else on a
method, use of ternary expressions, etc).

* Adds helper macros for AutomationNodes

	Adds 3 macros to the AutomationNode header file: INVAL, OUTVAL
and POS, which return the InValue, OutValue and Key of a node
respectively. This improved redability and made statements shorter on
the AutomationPattern.cpp code.
	Macros weren't added for InTangent and OutTangent, since those
are only used once in the code (and INTAN/OUTTAN might not have their
meaning as obvious as INVAL/OUTVAL).

* Removes tabs from ternary operator

	Removed tabs to improve formatting on a ternary operator
as requested and also removed a comment that doesn't seem necessary.

* Update files to use AutomationNode macros

	Other files besides "AutomationPattern.cpp" also included the
AutomationNode.h header and handled automation nodes, but they weren't
using the macros. Those were updated to use INVAL, OUTVAL and POS
macros.
	Two conditionals were changed to one liners for consistency.

* Addresses my own code review

	This commit addresses some fixes from a review I made from the
code on Github and also one requested change from Veratil.

	Changes:
	- Fixes code style issues.
	- Adds a helper MACRO to return the offset between the inValue
and outValue of a node and use it where getValueOffset was called.
	- Removes conditional that was not needed inside
AutomationPattern::valueAt.
	- Updates InlineAutomation.h to use the helper MACROs and
account for the outValue when deciding whether to save or discard an
inline automation.
	- Adds TODO comments on two loops present on
src/code/AutomationPattern.cpp that could be optimized.
	- Fixes some comments.
	- Uses INVAL(it) instead of valueAt(POS(it)) on the flip methods
when possible.
	- Adds a resetOutValue() method to AutomationNode and use it
where convenient.
	- Fixes a small "bug" where flipping a pattern from the TCO
context menu, when the pattern is smaller than the TCO, would use the
inValue of the last node for the node created at the end of the TCO
instead of the outValue (which is the value that the position would have
if the pattern continued).

* Addresses Veratil's review

	- Fixes some code style issues
	- Changes to improve readability at some snippets
	- Uses if one-liners when convenient
	- On a polynomial expression inside AutomationPattern::valueAt,
uses some variables to improve readability (those will be optimized out
by the compiler)
	- Removes unnecessary casting on alignedX variable inside
AutomationEditor::mousePressEvent (it was also using C-style casting
instead of static_cast)

* Adds helper MACROs for node tangents

	Adds INTAN and OUTTAN macros to retrieve a node's InTangent and
OutTangent respectively, and replace calls to getInTangent/getOutTangent
with those macros.

* Fixes header inclusion order

* Removes mutex from AutomationEditor

	Now that there's a mutex protecting the AutomationPattern on its
own methods, there's no need to have a mutex on the AutomationEditor
class. The editor's member variables don't need to be protected because
LMMS's UI runs from a single thread.
	This commit removes the m_patternEditorMutex.

* Locks mutex on AutomationPattern copy assignment

	On the copy assignment constructor of AutomationPattern, the
values were being copied from the other pattern without locking its
mutex, which could result in race conditions. Now the constructor locks
the other pattern's mutex.

	Other small changes:
	- Removes unnecessary comments and fix others.
	- Uses the OFFSET macro on the generateTangents method.
	- Uses the resetOutValue() method on
AutomationEditor::mousePressEvent, in a place where I forgot to change
it.

* Changes resetOutValue() so it generates tangents

	Changes the AutomationNode::resetOutValue() method so it calls
setOutValue() instead of directly setting the m_outValue, since the
latter will also take care of generating tangents.
	Fixes small bug where reseting outValues would not recalculate
the tangents.

* Changes some methods to use for loops

	AutomationEditor::removeNodes and AutomationEditor::resetNodes
were previously using while loops where for loops are much more well
suited. Both methods were changed to use those instead.

* Move removeNodes/resetNodes to AutomationPattern

	- Renames AutomationPattern::removeValue to
AutomationPattern::removeNode.
	- Moves AutomationEditor::removeNodes and
AutomationEditor::resetNodes to AutomationPattern, since they are more
suited there and could be reused in other areas of code that need to
remove a range of nodes.

* Optimizes loop inside putValue/putValues

	There was a TODO comment about a loop that could be optimized
inside putValue/putValues. It went through all the ticks in the
surrounding values instead of just going through the nodes that were in
that range. Now that the removeNodes/resetNodes methods are part of the
AutomationPattern we can use them to optimize the loop.

	Changes:
	- removeNodes/resetNodes will remove or reset a node if a range
with start == end is given (before it would return).
	- The loop was replaced with a call to removeNodes from
newTime + 1 to newTime + quantization() - 1 (which will cover the nodes
that are between the quantization limits). We add a conditional that
quantization() is greater than 1 to avoid a bug where the added node is
removed by that call because we get a range from [newTime + 1, newTime].

* Adds comment to mysterious calculation

	There was a calculation on the drawAutomationPoint method that
wasn't really obvious at first glance. Thanks to @PhysSong, a comment
was added explaining the reasoning behind the calculation.

* Reduces indentation on getNodeAt

	Reduces one indentation level on AutomationEditor::getNodeAt()
by reversing the conditional.
	Fixes style on switch statements.

* Applies Veratil suggestions

	Condense two code blocks in a single one by using a ternary
operator on the only variable that changed between them.

	Comment out a "else" block that currently doesn't have anything
(placeholder for future code).

	Format a for statement in multiple lines to improve readability.

* Updates comment from changed code

	Updates comment to better match the recently changed code.

* Uses lambda functions to extract code

	Uses two helper lambda functions inside
AutomationEditor::mousePressEvent to extract code and use fewer lines on
places where it's repeated.

* Fixes behavior of AutomationPattern::flipX

	To truly flip a pattern horizontally, we also needed to swap the
inValues and outValues of the nodes being flipped. This commit fixes
that behavior by including the swap when necessary.

	Also adds a TODO comment regarding the behavior of the
generateTangents method when the difference between inValue and outValue
is very small.

* Changes pattern XML for backwards compatibility

	Changes the inValue attribute name on the XML from "inValue" to
"value" to make projects created with the new automation pattern
partially backwards compatible (outValues will still not be loaded
obviously, but the inValues will be loaded as the regular pattern values
we had before).

* Fixes bug on AutomationPattern::resetNodes

	Fixes bug on AutomationPattern::resetNodes: If it was called
with tick0 == tick1, m_timeMap.find() return value was being used to
call resetOutValue. When QMap::find() doesn't find a value it returns
QMap::end() though, resulting in a SegFault.
	Fixed by checking if the return value is QMap::end() first.

* Adds drawing of automation node tangents

	This introduces a method on the AutomationEditor that draws a
line and an ellipse representing the inTangent and outTangent of
Automation Nodes, so they can be visualized on the Cubic Hermite
progression.
	The tangents are not yet editable.

* Adds mode to edit tangents

	Adds the edit mode that will be used to edit tangents. For now
there's no functionality, only the GUI elements were added.

* Adds comment about copy-assignment

	Adds a note about the default copy-assignment from
AutomationNode being used on the AutomationPattern constructor. If any
dynamic allocated resources are added to the class, an user-defined
copy-assignment constructor should be used instead.

	Also changes the position of an arithmetics operator on a
multiline statement for readability.

* Changes flipY logic and address PhysSong review

	This commit addresses PhysSong review:
	- An if-statement was replaced with a ternary operator on
AutomationEditor::paintEvent().
	- One comment was improved on PianoRow::drawDetuningInfo() to
make it clearer that drawing cubic hermit curves as straight lines is
just a temporary thing.
	- While applying the requested changes on the
AutomationPattern::flipY() method, I noticed that even though it
accepted any integer values as min and max, the current logic (both on
master and on the previous commit from this PR) would only work if the
range was [-max,+max] or [0,+max]. If min was -5 and max 10 for example,
the flipping could return us a pattern with values out of range. This
commit replaces the logic with an improved one that now relies on the
distance between the node and the edges of the range instead, thus
working for any range instead of those two mentioned earlier. The new
logic also attend to the request of using a for-loop and also using
in-place operations.

* Implements the dragging of node tangents

	Implements the action of dragging node tangents. A method called
getClosestNode returns the node that is closest to the mouse X position.
Then the action begins, with the tick of the node having its tangent
dragged stored in a local variable. It's also calculated whether we are
dragging the inTangent or outTangent.
	The new tangent is calculated as the tangent between the current
mouse position and the automation node.

* Saves tangent information from automation patterns

	Now saves the tangent values of automation pattern nodes. While
loading, for backwards compatibility, if any node doesn't have tangent
information the tangents are generated. Else, they are loaded from the
project file and kept.

	Dragging a node still resets all tangents. Moving an outValue
resets the tangents from the surrounding nodes.

* Implements the locking of tangents

	Now when the used manually edits a node's tangent, the node
locks both its tangents so they aren't recalculated by
AutomationPattern::generateTangents().
	When the used resets the tangents of a node (by right clicking
close to it on the edit tangents mode) they are unlocked again, and are
allowed to be recalculated.
	This information is saved on the project file as well.
	A macro was added to quickly return whether a node's tangents
are locked.
	AutomationEditor was made a friend class of AutomationPattern to
enable it to call generateTangents when a node's tangent is reset.

* Checks only for inTan on the LoadSettings

	When loading an automation node, when checking if we have
tangent information we only have to check for either inTan or outTan,
because if we have one we will have the other.

* Adds a convenient way to reset multiple tangents

	Now right clicking and dragging on Edit Tangents mode will reset
multiple tangents (similar to how it works for the reseting and removal
of nodes).

* Fixes small bug on generateTangents

	AutomationPattern::generateTangents() expects that a valid node
is given. While generating the amount of tangents requested, it avoids
going out of bound by checking if the node after the one being iterated
is the end of the timeMap, then setting the tangents to 0 and returning.
That worked fine before, but now we skip nodes that have their tangents
locked, so it could happen that the last tangent was locked and skipped
and we end up iterating m_timeMap.end().
	This was causing a segmentation fault if we edited the tangents
of the last node and added a new node after it. To avoid that, a second
conditional was added to the for-loop to check if the current node is
the end of the timemap.

* Fixes bug with Edit Tangents shortcut

	Bug found by @superpaik. I was setting the Edit Tangents
shortcut to the Draw OutValues mode, overriding its correct shortcut and
leaving Edit Tangents with none.

* Disables Edit Tan mode on other progressions

	The Edit tangents mode is now disabled when the user switches to
a different progression mode and reenabled when it changes back to Cubic
Hermite mode.

* Keep tangents when dragging nodes

	As requested by @superpaik after testing, logic was added to the
AutomationPattern::setDragValue method to keep a node's tangents if they
were locked.
	First, the method checks if the tangents were locked in the
first drag iteration and store its values if they were.
	Then, everytime the dragging routine puts a new value in the
timemap, it will set its tangents and lock them if needed.

* Changes tangent calculation behavior

	Changes the behavior of the tangent calculation for the Edit
Tangent mode. The new behavior will be submitted for testing to see if
it's considered better than the previous one, and reverted if it isn't.
	Also fixes a possible division by 0 bug.

* Fixes undo/redo with tangents editing

	The tangents editing logic was missing adding a journalling
checkpoint, hence the undo/redo wasn't working properly.
	This commit fixes it.

* Uses function to check if tangents can be edited

As per requested by PR review, instead of checking if the automation
clip uses Cubic Hermite progression to allow changing tangents, we now
instead use a method that will return true if the current progression
type allows tangent editing. That way it's easier to allow tangent
editing for new progression types that might be added in the future.

* Fixes bug reported by zonkmachine

	- The Edit Tangents button was not updating correctly when
the clip was changed inside the automation editor. This was fixed by
making the update routine a separate method and calling it on the places
necessary (when changing progression modes and when changing clips).
	- Some suggestions from messmerd PR review were also included.

* A couple review requests forgotten

	- Just adds 2 more review requested changes that were forgotten
in the previous commit.

* Address Sakertooth's review

* Adresses Sakertooth's review

* Address Sakertooth's review

	- Simplifies method that updates the edit tangent button on the
automation editor

---------

Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
2023-10-06 18:37:46 -04:00
Michael Gregorius
cc6a0e86b5 Remove border/shadows from scroll area
Remove the border/shadows from the QScrollAreas used in the context of the setup dialog via the style sheet.
2023-10-01 10:17:08 +02:00
Michael Gregorius
339ee6d1e9 Merge remote-tracking branch 'upstream/master' into 2510-SetupDialogWithLayouts-MasterMerge
Merge master to integrate the changes of:
* f10277715f: Classier enums
* 7aca8ae726: SetupDialog: Warn of unusual buffersizes
* 8fb9c3e6a2: Fix warnings in Clang build (#6893)

Solved conflicts in:
* src/gui/modals/SetupDialog.cpp
2023-10-01 09:40:42 +02:00
Michael Gregorius
0576f9daa6 Merge pull request #6789 from michaelgregorius/2510-HiDPI-Fix-For-QTreeViews
HiDPI fixes for elements based on QTreeView
2023-09-22 18:54:50 +02:00
Michael Gregorius
93d3e8c82c Adjust the classic theme
Adjust the classic theme so that it is consistent with the changes made to the default theme.

It was only necessary to change the font-size of the check boxes in the file browser to points because the QTreeView already does not contain any font settings.
2023-09-22 18:16:45 +02:00
Michael Gregorius
e5bb07a5ae Merge pull request #6787 from michaelgregorius/2510-Fix-HiDPI-Issues-For-Menus
Fix HiDPI issues for menus
2023-09-22 17:34:51 +02:00
Martin Pavelek
de062d6c54 Show detailed CPU load information in a tool-tip (#5970)
* Profiler rework

* Workaround for GCC bug

* Rollback QFile removal

* Use enum instead of a plain index to describe detailed stats

* Use the GCC workaround code for all compilers to avoid redundancy

* Update and fix comments

* Implement suggestions from review

* Split AudioEngine::renderNextBuffer() into separate functions, fix old formatting

* Remove QFile include

* Revert formatting changes

* Apply suggestion from review (remove unnecessary template parameter)

* Revert more formatting changes

* Convert DetailType to enum class

* DetailType enum class improvements suggested in review

* Use std::atomic for m_detailLoad

* RAII-style profiler probes

* Apply suggestions from code review

Co-authored-by: Dominic Clark <mrdomclark@gmail.com>

* Fix namespace comment

* Improve CPU load widget precision and use floats for load computations

* Atomic m_cpuLoad

* Add custom step size support for CPULoadWidget

* Apply suggestions from review (convert the profiler probe into a nested class, other small changes)

* Do not limit stored load averages to 100%

---------

Co-authored-by: sakertooth <sakertooth@gmail.com>
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
2023-09-04 19:33:42 -04:00
Rossmaxx
fa05ce20b8 Replace corrupted default samples with fixed ones. (#6752)
* pulled from upstream

* replaced broken sample files

* Revert "pulled from upstream"

This reverts commit 76967b5cc4.

* fixed shortened samples

* will this fix exprtk submodule?

This reverts commit 76967b5cc4.
2023-09-03 21:59:29 -04:00
Martin Pavelek
e1d3ecb184 Microtuner UI update (#6206)
* Replace deprecated sprintf() function

* Update microtuner-related UI (add more clues explaining how to use it)

* Simpler wording in the tooltips for "apply" buttons

* Post-merge fix of a forward declaration

* Rename Misc tab to Tuning and transposition; move Microtuner config dialog to Edit menu and make it also available from instrument tab

* Enable word wrap on "MIDI unsupported" label

* Remove forgotten new unnecessary includes

* Rename InstrumentMiscView to InstrumentTuningView in locales
2023-08-31 19:21:26 +02:00
Michael Gregorius
d2a0780a6e Adjust classic style sheet
Adjust the classic style sheet in the same way that the default style sheet was adjusted.

The change also removes the usage of a bold font weight for selected menu items to achieve a more consistent feel.
2023-08-28 20:12:09 +02:00
superpaik
d6cf417a4d Change zoom in SongEditor to a Slider Zoom (#6664)
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
Co-authored-by: Alex <allejok96@gmail.com>
2023-08-24 17:02:26 +01:00
Michael Gregorius
48cdaddd9d HiDPI fixes for elements based on QTreeView
Fix the HiDPI problems for elements that are based on QTreeView by
removing the fixed point based font size from the style sheet. This
affects:
* The file browser
* The headings of the plugin browser
* The patch selection dialogs for GigPlayer and SoundFont player

Also make the text size of the check boxes for user content and factory
content based on a point size instead of a pixel size.
2023-07-29 16:21:05 +02:00
Michael Gregorius
5674bb58e2 Fix HiDPI issues for menus
Menus now use the size that users have set globally for their
applications. This is accomplished by removing the fixed font size
definition (in points) for `QMenu` in `style.css`.

In some places the menus had been set to hard coded font sizes. This
code is also removed and applies to the following menus:
* Combo box menus
* Track operation widget (gear icon on tracks)
* The MIDI port menu
2023-07-29 09:58:40 +02:00
Michael Gregorius
4908bfe1a6 Scalable Setup Dialog
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.
2023-07-16 14:11:24 +02:00
Michael Gregorius
17295a4f86 Introduce SimpleTextFloat
Introduce the new class SimpleTextFloat which simply shows a text and
that works like a pseudo tool tip with a narrow margin. It was extracted
from TextFloat to adhere to the single responsibility principle.

The new class is used by:
* Fader: display the current volume when moving the fader
* Knob: display the current value when the knob is moved
* PianoRoll: display the current value when setting the note volume and
  panning

Add stylings for the new widget in style.css.
2023-01-10 19:20:26 +01:00
Dominic Clark
e92561265c Only rebuild translations when ts files change (#6566) 2022-12-18 18:04:37 +00:00
Levin Oehlmann
7227c89847 Namespace lmms (#6174)
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>
2022-06-19 20:08:46 +02:00
Alex
d2dd7e3db2 Move widget files, add folder for track and instrument (#6374) 2022-05-29 20:48:19 +01:00
Johannes Lorenz
230aece217 Add check-strings (#6379)
This adds a script `check-strings` that checks whether strings, such as file paths or class names, are valid in files outside of the source code, e.g. in translations or themes. This also adds a verify script to verify `check-strings` on a constant git commit. Both scripts are under CI.
2022-05-23 20:35:06 +02:00
Johannes Lorenz
f6bad88ad3 Fix casing of filenames and code in plugins/ (#6350)
No functional changes! No changes to savefiles/presets!

Fixes casing of everything that is currently lowercase but should
be uppercase.

Fixes also some other plugin strings, especially:

* opl2 -> OpulenZ (see 289887f4fc)
* calf -> veal (see ae291e0709)
* ladspa_effect -> LadspaEffect (see 9c9372f0c8)
* remove flp_import (see 2d1813fb64)
2022-04-03 13:26:12 +02:00
JGHFunRun
87b2663ac1 No "tb303" only "TB-303" (#6344) 2022-04-03 13:07:58 +02:00
Alex
dc73911391 Rename Beat/Bassline to Pattern (#6284)
- BB* -> Pattern*
- BBTrackContainer -> PatternStore
- BBTrackContainerView -> PatternEditor
- BBEditor -> PatternEditorWindow

Does not touch save files
2022-02-13 09:03:37 +01:00
Alexandre Almeida
55d361fb65 Rename TCO and related to Clip (#6226)
This PR renames

    TCO -> Clip
    Pattern -> MidiClip
    *TCO and *TCOView -> *Clip and *ClipView

The savefiles are not yet modified by this PR.
2022-01-14 05:45:21 +01:00
Yashraj Shinde
bf323d2024 Rename FxMixer to Mixer (#6239)
... as decided in #6089 and #5592.

This PR replaces every occurrence of "FX" where "Mixer Channel" is meant.
2022-01-09 08:15:23 +01:00
Ray Redondo
7e2ccc13d6 Run dos2unix (#6198) 2021-12-14 23:13:13 +01:00
Martin Pavelek
e07861ced3 Support for alternative tunings and keyboard mappings (#5522)
Co-authored-by: Kevin Zander <veratil@gmail.com>
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
Co-authored-by: Martin <martin@sigma.he29.net>
2021-09-09 18:49:24 +01:00
Martin Pavelek
6f8c6dba82 Alias-free oscillators (#5826)
Add a band-limited, alias-free wavetable oscillator option to the
`Oscillator` class. Use it by default for Triple Oscillator.

Savefiles which do not have this feature enabled (e.g. old
savefiles) will be loaded without this feature to keep the sound
consistent.

Original author: @curlymorphic.
Fixed: @he29-net.
2021-07-04 13:14:59 +02:00
LMMS Service Account
726fae2da3 locale: Update translations 2021-06-04 21:48:38 -06:00
Roxas
4589004e6c Better colors for pianoroll (CSS) (#5953)
Better color for ghost notes and keys after dynamic drawing was added
2021-05-07 16:50:36 -04:00
Martin Pavelek
f288137c22 MIDI range MKII (extracted from microtonal PR) (#5868)
* Update MIDI range to match MIDI specification

Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
Co-authored-by: Kevin Zander <veratil@gmail.com>
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: Spekular <Spekular@users.noreply.github.com>
2021-04-21 00:29:47 -05:00
Lost Robot
ab41037e0b Improve performance and quality of Sample Track display, and add RMS graph. (#5927)
* Buff Sample Track display performance and visuals, and add RMS display

Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
2021-04-15 21:59:46 -05:00
Alex
0967ffbc3a Enhanced quantize in PianoRoll (#5946)
* Button with menu has split highlight

* Add menu with more action to quantize button

* Style changes

* Fix CSS length-zero-no-unit warning

* Add combo button to classic theme
2021-03-16 17:42:08 +01:00
Spekular
8acb9222fd Knife Tool for Sample Clips (Again) (#5524)
* Rebase BaraMGB's Knife
Co-authored-by: Steffen Baranowsky <BaraMGB@freenet.de>

* Draw marker

* Refactoring and shift mode

* Allow resizing

* Add Icon

* Fix stuck marker on RMB, remove unnecessary cast

* Remove redundant line, more const

* Fix

* Review fixes

* Only perform split logic for SampleTCO

* Add unquantizedModHeld function

* missed one

* Don't use copy/paste

* Don't use copy/paste

* More git troubles

* Fix undo

* git dammit

* Cleaner solution?

* Set cursor, add copy assignment to SampleBuffer

* Add TODO comment

* Make it build

* Fixes from review

* Make splitTCO virtual

* Make splitTCO more generic

Co-authored-by: IanCaio <iancaio_dev@hotmail.com>

* Prevent resizing of MIDI clips in knife mode

* Fix move/resize and rework box select via ctrl

* Apply suggestions from code review.

Co-authored-by: IanCaio <iancaio_dev@hotmail.com>

* Don't show inaccurate/useless/empty text float in knife mode

* Addresses Github review

	- Fixes a typo where QWidget::mousePressEvent was being called
inside mouseReleaseEvent.
	- Avoids unnecessarily disabling journalling on the Split
action, since it doesn't require it.

* Revert format changes in Track

* Revert format changes in Track.h

* Revert formatting changes in Track.cpp

Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
2021-03-12 22:49:54 +01:00
Lost Robot
459948f8cd Add Compressor effect to LMMS (#5458)
* Add Compressor effect
2021-03-10 23:17:32 -07:00
rghvdberg
ea295c4ee8 Pianoroll: nudge/snap while dragging notes (#5848)
* pianoroll: nudge/snap while dragging notes

combobox for switching behavior
old behavior (nudge) is default

* snap note start or note end to nearest grid line

* fix member variable name

* change default width of pianoroll

* remove trailing white space

* use mouse position instead of m_draggednote

* Uses enum instead of text for GridMode selection

	To avoid problems with translations breaking the conditional,
PianoRoll::changeSnapMode now uses the value of the ComboBox model,
casted to the GridMode enum instead of the text.

* Fixes last code style issues

	A few code style issues were left, those are fixed in this
commit.

* Removes forgotten comma on enum

	Since the last enum value was commented out, there's an
unnecessary comma left that was removed.

* Rewrites some of the grid logic

	Separates Nudge logic and Snap logic more explicitly.
	Avoids recalculation of mouse conversion to time line ticks.
	Disables shift resizing for Snap mode.
	Removes unnecessary range checks.
	Fixes bug with note key boundary checks (which is present in master).

* Make noteOffset an int instead of TimePos

Co-authored-by: Ian Caio <iancaio_dev@hotmail.com>
2021-03-05 09:38:33 -03:00
Alex
5d366ef06f 4 new note modification tools (#5857)
* Add new note length modification tools

* "Last" instead of "latest"

* Code formatting

Co-authored-by: IanCaio <iancaio_dev@hotmail.com>

* Fix sort

* Fix incorrect cut of last note

* Fix Fill not stretching last note to end

* Fill from end positions

* Rename limitNoteLengths

* Compare with non-selected notes when filling

* Style changes by IanCaio + bugfix

* break instead of continue

Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
2021-03-05 09:31:27 -03:00
IanCaio
e880e3cb2a Changes AutomationPattern to use nodes instead of raw float values (#5712) 2021-02-28 06:48:15 -03:00
cyber-bridge
05de59c085 Feature: PianoRoll Knife (#5845)
* Initial PianoRoll razor feature

* Restore PianoRoll edit mode after focusOut and in razor mode.

* Show changes directly after cut.

* Fix hanging note after adjusting vol/pan with razor action.

* Extract the split action to a separate method

	This PR addresses some suggestions from a review, the most
important ones being:
	- Extracting the note split action to a separate method, called
Pattern::splitNotes
	- Removing getMouseTickPos method
	- Adding a variable that holds the current razor position and a
method to update it (quantizing if CTRL is not pressed)
	- Using [this] to capture "this" on the lambda function instead
of [=], since the latter doesn't work as intended from C++20 forward
	- Fixing some code style and adding comments

* Removes an extra call to noteUnderMouse

	By removing "&& noteUnderMouse()" from the mousePressEvent
conditional, we avoid an extra call to noteUnderMouse. The only
difference in the behavior of the tool is that now clicking on a place
that doesn't have a note will exit Razor mode.

* Style change suggested by @russiankumar

* Cancel razor action on SHIFT release.

* Make razor cut-line (color) themable.

* Add razor cut-line color to classic theme style.css

* Rename razor to knife.

* Change pixmap from razor to knife (from https://github.com/LMMS/lmms/pull/5524)

* Remove SHIFT behavior.

* Change knife shortcut to SHIFT+K

Co-authored-by: CYBERDEViL <cyberdevil@notabug.org>
Co-authored-by: Ian Caio <iancaio_dev@hotmail.com>
2021-02-26 17:17:16 +05:30
IanCaio
3d7d0051f3 Adds feature to merge Instrument Track patterns (#5700) 2020-12-12 11:33:45 -03:00
IanCaio
3c36365afa Adds support for MIDI CC events inside LMMS (#5581) 2020-12-01 22:27:37 -03:00
thmueller64
1949f93f10 Add checkboxes for selecting user and factory content (#5786)
Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
Co-authored-by: Kevin Zander <veratil@gmail.com>
2020-11-26 22:25:32 +00:00
DigArtRoks
a6e3958c93 Fix EffectRackView appearance (GUI). (#5766)
* Fix EffectRackView appearance (GUI).

* Elide the name of the effect when it tends to be too big. (#5752)
* Evenly space the controls (W/D, Decay Gate). (#5750)
* Show the scrollbar in the default theme to close the gap. (#5752)
* Reduce the gap between the effect and the scrollbar. (#5757)
* Use always the same width for the EffectRackview (InstrumentTrack and SampleTrack) to avoid gaps or cutoffs of the background.
* Widen the background in the default theme.
* Widen the embossed space in the background in the classic theme to fit the controls.

* Changes for improving the EffectRackView after reviews.

* Reduce the background for the default theme by 1 pixel.
* Reduce the background for the classic theme by 2 pixels and remove the darker line at the bottom right.
* Reduce the width of long names of the plugin also by 2 pixels.
* Put the controls 2 pixels closer to each other.
2020-11-07 15:52:32 +01:00
thmueller64
2d51eaef3d Theming of disabled knobs (#5549)
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
2020-10-30 21:52:32 +01:00
DigArtRoks
69a35b58d3 Fix more background colors of selected text (#5687) 2020-10-30 14:51:04 -04:00
Kumar
f5d0524b16 Enable track-wide color coding (#5573)
* Enable track-wide color coding

* Add support for automation tracks

* Allow saving & loading track colors

* Allow track color to be reset to default

* Partially migrate common settings to Track.cpp, fix bug

* Completely migrate local TCO color functions to TCO class, fix bug

* Set QColorDialog colors to better colors

* Color the side of the track according to TCO colors

* Disable color gradient when muted

* Change selection color to depend on TCO color

* Fix breaking builds

* Bug fix

* Fix another bug where BB track colors wouldn't load

* Restore changed demo to original state

* Fix BB Editor bug

* Fix breaking builds

* Allow random color picking

* Fix copy-paste bug

* Change how color is painted on a track

* Cleanup, and implement per-pattern colors

* Cleanup comments

* Migrate some functions

* Remove redundant function

* Rename some functions

* Migrate duplicates to superclass

* Use ColorChooser and reorder some includes

* Change how colors are saved

* Fix some formatting

* Fix some code

* Change how clip colors work

* Fix some unexpected behaviors

* Fix note border coloring being green on colored tracks

* Change name of an option

* Remove redundant code

* Fix ghost changes

* Remove colorRgb

* Rename backgroundColor, remove some variables we don't use

* Remove a redundant variable

* Migrate some duplicates to superclass

* Check for nullpointer

* Remove redundant variable

* Update some logic

* Change how muted colors are displayed

* Change how dark muted tracks become

* Place setModified() in appropriate places

* Make getColorForDisplay() function

* Change how colors are organised and saved

* Remove m_useStyleColor

* Remove a comment

* Quick changes

* Change how colors are saved

* Remove redundant stuff

* Remove redundant stuff pt. 2

* Change how colors are copied

* Fixes pt. 3

* Fixes pt. 4

* Change spaces to tabs

* Fix pseudochanges

* Remove s_lastTCOColor

* Fix pseudochanges pt. 2

* Fix breaking builds

* Add files via upload

* Add comments (again)
2020-10-20 19:26:22 +02:00