When #8169 was merged, the resize grip of clips was increased to 8 pixels to make it easier to resize clips which were right next to each other. However, this constant 8 pixel region on either end of the clip gets in the way when zoomed far out, since the width of the clip itself could be on the order of 8 pixels.
To fix this, this PR makes it so that the clip resize grip width dynamically changes with the zoom level. When zoomed far in, it's 8 pixels, but as you zoom out, the grip width is capped to be no more than 10% of the clip width. This makes it much easier to move the clip around without it getting in the way.
Fixes#8384
Bugs fixed:
1. Doubled tooltips on some Knobs (see #8358)
2. No dynamic floating text when dragging a Fader (regression from #8253)
3. Volume knobs displaying their units as "dBFS%" rather than just "dBFS" (regression from #8253)
4. Incorrect dBFS value in the dynamic floating text for volume knobs of the Delay and Flanger plugins
5. Incorrect dBFS values in the "Set value" dialog box for volume knobs of the Delay, Dynamics Processor, Flanger, and Wave Shaper plugins
6. Missing "%" unit in the context menu for Vibed's volume knobs
7. Incorrect handling of volume knobs for models that support negative amplitudes (currently only Flanger's feedback amount knob)
For (1), I reworked how static tooltips work in FloatModelEditorBase. Rather than use QWidget's tooltips, it shadows the tooltip methods from QWidget and redirects them to the existing SimpleTextFloat-based system.
Supporting both "static" and "dynamic" tooltips required some improvements to keep better track of user interactions with the Knobs. There was an existing m_buttonPressed boolean, but this was insufficient, so I converted it into a new InteractionType enum for keeping track of the user interaction state.
See the "Expected Behaviour" section of the bug report (#8358) for an explanation of how it works now from the user's perspective.
Essentially the same fix as #8385, but for notes in the Piano Roll.
This PR makes it so that the clip resize grip width of a note dynamically changes with the zoom level. When zoomed far in, it's a constant number of pixels, but as you zoom out, the grip width is capped to be no more than 25% of the note width. This makes it much easier to move the note around without it if it's tiny or when zoomed far out.
Previously, importing midi files containing multiple tracks was not supported. All of the notes got merged onto a single track.
Except, LMMS actually does support multi-track midi import, it just ignores the track index when placing the notes, and simply puts them in tracks based on their midi channel instead. LMMS does not support setting the channel of an individual note, so separating the loaded midi events onto separate tracks based on their channel does make sense.
But we don't have to choose one or the other! This PR makes it so that the notes in midi files are split into different tracks based on both their midi channel and midi track. This allows midi files which contain multiple tracks to be loaded normally, and hopefully even multi-channel multi-track midi files.
Additionally, some midi files contain a wealth of information regarding midi CC automation. Currently, we only handle pitch, panning, volume, and bank automation when importing midi files, but this PR also makes it so that the knobs in the instrument track CC rack are also automated.
NOTE: Regarding the CC automations, some CC numbers correspond to things like panning and volume, which are real knobs in lmms. In the case that one of these CC's are automated, it creates an automation track for that specific lmms knob. Otherwise, it automates the knob in the instrument track's midi CC rack.
* Prevent key modifiers from getting stuck
* Implement a custom isWinDeactivate function to assist in detection
---------
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
Fixes a bug where right-clicking on a sample in the sidebar and clicking "Send to new SlicerT instance" under the Pattern Editor section would instead create the instance in the Song Editor.
This PR makes it so that the scale/key/chord in the Piano Roll is saved with the project.
Also, while I was at it, I made it so that the zoom, vertical zoom, snap settings, quantization, and note lengths are saved too.
Aaand I also decided to save the zoom and snap size in the Song Editor because why not :D
However, the zoom/snap/etc are saved in the lmmsrc file, since it doesn't really make sense to save them per-project.
Makes the following changes to the Lb302 plugin for increased functionality, maintainability, and readability:
- Add note velocity & note panning to Lb302
- Remove evil mutex+dynamic array combo in favor of a real-time safe ringbuffer queue
- Use non-static data member initializers where possible
- Use `std::numbers::pi` instead of `M_PI`
- Use `std::array` and `std::unique_ptr` instead of manual memory management
- Change plain-old-data classes with only public members to structs
- Change some ints to f_cnt_t to better communicate their purpose and avoid weird implicit casting nonsense
- Change floats to sample_t where appropriate to better communicate their purpose
- Find suitable homes for loose constants
- Prefix standard library math function calls with std::
- Ensure all floating-point literals intended to be floats end in 'f' and are not doubles to appease MSVC
- Change uses of SIGNAL and SLOT macros to whatever they should be post-Qt6 upgrade
- Tidy code to conform to current code conventions
Also adds Hardware.h for low-level performance tools:
- busyWaitHint(), supporting x86, ARM, and RISC-V
- hardware_destructive_interference_size polyfill, supporting x86, ARM, RISC-V, and PPC
- Moved the contents of denormals.h to Hardware.h, renamed disable_denormals() to disableDenormals()
- Added ARM support to disableDenormals()
Removes construction of the unused default volume model from `SamplePlayHandle`. Frequent construction of this model was causing performance slowdowns due to the model having to find and create a journaling ID in a for loop inside `ProjectJournal::allocID`, leading to the exhaustion of available IDs very quickly. There were also general improvements made to `SamplePlayHandle` (using NSDMI, removing other unused members, etc).
This reworks the auto-quit feature by introducing a new AudioBuffer class which keeps track of which channels are currently silent as audio flows through the effects chain.
When track channels going into an effect's input are not marked as quiet, it is assumed a signal is present and the plugin needs to wake up if it is asleep due to auto-quit. After a plugin processes a buffer, the silence status is updated.
When the auto-quit setting is disabled (that is, when effects are always kept running), effects are always assumed to have input noise (a non-quiet signal present at the plugin inputs), which should result in the same behavior as before.
Benefits:
- The auto-quit system now closely follows how it is supposed to function by only waking plugins which have non-zero input rather than waking all plugins at once whenever an instrument plays a note or a sample track plays. This granularity better fits multi-channel plugins and pin connector routing where not all plugin inputs are connected to the same track channels. This means a sleeping plugin whose inputs are connected to channels 3/4 would not need to wake up if a signal is only present on channels 1/2.
- Silencing channels that are already known to be silent is a no-op
- Calculating the absolute peak sample value for a channel already known to be silent is a no-op
- The silence flags also could be useful for other purposes, such as adding visual indicators to represent how audio signals flow in and out of each plugin
- With a little more work, auto-quit could be enabled/disabled for plugins on an individual basis
- With a little more work, auto-quit could be implemented for instrument plugins
- AudioBuffer can be used with SharedMemory
- AudioBuffer could be used in plugins for their buffers
This new system works so long as the silence flags for each channel remain valid at each point along the effect chain. Modifying the buffers without an accompanying update of the silence flags could violate assumptions. Through unit tests, the correct functioning of AudioBuffer itself can be validated, but its usage in AudioBusHandle, Mixer, and a few other places where track channels are handled will need to be done with care.
---------
Co-authored-by: Sotonye Atemie <sakertooth@gmail.com>
Allows detaching a window from LMMS's main window, making things like working on multiple screens easier.
The behavior of detached windows can be customized in the Settings.
Closes#1259
---------
Signed-off-by: Dalton Messmer <messmer.dalton@gmail.com>
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
Co-authored-by: SpomJ <mihail_a_m@mail.ru>
Improves performance when moving mixer channels to the left or right using simple Qt layout operations and swapping of values. This commit also addresses a deadlock in Mixer::mixToChannel by ensuring we lock and unlock the same channel regardless of any move operations occurring simultaneously on another thread.
When #7454 was merged, Timelines were refactored to emit a positionJumped signal whenever their internal tick position was changed via Timeline::setTicks. This was meant as an easy way to account for all situations where the user might drag or click or somehow forcefully set the position of a timeline mid-playback.
However, the current way timeline syncing is implemented between the song editor and piano roll (when doing record-play in the piano roll) is by constantly calling setTicks on the piano roll's timeline whenever the song editor's timeline moves. This inadvertantly means that positionJumped is being emitted, even when the timeline is tracking smoothly.
This PR attempts to address this issue by adding an optional parameter to Timeline::setTicks which allows the caller to opt out of emitting positionJumped. Ideally, we would have a better system for syncing timelines together, one which does not rely on forcefully calling setTicks. But for now, this should work.
---------
Co-authored-by: Sotonye Atemie <satemiej@gmail.com>
Refactors the PortAudio backend to fix issues with DirectSound and MME crackling and not loading properly, as well as to improve code quality and maintainability.
---------
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
This refactors the export dialog to no longer use the export_project.ui file and moves it into standard C++ Qt code. This also brings minor changes to the dialog, such as horizontal labels instead of vertical ones.
* reimplement getter and setter of FloatModelEditorBase::m_volumeKnob to avoid undo checkpoint creation
* convert FloatModelEditorBase::m_volumeKnob from BoolModel to bool
* clean up
* remove unnecessary inline keywords and fix formatting
---------
Co-authored-by: Sotonye Atemie <sakertooth@gmail.com>
Removes `SampleLoader`. File dialog functions were moved into `FileDialog`. Creation functions were moved into `SampleBuffer`.
---------
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
This PR modifies how the Detuning tool works in the piano roll to let the user modify the automation curve right on the notes. This is actually fairly simple, as automation clips already contain the functions for dragging and removing points like in the Automation Editor. So essentially all that's being done is calculating the relative pos of the mouse to the nearest note, and setting the drag value in the automation clip to that position and key.
You can still access the old automation editor version by shift-click
messmerd asked if the code could be made general for any future note parameter besides detuning, in preparation for CLAP per-note parameter automation. I have refactored the relevant functions to accept an enum type for the kind of note parameter, although currently only detuning is supported.
---------
Co-authored-by: Sotonye Atemie <sakertooth@gmail.com>
Co-authored-by: Sotonye Atemie <satemiej@gmail.com>
Co-authored-by: szeli1 <143485814+szeli1@users.noreply.github.com>
Fixes#8182
When #7454 was merged, the frameOffset variable inside Song::PlayPos which kept track of the actual frame position which the song was playing at relative to the last tick, was moved to Timeline. In the process, the type was inadvertently changed from float to f_cnt_t.
This caused the frame offset to be truncated ever time it was updated in Song::processNextBuffer, causing the song playback to slowly drift back ever so slightly, just a handful of frames every bar. This caused any new sample clips spawned to be created slightly late, becoming out of sync with any existing playing samples.
This PR fixes the issue by reverting the frameOffset variable type to be float again, allowing it to track sub-sample offsets over time.
Closes#7869
This PR aims to fix linking bugs and it aims to make linking code faster. In the future I would like to replace controller and automation code with linked models, so it is essential for this feature to work as efficiently as possible.
Before this PR:
- AutomatableModels store a list of AutomatableModels that they are linked to.
- setValue() and other functions make recursive calls to themself resulting in the #7869 crash.
- Each AutomatableModel can unlink from other AutomatableModels, unlinking is the inverse operation to linking.
After this PR:
- AutomatableModels store a pointer to an other AutomatableModel making a linked list. The end is connected to the first element resulting in a "ring".
- setValue() and others are now recursion free, the code runs for every linked model, more efficiently than before.
- Each AutomatableModel can NOT unlink form other AutomatableModels, unlinking is NOT the inverse operation to linking. AutomatableModels can unlink themself from the linked list, they can not unlink themself from single models.
---------
Co-authored-by: allejok96 <allejok96@gmail.com>
Previously, this PR simply added a new signal to the Timeline class and had it emitted by the TimeLineWidget class in order to solve #7351.
However, as messmerd pointed out in his review comments, that was quite a hacky solution, and ideally the positionChanged signal would be solely managed by the backend Timeline class, while the frontend TimeLineWidget class would connect to those signals, instead of the other way around.
This PR is no longer a simple bugfix, but instead a refactoring of the Timeline/TimeLineWidget signal/slots.
Changes
- The positionChanged signal and updatePosition slot were removed from TimeLineWidget and moved to Timeline.
- Removed PlayPos, and instead store the timeline position in a TimePos along with a separate frame offset counter variable. The functions to set the ticks/timepos in Timeline emit the positionChanged signal. (Also, may emit positionJumped signal if the ticks were forcefully set--see below)
- The pos() method and PlayPos m_pos were removed from TimeLineWidget;
- The constructor for TimeLineWidget no longer requires a PlayPos reference.
- Since each TimeLineWidget stores a reference to its Timeline, a new method was added, timeline(), for other classes to access it.
- Removed array of PlayPos'es in Song. Now each Timeline holds their respective TimePos.
- Song's methods for getPlayPos were changed to return the TimePos of the respective Timeline. The non-const versions of the methods were removed because Timeline does not expose its TimePos to write.
- All of the places where Timelines are used were updated, along with their calls to access/modify the PlayPos. For example, occurrences of m_timeline->pos() were replaced with m_timeline->timeline()->pos(), and calls to m_timeline->pos().setTicks(ticks) were changed to m_timeline->timeline()->setTicks(ticks).
- ALSO: Removed m_elapsedMilliseconds, m_elapsedBars, and m_elapsedTicks from Song. The elapsed milliseconds is now handled individually by each Timeline.
- NEW: The m_jumped variable has been removed from Timeline. Now jumped events emit Timeline::positionJumped automatically whenever the ticks are forcefully set. This means it is no longer necessary to call timeline->setJumped(true) or timeline->setFrameOffset(0) whenever the playhead position is forcefully set. Many places in the codebase were already missing these calls, so this may fix some unknown bugs.
---------
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
Co-authored-by: saker <sakertooth@gmail.com>
Co-authored-by: Alex <allejok96@gmail.com>
Fixes#8152
Revert PianoRoll closing when empty (caused issues with detached windows)
Remove TextFloat warning when there are no instruments/multiple clips (showed up when reloading project)
(Keep clip creation for empty projects)
Add an icon and updated message in empty PianoRoll.
Mark PianoRollWindow invalid when there is no clip, making buttons impossible to click
---------
Co-authored-by: Fawn <rubiefawn@gmail.com>
Clang was incorrectly displayed as 'GCC Clang' because __GNUC__ is
defined by Clang for compatibility. Reordered preprocessor checks in
versioninfo.h to test for __clang__ before __GNUC__.
Fixes#8120
This bug was noticed when testing out #7559, but the PR had been open for over a year, so it was decided to merge it and fix it in this one.
Basically, when adding or removing a track, the TrackContainer sends out signals such as trackAdded or trackRemoved which PatternClipView uses to know when to update.
However, it does not send out a signal when a track has been moved.
This is because for some reason, it's done by the GUI TrackContainerView instead of the core TrackContainer.
This PR changes that by moving the core code to the core where it probably belongs, adding an appropriate trackMoved signal to TrackContainer, and connecting that to PatternClipView to update properly.
---------
Co-authored-by: Fawn <rubiefawn@gmail.com>
This PR changes the way PatternClips are drawn in include a simple "beat preivew," where each note in any non-empty instrument tracks within the pattern are drawn as short little rectangles on the ClipView. SampleClips and AutomationClips within patterns are not currently supported.
The height of the note boxes changes depending on how many tracks there are in the pattern, and how many of them actually have notes (empty tracks are only drawn half as tall).
There is also some padding at the top and bottom along with a little bit of spacing between each note, both vertically and horizontally. This can be edited in the css, along with the note color.
---------
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
Co-authored-by: Fawn <rubiefawn@gmail.com>
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.
* SVG-ify arrow buttons
These buttons are used in the instrument window, Vestige, and VST
effects. Separate versions of the arrow icons are used for the classic
theme.
* Fix some unrelated SVG formatting and metadata
* Revert accidental change to classic border radius
* Add some XML stuff back to appease Github
LMMS renders these SVGs just fine, but apparently the removal of the
XML declaration completely breaks Github's ability to render the image,
so I am adding these back for the sake of those who want to actually
look at the diff on the website lmao
* Attempt to fix Github SVG previews again (`xmlns`)
* Fix crossover eq band mute button icon size
You may ask, "what does this have to do with the arrow buttons?" and you
would be right to assume this is unrelated. However, I'm already
touching the relevant lines of the stylesheet so I may as well sneak it
in there.
* Add missing metadata to fader_knob.svg
And fix mixed indentation in headphones.svg
* Add missing `xmlns` to fader_knob.svg
GRADIENTS!!!!!!!!!!!!
* Fix classic theme arrow buttons
The originals were right angle chevrons
* Remove unused getters
- Display a message when a user attempts to open the piano roll in a project with no MIDI clips instead of opening a non-functional piano roll.
- Create a MIDI clip in the first instrument track when the piano roll is opened in an empty project.
* Rebase against master
Co-authored-by: michaelgregorius <michael.gregorius.git@arcor.de>
Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com>
* Fix Qt6 DMG on Apple (#7240)
- Fix linking issues with Qt Framework files
- Fix qmake detection
* Fixes after rebase
* Fix embed.cpp compilation
Fix implicit conversion from int when using QString.arg(...)
* Fix Qt6 signature change for nativeEventFilter (#7254)
* Adds win32EventFilter a wrapper for nativeEventFilter on Windows
* win32EventFilter is currently used to intercept top-level Window events (currently, to avoid VSTs setting transparency of the parent application)
* fix broken signal slot connections (#7274)
QComboBox activated() replaced with textActivated() since Qt 5.14
* Enabled VSTs on Qt 6 (#7273)
* enabled VST support for Qt 6 builds
* Note : Embedding on QT6 will be buggy on linux as a result of using qt embedding, which unfortunately is a qt bug which hasn't been resolved.
* Changed bar lines to follow snap size (#7034)
* Added lines in between bars
* Changed bar lines to follow snap size
* Changed default zoom and quantization value
* Added constants for line widths
* Added QSS configuration for new grid line colors
* Tied line widths to QSS properties
* Changed default quantization to 1/4
* Removed clear() from destructor model
* Removed destructor in ComboBoxModel.h
* Changed member set/get functions to pass by value
* Updated signal connection with newer syntax
* Fix compilation
* Fix MSVC builds
* fix nullptr deref in AudioFileProcessor (qt6 branch) (#7532)
* ensured mouse event != nullptr before deref
* separation of concerns: AFP WaveView updateCursor
extract check to pointerCloseToStartEndOrLoop()
* marked some function parameters as const
* Remove Core5Compat usage
* Fix bad merge
* Fixes after rebase
* Simplify QTX_WRAP_CPP call
* Remove comments that are obvious to a developer
* Whitespace
* Try using Qt 6 for MSVC CI
I chose Qt 6.5 because it's the last Qt LTS release with declared
support for Visual Studio 2019. Once we upgrade to Visual Studio 2022,
we could upgrade Qt as well.
* Fix MSVC build
Also fixes two memory leaks in MidiWinMM
* Fix GuiApplication on MSVC
* Fix interpolateInRgb
* Try building with patched Calf
* Fix submodule
* Fix OpulenZ build
* Try to fix zyn
* Fix comment
* Ty to fix zyn (again)
* Ty to fix RemotePluginBase
* Revert "Ty to fix RemotePluginBase"
This reverts commit 92dac44ffb11e19d1d5a21d9155369f017bd59e9.
* Update plugins/ZynAddSubFx/CMakeLists.txt
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* Fix vertical & horizontal scroll wheel in SongEditor
* AppImage: Fix finding of Qt6 libs
* Fix implicit QString --> QFileInfo conversion
* Point submodule to lmms
* Fix multiple deprecation warnings
* Fix for Clang compiler
* Build with latest Qt LTS version now that we use MSVC 2022
* Update jurplel/install-qt-action to v4.3.0
* Bump minimum Qt6 version for MSVC
* Fix incorrect Qt version checks
Some comparisons were using ">" rather than ">="
* `QSize()` != `QSize(0, 0)`
* Fix more deprecation warnings
* Fix style
* Simplify Spectrum Analyzer mouse events
The Qt bug that used to be present appears to have been fixed, so the
workaround can be removed
* Minor changes
* Fix deprecated QCheckBox signal
* Fix setContent helper functions
* Remove QMultiMap usage from ControlLayout
* Remove SIGNAL and SLOT macros
* Revert TrackView.cpp changes
* Remove Q_DISABLE_MOVE usage since it does not seem to be available in Qt6
---------
Co-authored-by: michaelgregorius <michael.gregorius.git@arcor.de>
Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com>
Co-authored-by: BoredGuy1 <66702733+BoredGuy1@users.noreply.github.com>
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: Lisa Magdalena Riedler <git@riedler.wien>
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
PathUtil: Serialization and Formatting
* Serialize all operations to use / instead of platform specific paths.
* Formatting changes for consistency.
* Reorder functions, add serialization enforcement to the other two functions.
Given these changes, the knife tool now uses `Qt::SplitHCursor`, but `Qt::IBeamCursor` is also a a viable option. I am noting this should substantial concern arise over the appearance of `Qt::SplitHCursor` due to cursor themes, such as the default one applied to applications running under WSL.
This cleans up typos in source comments and some user-facing strings.
Found via `codespell -q 3 -S "./plugins,./src/3rdparty,./data/locale,*.in,*.xpf" -L continous,currenty,globaly,inports,localy,nd,ot,sie,te,trough`
This PR simplifies #7762 by removing the editor-specific code from MainWindow and m_lastPlayMode from Song, and instead uses a static variable in Editor which keeps track of the last played editor.
This PR also removes the spacebar shortcut from MixerChannelView for changing the volume, as multiple users have noticed that it clashes with their intuition after getting used to the spacebar working everywhere else.