Improves the tap tempo algorithm and usage, as well refactoring the code for better maintainability.
---------
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
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>
Requested by a user on the forum. Sometimes, it can get tricky when two clips are right next to each other, and you're trying to resize one of them. Either you resize the right one, or the other one starts resizing behind the other, so you end up having to move one over, then resize it, then move it back. And it's just not awesome.
However, this can be mitigated by simply increasing the clip resize grip width. Currently, it is at 4 px, but increasing it to 8 px makes it easier to specifically target which clip you want to resize. It also probably makes it easier to resize clips in general for users who may struggle to aim the mouse perfectly within that 4 pixel gap.
Partially addresses #8188
For some reason, when a knob is set to be a "volume knob", the max volume allowed via double-clicking and typing in a value is 6.0 dB. For knobs such as the amplifier knob in Audio File Processor which go up to 500% (~14 db), this is not enough.
This PR makes it so that the dialog shows the actual max dB value based on the underlying model's max value, instead of being hardcoded to 6.0 dB. This PR does not address the minimum value.
* Clarify VST support to VST2 in README
Updated VST support mention from VST(i) to VST2 in features section for clarity.
* Update README.md
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* mention LV2 support
---------
Co-authored-by: Dalton Messmer <messmer.dalton@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>
Fixes#8200. Scrolling to change velocity/panning can affect unselected notes if hovering over them in the bottom section of the piano roll. This PR addresses that.
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>
Fixes#8190
When #7454 was merged, I added a check before emitting playbackPositionJumped to only emit when the song was playing, to prevent LFOs from being reset when the user dragged the timeline while the song was paused. However, I used Song::isPlaying(), which only returns true when the song is not exporting. This caused sample clips to not be updated when the playback position jumped back every loop, which means they just kept playing, ignoring the loop. To fix this, I have changed it to use m_playing, which is true for both exporting and normal playing.
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.
Fixes#8138
Essentially, when playing beat notes in the pattern editor, technically, they have an internal length of 0. However, when the NotePlayHandle is created and recieves that value of 0, it realizes it's supposed to be a beat note, so it asks the instrument track what the default length of note should be. For most instruments, that defaults to whatever the length of the envelope is (no matter whether the envelope is enabled or not. Is that a good system? I don't know.) However, AudioFileProcessor does it custom and returns the length of its sample in frames.
However, the frame count it returned did not take into account that the sample rate of lmms could be different from the sample rate of the sample. This PR fixes that issue by multiplying by the correct sample rate ratio.
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>
The TrackContentWidgets in the pattern editor rely on the positionChanged signal to be sent when the pattern index changes so that they know when to update. This signal was removed in #7454, but this PR puts it back.
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>
* Fix Shift+Space corrupting playback state when used on stopped editors
Shift+Space (togglePause) was allowing state corruption by modifying
m_playing and m_paused without checking m_playMode. This created an
impossible state where m_playing=true while m_playMode=None, causing
the regular Space key to stop working.
Added a guard to ensure togglePause() only operates when something is
actually playing (m_playMode != PlayMode::None). This prevents the
corrupted state and maintains proper play/pause/stop behavior.
Fixes#8036
---------
Co-authored-by: regulus79 <117475203+regulus79@users.noreply.github.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>
Previously, loading a new sample in an AFP instance with reverse enabled would desync the button from the model, such that the button would indicate the sample was reversed despite the new sample not actually being reversed.
This commit fixes this behavior so that samples loaded into an AFP instance with reverse enabled are actually reversed.
This fixes a regression in commit f44aa3e that caused OGG exports to not flush any remaining data properly when finalizing the export, leading to truncated outputs with a different duration.
---------
Co-authored-by: Sotonye Atemie <sakertooth@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.
Correct the button initialization order so mixer channels show the proper mute and solo states when they first appear. This applies to channels loaded from a project and channels created during the session, ensuring the UI reflects the actual underlying state properly.
* Centralize standard LMMS plugin logo
Previously, every single plugin would have its own copy of this image.
Now, these plugins pull it from the theme. I'm not sure it's valuable
for this to be themeable, but AFAIK it's the place all the other
non-plugin resources are stored, so that's where it goes for now.
Fixes an issue where quantizing notes in a midi clip with auto-resize disabled would cause the length to be reset, in cases where there is only a single note in the clip. This was due to how quantization removes and re-adds each note, so for a moment, the clip would be empty, thus treated as a beat clip. Beat clips were mistakenly always automatically resized no matter whether auto-resize was enabled or not. This PR fixes that by only auto-resizing beat clips when they have auto-resize enabled.
Co-authored-by: Fawn <rubiefawn@gmail.com>
---------
Co-authored-by: Fawn <rubiefawn@gmail.com>
* 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
The culprit was the little text warning under the instrument tuning view informing the user that MIDI-based instruments do not support the microtuner. The entire instrument window was expanding horizontally to accommodate this. This commit solves this by setting the width of the other tabs to be no wider than the instrument they belong to.
- 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.
Instead of including the files directly in plugins/MidiImport/portsmf,
that path is now a git submodule (https://github.com/portsmf/portsmf).
Several other changes have been made to clean up MidiImport as well.
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`
Set minimum deployment target for macOS builds
- Calculates MACOSX_DEPLOYMENT_TARGET based on qmake's minos value
- Echo's Lowest SDK supported for information purposes
---------
Co-authored-by: Tres Finocchiaro <tres.finocchiaro@gmail.com>
Disable ASLR when building RemoteVstPlugin executables on Windows in order to fix crashes when using certain VSTs
---------
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
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.
- Fixes: when right clicking on a piano key close to the lower edge of the screen, "Mark semitone" will mark the wrong key because it uses the upper edge of the context menu as reference.
- Fixes: getKey() is off by 2 pixels
- Introduces: yCoordOfKey() which is the reverse of getKey()
- Removes: section of code that can never be reached
---------
Co-authored-by: Johannes Lorenz <1042576+JohannesLorenz@users.noreply.github.com>
## Fix problems with lifetime of `QByteArray`
Fix a problem with the lifetime of a `QByteArray` in
`attemptToReconnectOutput` and `attemptToReconnectInput`.
The method `constData` was called on a temporary which gets destroyed
before `targetName` and `sourceName` are used, thus leading to undefined
behavior.
## Fix index checks
Fix index checks in `attemptToReconnectOutput` and
`attemptToReconnectInput`.
The previous code would have allowed an index to be `size` of the
underlying vector which would access out-of-bounds memory.
## Braces for one-liner if statements
Add braces for one-liner if statements.
Fix a segmentation fault that occurs if the JACK libraries are not
installed. In that case `jack_client_open` which is called through
`lib_weakjack` will return a `nullptr` for the client. Subsequent calls
to `jack_client_open` do not check for `nullptr` in the library so we
have to do this ourselves to prevent the segmentation fault. The check
is added to `AudioJack::setupWidget::getAudioPortNames`.
Extract the printing of the JACK status into the function
`printJackStatus` as its functionality is needed several times.
Print a warning and the status in `AudioJack::setupWidget::setupWidget`.
## Code review changes
Use `std::printf` and `std::fprintf`and print to `stderr` whenever fitting.
---------
Co-authored-by: Andrew Wiltshire <62200778+AW1534@users.noreply.github.com>
- Add `SampleType` concept
- Make `channels()` static when possible
- Add `dataSizeBytes()` and `dataView()` to `InterleavedBufferView`
- Support conversions between `std::span<SampleFrame>` and `InterleavedBufferView<float, 2>`
- Support iteration over frames of `InterleavedBufferView`
- Add `subspan` method
- Add `AudioBufferView` concept
---------
Co-authored-by: Sotonye Atemie <sakertooth@gmail.com>
Major changes:
- Remove Gate knob from effects, effectively hard coding its value to zero
- Replace effect RMS calculations with a more efficient way of detecting silent buffers
- Only perform silent buffer detection when `ProcessStatus::ContinueIfNotQuiet` is returned from a plugin AND auto-quit is enabled
Minor changes:
- Remove gate from presets
- Remove gate from .mmp projects
- Move `Effect::processorCount()` to `LadspaEffect`
- Rename `Effect::checkGate` to `Effect::handleAutoQuit`
- Adjust silence threshold for better compatibility with old RMS calculations
- Remove some unnecessary methods from `Effect`
- Reset quiet buffer count in `stopRunning`
- Use positive name for auto-quit boolean
- Simplify `m_autoQuitEnabled` initialization
Follow-Up of 7db3fa94a1 .
This was done by setting `CMAKE_C_INCLUDE_WHAT_YOU_USE` and
`CMAKE_CXX_INCLUDE_WHAT_YOU_USE` to (broken down into multiple lines here,
note, all below `FL/x.h` is not required for C):
```
include-what-you-use;
-Xiwyu;--mapping_file=/usr/share/include-what-you-use/qt5_11.imp;
-Xiwyu;--keep=*/xmmintrin.h;
-Xiwyu;--keep=*/lmmsconfig.h;
-Xiwyu;--keep=*/weak_libjack.h;
-Xiwyu;--keep=*/sys/*;
-Xiwyu;--keep=*/debug.h;
-Xiwyu;--keep=*/SDL/*;
-Xiwyu;--keep=*/alsa/*;
-Xiwyu;--keep=*/FL/x.h;
-Xiwyu;--keep=*/MidiApple.h;
-Xiwyu;--keep=*/MidiWinMM.h;
-Xiwyu;--keep=*/AudioSoundIo.h;
-Xiwyu;--keep=*/OpulenZ/adplug/*;
-Xiwyu;--keep=QPainterPath;
-Xiwyu;--keep=QtTest
```
FAQ:
* Q: Does this speed-up a completely fresh compile?
* A: No, I measured it.
* Q: Does it speed up anything else?
* A: Yes. If you change one header, it can reduce the number of CPP files
that your compiler needs to recompile, or your IDE has to re-scan.
* Q: What other reasons are for this PR?
* A: It's idiomatic to only include headers if you need them. Also, it will
reduce output for those who want to use IWYU for new PRs.
Background:
This is just a remainder PR of what I planned. My original idea was to setup
a CI which warns you of useless includes (but not of all issues that IWYU
complains about). However, I could not see that this was favored on Discord.
A full IWYU CI also has the problem that it (possibly??) needs to compile
with `make -j 1`, which would make CI really slow.
However, for that plan, I had to fix the whole code base to be IWYU
compliant - which it now is.
# GUI
## Present inputs/outputs in hierarchical menu
Present the available inputs and outputs in a hierarchical sorted menu
which shows clients with their ports.
The heavy lifting of creating the menu for the tool button is done in the
new method `buildMenu`.
It takes the input/output names in Jack's "Client name:Port name" format.
If an input/output name can be successfully split into the client name
and port name then a sub menu with the client name is created (if it was
not already created before) and the port name is added as an entry.
If the name cannot be split into exactly two components then it is simply
added to the top level menu as is.
Ports of the LMMS client are filtered out to prevent loops.
The menu starts with the client's sub menus in alphabetical order. Then
the top level entries are added in alphabetical order as well.
The callbacks for the `QAction` instances are implemented with lambdas
because MOC does not support nested classes like the setup widget is. For
now the used lambda only sets the text of the `QToolButton` as these are
used for persisting the configuration anyway.
## Disconnected state
Add the option to keep inputs/outputs disconnected.
The disconnected state is represented by the string "-" which is also
what is saved into the configuration in this case. For now the
representation in the GUI and of the save state is the same as it has the
advantage that no translation is necessary and thus not mapping between
display text and save state is necessary.
## Show technical output/input names
Show the technical output and input port names used by LMMS in the setup
dialog. Note: these are the names that are shown in tools like `qjackctl`
or `qpwgraph`.
This was proposed in a review. Personally I like the non-technical names
better but let's see what's accepted.
## Let the tool buttons use available space
Let the tool buttons stretch so that they look uniform and use all the
available space.
# Driver
## Reconnect inputs and outputs
Attempt to reconnect the inputs and outputs from the configuration during
startup of the Jack driver. Nothing will be done for inputs and outputs
that are not available at startup. Example: the users might have saved
some inputs when a device was available. The device is then disconnected
and LMMS restarted. The stored inputs cannot be used anymore. To give the
users the least surprise nothing is done.
`AudioJack::attemptToConnect` does the actual reconnection and also
prints some information for now.
`attemptToReconnectOutput` and `attemptToReconnectInput` delegate to
`attemptToConnect` with the right parameters.
# Technical details
## Generalized number of inputs/outputs
Generalize the number of inputs and outputs by using for loops. This
affects the number of widgets that are created and the amount of
configuration that is stored.
This change is a result of a code review discussion. In my opinion it
adds unnecessary complexity to something that should later be implemented
completely different anyway. It is for example now necessary to compute
the key names that are used during the saving of the configuration based
on the channel number. The commit exists so that its changes can be
discussed further. It might be reverted in one of the next commits.
## Collecting input and output names
Add `AudioJack::setupWidget::getAudioPortNames` which takes the type of
port and then collects all port names which match. Make
`getAudioOutputNames` and `getAudioInputNames` delegate to that method
with the appropriate type. This also hides the different terminologies a
bit.
## Separate Jack client in the GUI
The separate Jack client is necessary because the setup dialog does not
have any access to the actual driver. So a new client is created when the
dialog is opened and deleted when it is closed, i.e. when the dialog is
deleted itself.
## Repeated strings
Repeatedly used hard-coded strings are defined as static constant
variables in the anonymous namespace. This should prevent subtle mistakes
when working with the configuration values of the Jack driver.
## Saving the settings
`AudioJack::setupWidget::saveSettings` saves the selections that have
been made from the widgets right into the configuration.
- Build RemoteVstPlugin in C++20 mode
- Avoids using std::wstring due to strange issues with it when built
with wineg++. See https://bugs.winehq.org/show_bug.cgi?id=58465
- Fix some memory leaks + minor cleanup of RemoteVstPlugin code
- Rename `F_OPEN_UTF8` to `fopenUtf8`
- Use C++20 in our `determine_version_from_source` CMake function
- Update ZynAddSubFX submodule
* Remove Knob::setHtmlLabel
Remove the unused method `Knob::setHtmlLabel` and its associated members.
This removes some unnecessary complexity from the code.
* Public label methods
Make `Knob::setLabel` public. Add `Knob::getLabel` for completeness.
* Delegate in KnobControl::setText
Make `KnobControl::setText` delegate to the `Knob` instance now that `Knob::setLabel` is public again.
Users can now choose if they only want to export the selected notes when
exporting a MIDI clip as an `xpt` or `xptz` file in the piano roll. The
export file dialog now shows a checkbox with the label "Export only
selected notes".
## Technical details
Add the new public method `exportToXML` to `MidiClip`. Compared to
`saveSettings` it has an additional parameter `onlySelectedNotes` which
controls which notes are exported. The default is to export all notes.
The method `saveSettings` now simply delegates to `exportToXML` using the
default.
`PianoRollWindow::exportMidiClip` now adds a check box to the export
dialog which lets users select if they only want to export the selected
notes or all notes. The default is to export all notes. The method now
uses the new method `exportToXML` for the export and passes the state of
the check box into the method.
Fix the import of `xpt` and `xptz` files by adding upgrade code to
`DataFile::type`. The new code maps the old textual representation
"pattern" to the enum `Type::MidiClip`.
Without the extra upgrade code the text "pattern" is mapped to
`Type::Unknown`. This then leads to problems at the end of
`DataFile::loadData` where the enum representation is mapped back to the
textual representation again to retrieve the root element from the
upgraded XML.
So without the upgrade it's:
* Map "pattern" to `Type::Unknown`
* Upgrade XML from "pattern" to "midiclip"
* `Type::Unknown` does not map to "midiclip" and fetching the root
element fails.
With the upgrade it's:
* Map "pattern" to `Type::MidiClip`
* Upgrade XML from "pattern" to "midiclip"
* `Type::MidiClip` is mapped to "midiclip" and fetching the root element
succeeds.
When you record an automation clip with a logarithmic knob (for example, a freq knob in the equalizer) the recorded values in the automation editor are correct.....
....But, for whatever reason, lmms tries to scale the recorded values back to linear when playing the automation, which causes the recorded frequency to be much lower.
This pr does not fix the underlying issue, but instead just scales the recorded values so that everything works.
When clearing notes from a long melody clip in pattern editor, it looks like the clip becomes short, but it actually remains the same length (despite empty), and that affects the length of the whole pattern. This PR fixes this issue.
Makes it so that editor zoom, automation tension, along with quantization, note length, and all other combo boxes are not added to the undo history.
---------
Co-authored-by: szeli1 <143485814+szeli1@users.noreply.github.com>
Changes things so that only sample clips with auto-resize enabled will automatically resize to the sample length when dragging-dropping a sample from the sidebar onto a sample clip. Non-auto-resize clips will keep their original length, but still update so that their start time offset is 0.
Fixes TextFloat flickering which occurs when scrolling on knobs, faders, and note volume in the piano roll.
---------
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
Adds two non-owning views for audio buffers: `InterleavedBufferView` and `PlanarBufferView`.
The channel count can be specified at either compile-time or runtime. Specifying at compile-time provides both performance and space optimizations. The way this works is the same as `std::span` except this uses the new `DynamicChannelCount` constant rather than `std::dynamic_extent`.
This PR makes it so that when you double-click on a sample clip and select a new sample, it will automatically update the length of the clip, as long as the clip has auto-resize enabled.
Fix a crash that occurs when running under Wayland and when loading a VST
plugin with the option "Keep plugin windows on top when not embedded"
enabled.
Enable the `AudioJack` to take recorded input and push it to the `AudioEngine`. This adds functionality for `AudioJack` which already exists for `AudioSdl` and `AudioPortAudio`. Note that sample track recording in the LMMS core is not completed before #7786 .
This PR also removes the reading and saving of the channel number configuration in several places as it will default to `DEFAULT_CHANNELS` all the time anyway.
Co-authored-by: Johannes Lorenz <j.git@lorenz-ho.me>
Co-authored-by: Michael Gregorius <michael.gregorius.git@arcor.de>
Adjust the `Knob` class so that it defaults to taking the font size of
the knob's font into account when rendering its label. This allows to
use labels of different sizes for different knobs. Previously all knob
labels throughout the whole application were rendered with the same fixed
font size. Hence it was not possible to adjust the label size for a
single knob because this would have affected all other knobs as well.
The new implementation also allows the knobs to pick up CSS rules.
To be able to control the knob behavior two new constructors have been
added to the `Knob` class. Both constructors are concerned with creating
knobs with labels and therefore they directly take the label text as a
parameter. This removes numerous explicit calls to `setLabel` in the
code.
There is only one constructor that allows to switch between the new
behavior of taking the widget's font size into account and the old legacy
behavior of always rendering with the same fixed font size of
`SMALL_FONT_SIZE`. The parameter was modelled as an enum to make it
easier to find the remaining knob instances that use the legacy behavior.
This makes it easier to find them in case they should be removed as well.
In that case the string `LegacyFixedFontSize` can be searched.
The other new constructor allows to directly set the knob's (and
therefore the label's) font size to a pixel value.
Corresponding constructors have been added to `TempoSyncKnob`. The
constructors of `KnobControl` and `CustomTextKnob` have been adjusted to
take advantage of the new constructors. An usused constructor was removed
in `CustomTextKnob`.
The method `Knob::setLabel` has been made protected because labels should
now be set through the new constructors.
A new property called `m_fixedFontSizeLabelRendering` was added to the
`Knob` class. It controls how the labels are rendered. Fixed font size
legacy rendering can be activated by calling the protected method
`setFixedFontSizeLabelRendering`. The current setting can be queried via
`fixedFontSizeLabelRendering`.
## Changes in the plugins
Some plugins have been switched to using layouts to organize their
widgets so that they can accommodate for knobs with label sizes set by
the application font.
The fixed font size (legacy) rendering mode is still used in the
following places:
* EnvelopeAndLfoView
* InstrumentSoundShapingView
* InstrumentFunctionViews
* EffectView
* InstrumentTrackView
* SampleTrackView
* Delay plugin
* Carla plugin
# individual commit messages
What follows are the individual commit messages of the commits that have been squashed into one commit. They might help in case of more detailed investigations of how things came to be.
* Knob with correct label rendering
Enable the knob to render the label correctly at arbitrary sizes if it's configured to do so. Otherwise it will render like before. The used mode is determined when a label is set for the knob because as long as the label is not set a knob does not have one anyway.
The painting code now always renders the label with the font that's set for the widget.
The are now two methods to set the label text. The new method `setLabelLegacy` renders the label as before albeit in a slightly adjusted implementation. It now sets the widget font to a fixed pixel size font and then calculates the new widget size as before, i.e. not really taking the size of the font into account. This might lead to overlaps if the font of the knob is large.
The method `setLabel` now has an additional (temporary) parameter called `legacyMode`. It is by default set to `true` so that all knobs still render like they did before. This is implemented by delegating to `setLabelLegacy` if it's set to `true`. Otherwise the method calculates the new size of the widget by taking the pixmap and the label with the current font into account.
Please note that as of now you must set the knob font before calling any of the methods that sets the label. This is because the new size is only calculated via these code paths. However, this is already much better than only being able to use one hard-coded label size for all knobs.
* Switch from `setLabel` to `setLabelLegacy`
Switch all callers of `setLabel` to `setLabelLegacy` so that it becomes
obvious in which places the old knob implementation is used.
* Remove parameter `legacyMode` from `setLabel`
Remove the parameter `legacyMode` from `setLabel`. Add the member
`m_legacyMode` as it is needed in `Knob::changeEvent` so that we do not
switch the behavior when the knob is enabled/disabled.
* Extract methods
Extract `setLegacyMode` and `updateFixedSize`. Also add the getter `legacyMode`.
* Introduce legacy knob builders
Introduce legacy knob builders and apply them to the plugins. There are three new methods which encapsulate how to create a corresponding legacy knob:
* `Knob::buildLegacyKnob`
* `CustomTextKnob::buildLegacyKnob`
* `TempoSyncKnob::buildLegacyKnob`
These methods set the knob they build to legacy mode and also set a label in legacy mode. The idea is to concentrate the relevant legacy code in these methods. They will later also be useful to quickly find all the places in the application where legacy knobs are used.
The three methods are applied to the plugins directory. Most plugins use the build methods to build their knobs which also enables the removal of the explicit calls to `setLabelLegacy` from their code.
For some plugins their implementations were adjusted so that they can deal with showing the labels in the applicaiton font, i.e. in the font size of the widget their are contained in. Most of the times this involved removing the fixed size and putting the elements in a layout (while also removing move calls). The following LMMS plugins use the application font now and are thus better readable:
* Amplifier
* BassBooster
* Dispersion
* Flanger
* Peak Controller
* ReverbSC
* StereoEnhancer Effect
The Vectorscope now shows the "Persist." label in the same size as the label of the check boxes.
Setting an empty label was removed for Lb302.
* Legacy knob builders in GUI
Apply the legacy knob builders in the GUI components. Most components use the legacy knobs until they can be redesigned:
* Effect view ("W/D", "DECAY", "GATE")
* LFO Controller
* Instrument window
Everything related to the instrument window is for now kept to use the legacy knobs and should be adjusted at a later point to be more flexible:
* Envelope and LFO
* Functions
* Sound Shaping
The Instrument and sample track both use the legacy knobs for the "VOL" and "PAN" knobs. This might be adjusted later.
The following components now render the labels of their knobs with the application font size:
* MIDI CC Rack
* The class `LadspaControlView`, which is not in used anymore
Some vertical spacing was added to the MIDI CC Rack for slightly improved separation of the elements. The knobs are center aligned in the layout so that the transition between element under and over "CC 100" is cleaner. Setting the models in an explicit loop was removed and is now done when the knobs are created.
## Technical details
Extend `Knob::buildLegacyKnob` with the option to also set the name of the knob. This is needed for some changes in this PR.
The method `KnobControl::setText` now needs to distinguish between legacy mode and non-legacy mode.
* Remove `Knob::setLabelLegacy`
Remove `Knob::setLabelLegacy`. Instead make sure that the `Knob` updates its size in the following situations:
* The label is set.
* The font changes.
* Legacy mode is set or unset (already implemented).
The handling of font changes has been added to `Knob::changeEvent`. The update in case of a changed label is added to `Knob::setLabel`.
Every client that called `setLabelLegacy` now also sets the legacy font in size `SMALL_FONT_SIZE` as this was previously done in `setLabelLegacy`. The label is set via `setLabel` now. Both actions should result in an up-to-date size.
The method `KnobControl::setText` now only sets the label via `setLabel`, assuming that the wrapped knob was already configured correctly to either be a legacy knob or not.
* Use descent to calculate base line
Use the descent of the font to calculate the distance of the base line from the bottom of the knob widget if we are not in legacy mode. In legacy mode we still assume the descent to have a value of 2, i.e. the base line will always have a distance of 2 from the bottom of the knob widget regardless of the used font.
Also refactor the code a bit to make it more manageable.
* Extract `Knob::drawLabel`
Extract the method `Knob::drawLabel` which draws the label. It is called from `paintEvent`.
* Use non-legacy knobs for instrument and sample track
Use non-legacy knobs for the "VOL" and "PAN" knobs of the instrument and sample track. This gives a bit more separation between the knob and the label but to make this work the font size had to be decreased by one pixel.
* Introduce `buildKnobWithSmallPixelFont`
Introduce the builder method `buildKnobWithSmallPixelFont` in `Knob` and `TempoSyncKnob`. It creates a non-legacy knob with a small pixel sized font, i.e. it still uses the small font but with a corrected size computation and corrected space between the knob and the label. It is mostly used in places with manual layouts where there's enough space to have the bit of extra space between the knob and the label.
The following plugins use these knobs:
* Bitcrush
* Crossover EQ
* Dual Filter
* Dynamics Processor
* Multitap Echo
* Spectrum analyzer
* Mallets
* Waveshaper
* ZynAddSubFx
The "IN" and "OUT" label of the Bitcrush plugin use the default fixed font size now because the plugin uses a pixel based layout. Using the point based application font looked off.
They are also used in the following component:
* Effect view, i.e. the "W/D", "DECAY", "GATE" knobs of an effect
* LFO Controller
* Non-legacy knobs for VSTs
Use non-legacy knobs with small pixel fonts for the parameter lists of VST instruments and effects.
This is accomplished by renaming `CustomTextKnob::buildLegacyKnob` to `buildKnobWithSmallPixelFont` and removing the call to `setLegacyMode`.
* Fix styled knobs
Fix the handling of styled knobs which are created in non-legacy mode. Styled knobs do not use pixmaps and have no labels. Their size is set from the outside and they are painted within these limits. Hence we should not compute a new size from a pixmap and/or label in `Knob::updateFixedSize`.
This fixes the following plugins:
* FreeBoy
* Kicker
* Monstro
* Nescaline
* Opulenz
* Organic
* Sf2 Player
* sfxr
* SID
* SlicerT
* Triple
* Watsyn
* Xpressive
The functionality broke with commit defa8c0180e.
An alternative would have been to check for a styled knob in the contructor or `initUI` method and to set the legacy flag for these.
The best solution would likely be to create an own class for styled knobs and to pull that functionality out of `Knob` because they somewhat clash in their handling.
* Code review changes
Parameter whitespaces in the builder methods of `Knob`.
Use `adjustedToPixelSize` in `InstrumentTrackView` and `SampleTrackView`.
* Code review changes
Make the code that computes the new fixed size in legacy more readable
even if it is just legacy code that's was not touched. Add some code
documentation.
Other cosmetic changes:
* Whitespace adjustments
* Remove unused parameter in `paintEvent`
* Rename `knob_num` to `knobNum`
* Add documentation for legacy mode
Add some documentation which explains what the effects of legacy mode
are.
* Code review
Remove unnecessary dereference.
Also remove unncessary code repetition by introducing
`currentParamModel`.
* Decrease the label size of some knobs
Decrease the size of the following knob labels to 8 pixels:
* "VOL" and "PAN" in the instrument and sample track views
* "W/D", "DECAY" and "GATE" in the effect view
Technically this is accomplished by introducing
`Knob::buildKnobWithFixedPixelFont` and
`TempoSyncKnob::buildKnobWithFixedPixelFont`.
Both versions of `buildKnobWithSmallPixelFont` now also delegate to
the new methods.
* Adjustments to CrossoverEQControlDialog
Commit the adjustments that were done to `CrossoverEQControlDialog` which I had forgotten to add after fixing the merge.
* Fix formatting of CrossoverEQControlDialog
Fix the formatting of `CrossoverEQControlDialog` which got messed up after copying the code from the current version on GitHub.
* Code review changes
Use `std::max` instead of `qMax`. Remove some unnecessary whitespace.
* Protected legacy mode methods
Make `legacyMode` and `setLegacyMode` protected to ensure that legacy knobs can only be built using the factory method `buildLegacyKnob`. In the long term legacy mode should be removed.
* Code review: remove indexed access
The original request in the code review was to use `size_t` instead of
`uint32_t` in the for-loop. However it is possible to completely remove
the indexed access and to turn it into a simple iterated for-loop.
Also remove code repetition in the calculation of the maximum knob width
of the group. Use std::max instead of manual management.
* Fix u_int16_t to uint16_t
This should hopefully fix the WIndows builds.
* Fix AudioFileProcessor knobs
Fix a problem with the `AudioFileProcessorWaveView::knob` which is caused
by the fact the this knob uses the pixmap based knob type `Bright26`
without a label. Most other knobs that inherit from `Knob` set their knob
type to `Styled` which means that no pixmap is used to render the knob.
In the specific case the knob instance is created and the contructor
runs. In the constructor the AFP knob is set to a fixed size of (37,47).
However, at a later point the method `Knob::changeEvent` is triggered by
Qt due to a font change. This in turn calls `Knob::updateFixedSize` which
then recomputes the fixed size and effectively changes the width of the
knob to the width of the pixmap which is 27. Because the knob previously
was rendered centered with a width of 37 this means that the knob is now
effectively shifted by five pixels to the left.
This commit counters this effect by moving the affected AFP knobs five
pixels to the right. A visual difference between the fixed version and
the current master showed no differences. So this should fix the problem.
Because setting the knob to a fixed size of (37,47) does not have any
lasting effect anyway the code is removed from the constructor of the AFP
knob.
* Use legacy knobs in EffectView
* Legacy knobs for instrument & sample
Use legacy knobs for the instrument and sample track view ("VOL", "PAN").
* Add documentation to Knob builder methods
Add some documentation to the `Knob` builder methods. Mark `buildLegacyKnob` as deprecated and note that it should not be used in new code.
* Ensure legancy rendering for legacy knobs
Ensure that legacy knobs are always rendered at a size of 12 pixels,
i.e. `SMALL_FONT_SIZE`.
The previous implementation used the font metrics of the knob's current
font to compute the new fixed size and to render the label. It assumed
that the knob was created using `Knob::buildLegacyKnob` and that
therefore the font is set to 12 pixels. However, this meant that legacy
knobs can still be affected by style sheet settings. The following CSS
rule for example resulted in legacy knobs with a larger font size:
```
* { font-size: 18px; }
```
The fix is to use a font with a size of `SMALL_FONT_SIZE` when
calculating the fixed size of the `Knob` widget and when rendering it if
we are in legacy mode. This ensures that a legacy knob is unaffected by
CSS rules.
The non-legacy knob still uses the widget's font size and therefore it is
affected by CSS rules. However, this is a feature and not a bug because
when for example using a rule like the one above the knob does exactly
what it's asked to do.
* Remove unused constructor
Remove an unused constructor from CustomTextKnob
* Remove Knob::buildKnobWithSmallPixelFont
Remove the builder method `Knob::buildKnobWithSmallPixelFont` and replace
it with an equivalent new contstructor which takes the same arguments as
the build method.
* Remove Knob::buildKnobWithFixedPixelFont
Remove `Knob::buildKnobWithFixedPixelFont` as it is not used anymore.
Previously it was delegated to by the now removed method
`Knob::buildKnobWithSmallPixelFont`.
* Constructor for knobs with pixel size labels
Remove `TempoSyncKnob::TempoSyncKnob` and add an equivalent constructor.
Make `buildKnobWithSmallPixelFont` use the new constructor.
* Remove TempoSyncKnob::buildKnobWithSmallPixelFont
Remove `TempoSyncKnob::buildKnobWithSmallPixelFont` and make clients use
the new constructor.
* Remove CustomTextKnob::buildKnobWithSmallPixelFont
Remove `CustomTextKnob::buildKnobWithSmallPixelFont` and extend the
constructor so that it also takes a label. Previously all constructions
went through the build method and now all constructions use the extended
constructor.
* Knob constructors whichKnob constructors which take labels
Add constructors for `Knob` and `TempoSyncKnob` which also take the label
text. Make setLabel protected as most knobs should know their labels at
construction time.
This prevents "chatty" code like the following example:
```
Knob* knob = new Knob(KnobType::Bright26, this);
knob->setLabel("My label");
```
This now becomes a simple a one-liner:
```
Knob* knob = new Knob(KnobType::Bright26, "My label", this);
```
The constructor of `KnobControl` also had to be extended with the label
text because it cannot access the setLabel of the Knob that it manages.
However, it can pass the text during construction. Its implementation of
the virtual method `Control::setText` becomes empty due to this. The
`KnobControl` is currently only used in `Lv2ViewProc::Lv2ViewProc`. Here
the `KnobControl` is created by passing the port name into the
constructor. However, the virtual method `setText` is still called in
line 91 for all other implementations.
Add documentation for the constructors.
* Remove Knob::buildLegacyKnob
Remove `Knob::buildLegacyKnob` by extending the very similar constructor
with an enum that indicates whether the constructed `Knob` should be in
legacy mode or not. The default is to build a non-legacy `Knob`.
Wherever `Knob::buildLegacyKnob` was called the constructor is now called
with `Knob::Mode::Legacy` as the parameter. In some places where the
onject name is set `Knob::Mode::NonLegacy` has to be added explicitly.
* Remove TempoSyncKnob::buildLegacyKnob
Remove `TempoSyncKnob::buildLegacyKnob` by extending the very similar
constructor with an enum that indicates whether the constructed
`TempoSyncKnob` should be in legacy mode or not. The default is to
build a non-legacy `TempoSyncKnob`.
Wherever `TempoSyncKnob::buildLegacyKnob` was called the constructor is
now called with `Knob::Mode::Legacy` as the parameter.
* Vertical spacing for Peak Controller
Add a vertical spacing of 10 pixel between the knobs of the Peak Controller.
* Peak Controller: use default margins
Remove the specific call to `setContentsMargins` from the Peak Controller so that the main layout uses Qt's default margins.
Also remove the spacing again.
* Rename the enum `Knob::Mode`
Rename the enum `Knob::Mode` and its values so that they better describe
what they influence.
`Knob::Mode` is renamed to `Knob::LabelRendering` to indicate that its
value affects the label rendering.
The value `NonLegacy` is now called `WidgetFont` to indicate that the
knob uses the font settings of the widget when rendering the label.
The value `Legacy` is now called `LegacyFixedFontSize` to indicate that
it's a legacy behavior which uses a fixed font size that does not adhere
to the font size that's set for the widget's font.
Adjust all callers accordingly.
* Add TempoSyncKnob documentation
Document the constructor of `TempoSyncKnob` that can be used to set the
label rendering to lecacy mode.
* Name adjustments and parameter removal
Rename `m_legacyMode` to `m_fixedFontSizeLabelRendering`.
Rename the method `legacyMode` to `fixedFontSizeLabelRendering`.
Rename `setLegacyMode` to `setFixedFontSizeLabelRendering`. Also remove
the boolean parameter from the method as it was only called with `true`
anyway.
Reworks how note detuning copying works so as not to perform a clip duplication and allocation by default in the constructors
---------
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
Upgrade to Windows 2022 build runner and Visual Studio 2022 for MSVC builds.
Continue installing Qt 5.15.2 with the Visual Studio 2019 option since it doesn't provide a VS 2022 option.
A follow up to #7477, which ensures clips have auto-resizing enabled by default. This is needed because auto-resizing was the default behavior, but the code tried to use this newly added attribute with a default of 0 (i.e., auto resizing is not enabled).
Fixes a crash that occurs when attempting to play within the Pattern Editor with no Pattern Track created.
---------
Co-authored-by: Sotonye Atemie <sakertooth@gmail.com>
Prior to commit b5de1d50e, audible zipper artifacts were present when
using the PeakController on a bus to control the volume of another bus
for sidechain compression. The bus that had its volume reduced was the
one which produced audible artifacts.
Commit b5de1d50e introduced LERP to PeakController to smooth out its
signal, which eliminated the zipper artifacts. However, this had the
side effect of increased latency even when both attack and decay
settings were set to zero.
Until a more robust solution is implemented, reverting this change
eliminates the latency by eliminating the lerp, but reintroduces audible
zipper artifacts.
Allow for splitting and resizing all types of clips (automation, MIDI, sample, pattern, etc) using the knife tool in the Song Editor.
---------
Co-authored-by: szeli1 <143485814+szeli1@users.noreply.github.com>
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
Added the ability to favorite items. This gets added to its own tab named "My Favorites".
---------
Co-authored-by: Sotonye Atemie <sakertooth@gmail.com>
This PR refactors how the spacebar is handled by the editors and the MainWindow to allow it to play/stop (Shift+Space for play/pause) the last played editor, no matter if it is in focus or not.
---------
Co-authored-by: Fawn <rubiefawn@gmail.com>
Co-authored-by: Sotonye Atemie <satemiej@gmail.com>
Adds the ability to reverse the selected midi notes in the PianoRoll.
The tool is located under the wrench icon in the PianoRoll and can also be triggered with Shift-R.
---------
Co-authored-by: szeli1 <143485814+szeli1@users.noreply.github.com>
Previously, clicking on a track or dragging in a sample would always create a clip on the closest/previous bar, no matter what the Song Editor's snap size was. This fixes that issue by using the Song Editor's quantization when placing new clips, so for example if the snap size is 1/4 bar, the clip will be added at the closest/previous 1/4 bar mark.
* Add /.cache/ to .gitignore
Normally clangd's .cache exists in /build/, which is already in the .gitignore, but if cmake is run in the repository root instead of /build/ the cache is in turn generated in the repository root.
* Also add compile_commands.json to .gitignore
Newly created MIDI tracks were not automatically assigned to the desired MIDI device when the option to do so was specified in settings. This commit fixes that.
- Remove pointless *.exe option
- Add an "All VST files" option on Linux when there is both LinuxVST and Wine VST support
- Remove *.dll option from Linux builds without Wine VST support (i.e. LinuxVST-only builds)
* Renamed lmms_basics.h to LmmsTypes.h and scoped it down for that purpose.
* Shifted the LMMS_STRINGIFY macro to it's own header.
* Removed the debug.h header file and use cmake to handle the macro logic.
* Remove some unused headers and include directives
Adds a complex strum tool to the Piano Roll, allowing the user to take a selection of chords, and drag around the notes to shape the strum exactly how they want it.
---------
Co-authored-by: szeli1 <143485814+szeli1@users.noreply.github.com>
Co-authored-by: Sotonye Atemie <satemiej@gmail.com>
Fixes a regression from 07baf9e27a, in
which a channel that was created through a tracks "Assign track to new
mixer channel" context menu would display an incorrect name until it was
renamed by a user.
Created and replaced missing/mismatched assets, fixed mixer send arrows causing mixer height to be wrong, tweaked CSS stylesheet to fix active mixer channel being black
* Fix crash when switching opened projects #7793
When the DAW is already running with an open project and you attempt to
open another project via File > Open, a segfault used to occur.
The crash seems to have been caused by model()->value(), which was
called in Fader::getModelValueAsDbString(). The model() function
looked like it should return a pointer to an AutomatableModel.
I suspect that when a model was dropped in favor of loading models for
a new project, the AutomatableModel pointer became a null pointer.
Add a check to the AutomatableModel pointer so getModelValueAsDbString
returns early (before accessing member functions) if the pointer is
null. This fixes the crash.
Allow embed.cpp to load SVG assets at screen DPI by leveraging QPixmap::setDevicePixelRatio
---------
Co-authored-by: Tres Finocchiaro <tres.finocchiaro@gmail.com>
Co-authored-by: Fawn <rubiefawn@gmail.com>
In #7708, the track operations widget was given a centered vertical alignment in order to fix an aesthetic layout issue. This is being reverted, since it is possible to resize tracks, and all the other track interface elements are top-aligned.
The y-axis quantization for graph values was being calculated
incorrectly. This would have gone unnoticed since the only step sizes
currently used are 0 (continuous) or 1. Any other values produce
"sloped" quantization. This fix prevents this error from affecting
any future uses of graphModel.
* Add mute and solo buttons to instrument windows
* Change mute and solo buttons to optimized CC0 SVG assets
* Icons provided by @StakeoutPunch, button backgrounds provided by
@RebeccaDeField
---------
Co-authored-by: Sotonye Atemie <sakertooth@gmail.com>
Co-authored-by: Rebecca Noel Ati <contactme@rebeccadefield.com>
Co-authored-by: Stakeout Punch <StakeoutPunch@users.noreply.github.com>
* Accessors for volume, cutoff, resonance
Add private accessors for the volume, cutoff and resonance parameters (envelope and LFO).
This makes the code less technical and more readable as it for example removes lots of static casts. The casts are now done in a special helper method that returns the parameters for a given target.
* Remove EnvelopeAndLfoParameters array
Remove the `EnvelopeAndLfoParameters` array and use explicit instances for volume, cutoff, resonance. This simplifies construction and initialization of the instances.
Besides the array this also removes the `Target` enum and the `NumTargets` value.
To simplify storage and retrieval of the parameters three private methods have been added which provide the node names of the volume, cutoff and resonance parameters.
Adjust `InstrumentSoundShapingView` to the removed `NumTargets` property.
* Use references instead of pointers
Use references to the volume, cutoff and resonance parameters instead of pointers.
* Remove friend relationship
Remove the friend relationship between `InstrumentSoundShaping` and its related view by providing the models via getters.
* Get rid of targetNames
Get rid of `InstrumentSoundShaping::targetNames` by using translations and strings directly. Move the remaining stuff into `InstrumentSoundShapingView` until it is removed there as well.
* Explicit EnvelopeAndLfoViews
Remove the array of EnvelopeAndLfoViews and use dedicated instances instead.
This also enables the final removal of the remaining `targetNames`.
* Move the code of some getters
Move the code of some getters into the header file.
* Several code review changes
Apply some code review proposals.
Co-authored-by: Sotonye Atemie <sakertooth@gmail.com>
---------
Co-authored-by: Sotonye Atemie <sakertooth@gmail.com>
Refactors `AudioFileOgg`, a class used to export to OGG files. There were problems reported of the exported OGG file failing to be played back on some systems. To fix this issue as well as to improve code quality, the class was refactored. In addition, VBR (variable bit rate) is always used, with the quality of the export being determined by a ratio of the selected bit rate and the maximum bit rate allowed. This change naturally occurred when refactoring, though the libvorbisenc documentation recommend VBR for improved audio quality.
Adds the ability to cut multiple notes at once in the Piano Roll. Users can select the Knife tool and create a cut line by holding the mouse and dragging it across the notes that should be cut. This also allows cutting the notes at an angle. When releasing the mouse, the Shift key can be pressed to remove the shorter end of the notes that were cut. If any notes are selected, only they will be considered for the cut, even if the cut line covers more notes.
The scroll bars shown in the main window were removed in favor of a new navigation feature that utilizes dragging the mouse instead. Users can now hold the mouse down on an empty part of the workspace and drag the mouse around to navigate where necessary.
Introduces a new class FileRevealer to manage file selection across different platforms (Windows, macOS, Linux, and other *nix operating systems with xdg). Includes methods to open and select files or directories using the default file manager on the respective platform.
---------
Co-authored-by: Tres Finocchiaro <tres.finocchiaro@gmail.com>
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: Sotonye Atemie <sakertooth@gmail.com>
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* Use dbFS scale for the faders
Make the faders use a linear dbFS scale. They now also change position on first click and can then be dragged.
The `Fader` class now has a new property called `m_faderMinDb`. It's the minimum value before the amplification drops down fully to 0. It is needed because we cannot represent a scale from -inf to maxDB.
Rename `knobPosY` to `calculateKnobPosYFromModel` and move the implementation into the cpp file. The method now first converts the model's current amplification value to dbFS and then computes a ratio based on that values and the minimum and maximum dbFS values.
Add the method `setVolumeByLocalPixelValue` which takes a local y coordinate of the widget and sets the amplification of the model based on a dbFS scale.
Adjust `mousePressEvent` and `mouseMoveEvent` so that they mostly take the local y coordinate of the event and use that to adjust the model via `setVolumeByLocalPixelValue`.
Remove `m_moveStartPoint` and `m_startValue` and they are not needed anymore.
* Apply curve to faders
Apply a curve, i.e. the cube function and its inverse, to the fader
positions to that we have more space to work with in the "interesting"
areas around 0 dB and less space in the area where we tend to "-inf dB".
Set the minimum dB value of the fader to -120 dB to increase the potential
headroom.
* Support for dB models
Add support for models that are in dB.
There's a new member `m_modelIsLinear` which can be set via the
constructor. The default value in the constructor is `true`.
Add the method `modelIsLinear` which can be used to query the parameter.
It is used in `calculateKnobPosYFromModel` and
`setVolumeByLocalPixelValue`. Both methods got extended to deal with
models in dB. They were also refactored to extract code that is common
for both cases.
Ensure that the constructor of `Fader` is called with `false` for
`CrossoverEQControlDialog` and `EqFader` because these use models that
are in dB.
* Show current dB value of fader in tool tip
Show the current value of the fader in its tool tip. Please note that
this value is always shown in dB because the goal should be to get rid
of the linear values for the faders.
Some of the code is extracted into the new method
`Fader::getModelValueAsDbString` which is shared by
`Fader::modelValueChanged` (also new) and `Fader::updateTextFloat`.
Please note that `getModelValueAsDbString` will use "dB" instead of
"dBFS" as the unit and that it will format "-inf dB" instead of "-∞ dB".
These changes will also be visible in the text float that is used to
show the new values as the fader is being dragged.
* Let users enter values in dB
Let users enter values in dB in the dialog that opens with a double
click.
The minimum value that can be entered is the minimum value that the
fader allows to set, i.e. -120 dB. The maximum value is the maximum
value of the model converted to dB. As of now this is ~6 dB. The
current value is converted to dB. If it corresponds to "-inf dB", i.e.
if the amplification is 0 then the minimum value is used.
* Remove option "Display volume as dBFS"
Remove the option "Display volume as dBFS" from the settings dialog and
the check box option "Volume as dBFS" from the "View" menu. Volumes are
now always treated as dB, i.e. all evaluations of the property
"displaydbfs" have been removed which results in assuming that this
option is always true.
The upgrade code in `ConfigManager::upgrade_1_1_91` was left as is.
However, a note was added which informs the reader that the value of
"displaydbfs" is not evaluated anymore.
* Extend Fader::wheelEvent
Extend `Fader::wheelEvent` for the case where the model is not a dB
model (`modelIsLinear() == true`), e.g. for the mixer faders. In that
case it works as follows. Each step increments or decrements by 1 dB if
no modifier is pressed. With "Shift" pressed the increment value is 3 dB.
With "STRG" ("CTRL") pressed the increment value is reduced to 0.1 dB. If
the value goes below the minimum positive dB value that is allowed by the
fader then the fader is set to "-inf dB", i.e. zero amplification. If the
fader is set to "-inf dB" and the users want to increase the value then
it is first set to the minimum positive value that is allowed by the
fader.
If the model is a dB model then the same behavior as before is used.
Although it should be considered to adjust this case as well. These
models are used by the faders of the Crossover Equalizer, Equalizer,
Compressor and Delay and they are not very usable with the mouse wheel.
* Adjust the wheel behavior for faders with dB models
Make the faders of the Crossover Equalizer, Equalizer, Compressor and
Delay behave like the mixer faders, i.e. step in sizes of 3 dB, 1dB and
0.1 dB depending on whether a modifier key is pressed or not.
Extract some common code to do so and add some `const` keywords.
* Less "jumpy" knobs
Implement a more stable knob behavior.
Remove the jumping behavior if the users directly click on a volume
knob. By storing the offset from the knob center and taking it into
account during the changes it now also feels like the users are
dragging the knob.
Changes to the amplification are now only applied when the mouse is
moved. This makes the double click behavior much more stable, i.e. if
users click on the knob when it is at 0 dB the dialog will also show
0 dB and not something like 0.3 dB because the first click is already
registered as a change of volume.
If the users click next to the knob the amplification will still be
changed immediately to that value.
## Technical details
To make the knobs more stable a variable called `m_knobCenterOffset` was
introduced. It stores the offset of the click from the knob center so
that this value can be taken into account for in the method
`setVolumeByLocalPixelValue`.
* Make MSVC happy
Add an indication that a float value is assigned to a float variable.
* Introduce constexpr for scaling exponent
Introduce the `constexpr c_dBScalingExponent` which describes the
scaling exponent that's used to scale the dB scale in both directions.
This will simplify potential adjustments by keeping the values
consistent everywhere.
* Draw fader ticks
Draw fader ticks in case the model is a linear one. This means that for
now they should only be painted for the mixer faders but not for the
faders of the Compressor, Delay, etc.
Extract the computation of the scaled ratio between the maximum model dB
value and the minimum supported fader dB value into the new private
method `computeScaledRatio`. This is necessary because it is needed to
paint the fader knob at the correct position (using the knob bottom as
the reference) and to paint the fader ticks at the correct position
(using the knob center).
Introduce the private method `paintFaderTicks` which paints the fader
ticks.
Note: to paint some non-evenly spaced fader ticks replace the `for`
expression in `paintFaderTicks` with something like the following:
```
for (auto & i : {6.f, 0.f, -6.f, -12.f, -24.f, -36.f, -48.f, -60.f, -72.f, -84.f, -96.f, -108.f, -120.f})
```
* Fader adjustments via keyboard
Allow the adjustment of the faders via the keyboard. Using the up or
plus key will increment the fader value whereas the down or minus key
will decrement it. The same key modifiers as for the wheel event apply:
* No modifier: adjust by 1 dB
* Shift: adjust by 3 dB
* Control: adjust by 0.1 dB
Due to the very similar behavior of the mouse wheel and key press
handling some common functionality was factored out:
* Determinination of the (absolute) adjustment delta value by
insprecting the modifier keys of an event. Factored into
`determineAdjustmentDelta`.
* Adjustment of the model by a given dB delta value. Factored into
`adjustModelByDBDelta`.
* Move the fader of the selected channel
Move the fader of the selected channel instead of the fader that has
focus when the up/plus or down/minus keys are pressed. Doing so also
feels more natural because users can already change the selected
channel via the left and right keys and now they can immediately adjust
the volume of the currently selected channel while doing so.
Key events are now handled in `MixerView::keyPressEvent` instead of
`Fader::keyPressEvent` and the latter is removed. `MixerChannelView`
now has a method called `fader` which provides the associated fader.
This is needed so that the event handler of `MixerView` can act upon
the currently selected fader.
## Changes in Fader
The `Fader` class provides two new public methods.
The `adjust` method takes the modifier key(s) and the adjustment
direction and then decides internally how the modifier keys are mapped
to increment values. This is done to keep the mapping between modifier
keys and increment values consistent across different clients, e.g. the
key event of the `MixerView` and the wheel event of the `Fader` itself.
The direction is provided by the client because the means to determine
the direction can differ between clients and cases, e.g. a wheel event
determines the direction differently than a key event does.
The method `adjustByDecibelDelta` simply adjusts the fader by the given
delta amount. It currently is not really used in a public way but it
still makes sense to provide this functionality in case a parent class
or client wants to manipulate the faders by its very own logic.
Because the `Fader` class does not react itself to key press events
anymore the call to `setFocusPolicy` is removed again.
* Enter fader value when space key pressed
Let the users enter the fader value via dialog when the space key is
pressed.
Extract the dialog logic into the new method `adjustByDialog` and call
it from `MixerView::keyPressEvent`.
Make `Fader::mouseDoubleClickEvent` delegate to `adjustByDialog` and
also fix the behavior by accepting the event.
* More prominent fader ticks around 0 dB
Make the fader ticks around 0 dB more prominent but drawing them
slightly wider and with a more opaque color.
* Work around a Qt bug
Work around a Qt bug in conjunction with the scroll wheel and the Alt
key. Simply return 0 for the fader delta as soon as Alt is pressed.
* Fix wheel events without any modifier
Fix the handling of wheel events without any modifier key being pressed.
Commit ff435d551b accidentally tested against Alt using a logical OR
instead of an AND.
* Code review changes
First set of code review changes:
* Use Doxygen style documentation comments
* Remove comment about `displaydbfs` from upgrade routine
* White-space changes for touched lines.
* Make minimum dB value a constexpr
Make the minimum dB value a constexpr in the implementation file because
currently it's an implementation detail that should not be of any
interest to any other client.
So `m_faderMinDb` becomes `c_faderMinDb`.
* More flexible painting of fader ticks
Paint the fader ticks in a more systematic and flexible way. This also
removes some "magic numbers", e.g. by using `c_faderMinDb` instead of
`-120.f` as the lower limit.
The upper limit, i.e. the "starting point" is now also computed using
the maximum value of the model so that the fader will still paint
correctly if it ever changes.
* Make the zero indicator bolder
Make the zero indicator tick of the fader bolder.
* Make rendering of fader ticks a preference
Make rendering of fader ticks a preference which is off by default.
Introduce the new option "Show fader ticks" to the setup dialog and save
it to the UI attribute `showfaderticks`.
The configuration value is currently evaluated in `Fader::paintEvent`.
If this leads to performance problems it might be better to introduce a
boolean member to the `Fader` class which caches that value.
* Move constexprs to anonymous namespace
* unmute related FX channels
When soled one FX channel, unmute send and receive channels, to allow complex FX channel routing (BUS, SENDs, etc.)
* Comment change
* SEND channels
Activate also SEND channels recursively
* Remove unnecessary whitespace
* Encapsulate mixer channel index
Make the mixer channel index `m_channelIndex` private and add getters and
setters. Also add a method to determine if the channel is the master
channel.
Move `m_channelIndex` to the end of the initialization list of the
`MixerChannel` constructor because it is now the last member in the
header.
Adjust all clients to make use of the new methods.
* Replace const int& getIndex() with int index() const
* Format changes
---------
Co-authored-by: Michael Gregorius <michael.gregorius.git@arcor.de>
Co-authored-by: Sotonye Atemie <sakertooth@gmail.com>
* use c++20 concepts and numbers for lmms_constants.h
* replace lmms::numbers::sqrt2 with std::numbers::sqrt2
* replace lmms::numbers::e with std::numbers::e
Also replace the only use of lmms::numbers::inv_e with a local constexpr instead
* remove lmms::numbers::pi_half and lmms::numbers::pi_sqr
They were only used in one or two places each
* replace lmms::numbers::pi with std::numbers::pi
* add #include <numbers> to every file touched so far
This is probably not needed for some of these files. I'll remove those later
* Remove lmms::numbers
Rest in peace lmms::numbers::tau, my beloved
* Add missing #include <numbers>
* replace stray use of F_EPSILON with approximatelyEqual()
* make many constants inline constexpr
A lot of the remaining constants in lmms_constants.h are specific to
SaProcessor. If they are only used there, shouldn't they be in SaProcessor.h?
* ok then, it's allowed to be signed
* remove #include "lmms_constants.h" for files that don't need it
- And also move F_EPSILON into lmms_math.h
- And also add an overload for fast_rand() to specify a higher and lower bound
- And a bunch of other nonsense
* ok then, it's allowed to be inferred
* ok then, it can accept an integral
* fix typo
* appease msvc
* appease msvc again
* Replace linearInterpolate with std::lerp()
As well as time travel to undo several foolish decisions and squash tiny
commits together
* Fix msvc constexpr warnings
* Fix msvc float to double truncation warning
* Apply two suggestions from code review
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* Apply suggestions from code review
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* fix silly mistake
* Remove SlicerT's dependence on lmms_math.h
* Allow more type inference on fastRand() and fastPow10f()
* Apply suggestions from code review
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* Clean up fastRand() a little bit more
---------
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* Try to fix MSVC linker error related to lilv
* Remove temporary workaround
* Temporary debugging messages
* oops
* Temporary debugging
* Try to find FluidSynth using Config mode first
* Try again to fix lilv
* Fix FluidSynth installed with vcpkg on Windows
* Fix lilv from vcpkg
* Remove debug flag
* Fix for when lilv is not found (*-NOTFOUND evaluates to false)
* Use lowercase package name for lv2
* Try using only pkg_check_modules for lv2
* Use Lilv::lilv
* Add pkg-config guard back in
* Fix package name
Co-authored-by: Tres Finocchiaro <tres.finocchiaro@gmail.com>
* Fix Lilv_INCLUDE_DIRS
* Rename vcpkg cache key
---------
Co-authored-by: Tres Finocchiaro <tres.finocchiaro@gmail.com>
macOS: Replace Command + Drag shortcut key with Option + Drag
Add new header `KeyboardShortcuts.h` for platform-specific keyboard mappings
---------
Co-authored-by: Michael Gregorius <michael.gregorius.git@arcor.de>
* use c++ std::* math functions
This updates usages of sin, cos, tan, pow, exp, log, log10, sqrt, fmod, fabs, and fabsf,
excluding any usages that look like they might be part of a submodule or 3rd-party code.
There's probably some std math functions not listed here that haven't been updated yet.
* fix std::sqrt typo
lmao one always sneaks by
* Apply code review suggestions
- std::pow(2, x) -> std::exp2(x)
- std::pow(10, x) -> lmms::fastPow10f(x)
- std::pow(x, 2) -> x * x, std::pow(x, 3) -> x * x * x, etc.
- Resolve TODOs, fix typos, and so forth
Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com>
* Fix double -> float truncation, DrumSynth fix
I mistakenly introduced a bug in my recent PR regarding template
constants, in which a -1 that was supposed to appear outside of an abs()
instead was moved inside it, screwing up the generated waveform. I fixed
that and also simplified the function by factoring out the phase domain
wrapping using the new `ediv()` function from this PR. It should behave
how it's supposed to now... assuming all my parentheses are in the right
place lol
* Annotate magic numbers with TODOs for C++20
* On second thought, why wait?
What else is lmms::numbers for?
* begone inline
Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com>
* begone other inline
Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com>
* Re-inline function in lmms_math.h
For functions, constexpr implies inline so this just re-adds inline to
the one that isn't constexpr yet
* Formatting fixes, readability improvements
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* Fix previously missed pow() calls, cleanup
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* Just delete ediv() entirely lmao
No ediv(), no std::fmod(), no std::remainder(), just std::floor().
It should all work for negative phase inputs as well. If I end up
needing ediv() in the future, I can add it then.
* Simplify DrumSynth triangle waveform
This reuses more work and is also a lot more easy to visualize.
It's probably a meaningless micro-optimization, but it might be worth changing it back to a switch-case and just calculating ph_tau and saw01 at the beginning of the function in all code paths, even if it goes unused for the first two cases. Guess I'll see if anybody has strong opinions about it.
* Move multiplication inside abs()
* Clean up a few more pow(x, 2) -> x * x
* Remove numbers::inv_pi, numbers::inv_tau
* delete spooky leading 0
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
---------
Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com>
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
This PR attempts a number of improvements to the sample rendering (in the song editor, automation editor, AudioFileProcessor, SlicerT, etc) in LMMS:
Thumbnails: Samples are aggregated into a set of thumbnails of multiple resolutions. The smallest larger thumbnail is then chosen for rendering during sample drawing. Each set of thumbnails is stored with its sample file metadata in an unordered_map, so that duplicate samples will use the same set of thumbnails.
Partial rendering: additionally, this PR only renders the portions of the sample clips visible to the viewer to save rendering time.
* Experimental sample thumbnail
* Rename some classes and type aliases. Make some type declarations explicit
* Use a combination of audioFile name and shared_ptrs to track samples; refactor some loops
* That weird line at the end of the sample is now gone
* Small changes to the code; Add comments
* Add missing word to comment; Fix typo
* Track `SharedSampleThumbnailList`s instead
* Major refactor; implement thumbnailing for SlicerT, AFP and Automation editor
* Code clean up, renames and documenting
* Add the namespace lmms comments
* More code updates and documentation
* Fix error in comment
* Comment out `qDebug`s
* Fix formatting
* Use alternative initialization of `SampleThumbnailVisualizeParameters`
* Remove commented code
* Fix style and simplify code
* Use auto
* Draw lines using floating point
* Merge the classes into one nested class
+ Replace while loop with std::find_if
* Fix comparison of different signedness
* Include memory header
* Fix a logic error when selecting samples; Rename a const
* Fix more issues with signedness
* Fix sample drawing error in `visualizeOriginal`
* Only render regions in view of the sample
* Allow partial repaints of sample clips
* Remove unused variable
* Limit most of the painting to the visible region
* Revert back to using rect() in some places
* Partial rendering for AutomationEditor
* Don't redraw painted regions; allowHighResolution; remove `visualizeOriginal`; Remove s_sampleThumbnailCacheMap
* Add s_sampleThumbnailCacheMap back for testing convenience
* Minor change to the way `thumbnailSizeDivisor` is calculated
* Extend update region by an amount
* forgot about this
* Adapt to master; Redesign VisualizeParameters; Don't rely entirely on needsUpdate()
* Don't try to preserve painted regions
* Allow for a bit more thumbnails; Fix incorrect rendering when vertically scrolling
* Fix missing include statement
* Remove the unused variable
* Code optimization; Remove RMS member from Bit; Rename viewRect to drawRect
* More code optimizations
* Fix formatting
* Use begin instead of cbegin
* Improve generation of thumbnails
* Improve expressiveness of the draw code
* Add support for reversing
* Fix drawing code
* Fix draw code (part 2)
* Apply more fixes and simplifications
* Undo some out of scope changes
* Remove SampleWaveform
* Improve documentation
* Use size_t for some counters
* Change width parameter to be size_t
* Remove temporary aggregated peak variable
* Bump up AggregationPerZoomStep to 10
* Zoom out only requested range of thumbnail instead of clipping it separately
* Rename targetSampleWidth to targetThumbnailWidth
* Handle reversing for AFP; Iterate in reverse instead of reversing the entire thumbnail
* Change names to be more accurate
* Improve implementation of sample thumbnail cache map
* Move AggregationPerZoomStep back down to 2, do not cap smallest thumbnail width to display width
To improve performance with especially long
samples (~20 minutes)
* Simplify sample thumbnail cache handling in constructor
* Call drawLines instead of drawLine in a loop
QPainter::drawLine calls drawLines with a line count of 1. Therefore, calling drawLine in a loop means we are simply calling drawLines a lot more times than necessary.
* Bump up AggregationPerZoomStep to 10 again
Thought using 2 would help performance (when rendering). Maybe it does, but it's still quite slow when rendering a bunch of thumbnails at once.
* Fix off-by-one error when constructing Thumbnail from buffer
* Fix crash when viewport is not in bounds
* Apply performance improvements
Performance in the zoomOut function was bad because of the dynamic memory allocation. Huge chunks of memory were being allocated quite often, casuing a ton of cache misses and all around slower performance. To fix this, all the necessary downsampling is now done within the for loop and handled one pixel after another, instead of all at once.
To further avoid allocations in the draw call, the change to use drawLines has been reverted.
We now pass VisualizeParameters by value (it is only 64 bytes, which will fit quite nicely in a cache line, which is more benefical than reaching for that data by reference to some other part of the code).
After applying these changes, we are now practically only bounded by the painting done by Qt (according to profiling done by Valgrind). Proper use of OpenGL could resolve this issue, which should finally make the performance quite optimal in variety of situations.
* Apply minor changes
Update copyright and unused functions. Move in newly created thumbnail into the cache instead of copying it.
* Use C++20's designated initializers
* Create param right before visualizing
* Fix regressions with reversing
* Fix incorrect rendering in AFP and SlicerT
* Move MaxSampleThumbnailCacheSize and AggregationPerZoomStep into implementation file
* Remove static keyword
* Remove getter and setter for peak data
---------
Co-authored-by: Sotonye Atemie <sakertooth@gmail.com>
* add templates for common geometric constants
* oops missed one
* LD_2PI -> LD_PI
i re-added the wrong constant ffs
* CamelCase names and also verify compilation without -DLMMS_MINIMAL
* C++20 stuff
Updated to account for `<numbers>` and C++20:
- Marked all `lmms_constants.h` constants with an exact equivalent in `<numbers>` as deprecated
- Removed all `lmms_constants.h` constants where no variant is currently in use
- Using `inline constexpr`
- Using `std::floating_point` concept instead of `typename`
* add lmms::numbers namespace
* Remove panning_constants.h
Moves the four constants in panning_constants.h into panning.h, then
removes panning.h.
* Use std::exp(n) instead of powf(numbers::e, n)
* Use C++ std math functions
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* Use overloaded std math functions
An attempt to fix compiler warnings on some platforms
* Remove uses of __USE_XOPEN
And also update two functions I missed from the previous commit
* Missed a few
* Fix ANOTHER std math function use
Of course there's another one
---------
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* Fix rendering for Vectorscope
The rendering of the Vectorscope is broken on Wayland if the size of the
Vectorscope is increased. This is caused by using a `QImage` to render
the scope traces which is then scaled up.
Introduce a new way to paint the vector scope (goniometer) which simply
paints lines or points that progressively get dimmer and which does not
make use of a QImage anymore.
It supports the following features:
* Log mode
* Zooming
* Rendering the drawing performance
* Selecting a different color for the traces
It does not support:
* HQ Mode: The new implementation provides a performance that's
equivalent to Non-HQ mode and look similar or better than the HQ mode.
* Blurring of old data
* Persistence: Might be implemented by using a factor for the dimming
Rendering of the samples/trances uses the composition mode "Plus" so
that overlapping elements will appear like adding brightness. Painting
the grid and lines is done using the normal composition mode "Source
Over" so that it simply replaces existing pixels.
Painting of the lines/points and the grids and lines is done in a
"signal space", i.e. a transform where elements in the interval of
[-1, 1] feel "natural". The text is painted in "widget space".
* Remove old implementation
Remove HQ mode and persistence. Also remove the legacy option again.
This removes the models, loading, saving and the GUI controls.
Remove all unnecessary members from `VectorView`, adjust the
constructor. Move the implementation of `paintLinesMode` into
`paintEvent`. Remove methods `paintLegacyMode` and `paintLinesMode`.
* Move colors into VectorView
Move the colors out of `VecControls` into `VectorView` as they are
related to presentation.
* Remove friend relationship to VectorView
Remove a friend relationship to `VectorView` from `VecControls` by
introducing const getters for the models.
* Remove VectorView::m_visible
Remove the unnecessary member `m_visible` from `VectorView`. It was not
initialized and only written to but never read.
* Make Vectorscope themeable
Make the Vectorscope themeable by introducing Qt properties for the
relevant colors.
The default theme gets the values from the code whereas the classic
theme gets a trace with amber color.
* Rename m_colorFG
Rename `m_colorFG` to `m_colorTrace`. Adjust the Qt property
accordingly.
Remove local variable `traceColor` from paint method and use member
`m_colorTrace` directly.
* Remove m_colorOutline
Remove unused member `m_colorOutline`.
* Fix horizontal lines on silence
Fix the horizontal lines that are rendered on silence. They seem to be
produced when rendering lines that start and end at the same point.
Therefore we only draw a point if the current and last point are the
same.
* Add some margin to the VectorView
Add some margin to the rendering of the `VectorView` so that the circle
does not touch the bounary of the widget.
* Clean up the layout of the Vectorscope
Clean up the layout of the Vectorscope. The checkboxes are not put on
top of the vector view anymore but are organized in a horizontal layout
beneath it. This gives a much tidier look.
* Maximize button for resizable instruments
Show the maximize button for resizable instruments.
Most other changes have the character of refactorings and code
reorganizations.
Remove the negation in the if condition for resizable instruments to
make the code better readable.
Only manipulate the system menu if the instrument is not resizable.
Add a TODO to the special code that sets a size.
* Fix rendering of maximized sub windows
In `SubWindow::paintEvent` don't paint anything if the sub window is
maximized . Otherwise some gradients are visible behind the maximized
child content.
In `SubWindow::adjustTitleBar` hide the title label and the buttons if the
sub window is maximized. Always show the title and close button if not
maximized. This is needed to reset the state correctly after
maximization.
* Add SubWindow::addTitleButton
Add the helper method `SubWindow::addTitleButton` to reduce code
repetition in the constructor.
* Only disable the minimize button
Disable the minimize button by taking the current flags and removing
the minimize button hint from them instead of giving a list which might
become incomplete in the future. So only do what we want to do.
* Remove dependency on MdiArea
Remove a dependency on the `MdiArea` when checking if the sub window is
the active one. Query its own window state to find out if it is active.
* Clear Qt::MSWindowsFixedSizeDialogHint
Clear the `Qt::MSWindowsFixedSizeDialogHint` flag for resizable
instruments (symmetric to the `else` case).
* Update the sub window title bar of exchanged instruments
Update the title bar of an instrument's sub window if the model changes, e.g. if an instrument is exchanged via drag & drop.
The main fix is to call the new method `updateSubWindowState` in `InstrumentTrackWindow::modelChanged`. It contains mostly the code that was previously executed in the constructor of `InstrumentTrackWindow`. The constructor now simply calls this method after it has put the constructed instance into a sub window.
With the current implementation the sub window needs to be explicitly triggered to update its title bar once the flags have been adjusted in `updateSubWindowState`. This is done with the new public method `SubWindow::updateTitleBar`. Please note that such an explicit update is not needed if the instrument windows are managed by a `QMdiSubWindow` instead of a `SubWindow`. This means that the implementation of `SubWindow` is still missing something that `QMdiSubWindow` does. However, debugging also showed that setting the window flags of the sub window does not seem to lead to an event that could be caught in `SubWindow::changeEvent`. This was found out by simply dumping the event types of all events that arrive in that method and exchanging an instrument.
The method `updateSubWindowState` uses the added method `findSubWindowInParents` to find the sub window it is contained in. The latter method should be considered to be moved into a templated helper class because it might be useful in other contexts as well.
## Technical details
If you want to experiment with using QMdiSubWindows then simply add the following method to `MainWindow` (right next to `addWindowedWidget`):
```
QMdiSubWindow* MainWindow::addQMdiSubWindow(QWidget *w, Qt::WindowFlags windowFlags)
{
// wrap the widget in our own *custom* window that patches some errors in QMdiSubWindow
auto win = new QMdiSubWindow(m_workspace->viewport(), windowFlags);
win->setAttribute(Qt::WA_DeleteOnClose);
win->setWidget(w);
m_workspace->addSubWindow(win);
return win;
}
```
Then call that method instead of `addWindowedWidget` in the constructor of `InstrumentTrackWindow`:
```
QMdiSubWindow* subWin = getGUI()->mainWindow()->addQMdiSubWindow( this );
```
You can then comment out the cast and the call of `updateTitleBar` in `updateSubWindowState` and everything will still work.
* Update the system menu
Show or hide the "Size" and "Maximize" entries in the system menu
depending on whether the instrument view is resizable or not.
* Show non-resizable instruments as normal
Show the sub windows of non-resizable instruments as normal if the sub
window is maximized because it was previously used with a resizable
instrument.
* Fix typo
* Rename updateSubWindowState
Rename `updateSubWindowState` to `updateSubWindow`.
* Compile in C++20 mode
* Fix implicit lambda captures of `this` by `[=]`
Those implicit captures were deprecated in C++20
* Silence MSVC atomic std::shared_ptr warning
Unfortunately std::atomic<std::shared_ptr> (P0718R2) is not supported by
GCC until GCC 12 and still is not supported by Clang or Apple Clang, so
it looks like we will continue using std::atomic_load for the time being
* Use C++20 in RemoteVstPlugin
* Simplification
* Add comment
* Fix bitwise operations between different enumeration types
* Revert "Fix bitwise operations between different enumeration types"
This reverts commit d45792cd72.
* Use a helper function to combine keys and modifiers
* Remove AnalyzeTemporaryDtors from .clang-tidy
AnalyzeTemporaryDtors was deprecated in clang-tidy 16 and fully removed
in clang-tidy 18
* Use C++20 in .clang-format
* Use bitwise OR
Prevents issues if any enum flags in `args` have bits in common
* replace std::pow with better performing equivalents
* revert one instance where I swapped to fastPow10f
* Negative slope instead of multiplying -1
Co-authored-by: saker <sakertooth@gmail.com>
---------
Co-authored-by: saker <sakertooth@gmail.com>
Historically, the PeakController has had issues like attack/decay knobs
acting like on/off switches, and audio artifacts like buzzing or
clicking. This patch aims to address those issues.
The PeakController previously used lerp (linear interpolation) when
looping through the sample buffer, which was in updateValueBuffer. This
lerp utilized attack/decay values from control knobs. This is not the
correct place to utilize attack/decay because the only temporal data
available to the function is the frame and sample size. Therefore the
coefficient should simply be the sample rate instead.
Between each sample, processImpl would set m_lastSample to the RMS
without any sort of lerp. This resulted in m_lastSample producing
stair-like patterns over time, rather than a smooth line.
For context, m_lastSample is used to set the value of whatever is
connected to the PeakController. The basic lerp formula is:
m_lastSample = m_lastSample + ((1 - attack) * (RMS - m_lastSample))
This is useful because an attack of 0 sets m_lastSample to RMS, whereas
an attack of 1 would set m_lastSample to m_lastSample. This means our
attack/decay knobs can be used on a range from "snap to the next value
immediately" to "never stray from the last value".
* Remove attack/decay from PeakController frame lerp.
* Set frame lerp coefficient to 100.0 / sample_rate to fix buzzing.
* Add lerp between samples for PeakController to fix stairstep bug.
* The newly added lerp utilizes (1 - attack or decay) as the
coefficient, which means the knobs actually do something now.
* Remove QTextCodec
QTextCodec was removed from Qt6 and is only available through the
Qt5Compat module.
QTextCodec was only used by the HydrogenImport plugin when importing old
Hydrogen files that were saved using TinyXML before it supported UTF-8.
HydrogenImport would use QTextCodec to try to get the current encoding
from the locale, and then use that as a best guess for interpreting the
XML data in the unspecified encoding it was saved in. None of this was
ever reliable, since the encoding of the computer that saved the
Hydrogen file might not be the same as the computer running LMMS and
importing that file.
There is no good solution here, so I decided to simply assume the old
Hydrogen files are UTF-8 encoded. The worst that can happen is someone's
ancient Hydrogen files containing non-ASCII text of some random encoding
becomes mojibake'd after importing into LMMS, which is something that
already could have happened.
* Clean up a little
Remove the member `PluginView::m_isResizable` and it's associated method `setResizable`. Turn `isResizable` into a virtual method.
The reasoning is that whether or not an effect can be resized depends on its implementation. Therefore does not make sense to have a method like `setResizable`. If the underlying implementation does not support resizing then it would not make sense to call `setResizable(true)`. So `isResizable` now describes the underlying ability of a plugin to resize. It's then up to the clients of that method to decide how to treat the result of `isResizable`, i.e. if they want to make use of the ability to resize or not.
Put the elements of the `TrackOperationsWidget` into layouts. These are:
* The grip that can be used to move tracks
* The gear icon that opens the operations menu
* The mute button
* The solo button
The grip that can be used to move tracks around is extracted into its own class called `TrackGrip`. This has several advantages:
* It can be put into a layout.
* It can render itself at arbitrary sizes by simply repeating its pattern pixmap.
* It can be used in a much more object-oriented way because it emits signals when it is grabbed and released.
* It is responsible for locally updating its cursor state.
The default cursor of the grip now is an open hand which indicates to the users that it can be grabbed. While being grabbed the cursor now is a closed hand.
## Technical details
The class `TrackOperationsWidget` now holds an instance of `TrackGrip` and provides a getter to retrieve it. This getter is used by `TrackView` to connect to the two new signals `grabbed` and `released`. The method `TrackOperationsWidget::paintEvent` now only paints the background as it does not need to paint the grip anymore.
The `TrackView` now handles the grabbing and release of the grip in `TrackView::onTrackGripGrabbed` and `TrackView::onTrackGripReleased`. Because the events and cursor states are now handled by `TrackGrip` this code could be removed from `TrackView::mousePressEvent`.
There was a comment in `TrackView` which indicated that the `TrackOperationsWidget` had to be updated when the track is moved and released because it would hide some elements during the move. The comment and the corresponding code was removed because the operations widget does not hide its elements during moves (this was already the state before the changes made by this commit).
Adjust the style sheets of the classic and default themes with regards to the `QPushButton` that's used to show the gear menu in the `TrackOperationsWidget`. The `>` has been removed because the `QPushButton` is not a direct decendent of the `TrackOperationsWidget` anymore.
### Wrapping of `PixmapButton` in `QWidget`
The PixmapButtons that are used in `TrackOperationsWidget` current have to be wrapped into a `QWidget`. This is necessary due to some strange effect where the PixmapButtons are resized to a size that's larger than their minimum/fixed size when the method `show` is called in `TrackContainerView::realignTracks`. Specifically, with the default theme the buttons are resized from their minimum size of (16, 14) to (26, 26). This then makes them behave not as expected in layouts.
The resizing is not done for QWidgets. Therefore we wrap the PixmapButton in a QWidget which is set to a fixed size that will be able to show the active and inactive pixmap. We can then use the QWidget in layouts without any disturbances.
The resizing only seems to affect the track view hierarchy and is triggered by Qt's internal mechanisms. For example the buttons in the mixer view do not seem to be affected.
If you want to debug this simply override "PixmapButton::resizeEvent" and trigger a break point in there, e.g. whenever the new size is not (16, 14).
### More layout-friendly PixmapButton
Make the `PixmapButton` more friendly for layouts by implementing `minimumSizeHint`. It returns a size that accommodate to show the active and the inactive pixmap.
Also make `sizeHint` return the minimum size hint. The previous implementation would have made layouts jump when the pixmap is toggled with pixmaps of different sizes.
## Fix rendering of maximized sub windows
### Adjustments in paintEvent
In `SubWindow::paintEvent` don't paint anything if the sub window is
maximized . Otherwise some gradients are visible behind the maximized
child content.
### Adjustments in adjustTitleBar
In `SubWindow::adjustTitleBar` hide the title label and the buttons if the
sub window is maximized. Always show the title and close button if not
maximized. This is needed to reset the state correctly after
maximization.
Remove some calls to `isMaximized` where we already know that the sub
window is not maximized, i.e. where these calls would always return
`false`.
One adjustment would have resulted in a call to `setHidden(false)`. This
was changed to `setVisible(true)` to get rid of the double negation.
The other `false` would have gotten in an or statement and thus could be
removed completely.
### Add method addTitleButton
Add the helper method `SubWindow::addTitleButton` to reduce code
repetition in the constructor.
### Other changes
Remove a dependency on the `MdiArea` when checking if the sub window is
the active one. Query its own window state to find out if it is active.
When calling `setWindowFlags` in the constructor only adjust the existing
flags with the changes that we actually want to do. It was ensured that
all other flags that have been set before still apply with this change.
Align the rename line edit for tracks.
Make sure that the rename line edit of the `TrackLabelButton` has the
same font size as the widget itself. Because the font size is defined
via style sheets the font size of the line edit has to be set when the
actual renaming starts and not in the constructor. The reason is that
style sheets are set after the constructor has run.
Rename the local variable `txt` to the more speaking name `trackName`.
Ensure that the line edit is moved to the correct place for different
icon sizes by taking the icon size into account. To make this work this
also has to be done in the `rename` method.
## Other changes
Streamline the default style sheet of `TrackLabelButton` by removing
repeated properties that are inherited from the "main" style sheet, i.e.
that are already part of `lmms--gui--TrackLabelButton`.
Interestingly, the `background-color` property had to be repeated for
`lmms--gui--TrackLabelButton:hover`.
---------
Co-authored-by: Michael Gregorius <michael.gregorius.git@arcor.de>
Fix the problem with empty windows as described in issue #7412.
The `refocus` method in `MainWindow` is made public so that it can be called from `Editor::closeEvent`. It has also been refactored for better readability.
---------
Co-authored-by: Michael Gregorius <michael.gregorius.git@arcor.de>
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
Add proportional scrolling to the song editor, piano roll and automation editor. Proportional scrolling means that if for example a certain measure is on the right side of the song editor then it will take a certain number of mouse wheel moves to get it to the left side of the editor. It is the same number of wheel moves regardless of the zoom level.
* fix out-of-bounds crash in AudioFileProcessor
by correctly setting m_from and m_to without them interfering with each other
* fixed flattened wave caused by inaccurate math
see PR for before/after
* simply stop drawing AFP waveform when there's no more data
this fixes the single point at the end of waveforms that sometimes shows up
* fixed seemingly insignificant type confusion (?)
execution seemed fine but my debugger started freaking out,
and if gdb is telling me I got a negative-sized vector,
I'd rather fix this issue than speculate "it's probably fine"
* fixed data offset for AFP waveform vis
the data itself isn't reversed, so we have to account for that
* Add fast fma functions
* Use fast fma functions
* Add fast pow function
* Use fast pow function
* Fix build
* Remove fastFma
* Avoid UB in fastPow
On GCC with -O1 or -O2 optimizations, this new implementation generates
identical assembly to the old union-based implementation
* changed font sizes to better values
* rename gui_templates.h to FontHelper.h
* replace hardcoded values with constants
* make knob labels use small font
* code review from michael
* more consolidation
* Fix text problem in Vectorscope
Fix a problem with cutoff text in Vectorscope. During the constructor
call of `LedCheckBox` the method `LedCheckBox::onTextUpdated` is
triggered which sets a fixed size that fits the pixmap and the text.
After instantiating the two instances in `VecControlsDialog` the
constructor then set a minimum size which overrode the fixed size that
was previously set. This then led to text that was cutoff.
---------
Co-authored-by: Michael Gregorius <michael.gregorius.git@arcor.de>
* Move common effect processing code to wrapper method
- Introduce `processImpl` and `sleepImpl` methods, and adapt each effect
plugin to use them
- Use double for RMS out sum in Compressor and LOMM
- Run `checkGate` for GranularPitchShifterEffect
- Minor changes to LadspaEffect
- Remove dynamic allocations and VLAs from VstEffect's process method
- Some minor style/formatting fixes
* Fix VstEffect regression
* GranularPitchShifterEffect should not call `checkGate`
* Apply suggestions from code review
Co-authored-by: saker <sakertooth@gmail.com>
* Follow naming convention for local variables
* Add `MAXIMUM_BUFFER_SIZE` and use it in VstEffect
* Revert "GranularPitchShifterEffect should not call `checkGate`"
This reverts commit 67526f0ffe.
* VstEffect: Simplify setting "Don't Run" state
* Rename `sleepImpl` to `processBypassedImpl`
* Use `MAXIMUM_BUFFER_SIZE` in SetupDialog
* Pass `outSum` as out parameter; Fix LadspaEffect mutex
* Move outSum calculations to wrapper method
* Fix Linux build
* Oops
* Apply suggestions from code review
Co-authored-by: Johannes Lorenz <1042576+JohannesLorenz@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: saker <sakertooth@gmail.com>
---------
Co-authored-by: saker <sakertooth@gmail.com>
Co-authored-by: Johannes Lorenz <1042576+JohannesLorenz@users.noreply.github.com>
This problem seem to arise due to casting _n->framesLeft() and _n->offset() from an unsigned type (size_t) to a signed type (int). The fix is to use size_t as the type for std::max across the board.
* Fix: unnecessary space in Update EqControlsDialog.cpp
Fix: unnecessary space in Update EqControlsDialog.cpp
Greetings,
Gootector
* Style fix from Ross
---------
Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com>
* simplified fraction and absfraction functions
* removed unused fastSqrt() and fastPow()
functions
* unused absMin() and absMax()
* move roundAt to math header
* Code review from saker
Co-authored-by: saker <sakertooth@gmail.com>
* use std::trunc()
* fixup after fixing merge conflicts
* remove unused fastFma and fastFmal functions.
* remove lmms_basics include, not needed
* use signedPowf from lmms_math in NES
* removed fastRand function, unused
* remove unused sinc function
* cleanup signedPowf
* code review
* further simplify random number math
* removed static from lmms_math file
---------
Co-authored-by: saker <sakertooth@gmail.com>
Ensure that no MIDI information (connected inputs, outputs, etc.) is
stored in presets. This main fix can be found in
`InstrumentTrack::saveTrackSpecificSettings` where the state of the
MIDI ports are now only saved if we are not in preset mode.
The remaining changes are concered with a refactoring of the code
that's related to saving and loading presets.
The refactoring mainly revolves around the removal of the member
`m_simpleSerializingMode` and the method `setSimpleSerializing` in
`Track`.
This is accomplished by introducing two new methods `saveTrack` and
`loadTrack`. These methods have a similar interface to `saveSettings`
and `loadSettings` but they additionally contain a boolean which
indicates if a preset is saved/loaded or a whole track. Both new
methods contain the previous code of `saveSettings` and `loadSettings`.
The latter two now only delegate to the new methods assuming that the
full track is to be stored/loaded if called via the overridden methods
`saveSettings` and `loadSettings`.
The methods `savePreset` and `loadPreset` are added as well. They call
`saveTrack` and `loadTrack` with the preset boolean set to `true`.
These methods are now used by all places in the code where presets are
saved or loaded which makes the code more readable. Clients also do not
need to know any implementation details of `Track`, e.g. like having to
call `setSimpleSerializing`.
Adjust `saveTrackSpecificSettings` so that it also passes information
of whether a preset or a whole track is stored. This leads to changes
in the interfaces of `AutomationTrack`, `InstrumentTrack`,
`PatternTrack` and `SampleTrack`. Only the implementation of
`InstrumentTrack` uses the new information though.
Remove the fallback code in `CMakeLists.txt`. Keep the message that's shown when SDL is wanted but not found. Remove the specific `LMMS_HAVE_SDL2` define.
Just print "OK" if SDL is found.
Remove several ifdefs which check for SDL2 or SDL1. Remove all code related to SDL1.
* Enable configuration of input device for SDL
Up to now the SDL audio driver attempted to use the default recording
device. This might not be what users want or expect, especially since the
actually used device is not visible anywhere. So if recording does not
work for the users they have no way to find out what's wrong.
Extend the settings screen of the SDL driver with a combo box that allows
to select the input device to be used. Store the selected device name in
a new attribute called "inputdevice" in the "audiosdl" section of the
configuration file.
Use the information from the configuration when attempting to inialize
the input device. Fall back to the default device if that does not work.
(cherry picked from commit 33139b9f4c)
* Provide a setting for system default input
Provide the setting "[System Default]" which instructs the SDL driver to
use the default device of the system as the input device. In the
configuration file this option is represented as an empty string. This
should play well with the current existing configuration of the users.
(cherry picked from commit 29c43c2bb6)
* Configuration of output device for SDL
Let users configure the output device that's used by the SDL driver.
Code-wise the implementation is very similar to the input device
configuration.
Use a `QComboBox` instead of a `QLineEdit` for `m_device` and rename it
to `m_playbackDeviceComboBox`.
Rename `s_defaultInputDevice` to `s_systemDefaultDevice` because it is
used in the context of playback and input devices.
(cherry picked from commit 1ab45e4994)
* Ensure label visibility
Make sure that labels are always shown by setting the row wrap policy of
the form layout to wrap long rows.
(cherry picked from commit a123d0e3cb)
* Rename "Device"
Rename "Device" to "Playback device" to make clear what the setting
refers to.
(cherry picked from commit 1f0cda4983)
* Remove repeated strings
Introduce const expressions to get rid of repeated strings with a risk
of typos.
(cherry picked from commit f9ea9705b8)
* Apply some more changes
Apply some more changes that have been made to `AudioSdl` in the
recording branch.
* Conditional ternary operator
Also use a conditional ternary operator for the input device setup.
* Methods for population of combo boxes
Move the population of the input and playback device combo boxes into
the methods `populatePlaybackDeviceComboBox` and
`populateInputDeviceComboBox`.
* Sort devices in combo box
Sort the devices names alphabetically in the input and playback combo
boxes. The default devices is always shown as the first entry.
* Code review fixes
Use `AudioDeviceSetupWidget` instead of `QObject` to translate "[System
Default]".
Fix copy/paste error in comment.
* Simplify some constexpr statements
* Fix#5851: Implement `EffectRackView::sizeHint()`
This fixes `EffectRackView` to have a permanent size hint instead of
resizing the widget once in `InstrumentTrackWindow`. The size hint tells
the `InstrumentTrackWindow` to not increase with a growing number of
effects in the `EffectRackView`.
* remove typeInfo struct from lmms_basics.h
* Code review
Co-authored-by: saker <sakertooth@gmail.com>
* converted epsilon to a constant
* renamed to approximatelyEqual and moved to top
---------
Co-authored-by: saker <sakertooth@gmail.com>
Introduce a method which checks if a file that's loaded has the LADSPA
controls saved in an old format that was written with a version before
commit e99efd541a.
The method is run at the end so that problems in all file versions are
detected. If a real upgrade was to be implemented it would have to run
between `DataFile::upgrade_0_4_0_rc2` and `DataFile::upgrade_1_0_99`.
See #5738 for more details.
If a problematic file is encountered a warning dialog that provides the number of affected LADSPA plugins is shown.
* Initial Commit
* Refactor code and add new icons
* Fix logical error
* Add smooth scrolling to Song Editor
* Remove unused variable
* Fix scrolling speed and scrollbar width
* Remove QDebug and re-add a newline I deleted in an unrelated file
* Forgot to add files to commit
* Remove unused variable
* Fix Styling
* Fix Styling Again
* Fix Styling Again
* Fix Styling Again
* Add icons for classic theme
* Accidentally committed varying scroll speed with zoom -- removing
* Change abs to std::abs
Co-authored-by: saker <sakertooth@gmail.com>
* Change qMax to std::max and use static_cast
Co-authored-by: saker <sakertooth@gmail.com>
* Simplify stepped auto scrolling
Co-authored-by: saker <sakertooth@gmail.com>
* Remove unnecessary parentheses
* Remove return statement causing the play head line to stop
* Add specific tooltips to auto scrolling button states
* Remove `== true` from SongEditor.cpp
Co-authored-by: saker <sakertooth@gmail.com>
* Make tooltips translatable
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
* Fix zooming position calculation
* Rename bars to ticks
* Fix rubberband rect size
---------
Co-authored-by: saker <sakertooth@gmail.com>
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
Defines `fpp_t` and `f_cnt_t` to be of `size_t` within `lmms_basics.h`. Most of the codebase used `fpp_t` to represent the size of an array of sample frames, which is incorrect, given that `fpp_t` was only 16 bits when sizes greater than 32767 are very possible. `f_cnt_t` was defined as `size_t` as well for consistency.
---------
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
About the PR:
* We use "blocked" as an abstract term, when there may be different reasons
* If there is a concrete reason, we use a more concrete word like "unstable"
or "not useful"
* Double negations like "don't block" or "block unstable" are avoided
Besides this, this PR
* Lets `Lv2Manager` hide the full `std::set` of plugin URIs
* Fixes occurences of "BuffersizeLessThan32" - it is less or equal
* Moves `enableBlockedPlugins` from Engine to `ConfigManager`
Fix a buzzing sound in Monstro's 2nd oscillator. It was introduced with
commit c2f2b7e0d7.
The problem was caused by checking if `len_r` is not equal to 0 instead of
checking `pd_r`.
* Adds "Show Hidden Content Dialogue"
* Update FileBrowser.cpp
* Automatically rearrange layout to fit check boxes
* check if files are hidden in a cross platform manner
* put the hidden files checkbox below the user and factory check boxes at all times
* removed layout rearrangement code
* moved checkbox code to FileBrowser
* Removed unused include
* Cleanup in FileBrowser
Move the method `addContentCheckBox` to the other private methods.
Remove the method parameters because it can use the members.
Remove the conditional when adding the "Hidden content" checkbox because
it was always true.
---------
Co-authored-by: Michael Gregorius <michael.gregorius.git@arcor.de>
* Remove the struct StereoSample
Remove the struct `StereoSample`. Let `AudioEngine::getPeakValues` return a `sampleFrame` instead.
Adjust the calls in `Mixer` and `Oscilloscope`.
* Simplify AudioEngine::getPeakValues
* Remove surroundSampleFrame
Some code assumes that `surroundSampleFrame` is interchangeable with `sampleFrame`. Thus, if the line `#define LMMS_DISABLE_SURROUND` is commented out in `lmms_basics.h` then the code does not compile anymore because `surroundSampleFrame` now is defined to be an array with four values instead of two. There also does not seem to be any support for surround sound (four channels instead of two) in the application. The faders and mixers do not seem to support more that two channels and the instruments and effects all expect a `sampleFrame`, i.e. stereo channels. It therefore makes sense to remove the "feature" because it also hinders the improvement of `sampleFrame`, e.g. by making it a class with some convenience methods that act on `sampleFrame` instances.
All occurrences of `surroundSampleFrame` are replaced with `sampleFrame`.
The version of `BufferManager::clear` that takes a `surroundSampleFrame` is removed completely.
The define `SURROUND_CHANNELS` is removed. All its occurrences are replaced with `DEFAULT_CHANNELS`.
Most of the audio devices classes, i.e. classes that inherit from `AudioDevice`, now clamp the configuration parameter between two values of `DEFAULT_CHANNELS`. This can be improved/streamlined later.
`BYTES_PER_SURROUND_FRAME` has been removed as it was not used anywhere anyway.
* Make sampleFrame a class
Make `sampleFrame` a class with several convenience methods. As a first step and demonstration adjust the follow methods to make use of the new functionality:
* `AudioEngine::getPeakValues`: Much more concise now.
* `lmms::MixHelpers::sanitize`: Better structure, better readable, less dereferencing and juggling with indices.
* `AddOp`, `AddMultipliedOp`, `multiply`: Make use of operators. Might become superfluous in the future.
* More operators and methods for sampleFrame
Add some more operators and methods to `sampleFrame`:
* Constructor which initializes both channels from a single sample value
* Assignment operator from a single sample value
* Addition/multiplication operators
* Scalar product
Adjust some more plugins to the new functionality of `sampleFrame`.
* Adjust DelayEffect to methods in sampleFrame
* Use composition instead of inheritance
Using inheritance was the quickest way to enable adding methods to `sampleFrame` without having to reimpement much of `std::array`s interface.
This is changed with this commit. The array is now a member of `sampleFrame` and the interface is extended with the necessary methods `data` and the index operator.
An `average` method was added so that no iterators need to be implemented (see changes in `SampleWaveform.cpp`).
* Apply suggestions from code review
Apply Veratil's suggestions from the code review
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Fix warnings: zeroing non-trivial type
Fix several warnings of the following form:
Warnung: »void* memset(void*, int, size_t)« Säubern eines Objekts von nichttrivialem Typ »class lmms::sampleFrame«; use assignment or value-initialization instead [-Wclass-memaccess]
* Remove unnecessary reinterpret_casts
Remove some unnecessary reinterpret_casts with regards to `sampleFrame` buffers.
`PlayHandle::m_playHandleBuffer` already is a `sampleFrame*` and does not need a reinterpret_cast anymore.
In `LadspaEffect::processAudioBuffer` the `QVarLengthArray` is now directly initialized as an array of `sampleFrame` instances.
I guess in both places the `sampleFrame` previously was a `surroundSampleFrame` which has been removed.
* Clean up zeroSampleFrames code
* Fix warnings in RemotePlugin
Fix some warnings related to calls to `memcpy` in conjunction with`sampleFrame` which is now a class.
Add the helper functions `copyToSampleFrames` and `copyFromSampleFrames` and use them. The first function copies data from a `float` buffer into a `sampleFrame` buffer and the second copies vice versa.
* Rename "sampleFrame" to "SampleFrame"
Uppercase the name of `sampleFrame` so that it uses UpperCamelCase convention.
* Move SampleFrame into its own file
Move the class `SampleFrame` into its own class and remove it from `lmms_basics.h`.
Add forward includes to all headers where possible or include the `SampleFrame` header if it's not just referenced but used.
Add include to all cpp files where necessary.
It's a bit surprising that the `SampleFrame` header does not need to be included much more often in the implementation/cpp files. This is an indicator that it seems to be included via an include chain that at one point includes one of the headers where an include instead of a forward declaration had to be added in this commit.
* Return reference for += and *=
Return a reference for the compound assignment operators `+=` and `-=`.
* Explicit float constructor
Make the constructor that takes a `float` explicit.
Remove the assignment operator that takes a `float`. Clients must use the
explicit `float` constructor and assign the result.
Adjust the code in "BitInvader" accordingly.
* Use std::fill in zeroSampleFrames
* Use zeroSampleFrames in sanitize
* Replace max with absMax
Replace `SampleFrame::max` with `SampleFrame::absMax`.
Use `absMax` in `DelayEffect::processAudioBuffer`. This should also fix
a buggy implementation of the peak computation.
Add the function `getAbsPeakValues`. It computes the absolute peak
values for a buffer.
Remove `AudioEngine::getPeakValues`. It's not really the business of the
audio engine. Let `Mixer` and `Oscilloscope` use `getAbsPeakValues`.
* Replace scalarProduct
Replace the rather mathematical method `scalarProduct` with
`sumOfSquaredAmplitudes`. It was always called on itself anyway.
* Remove comment/TODO
* Simplify sanitize
Simplify the `sanitize` function by getting rid of the `bool found` and
by zeroing the buffer as soon as a problem is found.
* Put pointer symbols next to type
* Code review adjustments
* Remove "#pragme once"
* Adjust name of include guard
* Remove superfluous includes (leftovers from previous code changes)
---------
Co-authored-by: Kevin Zander <veratil@gmail.com>
When launching the wine VST process various wrappers may be involved,
when they exit the VST process becomes orphaned. This breaks the
PollParentThread mechanism which is responsible for cleaning up
processes in case of a crash. Because of this 64bit VST process exits
prematurely, in other words 64bit VST is currently broken in a typical
wine configuration.
A solution suggested by Lukas W is to set the PR_SET_CHILD_SUBREAPER
flag which makes the kernel reparent such process to lmms and
PollParentThread then works as intended.
Co-authored-by: Lukas W <lukaswhl@gmail.com>
Fixes an issue where sorted arpeggios over multiple notes used a largely
unusable algorithm. piano-octave-arp instead of octave-arp-piano.
Fixes#6499Fixes#4491
## Add support for "factorysample:" prefix
Add support to upgrade files with `src` tags that are prefixed with "factorysample:".
## Fix "bassloopes" typo
Fix projects that still reference files with the typo "bassloopes" in their name.
The upgrade is implemented in its own method because it is unrelated to the BPM renaming even if it is technically very similar in its solution.
Introduce the helper method `mapSrcAttributeInElementsWithResources` which replaces the `src` attribute in elements with resources (samples and AFP) if it can be found in a map.
Add peak indicators to the mixer strips. They show the maximum peak value
that was observed and can be reset by clicking on them.
## Implementation details
The implementation works via a signal/slot mechanism. The `Fader` class
has a new signal `peakChanged` which reports peak values as
amplifications. A new class `PeakIndicator` is added which has a slot
`updatePeak` which is connected to the new signal in `Fader`.
The `PeakIndicator` inherits from `QLabel` and mainly deals with updating
the label text from the current peak value.
Add a `PeakIndicator` instance to `MixerChannelView`. Add a `reset`
method to `MixerChannelView` so that the mixer channel can be reset on
the loading of new projects, etc. The current implementation resets the
peak indicator back to -inf dbFS. The `reset` method is called in
`MixerView::clear`.
Remove the clamping in `Fader::setPeak` so that all peaks are reported.
Emit the new signal if the peak changes.
Adjust the rendering of BarModelEditor to make it respect logarithmic
and linear models. The code now uses `inverseScaledValue` instead of
`value` just like the `Knob` class does when calculating the angle.
## Make mixer channels resizable
Make the mixer channels resizable within the mixer view.
Remove the setting of the size policy from `MixerChannelView`. Add the
`Fader` widget with a stretch factor so that it is resized within the
layout of the mixer channel/strip. Remove the stretch that was added to
the layout because the fader now stretches.
In `MixerView` remove the top alignments when widgets are added to the
layout so that they can resize. Set the channel layout to align to the
left so that it behaves correctly when it is resized by the scroll area
it is contained in. Make the widget resizable in the scroll area so that
it always fills the space. Set the minimum height of the scroll area to
the minimum size of the widget plus the scrollbar height so that the
channel strips are never overlapped by the scrollbar.
Set the size policy of the "new channel" button so that it grows
vertically with the mixer view. Set a fixed size so that it is as wide as
a mixer strip.
## Enable maximization for mixer view
Enable the maximize button for the mixer view now that it is fully
resizable.
Don't make LMMS calculate the song length for every added TCO when a new project is created or a project is loaded. Instead do it only once afterwards. This is accomplished by preventing any calculations in `Song::updateLength` if a song is currently loaded. `Song::updateLength` is then called immediately after the loading flag has been set to `false` in both cases.
---------
Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
The CPU feature requirements for any currently supported 32-bit version of Windows (8.1 and 10) are PAE, NX and SSE2. That should mean a green light for bumping the CPU we build for to the minimum one with SSE2.
* Revert "Fix glitch with automation points (#7269)"
This reverts commit d60fd0d022.
* Fix glitch in Automation Editor. This reverts the earlier fix and tries to solve the issue by instead rounding off the values of the top/bottom levels before comparison with the automation point value.
---------
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
Update MinGW CI to Ubuntu 20.04
* Use ghcr.io/lmms/linux.mingw:20.04
* Fix deprecation in ClipView.cpp
* Fix ccache and simplify git configuration
* Apply patch by @DomClark for MinGW's SDL2 target
* Update excludelist-win
* some css tweaks for accessibility
* suggestions from review
* classic theme focus
* fix bug where button color disappears on focus
* More scrollbar color changes on hover.
* Commented the hover effect for now.
* Remove handle "hover" effect.
* scrollbar
* revert button active state
Fix the missing initialization of some variables in `TrackContentWidget`.
This led to some performances issues when the widget was painted because
a for loop was executed for which the variable started at a very large
negative number and was then incremented.
* 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
- Switch to Ubuntu 20.04 Docker image ghcr.io/lmms/linux.gcc:20.04
- Linux packages have migrated from Docker Hub to https://github.com/orgs/lmms/packages
- Built using the Dockerfiles from Update Linux images lmms-ci-docker#15
- Updated the veal submodule to the latest commit on the default ladspa branch
- Fixed an error when catching a polymorphic type with GCC 9. See: LMMS/veal@0ae9287
- Added GCC flag -Wno-format-truncation for ZynAddSubFx build.
- Adds GCC flag -Wno-format-overflow for calf/veal build.
Closes#6993
Oversampling can have many different effects to the audio signal such as latency, phase issues, clipping, smearing, etc, so this should really be an option on a per-plugin basis, not globally across all of LMMS (which, in some places, shouldn't really need to oversample at all but were oversampled anyways).
Add the virtual method `Effect::onEnabledChanged` which can be overridden by effects so that they can react to state changes with regards to being enabled or bypassed. The call of this methods is connected to state changes of the enabled model in the constructor of `Effect`.
Implement the method in `DualFilterEffect` by resetting the history of the two filters. This is done to prevent pops that have been reported in #4612.
The original code was doing division in `int`, which causes lost of accuracy and results in the waveform randomly shifting when zooming in and out.
This should fix it by casting variables to `float` before dividing, as well as keeping the values in `float` type.
The pull request also changes some type declaration to explicit to increase readability
Fix the upgrade routine that was introduced with pull request #6747 which added the BPM value to some file names.
This also simplifies the implementation by using a map.
Note: this also removes the code about the prefix `factorysample:`. If it is used in some files these entries will also have to be added to the map.
Check if a non-empty buffer was loaded and only set the sample clip if that's the case.
## Other changes
Move setting the song to modified towards the core in the context of `SampleClip`. Previously the `SampleClipView` did this but it's none of it's business.
Introduce `SampleClip::changeLengthToSampleLength` which changes the length of the clip to the length of the sample. This was also previously done by the view which is again the wrong place to do the necessary calculations. An unnecessary `static_cast` was removed while carrying over the code.
Add the method `SampleClip::hasSampleFileLoaded` which checks if the loaded sample corresponds to a given file name.
Fix code formatting.
The previous implementation of Lb302`s decay used a fixed decay factor that was multiplied with the signal until the minimum threshold of 1/65536 was crossed. This fixed factor resulted in different lengths in time for different sample rates.
This is fixed by computing the decay factor by taking the sample rate into account as well. The new static method `computeDecayFactor` computes the factor that is needed to make a signal decay from 1 to a given attenuation over a given time.
The parameters used in the call to that method in `Lb302Synth::process` have been fine-tuned such that, at a sample rate of 44.1 kHz, they result in a factor very close to the previous hard-coded factor of 0.99897516.
When applying its release stage Kicker did not take the frames before the release into account but instead always applied the release to the full buffer. This potentially lead to a jump in the attenuation values instead of a clean linear decay.
See #7225 for more details.
## Instrument flags as a property of an instrument
The instruments flags (single streamed, MIDI based, not bendable) are properties of an instrument that do not change over time. Therefore the flags are made a property of the instrument which is initialized at construction time.
Adjust the constructors of all instruments which overrode the `flags` method to pass their flags into the `Instrument` constructor.
## Add helper methods for flags
Add helper methods for the flags. This makes the code more concise and readable and clients do not need to know the technical details on how to evaluate a flag.
## Remove the flags methods
Remove the flags methods to make it an implementation detail on how the flags are managed.
Many, many years ago (93a456c), high quality mode was merely disabled after it was noted that it can be problematic rather than being completely removed. Remove it from the codebase so we can get rid of some code and clean things up a bit.
Make instruments report their release time in milliseconds so that it becomes independent of the sample rate and sounds the same at any sample rate.
Technically this is done by removing the virtual keyword from `desiredReleaseFrames` so that it cannot be overridden anymore. The method now only serves to compute the number of frames from the given release time in milliseconds.
A new virtual method `desiredReleaseTimeMs` is added which instruments can override. The default returns 0 ms just like the default implementation previously returned 0 frames.
The method `computeReleaseTimeMsByFrameCount` is added for instruments that still use a hard coded release in frames. As of now this is only `SidInstrument`.
Add the helper method `getSampleRate` to `Instrument`.
Adjust several instruments to report their release times in milliseconds. The times are computed by taking the release in frames and assuming a sample rate of 44.1 kHz. In most cases the times are rounded to a "nice" next value, e.g.:
* 64 frames -> 1.5 ms (66 frames)
* 128 frames -> 3.0 ms (132 frames)
* 512 frames -> 12. ms (529 frames)
* 1000 frames -> 23 ms (1014 samples)
In parentheses the number of frames are shown which result from the rounded number of milliseconds when converted back assuming a sample rate of 44.1 kHz. The difference should not be noticeable in existing projects.
Remove the overrides for instruments that return the same value as the base class `Instrument` anyway. These are:
* GigPlayer
* Lb302
* Sf2Player
For `MonstroInstrument` the implementation is adjusted to behave in a very similar way. First the maximum of the envelope release times is computed. These are already available in milliseconds. Then the maximum of that value and 1.5 ms is taken and returned as the result.
Move icon determination into TrackLabelButton again
Fully undo the changes made in commit 88e0e94dcd because the intermediate revert made in commit 04ecf73395 seems to have led to a performance problem due to the icon being set over and over again in `TrackLabelButton::paintEvent`.
The original intention of the changes made in pull request #7114 was to remove the painting code that dynamically determines the icon over and over again. Ideally the icon that is used by an instrument should be somewhat of a "static" property that should be known very early on when an instrument view is created. There should not be any need to dynamically resolve the icon over and over, especially not in a button class very far down in the widget hierarchy. However, due to technical reasons this is not the case in the current code. See pull request #7132 for more details.
## Bump CMT to d8bf8084aa3
Bump the CMT submodule to commit d8bf8084aa3 which contains the underlying fixes for issue #5167.
The CMT delay uses `sprintf` calls to generate the technical names and display names of the delays. These calls are locale dependent. As a consequence for example the feedback delay might have been saved either as "fbdelay_0.1s" (point) or "fbdelay_0,1s" (comma) in a save file.
The CMT fix makes sure that all delays use points in their names and thus that they now always report the same name strings.
## Add upgrade routine for CMT delays
Add an upgrade routine for CMT delays which works in conjunction with the upgraded CMT submodule. Because the delays will now always report their name with points old save files which might contain versions with the comma must be upgraded to a name with a point.
## Scalable LFO graph
Make the rendering of the LFO graph scalable. Change the fixed size to a minimum size. Adjust the rendering code such that it uses the width and height of the widget instead of the background pixmap.
Only draw only poly line once instead of many line segments. Collect the points in the for-loop to be able to do so. This makes the code a bit more understandable because we now compute exacly one point per iteration in the for-loop.
Use the same interpolation for the line color like in the envelope graph.
Rename some variables to make them consistent with the other code.
Remove the member `m_params` which is not used anyway. This also allows for the removal of the overridden `modelChanged` method.
## Use "Hz" instead of "ms/LFO"
Use the more common unit "Hz" to display the frequency of the LFO instead of "ms/LFO". The frequency is always displayed with three digits after the decimal separator to prevent "jumps".
## Take "Freq * 100" into account
This commit fixes a bug where the "Freq * 100" option was not taken into account when computing and displaying the frequency of the LFO.
## Keep info text legible
Draw a slightly transparent black rectangle underneath the text to keep it legible, e.g. for high frequencies with an LFO amount of 1 which results in a very bright and dense graph.
## Extract drawing of info text into method
Extract the drawing of the info text into its own private method `drawInfoText`.
Make the graph scalable by adjusting the painting code of the envelope so that it does not assume fixed widths and heights anymore. Remove the setting of a fixed size from the envelope graph and only set a minimum size.
Make three scaling modes available which can be selected via a context menu in the graph:
* "Dynamic": This modes corresponds to the rendering strategy of the previous implementation. Initially 80/182 of the available width is used as the maximum width per segment. This can be interpreted like a "zoomed" version of the absolute mode. If the needed space becomes larger than the full width though then it falls back to relative rendering.
* "Absolute": Each of the five segments is assigned 1/5 of the available width. The envelopes will always fit but might appear small depending of the current settings. This is a good mode to compare envelopes though.
* "Relative": If there is at least one non-zero segment then the whole width is always used to present the envelope.
The default scaling mode is "Dynamic".
## Technical details
The new painting code is more or less divided into two parts. The first part calculates `QPointF` instances for the different points. In the second part these points are then used to draw the lines and markers. This makes the actual rendering code much more straight forward, readable and maintainable.
The interpolation between the line color of an inactive and an active envelope has also been restructured so that it is much more obvious that we are doing an interpolation in the first place. The colors at both ends of the interpolation are explicit now and can therefore be adjusted much easier. The actual color interpolation is done in the helper function `interpolateInRgb` which is provided by the new class `ColorHelper`. This class will later also be needed when the LFO graph is made scalable.
The line is rendered as a polyline instead of single line segments.
The drawing of the markers has been abstracted into a lambda (with some outside captures though) so that it can be easily adjusted if necessary. The markers are rendered as circles instead of rectangles because that looks much nicer especially when the widget is rendered at a larger size.
The width of the lines and marker outlines is determined using the size of the widget so that it scales with the size.
A `lerp` function has been added to `lmms_math.h`.
* Don't auto-quantize notes when recording MIDI input.
* Add midi:autoquantize to config file and a widget to set it in the MIDI settings.
* Quantize notes during recording if midi:autoquantize is enabled.
* Apply suggestions from code review: Formatting
Style formatting
Co-authored-by: saker <sakertooth@gmail.com>
* Cache the auto quantization setting in a PianoRoll member variable, and update it on ConfigManager::valueChanged()
* Apply suggestions from code review: Formatting & temp variable
One formatting change, and reusing an existing variable instead of introducting a new local one.
Co-authored-by: saker <sakertooth@gmail.com>
Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
* Update src/gui/modals/SetupDialog.cpp
Good catch.
Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
* Fix logic bug in PianoRoll's midi/autoquantize value observer.
* Use '!' instead of 'not' to please MSVC.
* autoquantize: Add an explicit check for consistency with the rest of the PR, and give the setting a default value in SetupDialog constructor.
* Integrate MIDI auto-quantize checkbox into the resizable layout, and add a tool tip.
---------
Co-authored-by: saker <sakertooth@gmail.com>
Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
Change the label of the group box from "CUSTOM BASE VELOCITY" to "VELOCITY MAPPING".
Remove the long explanation text from the group box and add the following tool tip for the LcdSpinBox: "MIDI notes at this velocity correspond to 100% note velocity."
Change the label of the spin box from "BASE VELOCITY" to "MIDI VELOCITY" because that's what the value actually represents.
Fix some NaNs in the context of the display of dbFS values when "View > Volume as dbFS" is checked. They occur during the display of the current value when a mixer fader or the volume knob of an instrument is pulled down completely.
The fix is to detect these cases and to display "-∞ dbFS".
Also fix a problem with the editor where dbFS values can be entered for volume knobs. When the knob is turned completely to the left and the amplification is 0 then the initially displayed value is set to -96 dBFS, i.e. the lower limit that is shown in the dialog. This is done because the dialog likely cannot handle displaying or entering "-∞".
* Render fader levels in code with a gradient
Render the fader level in code using a gradient instead of using pixmaps. The problem with the pixmaps is that they don't "know" how a fader instance is configured with regards to the minimum and maximum value. This means that the display can give quite a wrong impression.
The rendering of levels has been unified in the method `paintLevels`. It can render using dbFS and linear scale. The method `paintLinearLevels` has been removed completely, i.e. there's no more code that renders using pixmaps.
Much of the previous code relied on the size of the background image `fader_background.png`, e.g. the initialization of the size. For now the `Fader` widget is initially resized to the size of that background image as it is present in the default and classic theme (see `Fader::init`). All rendering uses the size of the widget itself to determine where to draw what. This means that the widget is prepared to be resizable.
The method `paintLevels` first renders the background of the level indicators and uses these as clipping paths for all other rendering operations, e.g. for the rendering of the levels themselves. Levels are rendered using a gradient which is defined with the following stops:
* Two stops for the ok levels.
* One stop for warning levels.
* One stop for clipping levels.
Peak indicators do not use the three distinct colors anymore but instead use the color of the gradient at that position of the peak. This makes everything look "smooth".
The code now also renders a marker at unity position, i.e. at position 1.0 in linear levels and 0 dbFS in dbFS scale.
The painting code makes lots of use of the class `PaintHelper`. This class is configured with a minimum and maximum value and can then return linear factors for given values. There are two supported modes:
* Map min to 0 and max to 1
* Map min to 1 and max to 0
It can also compute rectangles that correspond to a given value. These methods can be given rectangles that are supposed to represent the span from min to max. The returned result is then a rectangle that fills the lower part of the source rectangle according to the given value with regards to min and max (`getMeterRect`). Another method returns a rectangle of height 1 which lies inside the given source rectangle at the corresponding level (`getPersistentPeakRect`).
The method `paintLevels` uses a mapping function to map the amplitude values (current peak value, persistent peak, etc.) to the display values. There's one mapper that keeps the original value and it is used to display everything in a linear scale. Another mapper maps everything to dbFS and uses these values as display everything in a dbFS scale. The following values must be mapped for the left and right channel to make this work:
* Min and max display values (min and max peak values)
* The current peak value
* The persistent peak value
* The value for unity, i.e. 1.0 in linear levels and 0 dbFS in dbFS scale.
Remove the method `calculateDisplayPeak` which was used in the old method to render linear levels.
`Fader::setPeak` now uses `std::clamp` instead of doing "manual" comparisons.
The LMMS plugins Compressor, EQ and Delay are still configured to use linear displays. It should be considered to switch them to dbFS/logarithmic displays as well and to remove the code that renders linearly.
* Remove unused pixmaps from `Fader`
Remove the now unused pixmaps for the background and the LEDs from the `Fader` class and remove the files from the default and classic theme directories.
* Rename peak properties and use them to render levels
Rename the peak properties as follows:
* peakGreen -> peakOk
* peakRed -> peakClip
* peakYellow -> peakWarn
The reasoning is that a style might for example use a different color than green to indicate levels that are ok.
Use the properties to initialize the gradient that is used to render the levels.
Initialize the properties to the colors of the current default theme so that it's not mandatory to set them in a style sheet. Up until now they have all been initialized as black.
* Always render the knob in the middle of the fader
Render the knob in the middle of the fader regardless of the width. The previous implementation was dependent on the fader pixmap having a matching width because it always rendered at x=0.
* Set size policy of fader to minimum expanding
Set the size policy of the fader to minimum expanding in both directions. This will make the fader grow in layouts if there is space.
* Default dbFS levels and better peak values
Default to dbFS levels for all faders and set some better minimum and maximum peak values.
* Fix faders of Crossover EQ
Fix the faders of the Crossover EQ which were initialized and rendered much too wide and with a line at unity. The large width also resulted in the knobs being rendered outside of view.
Resize the fader to the minimum size so that it is constructed at a sane default.
Introduce a property that allows to control if the unity line is rendered. The property is available in style sheets and defaults to the unity lines being rendered. Adjust the paint code to evaluate the property.
Initialize the faders of the Crossover EQ such that the unity line is not drawn.
* Remove EqFader constructor with pixmaps
Remove the constructor of `EqFader` that takes the pixmaps to the fader background, leds and knob. The background and leds pixmaps are not used by the base class `Fader` for rendering anymore to make the `Fader` resizable. A pixmap is still used to render the knob but the constructor that takes the knob as an argument does not do anything meaningful with it, i.e. all faders are rendered with the default knob anyway.
Remove the resources for the fader background, leds and knob as they are not used and the knob was the same image as the default knob anyway.
Remove the static pixmaps from the constructor of `EqControlsDialog`. Switch the instantiations of the EQ's faders to use the remaining constructor of `EqFader`. This constructor sets a different fixed size of (23, 116) compared to the removed constructor which set a size of (23, 80). Therefore all faders that used the removed constructor are now set explicitly to a fixed size of (23, 80).
The constructor that's now used also calls a different base constructor than the removed one. The difference between the two base constructors of `Fader` is that one of them sets the member `m_conversionFactor` to 100.0 whereas the other one keeps the default of 1.0. The adjusted faders in `EqControlsDialog` are thus now constructed with the conversion factor set to 100. However, all of them already call `setDisplayConversion` with `false` after construction which results in the conversion factor being reset to 1.0. So the result should be the same as before the changes.
* Remove background and LEDs pixmap from Fader constructor
Remove the parameters for the background and LEDs pixmap from the second `Fader` constructor. Make the knob pixmap parameter in the constructor a const reference. Assign the reference to the knob pixmap of the `Fader` itself. This enables clients to use their own fader knobs as is the case with the Crossover EQ. The EQ now renders using it's own knobs again.
Make the second constructor delegate to the first one. This will additionally set the conversion factor to 100 but this is not a problem with the current code because the only user of the second constructor, the Crossover EQ, already calls `setDisplayConversion` with the parameter set to `false`, hence reinstating a conversion factor of 1.
Remove the resources for the background and LEDs from the Crossover EQ as they are not used anymore. Remove the three QPixmap members from `CrossoverEQControlDialog` as they are not needed. The background and LEDs are not used anyway and the knob is passed in as a constant reference which is copied. Hence we can use a local variable in the constructor of `CrossoverEQControlDialog`.
* Remove the init method from Fader
Remove the `init` method from `Fader` as it is not needed anymore due to the constructor delegation. Tidy up the parameter lists and use of spaces in the constructor.
* Introduce range with solid warn color
Introduce a second point in the gradient for the warn colors so that we get a certain range with the full/solid warn color.
The colors are distributed as follows now. The solid ok range goes from -inf dbFS to -12 dbFS. The warn range goes from -6 dbFS to 0 dbFS. In between the colors are interpolated. Values above 0 dbFS interpolate from the warn color to the clip color.
This is now quite similar to the previous implementation.
# Analysis of the previous pixmap implementation
The pixmap implementation used pixmaps with a height of 116 pixels to map 51 dbFS (-42 dbFS to 9 dbFS) across the whole height. The pixels of the LED pixmap were distributed as follows along the Y-axis:
* Margin: 4
* Red: 18
* Yellow: 14
* Green: 76
* Margin: 4
Due to the margins the actual red, yellow and green areas only represent a range of (1 - (4+4) / 116) * 51 ~ 47,48 dbFS. This range is distributed as follows across the colors:
Red: 7.91 dbFS
Yellow: 6.16 dbFS
Green: 33.41 dbFS
The borders between the colors are located along the following dbFS values:
* Red/yellow: 9 - (4 + 18) / 116 * 51 dbFS ~ -0.67 dbFS
* Yellow/green: 9 - (4 + 18 + 14) / 116 * 51 dbFS ~ -6.83 dbFS
* The green marker is rendered for values above -40.24 dbFS.
* Remove unused method Fader::clips
* Fader: Correctly render arbitrary ranges
Adjust the `Fader` so that it can correctly render arbitrary ranges of min and max peak values, e.g. that it would render a display range of [-12 dbFS, -42 dbFS] correctly.
Until now the gradient was defined to start at the top of the levels rectangle and end at the bottom. As a result the top was always rendered in the "clip" color and the bottom in the "ok" color. However, this is wrong, e.g. if we configure the `Fader` with a max value of -12 dbFS and a min value of -42 dbFS. In that case the whole range of the fader should be rendered with the "ok" color.
The fix is to compute the correct window coordinates of the start and end point of gradient using from the "window" of values that the `Fader` displays and then to map the in-between colors accordingly. See the added comments in the code for more details.
Add the templated helper class `LinearMap` to `lmms_math.h`. The class defines a linear function/map which is initialized using two points. With the `map` function it is then possible to evaluate arbitrary X-coordinates.
* Remove unused methods in PaintHelper
Remove the now unused mapping methods from `PaintHelper`. Their functionality has been replaced with the usage of `LinearMap` in the code.
* Fix some builds
Include `cassert` for some builds that otherwise fail.
* Opaque unity marker with styling option
Make the unity marker opaque by default and enable to style it with the style sheets. None of the two style sheets uses this option though.
* Darker default color for the unity line
* Move code
Move the computation of most mapped values at the top right after the definition of the mapper so that it is readily available in all phases of the painting code.
* Render unity lines in background
Render the unity lines before rendering the levels so that they get overdrawn and do not stick out when they are crossed.
* Don't draw transparent white lines anymore
Don't draw the transparent white lines anymore as they were mostly clipped anyway and only create "smudge".
* Full on clip color at unity
Adjust the gradient so that the full on clip color shows starting at unity. There is only a very short transition from the end of warning to clipping making it look like a solid color "standing" on top of a gradient.
* Fix discrepancy between levels and unity markers
This commit removes the helper class `PaintHelper` and now uses two lambdas to compute the rectangles for the peak indicators and levels. It uses the linear map which maps the peak values (in dbFS or linear) to window coordinates of the widget.
The change fixes a discrepancy in the following implementation for which the full on clip rectangle rendered slightly below the unity marker.
* Fix fader display for Equalizer shelves and peaks
The peak values for the shelves and peaks of the Equalizer plugin are computed in `EqEffect::peakBand`. The previous implementation evaluated the bins of the corresponding frequency spectrum and determined the "loudest" one. The value of this bin was then converted to dbFS and mapped to the interval [0, inf[ where all values less or equal to -60 dbFS were mapped to 0 and a value of 40 dbFS was mapped to 1. So effectively everything was mapped somewhere into [0, 1] yet in a quite "distorted" way because a signal of 40 dbFS resulted in being displayed as unity in the fader.
This commit directly returns the value of the maximum bin, i.e. it does not map first to dbFS and then linearize the result anymore. This should work because the `Fader` class assumes a "linear" input signal and if the value of the bin was previously mapped to dbFS it should have some "linear" character. Please note that this is still somewhat of a "proxy" value because ideally the summed amplitude of all relevant bins in the frequency range would be shown and not just the "loudest" one.
## Other changes
Rename `peakBand` to `linearPeakBand` to make more clear that a linear value is returned.
Handle a potential division by zero by checking the value of `fft->getEnergy()` before using it.
Index into `fft->m_bands` so that no parallel incrementing of the pointer is needed. This also enables the removal of the local variable `b`.
* Improve the rendering of the levels
The levels rendering now more explicitly distinguished between the rendering of the level outline/border and the level meters. The level rectangles are "inset" with regards to the borders so that there is a margin between the level borders and the meter readings. This margin is now also applied to the top and bottom of the levels. Levels are now also rendered as rounded rectangles similar to the level borders.
Only render the levels and peaks if their values are greater than the minimum level.
Make the radius of the rounded rectangles more pronounced by increasing its value from 1 to 2.
Decrease the margins so that the level readings become wider, i.e. so that they are rendered with more pixels.
Add the lambda `computeLevelMarkerRect` so that the rendering of the level markers is more decoupled from the rendering of the peak markers.
* Reduce code repetition
Reduce code repetition in `EqEffect::setBandPeaks` by introducing a lambda. Adjust code formatting.
* Code review changes
Code review changes in `Fader.cpp`. Mostly whitespace adjustments.
Split up the calculation of the meter width to make it more understandable. This also reduces the number of parentheses.
* Use MEMBER instead of READ/WRITE
Use `MEMBER` instead of `READ`/`WRITE` for some properties that are not called explicitly from outside of the class.
* Use default member initializers for Fader
Use default member initializers for the members in `Fader` that have previously been initialized in the constructor list.
* Make code clearer
Make code clearer in `Fader::FadermouseDoubleClickEvent`. Only divide if the dialog was accepted with OK.
Move the envelope and LFO graphs into their own classes.
Besides the improved code organization this step had to be done to be able to use layouts in `EnvelopeAndLfoView`. The class previously had fixed layouts mixed with custom rendering in the paint event. Mouse events are now also handled in both new classes instead of in `EnvelopeAndLfoView`.
## Layouts in EnvelopeAndLfoView
Use layouts to align the elements of the `EnvelopeAndLfoView`. This removes lots of hard-coded values. Add helper lambdas for the repeated creation of `Knob` and `PixmapButton` instances.
The spacing that is explicitly introduced between the envelope and LFO should be removed once there is a more open layout.
## Layouts for InstrumentSoundShapingView
Use layouts to align the elements of the `InstrumentSoundShapingView`.
## Info text improvements in LFO graph
Draw the info text at around 20% of the LFO graph's height. This prepares the dialog to be scaled later.
Write "1000 ms/LFO" instead of "ms/LFO: 1000" with a larger gap.
## Accessors for EnvelopeAndLfoParameters
Make the enum `LfoShape` in `EnvelopeAndLfoParameters` public so that it can be used without friend declarations. Add accessor methods for the model of the LFO.
## Other improvements
* Adjust include orders
* Variable initialization in headers
* Prevention of most vexing parses
Adjust and rename the function `pointSize` so that it sets the font size in pixels. Rename `pointSize` to `adjustedToPixelSize` because that's what it does now. It returns a font adjusted to a given pixel size. Rename `fontPointer` to `font` because it's not a pointer but a copy. Rename `fontSize` to simply `size`.
This works if the intended model is that users use global fractional scaling. In that case pixel sized fonts are also scaled so that they should stay legible for different screen sizes and pixel densities.
## Adjust plugins with regards to adjustedToPixelSize
Adjust the plugins with regards to the use of `adjustedToPixelSize`.
Remove the explicit setting of the font size of combo boxes in the following places to make the combo boxes consistent:
* `AudioFileProcessorView.cpp`
* `DualFilterControlDialog.cpp`
* `Monstro.cpp` (does not even seem to use text)
* `Mallets.cpp`
Remove calls to `adjustedToPixelSize` in the following places because they can deal with different font sizes:
* `LadspaBrowser.cpp`
Set an explicit point sized font size for the "Show GUI" button in `ZynAddSubFx.cpp`
Increase the font size of the buttons in the Vestige plugin and reduce code repetition by introducing a single variable for the font size.
I was not able to find out where the font in `VstEffectControlDialog.cpp` is shown. So it is left as is for now.
## Adjust the font sizes in the area of GUI editors and instruments.
Increase the font size to 10 pixels in the following places:
* Effect view: "Controls" button and the display of the effect name at the bottom
* Automation editor: Min and max value display to the left of the editor
* InstrumentFunctionViews: Labels "Chord:", "Direction:" and "Mode:"
* InstrumentMidiIOView: Message display "Specify the velocity normalization base for MIDI-based instruments at 100% note velocity."
* InstrumentSoundShapingView: Message display "Envelopes, LFOs and filters are not supported by the current instrument."
* InstrumentTuningView: Message display "Enables the use of global transposition"
Increase the font size to 12 pixels in the mixer channel view, i.e. the display of the channel name.
Render messages in system font size in the following areas because there should be enough space for almost all sizes:
* Automation editor: Message display "Please open an automation clip by double-clicking on it!"
* Piano roll: Message display "Please open a clip by double-clicking on it!"
Use the application font for the line edit that can be used to change the instrument name.
Remove overrides which explicitly set the font size for LED check boxes in:
* EnvelopeAndLfoView: Labels "FREQ x 100" and "MODULATE ENV AMOUNT"
Remove overrides which explicitly set the font size for combo boxes in:
* InstrumentSoundShapingView: Filter combo box
## Adjust font sizes in widgets
Adjust the font sizes in the area of the custom GUI widgets.
Increase and unify the pixel font size to 10 pixels in the following classes:
* `ComboBox`
* `GroupBox`
* `Knob`
* `LcdFloatSpinBox`
* `LcdWidget`
* `LedCheckBox`
* `Oscilloscope`: Display of "Click to enable"
* `TabWidget`
Shorten the text in `EnvelopeAndLfoView` from "MODULATE ENV AMOUNT" to "MOD ENV AMOUNT" to make it fit with the new font size of `LedCheckBox`.
Remove the setting of the font size in pixels from `MeterDialog` because it's displayed in a layout and can accommodate all font sizes. Note: the dialog can be triggered from a LADSPA plugin with tempo sync, e.g. "Allpass delay line". Right click on the time parameter and select "Tempo Sync > Custom..." from the context menu.
Remove the setting of the font size in `TabBar` as none of the added `TabButton` instances displays text in the first place.
Remove the setting of the font size in `TabWidget::addTab` because the font size is already set in the constructor. It would be an unexpected size effect of setting a tab anyway. Remove a duplicate call to setting the font size in `TabWidget::paintEvent`.
Remove unnecessary includes of `gui_templates.h` wherever this is possible now.
## Direct use of setPixelSize
Directly use `setPixelSize` when drawing the "Note Velocity" and "Note Panning" strings as they will likely never be drawn using point sizes.
Remove the "GENERAL SETTINGS" tab from the instrument track and sample track window.
This removes clutter as well as dependencies to the non-scalable `TabWidget`.
Remove superfluous calls to `setSpacing` which have set the default value of 6.
Use the default content margins of (9, 9, 9, 9) instead of (8, 8, 8, 8).
Some analysis done with Callgrind showed that the `LcdWidget` spends quite some time repainting itself even when nothing has changed. Some widget instances are used in song update contexts where `LcdWidget::setValue` is called 60 times per second.
This commit fixes the problem by only updating the `LcdWidget` if its value really has changed.
Adjust the condition in the if-clause so that it becomes clearer what's the interval of interest.
Prepare the application for Qt6 by conditionally removing the use of `QApplication::desktop` in `ComboBox.cpp`. The method was already deprecated in Qt5 and is removed in Qt6.
Instead the method `QWidget::screen` is used now if the Qt version is equal to or newer than 5.14 (because the method was only introduced with that version). Fall back to `QApplication::desktop` if an older version is detected during the build. This is for example the case for the CI builds which are based on Ubuntu 18.04.
Generalize the check if the menu can be shown in the screen. The code now also does handles the case where the menu would go out of screen along the X axis.
Also remove the unused include `embed.h`.
Some methods in `LadspaManager` performed repeated searches through the map by first calling `contains` and then by actually fetching the entry. This is fixed by using `find` on the map. It returns an iterator which can directly provide the result or indicate that nothing was found. That way the map is only searched once.
* clang-tidy: Apply cppcoreguidelines-init-variables everywhere (treating NaNs as zeros)
* Initialize msec and tick outside switch
* Update plugins/Vestige/Vestige.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update plugins/Vestige/Vestige.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update plugins/Vestige/Vestige.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update plugins/VstEffect/VstEffectControls.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update src/core/DrumSynth.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update plugins/VstEffect/VstEffectControls.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update plugins/VstEffect/VstEffectControls.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update src/core/DrumSynth.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update src/core/DrumSynth.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update src/core/DrumSynth.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update src/core/DrumSynth.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update src/core/DrumSynth.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update src/core/DrumSynth.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Use initialization with =
* Use tabs
* Use static_cast
* Update DrumSynth.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update DrumSynth.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update DrumSynth.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update src/core/DrumSynth.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Do not use tabs for alignment in src/core/DrumSynth.cpp
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* Move x variable inside loop
* Use ternary operator for b variable
* Revert "Use tabs"
This reverts commit 07afd8a83f58b539c3673310b2aad4b63c9198a0.
* Remove unnecessary variables in XpressiveView
* Simplify initialization in Plugin
* Combine declaration and initialization in EqCurve
* Combine declaration and initialization in Song
* Combine declaration and initialization in AudioAlsa
* Combine declaration and initialization in EqCurve (again)
* Missed some
* Undo changes made to non-LMMS files
* Undo indentation changes in SidInstrument.cpp
* Combine declaration with assignment in IoHelper
* Combine declaration with assignment using auto in Carla
* Combine declaration with assignment
* Combine declaration with assignment in BasicFilters
* Simplify assignments in AudioFileProcessorWaveView::zoom
* Simplify out sample variable in BitInvader
* Remove sampleLength variable in DelayEffect
* Move gain variable in DynamicsProcessor
* Combine peak variable declaration with assignment in EqSpectrumView
* Move left/right lfo variables in for loop in FlangerEffect
* Use ternary operator for group variable in LadspaControlDialog
* Combine declaration with assignment in Lb302
* Combine declaration with assignment in MidiExport
* Combine declaration with assignment in MidiFile
* Combine declaration with assignment in MidiImport
* Use ternary operator for vel_adjusted variable in OpulenZ
* Move tmpL and dcblkL variables in for loop in ReverbSC
* Combine declaration with initialization in SlicerT
* Combine declaration with assignment in SaSpectrumView
* Combine declaration with assignment in SaWaterfallView
* Combine declaration with assignment in StereoEnhancerEffect
* Combine declaration with assignment in VibratingString
* Combine declaration with assignment in VstEffectControls
* Combine declaration with assignment in Xpressive
* Combine declaration with assignment in AutomatableModel
* Combine declaration with assignment in AutomationClip
* Move sample variable in for loop in BandLimitedWave
* Combine declaration with assignment in DataFile
* Combine declaration with assignment in DrumSynth
* Combine declaration with assignment in Effect
* Remove redundant assignment to nphsLeft in InstrumentPlayHandle
* Combine declaration with assignment in LadspaManager
* Combine declaration with assignment in LinkedModelGroups
* Combine declaration with assignment in MemoryHelper
* Combine declaration with assignment in AudioAlsa
* Combine declaration with assignment in AudioFileOgg
* Combine declaration with assignment in AudioPortAudio
* Combine declaration with assignment in AudioSoundIo
* Combine declaration with assignment in Lv2Evbuf
* Combine declaration with assignment in Lv2Proc
* Combine declaration with assignment in main
* Combine declaration with assignment in MidiAlsaRaw
* Combine declaration with assignment in MidiAlsaSeq
* Combine declaration with assignment in MidiController
* Combine declaration with assignment in MidiJack
* Combine declaration with assignment in MidiSndio
* Combine declaration with assignment in ControlLayout
* Combine declaration with assignment in MainWindow
* Combine declaration with assignment in ProjectNotes
* Use ternary operator for nextValue variable in AutomationClipView
* Combine declaration with assignment in AutomationEditor
* Move length variable in for-loop in PianoRoll
* Combine declaration with assignment in ControllerConnectionDialog
* Combine declaration with assignment in Graph
* Combine declaration with assignment in LcdFloatSpinBox
* Combine declaration with assignment in TimeDisplayWidget
* Remove currentNote variable in InstrumentTrack
* Combine declaration with assignment in DrumSynth (again)
* Use ternary operator for factor variable in BitInvader
* Use ternary operator for highestBandwich variable in EqCurve
Bandwich?
* Move sum variable into for loop in Graph
* Fix format in MidiSndio
* Fixup a few more
* Cleanup error variables
* Use ternary operators and combine declaration with initialization
* Combine declaration with initialization
* Update plugins/LadspaEffect/LadspaControlDialog.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update plugins/OpulenZ/OpulenZ.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update plugins/SpectrumAnalyzer/SaProcessor.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update src/core/midi/MidiAlsaRaw.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update src/gui/MainWindow.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update src/gui/clips/AutomationClipView.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update src/gui/editors/AutomationEditor.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update src/gui/widgets/Fader.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Move static_cast conversion into separate variable
* Use real index when interpolating
* Remove empty line
* Make helpBtn a private member
* Move controller type into separate variable
* Fix format of DrumSynth::waveform function
* Use tabs and static_cast
* Remove redundant if branch
* Refactor using static_cast/reinterpret_cast
* Add std namespace prefix
* Store repeated conditional into boolean variable
* Cast to int before assigning to m_currentLength
* Rename note_frames to noteFrames
* Update src/core/Controller.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update src/core/DrumSynth.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update src/gui/widgets/Graph.cpp
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Revert changes that initialized variables redudantly
For situations where the initialization is
more complex or passed into a function
by a pointer, we dont need to do
initialization ourselves since it is
already done for us, just in a different way.
* Remove redundant err variable
* Remove explicit check of err variable
* Clean up changes and address review
* Do not initialize to 0/nullptr when not needed
* Wrap condition in parentheses for readability
---------
Co-authored-by: Kevin Zander <veratil@gmail.com>
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* remove the gui_templates header where functions not used
* refactor and replace template with function argument
* refactor: merge pointSizeF function with pointSize
* removed template per michael's review
* use std::max for more readability
* remove the QDesktopWidget header
* cleanup arguments and remove parentheses from return
Enable to set different colors for the oscilloscope channels:
* Left channel color
* Right channel color
* Color of all other channels
The clipping color is now used per channel, i.e. if the left channel clips but the right does not then only the signal of the left channel is painted in the clipping color.
Enable setting the colors in the style sheets and adjust the style sheets of the default and classic theme accordingly.
Moves the confirmation to remove mixer channels outside of `MixerView::deleteChannel` and into `MixerChannelView::removeChannel`. This is so that the confirmation only applies when the user uses the context menu to remove a channel, which is important since no confirmation should apply when, for example, the mixer view is cleared with calls to `MixerView::clear`.
* replace QRegExp with QRegularExpression (find n replace)
* follow up to fix errors
* removed rpmalloc
* Fix compilation for qt5, to be fixed when qt6 fully supported.
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Added QtGlobal header for version finding fix
* Use the other syntax to try fix compilation.
* Check for 5.12 instead.
* Fix the header
* Attempt at fixing it further.
* Use version checks properly in header file
* Use QT_VERSION_CHECK macro in sources
* Apply suggestions from messmerd's review
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
---------
Co-authored-by: Kevin Zander <veratil@gmail.com>
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
Revert some of the changes made in commit 88e0e94dcd. The underlying idea was that the `InstrumentTrackView` should be responsible for assigning the icon that's shown by its `TrackLabelButton`. However, this does not work because in some cases the `InstrumentTrack` that's passed into `InstrumentTrackView::determinePixmap` does not have an `Instrument` assigned. This in turn seems to be caused due to initalizations that are running in parallel in different threads.
Here are the steps to reproduce the threading problem (line numbers refer to commit 360254f):
1. Set a break point in line 1054 of `InstrumentTrack`, i.e. the line in `InstrumentTrack::loadInstrument` where `m_instrument` is being assigned to.
2. Set a break point in `InstrumentTrackView::determinePixmap`, e.g. inside of the first if statement.
3. Drop an instance of "Sf2 Player" onto the Song Editor.
4. The first break point in `InstrumentTrack` is hit in a thread called "lmms::Instrumen" (shown like that in my debugger). Try to step over it.
5. The second break point in `InstrumentTrackView` now gets hit before the code is stepped over. This time we are in the thread called "lmms". I guess this is the GUI main thread.
6. Continue execution.
If you now switch to the application then the icon is shown. I guess the debugger is halted long enough in the main thread so that the InstrumentTrack gets an instrument assigned in another thread.
If you delete/disable the break point in `InstrumentTrack::determinePixmap` and follow the coarse steps above then the icon is not shown because the track has no instrument.
The current fix still delegates to the `InstrumentTrackView` to determine the pixmap in hopes that one day there will be a better solution where the parent component can be fully responsible for its child component.
Fixes#7116.
Fix several NaNs in the context of the basic filters and the Equalizer.
The coefficients of the `BiQuad` were not initialized which seems to have led to NaNs down the line.
Fix a division by zero in `EqEffect::peakBand` and `EqSpectrumView::paintEvent` if the energy is zero.
The condition `m_peakSum <= 0` was removed from `EqSpectrumView::paintEvent` because the value is initialized to 0 down the line and later only potentially positive values are added.
Removes `MemoryManager` and the use of rpmalloc in favor of the `new` and `delete` operators found in C++.
---------
Co-authored-by: Veratil <veratil@gmail.com>
* Fix crash in Audio File Processor
Fix a crash in the Audio File Processor that occurs when an Audio File Processor with a reversed sample is loaded from a save file and then the plugin window is opened.
The problem was caused by a call to `AudioFileProcessorWaveView::slideSampleByFrames` during the execution of constructor of `AudioFileProcessorWaveView`. In that situation the three `knob` members were all `nullptr` because for some reason there was an explicit setter for them which was only called after construction. This is fixed by passing and setting the knobs in the constructor.
Another question is if it's not a problem in the first place that the knobs are given to the `AudioFileProcessorWaveView` instead of their underlying models.
Reenable zooming in the song editor by
* only resizing the track if the alt modifier is pressed and
* only accepting the wheel even if we in fact resize the track.
By doing so all other wheel events bubble up so that zooming and scrolling of the song editor can be handled by parent components.
The code that handles the retrieval of the delta value had to be adjusted as well. The reason is that pressing the alt key messes with the way that deltas are reported in the wheel event. The wheel event is interpreted as a horizontal scroll when alt is pressed.
* Fix invalidated iterator when removing notes in Piano Roll
* fixup - typo
* Add MidiClip::removeNote(iterator) function
* Use iterator version of remoteNote
* Fix parameter name
* Change variable name again
* Simplify TrackLabelButton
Remove the dependency to `Instrument` and `InstrumentTrack` from `TrackLabelButton`. The icon of an `InstrumentTrackView` is now determined in the class `InstrumentTrackView` itself using the new static method `determinePixmap`. This enables the removal of the overridden `paintEvent` method from `TrackLabelButton`.
It was also attempted to keep a non-static member function version and to use the `InstrumentTrackView`'s model with a cast. However, this did not work because 'setModel' is executed as the very last step in the constructor, i.e. the model is not already set when `determinePixmap` is called. Pulling it to the top is too risky right now.
* Add helper method isInCompactMode
Add the helper method `isInCompactMode` which knows how to use the `ConfigManager` to determine if the option for compact track buttons is enabled. This removes duplicate code with intricate knowledge of the keys under which compact mode is stored.
* Set song as modified when track name changes
Extend `Track::setName` to set the song as modified whenever the track name changes. This moves the update into a core class and enables the removal of the dependencies to `Engine` and `Song` from the GUI class `TrackLabelButton`.
Also add a check if the name is really changed and only perform the actions if that's the case.
To make this work the implementation of `setName` had to be moved from the header into the implementation file.
* Keep instrument and sample content at top on resize
Keep the content of the instrument and sample track at the top of the widget if the widget is resized. This is also fixes a bug where the `TrackLabelButton` does not react anymore when the size is increased.
Technically the layout with the actual widgets is put into another vertical layout with a spacer that consumes all remaining space at the bottom.
* Vertical track resizing via mouse wheel
Enable to vertically resize tracks using the mouse wheel. Scrolling the mouse wheel over the track view with the control key pressed will increase/decrease the height by one pixel per wheel event. Pressing the shift key will increase/decrease in steps of five pixels.
Extract code that can be shared between the existing and the new way to resize the track into the private helper method `resizeToHeight`.
* Render beat pattern step buttons at the top
Render the step buttons of beat patterns at the top instead of at the bottom so that they stay aligned with the other elements to the left of them (buttons, knobs, etc).
Set the y offset to 4 so that the step buttons are vertically aligned with the other elements. The previous calculation lead to a minimum offset of 6 which always made the step buttons look misaligned.
Introduce the new static variable `BeatStepButtonOffset` which ensures that the rendering and the evaluation of mouse clicks do not go out of sync.
On plugin instantiation failure, `Lv2Proc::m_valid` was being set to false. However, `Lv2Proc::run` did not evaluate `m_valid` and still called `lilv_instance_run`, which caused undefined behavior, including crashes.
This bug fixes this by not even create such zombie classes, and instead `throw`s right away. The throws are caught in `lmms_plugin_main`, as suggested in the PR discussion and as the VST3 approach.
This revisits two main aspects of playback from `Sample`: copying frames into a temporary playback buffer before resampling, and advancing the state's frame index. Both operations were improperly done, causing distorted audio to be heard when resampling from within the `Sample::play` function.
To fix this, playback into the temporary playback buffer is now done using the `playRaw` function, which copies the frame one by one in a loop, moving through the buffer correctly as determined by the loop mode. In addition, advancement of the playback index is done using the `advance` function, which advances the index by the given amount and handles an out of bounds index for the loop modes as necessary using the modulo operator.
Hide the LED button for "Custom Base Velocity" as it did not have any other effect besides disabling the spinbox in the GUI. It did not affect any model which could be evaluated elsewhere.
## Technical details
Add functionality to show/hide the LED button to `GroupBox`. There's also a corresponding getter called `ledButtonShown`. The latter is evaluated in the following situations:
* Mouse clicks: if the LED button is hidden then the model is not toggled.
* Paining: The X position of the caption changes depending on whether the LED button is shown or not.
At a certain point the class `GroupBox` should be replaced by something that's implemented with layouts and which is used wherever it's possible.
* Add private setters for "from" and "to"
Add private setters for the "from" and "to" values in `AudioFileProcessorWaveView`. When being used the setters will ensure that the bounds are respected.
Also add a `range` method because this computation was done repeatedly throughout the code.
Fixes#7068 but masks some of the original problems with the code that computes out-of-bounds values for "from" and "to" like the `slide` method. Problematic code can still be found by temporarily adding the following assertions to the setters:
* `assert (to <= m_sample->sampleSize());` in `setTo`
* `assert (from >= 0);` in `setFrom`
* Remove superfluous calls to qMax and qMin
## Extract views
Extract the classes `AudioFileProcessorWaveView` and `AudioFileProcessorView` into their own files.
Reformat the new classes by removing unnecessary whitespace and underscores. Add spaces to if-statements.
Cleanup the includes.
## Remove friend relationship
Remove the friend relationship between `AudioFileProcessor` and `AudioFileProcessorView`.
Introduce getters for entities that the view is interested in.
Fixes most of the problem that the MIDI port information is not cloned when a track is cloned.
The bug was caused because cloning is implemented via serialization and deserialization of the Track. The previous code only serialized the MIDI port if `Engine::getSong()->isSavingProject()` is true. However, when we are cloning the statement will be `false` because we are not saving the song. Therefore the MIDI port's state was not saved and the clone was initialized with the default values.
The fix is to serialize the MIDI port in the following cases:
* We are not in song saving mode, i.e. we are in the state that this issue is about, e.g. cloning.
* We save a song and the MIDI connections are not discarded.
Using boolean algebra these conditions can be simplified as seen in the changed statement.
* Fix mixer channel updates on solo/mute
Fix the update of the mixer channels whenever a channel is soloed or muted.
The solution is rather "brutal" as it updates all mixer channel views when one of the models changes.
Introduce private helper method `MixerView::updateAllMixerChannels`. It calls the `update` method on each `MixerChannelView` so that they can get repainted.
Call `updateAllMixerChannels` at the end of the existing method `toggledSolo`.
Introduce a new method `MixerView::toggledMute` which is called whenever the mute model of a channel changes. It also updates all mixer channels.
Fixes#7054.
* Improve mixer channel update for mute events
Improve the mixer channel update for mute events by not delegating to `MixerView` like for the solo case. Instead the `MixerChannelView` now has its own `toggledMute` slot which simply updates the widget on changes to the mute model.
Also fix `MixerChannelView::setChannelIndex` by disconnecting from the signals of the previous mixer channel and connecting to the signals for the new one.
Remove `toggledMute` from `MixerView`.
The solo implementation is kept as is because it also triggers changes to the core model. So the chain seems to be:
* Solo button clicked in mixer channel view
* Button changes solo model
* Solo model signals to mixer view which was connected via the mixer channel view
* Mixer view performs changes in the other core models
* All mixer channels are updated.
Are better chain would first update the core models and then update the GUI from the changes:
* Solo button clicked in mixer channel view
* Button changes solo model
* Solo model signals to core mixer, i.e. not a view!
* Mixer view performs changes in the other core models
* Changed models emit signal to GUI elements
* Revert "Improve mixer channel update for mute events"
This reverts commit ede65963ea.
* Add comment
After the revert done with commit the code is more consistent again but not in a good way. Hence a comment is added which indicates that an inprovement is needed.
* Abstract mixer retrieval
Abstract the retrieval of the mixer behind the new method `getMixer`. This is done in preparation for some dependency injection so that the `MixerView` does not have to ask the `Engine` for the mixer but gets it injected, a.k.a. the "Hollywood principle": "Don't call us, we'll call you."
It's called `getMixer` and not just mixer because it allows for locale variables to be called `mixer` without confusing it with the method.
* Let MixerView connect directly to models
Let the `MixerView` connect directly to the solo and mute models it is connected with.
Remove the connections that are made in `MixerChannelView` which acted as a proxy which only complicated things.
Add `connectToSoloAndMute` which connects the `MixerView` to the solo and mute models of a given channel. Call it whenever a new channel is created.
Add `disconnectFromSoloAndMute` which disconnects the `MixerView` from the solo and mute models of a given channel. Call it when a channel is deleted.
* Code cleanup
Cleanup code related to the creation of the master channel view.
* Inject the Mixer into the MixerView
Inject the `Mixer` into the `MixerView` via the constructor. This makes it more explicit that the `Mixer` is the model of the view. It also implements the "Dependency Inversion Principle" in that the `MIxerView` does not have to ask the `Engine` for the `Mixer` anymore.
The current changes should be safe in that the `Mixer` instance is static and does not change.
* Fix connections on song load
Disconnect and reconnect in `MixerView::refreshDisplay` which is called when a song is loaded.
Caused by not calling `Engine::destroy`, as well as creating tracks/clips on the heap and not freeing the memory at the end of the test.
Instead of creating tracks/clips on the heap, they are now made on the stack, similar to how the surrounding tests create its objects.
Reduce code repetition in `MixerChannelView` by introducing methods that:
* Retrieve the `MixerChannel` that's associated with the view
* Check if the associated channel is the master channel
This abstracts some functionality and also reduces direct usage of the variable `m_channelIndex`.
* set win32 flag
* added mingw too to win32 flag + dom's suggestions
* revert unnecessary changes i made.
* simplify msys linker flag condition
* removed extra whitespace
* whitespace change 2
Fix a crash that occurs when songs are loaded after each other. The crash only occurs if the "participating" songs have at least one other channel besides the master channel.
The crash occurred because the `MixerChannelViews` were not really deleted in `MixerView::refreshDisplay`. As a consequence the parent child relationship was still given between the `MixerView` and the `MixerChannelView`. When a song was loaded the event queue was evaluated which in turn resulted in the method `Fader::knobPosY` being called on a `Fader` which did not have a model anymore.
Fixes#7046.
* Handle divisions by 0 in Lb302
Handle potential division by 0 which in turn lead to floating point exceptions in Lb302. The division can occur in the `process` method if it is called with the member `vco_inc` still initialized to 0. This seems to happen then the Lb302 processes with no notes actually being played.
The offending call is `BandLimitedWave::pdToLen(vco_inc)` which is now prevented when the increment is 0. In the latter case a sample of 0 is produced. This works because in all other cases the Lb302 instance should process a note which in turn sets the increments to something different from 0.
* Fix FPEs in Monstro
Fix some floating point exceptions in `MonstroSynth::renderOutput` that occurred due to calling `BandLimitedWave::pdToLen` with a value of 0. This happened when one of the phase deltas was set to 0, i.e. `pd_l` or `pd_r`. These cases are now checked and produce silence in the corresponding components if the phase delta is set to 0.
* Fix uninitialized variables
Initialize the local variables `len_l` and `len_r` to 0. This fixes compiler warnings a la "error: 'len_r' may be used uninitialized in this function" which are treated as errors on the build server.
* Adjust whitespace of touched code
Fix the peak update of the LMMS equalizer which accidentally used the same sample twice.
Simplify the `gain` method by removing repeated deferences which made the code hard to read.
Use `std::max` to update the peak values to the maximum of the buffer.
# Extend TabWidget's style sheet options
Extend the `TabWidget` class so that the text color of the selected tab
can be set in the style sheet. Adjust the paint method to make use of
the new property.
Adjust the default style sheet as follows:
* Background color of the selected tab is the green of the knobs
* Text color of the selected tab is full on white
Adjust the classic style sheet in such a way that nothing changes, i.e.
the text colors of the selected tab and the other ones are the same.
# Code review style changes
Completely adjust the code style of TabWidget:
* Pointer/reference close to type
* Remove underscores from parameter names
* Remove spaces from parentheses
* Add space after if and for statements
# Remove repeated iterator dereferences
Remove repeated iterator dereferences by introducing variables with speaking names.
Fixes#6730.
Remove the code which computes a minimum height for the LADSPA dialogs. It was intended to make sure that no scrollbar is shown in most cases. However, doing so came at the cost that the computed height was the minimum height as well. Therefore the dialogs took a lot of space on low-res displays and could not be made smaller.
After the removal the behavior is still sane. Small dialogs are shown in full and dialogs which are larger, e.g. "Calf Equalizer 12 Band LADSPA", seem to be sized around half the height of the workspace and show scrollbars.
Use Qt layouts for the mixer channels. These changes will enable several other improvements, like for example making the mixer and faders resizable, adding peak indicators, etc.
This is a squash commit which consists of the following individual commits:
* Remove extra transparency in send/receive arrows
The extra transparency was conflicting with the positioning of
the arrows in the layout
* Begin reimplementing MixerChannelView
MixerChannelView is now a combination of the
MixerLine with the previous MixerChannelView
* Adjust SendButtonIndicator to use MixerChannelView
* Remove MixerLine
- Move MixerChannelView into src/gui
* Remove MixerView::MixerChannelView
* Remove header of MixerLine
* Change MixerView.h to use MixerChannelView
Change MixerView.h to use MixerChannelView rather than MixerLine
Also do some cleanup, such as removing an unused forward declaration
of QButtonGroup
* Create EffectRackView
+ Set height of sizeHint() using MIXER_CHANNEL_HEIGHT (287)
* Remove include of MixerLine
- Include MixerChannelView
* Phase 1: Adjust MixerView to use new MixerChannelView
* Move children wigets into header file
* Phase 2: Adjust MixerView to use new MixerChannelView
* Phase 3: Adjust MixerView to use new MixerChannelView
* Phase 4: Adjust MixerView to use new MixerChannelView
* Phase 5: Adjust MixerView to use new MixerChannelView
* Phase 5: Adjust MixerView to use new MixerChannelView
* Remove places where MixerChannelView is being deleted
Before, MixerChannelView was not inherited by QWidget,
meaning it could not have a parent and had to be deleted
when necessary. Since the MixerView owns the
new MixerChannelView, this is no longer necessary.
* Replace MixerLine with MixerChannelView
- Include MixerChannelView in MixerView
* Replace setCurrentMixerLine calls with setCurrentMixerChannel around codebase
* Add event handlers in MixerChannelView
* Implement MixerChannelView::eventFilter
* Update theme styles to use MixerChannelView
* Add QColor properties from style
- Set the Qt::WA_StyledBackground attribute on
* Add effect rack to rack layout when adding channel
* Set size for MixerChannelView
- Change nullptr to this for certain widgets
- Some custom widgets may expect there to be a parent
- Add spacing in channel layout
- Increase size of mixer channel
* Retain size when widgets are hidden
* Implement paintEvent
- Rename states in SendReceiveState
* Implement send/receive arrow toggling
- Make maxTextHeight constexpr in elideName
- Remove background changing on mouse press
(is now handled in paintEvent)
* Implement renaming mixer channels
* Implement color functions
* Implement channel moving/removing functions
* Do some cleanup
Not sure if that connection with the mute model was needed, but removing
it did not seem to introduce any issues.
* Include cassert
* Replace references to MixerLine with MixerChannelView
* Reduce height
+ Make m_renameLineEdit transparent
+ Retain size when LCD is hidden
+ Remove stretch after renameLineEdit in layout
* Remove trailing whitespace
* Make m_renameLineEdit read only
+ Transpose m_renameLineEditView rectangle (with 5px offset)
* Set spacing in channel layout back to 0
* Remove sizeHint override and constant size
* Use sizeHint for mixerChannelSize
+ Leave auto fill background to false in MixerChannelView
+ Only set width for EffectRackView
* Set margins to 4 on all sides in MixerChannelView
* Move solo and mute closer to each other
Move the solo and mute buttons closer to each other in the mixer channels.
Technically this is accomplished by putting them into their own layout with minimal margins and spacing.
* Fixes for CodeFactor
* Code review changes
Mostly whitespace and formatting changes: remove tabs, remove spaces in parameter lists, remove underscores from parameter names.
Some lines have been shortened by introducing intermediate variables, e.g. in `MixerChannelView`.
`MixerView` has many changes but only related to whitespace. Spaces have been introduced for if and for statements. Whitespace at round braces has been removed everywhere in the implementation file even if a line was not touched by the intial changes.
Remove duplicate forward declaration of `MixerChannelView`.
* Adjust parameter order in MixerChannelView's constructor
Make the parent `QWidget` the first parameter as it is a Qt convention. The default parameter had to be removed due to this.
* Move styling of rename line edit into style sheets
Move the style of the `QGraphicsView` for the rename line edit from the code into the style sheets of the default and classic theme.
* More code review changes
Fix spaces between types and references/pointers, e.g. use `const QBrush& c` instead of `const QBrush & c`.
Remove underscores from parameter names.
Remove spaces near parentheses.
Replace tabs with spaces.
Introduce intermediate variable to resolve "hanging" + operator.
Replace the connection for the periodic fader updates with one that uses function pointers instead of `SIGNAL` and `SLOT`.
---------
Co-authored-by: Michael Gregorius <michael.gregorius.git@arcor.de>
* Add refactored SampleBuffer
* Add Sample
* Add SampleLoader
* Integrate changes into AudioSampleRecorder
* Integrate changes into Oscillator
* Integrate changes into SampleClip/SamplePlayHandle
* Integrate changes into Graph
* Remove SampleBuffer include from SampleClipView
* Integrate changes into Patman
* Reduce indirection to sample buffer from Sample
* Integrate changes into AudioFileProcessor
* Remove old SampleBuffer
* Include memory header in TripleOscillator
* Include memory header in Oscillator
* Use atomic_load within SampleClip::sample
* Include memory header in EnvelopeAndLfoParameters
* Use std::atomic_load for most calls to Oscillator::userWaveSample
* Revert accidental change on SamplePlayHandle L.111
* Check if audio file is empty before loading
* Add asserts to Sample
* Add cassert include within Sample
* Adjust assert expressions in Sample
* Remove use of shared ownership for Sample
Sample does not need to be wrapped around a std::shared_ptr.
This was to work with the audio thread, but the audio thread
can instead have their own Sample separate from the UI's Sample,
so changes to the UI's Sample would not leave the audio worker thread
using freed data if it had pointed to it.
* Use ArrayVector in Sample
* Enforce std::atomic_load for users of std::shared_ptr<const SampleBuffer>
* Use requestChangesGuard in ClipView::remove
Fixes data race when deleting SampleClip
* Revert only formatting changes
* Update ClipView::remove comment
* Revert "Remove use of shared ownership for Sample"
This reverts commit 1d452331d1.
In some cases, you can infact do away with shared ownership
on Sample if there are no writes being made to either of them,
but to make sure changes are reflected to the object in cases
where writes do happen, they should work with the same one.
* Fix heap-use-after-free in Track::loadSettings
* Remove m_buffer asserts
* Refactor play functionality (again)
The responsibility of resampling the buffer
and moving the frame index is now in Sample::play, allowing the removal
of both playSampleRangeLoop and playSampleRangePingPong.
* Change copyright
* Cast processingSampleRate to float
Fixes division by zero error
* Update include/SampleLoader.h
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Update include/SampleLoader.h
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Format SampleLoader.h
* Remove SampleBuffer.h include in SampleRecordHandle.h
* Update src/core/Oscillator.cpp
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Use typeInfo<float> for float equality comparison
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Use std::min in Sample::visualize
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Move in result to m_data
* Use if block in playSampleRange
* Pass in unique_ptr to SampleClip::setSampleBuffer
* Return const QString& from SampleBuffer::audioFile
* Do not pass in unique_ptr by r-value reference
* Use isEmpty() within SampleClipView::updateSample
* Remove use of atomic_store and atomic_load
* Remove ArrayVector comment
* Use array specialization for unique_ptr when managing DrumSynth data
Also made it so that we don't create result
before checking if we failed to decode the file,
potentially saving us an allocation.
* Don't manually delete Clip if it has a Track
* Clean up generateAntiAliasUserWaveTable function
Also, make it so that we actually call this function
when necessary in TripleOscillator.
* Set user wave, even when value is empty
If the value or file is empty, I think showing a
error popup here is ideal.
* Remove whitespace in EnvelopeAndLfoParameters.cpp L#121
* Fix error in c5f7ccba49
We still have to delete the Clip's, or else we would just be eating
up memory. But we should first make sure that the Track's no longer
see this Clip in their m_clips vector. This has to happen
as it's own operation because we have to wait for the audio thread(s)
first. This would ensure that Track's do not create
PlayHandle's that would refer to a Clip that is currently
being destroyed. After that, then we call deleteLater on the Clip.
* Convert std::shared_ptr<Sample> to Sample
This conversion does not apply to Patman as there seems to be issues
with it causing heap-use-after-free issues, such as with
PatmanInstrument::unloadCurrentPatch
* Fix segfault when closing LMMS
Song should be deleted before AudioEngine.
* Construct buffer through SampleLoader in FileBrowser's previewFileItem function
+ Remove const qualification in SamplePlayHandle(const QString&)
constructor for m_sample
* Move guard out of removeClip and deleteClips
+ Revert commit 1769ed517d since
this would fix it anyway
(we don't try to lock the engine to
delete the global automation track when closing LMMS now)
* Simplify the switch in play function for loopMode
* Add SampleDecoder
* Add LMMS_HAVE_OGGVORBIS comment
* Fix unused variable error
* Include unordered_map
* Simplify SampleDecoder
Instead of using the extension (which could be wrong) for the file,
we simply loop through all the decoders available. First sndfile because
it covers a lot of formats, then the ogg decoder for the few cases where sndfile
would not work for certain audio codecs, and then the DrumSynth decoder.
* Attempt to fix Mac builds
* Attempt to fix Mac builds take 2
* Add vector include to SampleDecoder
* Add TODO comment about shared ownership with clips
Calls to ClipView::remove may occur at any point, which can cause
a problem when the Track is using the clip about to be removed.
A suitable solution would be to use shared ownership between the Track
and ClipView for the clip. Track's can then simply remove the shared
pointer in their m_clips vector, and ClipView can call reset on the
shared pointer on calls to ClipView::remove.
* Adjust TODO comment
Disregard the shared ownership idea. Since we would be modifying
the collection of Clip's in Track when removing the Clip, the Track
could be iterating said collection while this happens,
causing a bug. In this case, we do actually
want a synchronization mechanism.
However, I didn't mention another separate issue in the TODO comment
that should've been addressed: ~Clip should not be responsible for
actually removing the itself from it's Track. With calls to removeClip,
one would expect that to already occur.
* Remove Sample::playbackSize
Inside SampleClip::sampleLength, we should be using Sample::sampleSize
instead.
* Fix issues involving length of Sample's
SampleClip::sampleLength should be passing the Sample's sample rate to
Engine::framesPerTick.
I also changed sampleDuration to return a std::chrono::milliseconds
instead of an int so that the callers know what time interval
is being used.
* Simplify if condition in src/gui/FileBrowser.cpp
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Simplify if condition in src/core/SampleBuffer.cpp
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Update style in include/Oscillator.h
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Format src/core/SampleDecoder.cpp
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Set the sample rate to be that of the AudioEngine by default
I also removed some checks involving the state of the SampleBuffer.
These functions should expect a valid SampleBuffer each time.
This helps to simplify things since we don't have to validate it
in each function.
* Set single-argument constructors in Sample and SampleBuffer to be explicit
* Do not make a copy when reading result from the decoder
* Add constructor to pass in vector of sampleFrame's directly
* Do a pass by value and move in SampleBuffer.cpp
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Pass vector by value in SampleBuffer.h
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Make Sample(std::shared_ptr) constructor explicit
* Properly draw sample waveform when reversed
* Collect sample not found errors when loading project
Also return empty buffers when trying to load
either an empty file or empty Base64 string
* Use std::make_unique<SampleBuffer> in SampleLoader
* Fix loop modes
* Limit sample duration to [start, end] and not the entire buffer
* Use structured binding to access buffer
* Check if GUI exists before displaying error
* Make Base64 constructor pass in the string instead
* Remove use of QByteArray::fromBase64Encoding
* Inline simple functions in SampleBuffer
* Dynamically include supported audio file types
* Remove redundant inline specifier
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Translate file types
* Cache calls to SampleDecoder::supportedAudioTypes
* Fix translations in SampleLoader (again)
Also ensure that all the file types are listed first.
Also simplified the generation of the list a bit.
* Store static local variable for supported audio types instead of in the header
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Clamp frame index depending on loop mode
* Inline member functions of PlaybackState
* Do not collect errors in SampleLoader when loading projects
Also fix conflicts with surrounding codebase
* Default construct shared pointers to SampleBuffer
* Simplify and optimize Sample::visulaize()
* Remove redundant gui:: prefix
* Rearrange Sample::visualize after optimizations by DanielKauss
* Apply amplification when visualizing sample waveforms
* Set default min and max values to 1 and -1
* Treat waveform as mono signal when visualizing
* Ensure visualization works when framesPerPixel < 1
* Simplify Sample::visualize a bit more
* Fix CPU lag in Sample by using atomics (with relaxed ordering)
Changing any of the frame markers originally took a writer
lock on a mutex.
The problem is that Sample::play took a reader lock first before
executing. Because Sample::play has to wait on the writer, this
created a lot of lag and raised the CPU meter. The solution
would to be to use atomics instead.
* Fix errors from merge
* Fix broken LFO controller functionality
The shared_ptr should have been taken by reference.
* Remove TODO
* Update EnvelopeAndLfoView.cpp
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* Update src/gui/clips/SampleClipView.cpp
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* Update plugins/SlicerT/SlicerT.cpp
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* Update plugins/SlicerT/SlicerT.cpp
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
* Store shortest relative path in SampleBuffer
* Tie up a few loose ends
* Use sample_rate_t when storing sample rate in SampleBuffer
* Add missing named requirement functions and aliases
* Use sampledata attribute when loading from Base64 in AFP
* Remove initializer for m_userWave in the constructor
* Do not use trailing return syntax when return is void
* Move decoder functionality into unnamed namespace
* Remove redundant gui:: prefix
* Use PathUtil::toAbsolute to simplify code in SampleLoader::openAudioFile
* Fix translations in SampleLoader::openAudioFile
Co-authored-by: DomClark <mrdomclark@gmail.com>
* Fix formatting for ternary operator
* Remove redundant inlines
* Resolve UB when decoding from Base64 data in SampleBuffer
* Fix up SampleClip constructors
* Add AudioResampler, a wrapper class around libsamplerate
The wrapper has only been applied to Sample::PlaybackState for now.
AudioResampler should be used by other classes in the future that do
resampling with libsamplerate.
* Move buffer when moving and simplify assignment functions in Sample
* Move Sample::visualize out of Sample and into the GUI namespace
* Initialize supportedAudioTypes in static lambda
* Return shared pointer from SampleLoader
* Create and use static empty SampleBuffer by default
* Fix header guard in SampleWaveform.h
* Remove use of src_clone
CI seems to have an old version of libsamplerate and does not have this method.
* Include memory header in SampleBuffer.h
* Remove mutex and shared_mutex includes in Sample.h
* Attempt to fix string operand error within AudioResampler
* Include string header in AudioResampler.cpp
* Add LMMS_EXPORT for SampleWaveform class declaration
* Add LMMS_EXPORT for AudioResampler class declaration
* Enforce returning std::shared_ptr<const SampleBuffer>
* Restrict the size of the memcpy to the destination size, not the source size
* Do not make resample const
AudioResampler::resample, while seemingly not changing the data of the resampler, still alters its internal state and therefore should not be const.
This is because libsamplerate manages state when
resampling.
* Initialize data.end_of_input
* Add trailing new lines
* Simplify AudioResampler interface
* Fix header guard prefix to LMMS_GUI instead of LMMS
* Remove Sample::resampleSampleRange
---------
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
Co-authored-by: Daniel Kauss <daniel.kauss.serna@gmail.com>
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
Co-authored-by: DomClark <mrdomclark@gmail.com>
Fix a floating point exception in the Spectrum Analyzer which occurs if the amplitude is 0. The amplitude is used in the calculation of a logarithm which is not defined for values smaller or equal to 0.
The fix is to replace a value of 0 with the minimum positive float value. Negative values are not handled because it seems that only values greater or equal to 0 are fed into the method. This assumption is asserted in case this ever changes.
* Replace knobFModel with std::vector
* Create QPixmap's on the stack
* Assign parent for QGraphicsScene
A call to QGraphicsView::setScene does not make
the view take ownership of the scene.
* Do not allocate QList on the heap
* Use static QPixmap's
The QPixmap's need to be created within the constructor, and not outside
where they are defined, since it can't find them otherwise.
I'm not too sure why.
* Clear m_vi2->knobFModel in destructor
* Use local static QPixmap's
* Do not allocate QPixmap with new in AudioFileProcessor
* Do not allocate QPixmap with new in Nes
* Do not allocate QPixmap with new in Organic
* Do not allocate QPixmap with new in SaControlsDialog
* Do not allocate QPixmap with new in Vestige
* Do not allocate QPixmap with new for FileBrowser
* Do not allocate QPixmap with new in MixerLine
* Do not allocate QPixmap with new in SendButtonIndicator
* Do not allocate QPixmap with new in AutomationClipView
* Do not allocate QPixmap with new in MidiClipView
* Do not allocate QPixmap with new in AutomationEditor
* Do not allocate QPixmap with new in PianoRoll
* Do not allocate QPixmap with new in TimeLineWidget
* Do not allocate QPixmap with new in EnvelopeAndLfoView
* Do not allocate QPixmap with new in PianoView
* Do not allocate QPixmap with new in ComboBox
* Do not allocate QPixmap with new in Fader
* Do not allocate QPixmap with new for LcdWidget
* Do not allocate QPixmap with new for LedCheckbox
* Use m_ as prefix for members
* Use uniform initialization
I already started using uniform initialization for the QPixmap changes
for some reason, so I'm finishing that up.
* Uniform initiaization
* And then he realized he was making copies...
* Do not call QPixmap copy constructor
* Do not call QPixmap copy constructor in SaControlsDialog
* Do not make pixmap's static for Lcd's and Led's
* Initialize pixmaps in-class
* Fix few mistakes and formatting
Improves performance when searching in the file browser (confirmed with profiling using KCacheGrind), adds a search indicator at the bottom to let the user know a search is in progress, blacklists unnecessary system directories (speeding up both the search speed and potentially load times as well by reducing the number of filesystem entries to consider), and fixes an issue that causes not all of the search results to appear.
* Initial Commit
Starts implementing Note Types. The two available types are
RegularNote and StepNote. PianoRoll now paints the color with a
different color for StepNotes. Pattern::addStep now sets the type of the
note to StepNote.
Negative size is still used to signal a step note.
* Update Pattern.cpp to account for the Note::Type
Updates the methods noteAtStep(), addStepNote() and checkType()
from Pattern.cpp to account for the note type and not the note length.
* Update PatternView::paintEvent to draw step notes
PatternView::paintEvent now draws the pattern if the pattern
type is BeatPattern and TCOs aren't fixed (Song Editor). Color used is
still the BeatPattern color (grey) and the conditional doesn't look very
nice and can be improved.
Pattern::beatPatternLength was also updated so it accounts for
the note type not note length. Review this method, as it looks a bit
weird (particularly the second conditional).
* Implements StepNotes setting a NPH with 0 frames
Now, instead of TimePos returning 0 for negative lengths, we
create a NotePlayHandle with 0 frames when the note type is StepNote on
InstrumentTrack::play.
* Improves PatternView::paintEvent conditional
Improves a conditional inside PatternView::paintEvent by
reversing the order in which they are executed.
* Adds upgrade method for backwards compatibility
Adds an upgrade method that converts notes with negative length
to StepNotes, so old projects can be loaded properly.
Explicitly set the Note::RegularNote value as 0.
Make the default "type" value "0", so notes without a type are
loaded as RegularNotes.
* Addresses Veratil's review
- Changes "addStepNote" so "checkType" isn't called twice in a
row.
- Changes style on a one line conditional.
* Uses ternary expression on statement
Reduces number of lines by using ternary expression.
* Addresses PR review (sakertooth)
- Changes class setter to inline
- Uses enum class instead of enum
- Uses auto and const where appropriate
* Finished changes from review (sakertooth)
- Used std::max instead of qMax
- Fixed style on lines changed in the PR
* Uses std::find_if to save codelines
As suggested by sakertooth, by using std::find_if we are able to
simplify the checkType method to two lines.
* Addresses review from sakertooth
- Reverts m_detuning in-class initialization
- Removes testing warning
- Removes unnecessary comment
* Addresses DomClark's review
- Rename the Note Types enum to avoid redundancy
- Uses std::all_of instead of std::find_if on MidiClip checkType
- Rewrites addStepNote so it sets the note type before adding it
to the clip, avoiding having to manually change the type of the clip
after adding the note
* Updates MidiExport to use Note Types
- Now MidiExport is updated to use note types instead of relying
on negative length notes.
- For that change it was necessary to find a way of letting
MidiExport know how long step notes should be. The solution found was to
add an attribute to the Instrument XML called "beatlen", which would
hold the number of frames of the instrument's beat. That would be
converted to ticks, so we could calculate how long the MIDI notes would
have to be to play the whole step note. If the attribute was not found,
the default value of 16 ticks would be used as a length of step notes,
as a fallback.
* Fixes ambiguity on enum usage
Due to changes in the name of enum classes, there was an
ambiguity caused in NotePlayHandle.cpp. That was fixed.
* Addresses new code reviews
- Addresses code review from PhysSong and Messmerd
* Fixes note drawing on Song Editor
- Notes were not being draw on the song editor for BeatClips.
This commit fixes this.
* Adds cassert header to TimePos.cpp
- Adds header to use assert() on TimePos.cpp
* Apply suggestions from code review
Fixes style on some lines
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Reverts some changes on MidiExport
- Some changes were reverted on MidiExport and InstrumentTrack.
We were storing the beat length on the XML of Instrument Tracks, but in
reality the beat length is a per note attribute, and some instruments
could run into a segmentation fault when calling beat length without a
NotePlayHandle (i.e.: AFP). Because of that I reverted this change, so
the beat length is not stored on the XML anymore, and instead we have a
magic number on the MidiExport class that holds a default beat length
which is actually an upper limit for the MIDI notes of step notes. In
the future we can improve this by finding a way to store the beat length
on the note class to use it instead. The MidiExport logic is not
worsened at all because previously the beat length wasn't even
considered during export (it was actually improved making the exported
notes extend until the next one instead of cutting shorter).
* Fix the order of included files
---------
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
The revamp consists of one lock. When the audio thread needs to render audio or another thread wants to run a change, acquiring the lock grants mutual exclusion to do one of the two. The intention is that this will provide stronger guarantees that changes do not run concurrently with the audio thread, as well as having the synchronization mechanism itself be free of data races (verified with TSan).
* Added floating-point vorbis BPM tags to files in lmms/data/samples/beats
* Added rounded BPM to filenames, surrounded by square brackets and separated from the rest of the filename by an underscore
This fixes at least three issues:
* Help window is not synched with window manager's `X`-button
* Help window is not being closed on track destruction or on closing the plugin window
* Trims help window strings and force-adds a newline, because `QLabel::sizeHint` sometimes computes too small values. Now, together with #6956, all help windows fit their strings. Some help windows are too large by one line, but this seems better than forcing the user to resize them if they are too small by one line.
Before this commit, on creation, `SubWindow` gets resized to exactly the
children's `sizeHint`. This makes the child too small, since the
`SubWindow` already contains a title bar and borders.
With this commit, the `SubWindow` is calculated such that after
rendering, the child window gets exactly the `size` that its `sizeHint`
has previously suggested.
Most of LMMS widgets are not resizable, but the Lv2 help window is a
good example to test this out. The help windows now in most cases
contain enough space to fit the help text. In some cases, it still does
not fit, though debug prints show that the `size` matches the
`sizeHint`.
This PR is a about reloading an `Lv2Proc`, e.g. in case of a sample rate
change.
Prior to this PR, #6419 handled this by first saving the models into
XML, then destroying and re-initializing the whole `Lv2Proc` and finally
reloading the saved XML. However, #6786 shows that the automation is not
properly restored in such a case.
This PR thus attempts to not destroy the automatable models, just
everything else. This is done by moving `Lv2Proc::createPorts` into the
CTOR before calling `Lv2Proc::initPlugin`, which makes `initPlugin()`
and `shutdownPlugin()` proper inverses of each other (note that in jalv,
the ports are also created before the features are). The new class
`Lv2ProcSuspender` adds an RAII interface for reloading the `Lv2Proc`.
Note that another, possibly more clean approach would be to separate the
features and the plugin from the models ("controls"), to then only
destroy the features and the plugin. This could be done by having
`Lv2Effect` contain an `Lv2Proc` and `Lv2FxControls` contain an
`Lv2ProcControls`. Then the effect classes are the usual way round, and
you still maintain the separation between processor and controls in the
core LV2 code. (Similarly for the instrument, except we don't have a
processor/control split for instruments, so an instance of each class
would be contained within the same instrument instance.) - Thanks for
this proposal to @DomClark .
Improves the search performance of the file browser by delegating the search to a worker thread. The main thread then builds the tree and displays it to the user.
Fixes LV2 instrument instantiation crash which occurs when right-clicking an LV2
instrument in the plugin browser and then clicking "Send to new instrument
track"
Make the search features more prominent by adding an icon with a magnifying glass to the line edits. Because there is no specific icon for "search" the same icon as for "zoom" is used.
Make the "Search" text translatable in `PluginBrowser.cpp` and add a search icon.
Make the search in the effects selection dialog more similar to the other ones by adding a search icon and a placeholder text and by enabling the clear button.
Make some whitespace adjustments in the vicinity of the other adjustments.
Use function pointers instead of signals and slots for some connections. Use a lambda for the slot in the file browser code because GCC does not compile if the parameters differ between the connected functions. It seems that it cannot deal with default parameters.
It could be considered to create the search line edits in a factory although this would not work for the effects select dialog because its line edit is created in the UI file. In that case we'd have to add an additional method like `embellishLineEditForSearch(QLineEdit*)` or something similar to the factory.
Fixes#6966.
Homebrew doesn't provide bottles for macOS 11 anymore, causing
dependencies to be compiled in CI which takes approximately 173 years.
Therefore, upgrade to macOS 12 and
- remove DEVELOPER_DIR environment variable which caused problems but
its removal doesn't appear to break anything
- upgrade npm because versions before 10.2.2 use Python's distutils
package which was removed in Python 12. See
- https://github.com/npm/cli/pull/6937
- https://github.com/nodejs/node-gyp/issues/2869
Updating to use the recommended method QSaveFile instead of QFile.
Hopefully fix issue where LMMS in rare occasions would produce empty
files on save.
---------
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update third-party actions to latest version
* Use vcpkg in manifest mode
* Only trim ccache after build
* Use ccache with MSVC
* Use Brewfile and cache Homebrew downloads
* Use --print-config for ccache 3
* Attempt to make ccache actually work with MSVC
* Zero ccache stats before building
* Use SDL2 on macOS
As discovered by @michaelgregorious & @zonkmachine, applyRelease's
condition to determine whether the release ramp starts within the
current buffer was off by 1 frame, running the release code when the
ramp should only start in frame 0 of the next buffer. This could cause
the ramp to be miscalculated, starting at a value greater than 1.0 and
and thus actually amplifying the signal.
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>
* Lv2Proc: Delay worker iface (Fixes#6946) (#6947)
This delays passing the `LV2_Worker_Interface` to the `Lv2Worker` class,
because prior to the patch, the instance, which provides the interface,
has not been initialized yet, which resulted in a segfault.
* Update src/core/lv2/Lv2Worker.cpp
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* setIface -> setInterface
* `if(` -> `if (`
* Update src/core/lv2/Lv2Proc.cpp
Co-authored-by: saker <sakertooth@gmail.com>
* Rework, editorial, from @sakertooth
* Fixup: `interface` is reserved on MSVC
https://stackoverflow.com/a/25234279
* Apply suggestions from code review
Co-authored-by: saker <sakertooth@gmail.com>
* Initialize handle/interface as nullptr
---------
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
Co-authored-by: saker <sakertooth@gmail.com>
Introduced in #5970 , `CPULoadWidget::m_stepSize` is uninitialized,
leading to valgrind warnings:
```
==9429== Conditional jump or move depends on uninitialised value(s)
==9429== at 0x3715A9: int const& std::max<int>(int const&, int const&) (stl_algobase.h:262)
==9429== by 0x59E3BB: lmms::gui::CPULoadWidget::stepSize() const (CPULoadWidget.h:59)
==9429== by 0x59DA2E: lmms::gui::CPULoadWidget::paintEvent(QPaintEvent*) (CPULoadWidget.cpp:78)
```
Even though `grep` shows:
```
data/themes/classic/style.css: qproperty-stepSize: 4;
data/themes/default/style.css: qproperty-stepSize: 1;
```
It seems like the issue is caused by paint events occurring even before
the style sheet has been applied. In order to fix this, and to be future
proof with style sheets which do not set it, we initialize
`CPULoadWidget::m_stepSize` to `1`.
* Updated some old file filtering code.
I was trying to add a way to show/hide the .bak and other files with some
filter buttons when I noticed the code in FileBrowser::addItems was copy
pasta that had lava flowed from the much more modern Directory::addItems.
In addition, only, FileBrowser::addItems was not respecting the filter's
at all. I brought both of them into line with Qt 5 practices which
now respects the m_filter list of extensions for both FileBrowser
and Directory. In Directory::addItems I only needed to change where
the match was being done, FileBrowser::addItems didn't try to
filter/match at all.
* Set name filters inside entryInfoList call, const
Some fixes for const iterating the file list.
Setting file name filters along with the call instead of seperately.
* Style changes src/gui/FileBrowser.cpp
Co-authored-by: saker <sakertooth@gmail.com>
* Fixed style/format FileBrowser.cpp
---------
Co-authored-by: saker <sakertooth@gmail.com>
This PR makes changes in the submodule `zynaddsubfx`. It affects its
submodule `instruments`:
* updates the URL to use github (since SF is less reliable)
* changes the protocl from SSH to HTTPS (see
https://stackoverflow.com/a/50299434)
* does not change the submodule's commit ID
You must now run
```
git submodule sync --recursive
```
once to reflect this change.
* Fix warnings "QPainterPath::lineTo Invalid coordinates" on console when loading the effect or changing
some paramenters, by not "drawing" the EQ curve when there is no EQ band active.
* Fix warnings on console "QPainterPath::lineTo Invalid coordinates" when EQ is processing a sound, because
in this function log10f generates a pole error when freq is 0, returning and invalid x value pixel
* Update plugins/Eq/EqCurve.cpp
---------
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
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>
* Fix issue with knob range
* Randomness for BandedWG
* Implement Tubular Bells ADSR
* LFO - update values on change while playing
* coding style
* Vibrato Gain - update
LMMS supports the Lv2 feature powerOf2BlockLength. Plugins that need to be a
power of two (32, 64, 128...) are not loaded if the buffer size setting is set
to something else. However this logic breaks down on buffer sizes larger than
256. On larger sizes, LMMS works with chunks of 256 and plugins are still
presented with a value of 256. So anything larger than 256 is a valid size as
powerOf2BlockLength is concerned. LMMS supported powerOf2BlockLength correctly
since 9c46370 but setup manager messages and comments are wrong in too strictly
demanding an actual power of two value. 768 is not a power of two, but three
chunks of 256 which are power of two values.
Co-authored-by: Johannes Lorenz <1042576+JohannesLorenz@users.noreply.github.com>
* fixed cmakelists conditions
* Fixed the order messup.
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
---------
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
Enable the removal of the `LedCheckBox` include by commenting out code instead of using an `if(false)` statement.
The commented out code was adjusted so that it would work with the current usage of layouts.
Give the reset buttons for auto save and buffer size a rectangular shape. The size is fixed but the button and the pixmap scale with different scaling factors so that should be ok.
This fixes to bugs leading to clicks on instrument note-off in most
instruments.
The first bug was introduced as part of a refactoring done by Vesa [1]
and caused each note play handle's last buffer being dropped because
the play handles were deleted before being processed in AudioPort.
Thanks to @lleroy for pointing this out. [2]
The second bug / typo has always been there [3] and was a misplaced
parenthesis in Instrument::applyRelease breaking the calculation of the
note-off envelope's start frame, sometimes putting it outside of the
buffer.
Fixes#3086
[1] 857de8d2c8 and related commits
[1] https://github.com/LMMS/lmms/issues/3086#issuecomment-519087089
[2] 02433380c6
* Mallets - Add random knob function
Implement randomness for the instrument. When Random is applied, Hardness and Position of instrument 1 - 9, or Modulator and Crossfade on instrument 10 (Tubular Bells), are nudged on every note to liven up the sound. With the modulated knobs placed at their center values, Random at max will select from the full range of possible values.
Co-authored-by: saker <sakertooth@gmail.com>
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
lilv can return the scale points in randomized order, and so the linked
models (of stereo effects wit 2 `Lv2Proc`) may have different scale
points. This would mean that the same combo enumeration value would have
different float values in linked models. This problem is fixed by
sorting the scale values.
Also, it is more natural for users if scale points are enumerated in a
numerical order.
This displays a warning dialog if the users requests unusual
buffersizes:
- buffersizes less than 32
- buffersizes which are not a (natural number) power of 2
This commit also replaces some `setGeometry` stuff by `QBoxLayout`.
This improves the way digits are calculated for display in
`Lv2ViewProc`:
- More than 2 digits are now recognized
- Minus signs are now recognized
- Tests have been added
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.
Replace the check for a `nullptr` buffer with a check that checks if the NotePlayHandle uses a buffer. This is effectively the same condition that's used by `PlayHandle::doProcessing` to decide if it should call play with a `nullptr` in the first place. Hence it should be the most fitting check.
Remove whitespace in methods and add it to the parenthesis of some statements. Remove underscores from parameter names. Remove usage of `this` pointer.
Add `auto` keyword to shorten line length in `InstrumentPlayHandle::play`.
Move `const_cast` of `NotePlayHandle` closer to the `process` method as this method is the reason that the cast is needed in the first place. One might also add a version of `nphsOfInstrumentTrack` that returns a non-const result but it seems to be a general problem of a missing clear responsibility so I keep it as is.
Remove identical calls to `InstrumentTrack::processAudioBuffer` which appear in the overridden implementations of `Instrument::play` and `Instrument::playNotes`. Instead the call to `processAudioBuffer` has been moved into `InstrumentPlayHandle::play` and `InstrumentTrack::playNote`. These two methods call the aforementioned methods of `Instrument`. Especially in the case of `InstrumentTrack::playNote` the previous implementation resulted in some unncessary "ping pong" where `InstrumentTrack` called a method on an `Instrument` which then in turn called a method on `InstrumentTrack`. And this was done in almost every instrument.
In `InstrumentTrack::playNote` an additional check was added which only calls `processAudioBuffer` if the buffer is not `nullptr`. The reason is that under certain circumstances `PlayHandle::doProcessing` calls the `play` method by explicitly passing a `nullptr` as the buffer. This behavior was added with commit 7bc97f5d5b. Because it is unknown if this was done for some side effects the code was adjusted so that it behaves identical in this case.
Move the complex implementation for `InstrumentPlayHandle::play` and `InstrumentPlayHandle::isFromTrack` into the cpp file and optimize the includes.
* FileDialog : Adding mounted volumes on Linux
* Adding some file systems types and collapsing 2 'if' statements in one
* Removing the foreach
* Correcting PREPROCESSOR directive
* fixes#6354: Sample and Hold for LFO Controller
LFO controller's "white noise" wave shape didn't respect the frequency knob at all, so
Sample-and-Hold was added to extend the functionality of the LFO Controller with this
random waveshape. The original functionallity can still be accessed by setting the
FREQ knob to minimum (0.01)
---------
Co-authored-by: Kevin Zander <veratil@gmail.com>
Co-authored-by: saker <sakertooth@gmail.com>
* Change the title for SideBarWidgets to be vertically centered related to icon and with no underlining
* Update src/gui/SideBarWidget.cpp
Co-authored-by: saker <sakertooth@gmail.com>
* Updating FileBrowser display when searching : showing matching files
* Correcting increment and removing duplicated calls
* Correcting reload tree when filter is activated
---------
Co-authored-by: saker <sakertooth@gmail.com>
* Add options to enable sanitizers
* Specify them as debugging options
* Apply suggestions made by Dom
* Fix linking issues
There were linking issues, most likely because we were
applying the sanitizer flags to unnecessary targets that
are part of the build. Now, we only focus on adding the
compiler flags to lmmsobjs as a PUBLIC dependency,
and selectively choose what targets we need to apply
the linker flags to as PRIVATE dependencies.
* Add UBSan
* Add status messages
* Remove GNU as supported compiler for MSan
* Revert to using add_<compile|link>_options again
* Fix sanitizer linkage within veal and cmt libraries
I suspect that our sanitizer flags were removed for these two CMake
targets. Instead of setting the properties directly, we call
target_compile_options and target_link_options
instead.
* Remove TODO comment
* Revert "Fix sanitizer linkage within veal and cmt libraries"
This reverts commit b04dce8d8c.
* Use CMAKE_<LANG>_FLAGS_<CONFIG> and apply fixes
* Remove quotes
* Add support for additional flags
* Disable vptr for UBSan
* Print "Debug using" in status for clarity
* Wrap ${supported_compilers} and ${status_flag} in quotes
* Replace semicolons with spaces in additional_flags
* Remove platform check for no-undefined flag
The platform check was added as an attempt
to make this branch compile with the veal
and cmt libraries. However, it seems to work
without it, so the problem must've been something
else occuring in these files.
* Undo change to FP exceptions status message
* Use spaces instead of tabs
* Remove -no-undefined flag for cmt and veal libraries
The quantPos arg of AutomationClip::setDragValue causes the node time
to be quantized before its looked up in the timeMap iterator.
This results in the node not being found and a new one being created
inside the setDragValue function even though we had found one.
Simply setting it to true causes this bug, simply setting it to false
causes a new node to be created off grid/not snapped. So the fix
is to quantize the position for the lookup only if we haven't found an
existing node under the cursor.
* 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>
* Fix LADSPA effects memory leak
* Fix buffer overflow in PianoView
* Avoid using invalid iterators in AutomationClip
* Fix memory leaks in SimpleTextFloat
* Handle potential case where QMap::lowerBound(...) returns end iterator
* Implement suggestions from review
* 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
* Add `ArrayVector` class template and tests
* Fix counting of failed test suites
* Support detuning and panning with Sf2 Player
* Restrict panning to supported FluidSynth versions
* Fix data array cast type
* Fix tests for Qt<5.10 and correct mistaken test
* DIsplay warning for FluidSynth < 2
* Remove unnecessary clamp
* Update include guard name
* Showing Knob value on mouse over
* Correcting minors source code issues
* Correcting double QTimer include
* Removing blank lines
* Removing space and add one
* Update src/gui/widgets/SimpleTextFloat.cpp
Co-authored-by: saker <sakertooth@gmail.com>
* Correcting QTimer
* Remove a parameter that has the default value
---------
Co-authored-by: saker <sakertooth@gmail.com>
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.
* Add mixer channel LCD to SampleTrackView
* Increase sizes to compensate for LCD box
The DEFAULT_SETTINGS_WIDGET_WIDTH and
DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT
were both increased by +32 pixels. TRACK_OP_WIDTH
and TRACK_OP_WIDTH_COMPACT were then changed
relative to that increase.
* Use Qt layout in SampleTrackView
* Add mixer channel LCD to InstrumentTrackView
* Move LCD box to the right of the track label
* Revert changes to TRACK_OP_WIDTH and TRACK_OP_WIDTH_COMPACT
* Change the title for SideBarWidgets to be vertically centered related to icon and with no underlining
* Update src/gui/SideBarWidget.cpp
Co-authored-by: saker <sakertooth@gmail.com>
---------
Co-authored-by: saker <sakertooth@gmail.com>
Towards the end of the development for the fix of #6548 (via #6725) the upgrade code was refactored into its own class. While doing so it was forgotten to actually call the `upgrade` method on the `UpgradeExtendedNoteRange` instance. As a result almost all files should currently open in a wrong state with many instruments transposed. This commit fixes this.
Also explicitly check the assertion that BB tracks do not contain other BB tracks.
* Modifier keys for mouse wheel adjustments (#6769)
Give the users the option to use modifier keys (Shift, Ctrl, Alt) to
switch between different scales of adjustment when changing knob values
using the mouse wheel.
The commit implements the following behaviour:
* Using the mouse wheel without any modifier keys makes coarser
adjustments than the current default, i.e. the range of the
parameter can be swept with 100 mouse wheel events instead of 2000.
* Pressing the "Shift" key while using the mouse wheel allows making
coarser adjustments than the default. The range can be swept with
10 mouse wheel events.
* Pressing the "Ctrl" key allows making finer adjustments than the
default. The range is swept with 1000 events.
* Pressing the "Alt" key allows even finer adjustments. The range is
swept with 2000 events (the current default).
Most of these scales are organized in magnitudes (10, 100, 1000) which
should give a very natural feeling to "zone in" on a value.
* Fix indentation of comments
Fix the indention of comments as Qt Creator seems to be incapable of
copy-pasting code in a sensible way.
* Fix comments
Fix the comments by describing better the ideas instead of referencing values.
* Fix format in src/gui/widgets/Knob.cpp
---------
Co-authored-by: saker <sakertooth@gmail.com>
* fixed#6759: Context menu string doesn't update
The TempoSyncKnobModel didn't emit any signal when the a
SyncMode::Custom was recaclulated.
Also it looks like someone broke the TempoSyncKnowModel
bc SyncMode had been renamed to TempoSyncMode and the
build was screaming.
* fixed#6759: Knob custom tempo
The TempoSyncKnobModel didn't emit any signal when the a SyncMode::Custom was recalculated.
Also it looks like someone broke the TempoSyncKnowModel
because SyncMode had been renamed to TempoSyncMode and the
build was screaming.
Recommit, fixed silly mistake where the signal would be emitted twice
on mode change to Custom.
* Update src/core/TempoSyncKnobModel.cpp
Co-authored-by: saker <sakertooth@gmail.com>
* Update src/core/TempoSyncKnobModel.cpp
Co-authored-by: saker <sakertooth@gmail.com>
* Use function pointers for connect TempoSyncKnob.cpp
* Silly fp mistake fixed in TempoSyncKnob.cpp
* Unfixed second macro call for now: TempoSyncKnob.cpp
---------
Co-authored-by: saker <sakertooth@gmail.com>
* Add Tap Tempo Feature (#6375)
Resolves#5181
* Update formatting, use namespaces, etc.
* Use Qt Designer .ui file to handle the UI
Thanks to irrenhaus for the idea
Also added a few buttons I will add functionality for
* Play metronome sound when tapped
* Improve stabilization speed by comparing differences in length between intervals
To improve the speed at which the BPM counter stabilizes at a
certain number, we now compare the differences in length between
the last two taps and the most recent two taps and reset the counter
if the threshold is passed.
I made it so that a difference of 500 ms resets the counter.
* Remove duplicate m_ui
An artifact from my battle with Git and merge conflicts..
* Format TapTempoUi header file
* Add lmms namespace in UI file
* Remove taptempo.ui XML file
Not needed
* Add LMMS_EXPORT to SamplePlayHandle
* Use std::chrono::duration<double, std::milli> for intervals
Co-authored-by: irrenhaus3 <irrenhaus3@gmail.com>
* Use alias for steady_clock
Co-authored-by: irrenhaus3 <irrenhaus3@gmail.com>
* Speed up convergence by accounting for recent intervals
This uses a combination of keeping track of a more accurate BPM,
while also using a BPM difference threshold to move towards the true BPM
more quickly.
After three taps, a "recent interval" is calculated, which is similar
to the latest interval, but less fluctuating since it accounts for
three taps instead of one. This allows for comparing between
the BPM on the display with the recent BPM more closely.
We then compare the difference in magnitude of both BPM's
with the threshold. If the threshold is passed, the counter gets reset.
* Remove semicolon from "QOBJECT;" in plugins/TapTempo/TapTempo.h
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
* Add newline between using alias and constructor
* Cleanup header files
* Add // namespace lmms::gui comment
* Rename header guards in plugins/TapTempo/TapTempo.h
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Rename header guards in plugins/TapTempo/TapTempo.h
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Rename header guards in plugins/TapTempo/TapTempoUi.h
Will merge this file with ``TapTempoView`` soon.
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Rename header guards in plugins/TapTempo/TapTempoUi.h
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Update plugins/TapTempo/TapTempo.h
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Replace virtual with override in plugins/TapTempo/TapTempo.h
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Merge UI file into TapTempoView
* Pass TapTempo* directly into constructor in plugins/TapTempo/TapTempoView.h
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Update style in plugins/TapTempo/TapTempoView.h
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Add parameter name for keyPressEvent function in plugins/TapTempo/TapTempoView.h
Also reorder the function declarations to match the order in the source file.
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Remove dynamic_cast to TapTempo* in plugins/TapTempo/TapTempoView.cpp
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Restrict C linkage to only lmms_plugin_main and plugin descriptor
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Simplify algorithm
* Update labels when calling closeEvent
* Add reset button
* Adjust layout
* Format document
* Only allow the tap button to gain focus
* Use icon provided by LMMS
* Add sync button and adjust formatting
* Make the metronome downbeat the first beat
Also simplify code
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Round BPM values when syncing with project tempo
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Change Plugin::Tool to Plugin::Type::Tool
---------
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
* Fix if statement in ClipView
* Move controllers.begin() to be the first argument
It was the second argument, which means it could've
returned negatives for random access iterators.
* Replace QVector with std::vector in AudioEngine
* Replace QVector with std::vector in AudioEngineWorkerThread
* Replace QVector with std::vector in AudioJack
* Replace QVector with std::vector in AutomatableModel
* Replace QVector with std::vector in AutomationClip
* Replace QVector with std::vector in AutomationEditor
* Replace QVector with std::vector in ConfigManager
* Replace QVector with std::vector in Controller
* Replace QVector with std::vector in ControllerConnection
* Replace QVector with std::vector in EffectChain
* Replace QVector with std::vector in EnvelopeAndLfoParameters
* Replace QVector with std::vector in InstrumentFunctions
* Replace QVector with std::vector in MidiClient
* Replace QVector with std::vector in Mixer
* Replace QVector with std::vector in Note
* Replace QVector with std::vector in PeakController
* Replace QVector with std::vector in PianoRoll
* Replace QVector with std::vector in PluginFactory
* Replace QVector with std::vector in RenderManager
* Replace QVector with std::vector in StepRecorder
* Replace QVector with std::vector in Track
* Replace QVector with std::vector in TrackContainer
* Replace QVector with std::vector in Song
* Adapt QVector to std::vector changes in ControllerConnectionDialog
* Phase 2: Use std::abs in panning.h
Without this, the QVector changes will make the code not compile.
* Phase 2: Replace QVector with std::vector in PeakControllerEffect
* Phase 2: Replace QVector with std::vector in AutomatableModel
* Phase 2: Replace QVector with std::vector in AutomationClip
* Phase 2: Replace QVector with std::vector in ControllerConnection
* Phase 2: Replace QVector with std::vector in EffectChain
* Phase 2: Replace QVector with std::vector in Mixer
* Phase 2: Replace QVector with std::vector in PeakController
* Phase 2: Replace QVector with std::vector in RenderManager
* Phase 2: Replace QVector with std::vector in Song
* Phase 2: Replace QVector with std::vector in StepRecorder
* Phase 2: Replace QVector with std::vector in Track
* Phase 2: Replace QVector with std::vector in TrackContainer
* Phase 2: Adapt QVector changes in EffectRackView
* Phase 2: Adapt QVector changes in AutomationClipView
* Phase 2: Adapt QVector changes in ClipView
* Phase 2: Adapt QVector changes in AutomationEditor
* Phase 2: Adapt QVector changes in PianoRoll
* Phase 2: Adapt QVector changes in TrackContainerView
* Phase 2: Adapt QVector changes in TrackContentWidget
* Phase 2: Adapt QVector changes in InstrumentTrack
* Phase 2: Adapt QVector changes in MidiClip
* Phase 2: Adapt QVector changes in SampleTrack
* Fix segmentation fault in ConfigManager::value
* Fix unintended faulty std::vector insert in AutomationClip::resolveAllIDs
* Resolve trailing whitespace in src/core/StepRecorder.cpp
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
* Use std::next and std::prev in EffectChain::moveUp/moveDown
* Introduce static "combineAllTracks" function in AutomationClip
* Adjust variable name in Song::automatedValuesAt
* Adjust removal of long step notes in StepRecorder::removeNotesReleasedForTooLong
* Iterate over m_chords by const reference in src/core/InstrumentFunctions.cpp
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
* Fix StepRecorder::removeNotesReleasedForTooLong again
* Combine the ConfigManager::value overloads using std::optional
* Revise StepRecorder::removeNotesReleasedForTooLong
* Remove redundant std::optional in ConfigManager::value
* Remove trailing whitespace in ConfigManager::value
* Fix: Prevent incorrect use of std::distance when element not found
* Chore: Remove trailing whitespace in edited files
* Only set the id attribute if the controller was found
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
* Remove extra indents from 84b8fe8a559855ed263b74cc582eab3655250c5f
* Fix compilation issues
* Add LMMS_ prefix for header guard in Track.h
* Undo changes made to MixerView::deleteUnusedChannels
* Simplify code to handle failure of finding tracks
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
* Split ternary operator into separate if statement
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
* Undo changes to indentation in MixerRoute
* Do general clean-up
Some of the changes made:
+ Use auto where benefical
+ Fix bug in AutomatableModel::globalAutomationValueAt (for loop should be looping over clips variable, not clipsInRange)
+ Undo out of focus whitespace changes
* Always assign to m_steps regardless if clip is found or not
Even when the clip is not found (i.e., currentClip is -1), m_steps still
gets assigned to.
* Insert at the end of tracks vector in src/core/Mixer.cpp
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
* Insert at the end of tracks vector in src/core/Mixer.cpp (2)
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
* Remove redundant template parameter
* Use std::array for zoomLevels
---------
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
* Bump submodule and generate std headers
* Commit submodule update
* Downgrade to earlier commit
Can be upgraded once a proper C++20 MinGW compiler
is available for the docker images.
* Downgrade to the correct commit
* Append mingw_stdthreads to EXTRA_LIBRARIES
Currently for this CMake version, it seems that there is no support to
link other targets to object libraries. I'll add it to EXTRA_LIBRARIES
instead.
* Add LMMS_ prefix to USE_MINGW_STD_THREADS
* Use built-in MINGW CMake variable
* Use lowercase rather than uppercase
Issue was caused by an obiwan (off-by-one)
The 'if (y > limit)' test was broken by an incorrect inequality,
should be >=, and a graphical adjustment made previously in the
'y = ...' statement. I perserved the graphical adjustment and
fixed the test to be 'if (y >= limit - 1) { break; }'
* Fixes bug from issue 6002
Since the refactoring of the Copy/Paste features, it was not
possible to paste inside the BBEditor (now Pattern Editor), as reported
on issue #6002. The reason for that is better explained in the issue
discussion.
This PR fixes this by allowing pasting inside the Pattern Editor
when the clipboard has a single Clip, which is what was allowed on the
previous workflow, while at the same time avoiding the unexpected
behavior of pasting multiple Clips that might invade the positions
reserved for different Pattern Tracks.
Add the comment "// namespace lmms" to the closing scope of the lmms
namespaces. The "scripted-checks" are quite strict. Perhaps they should
be renamed to "strict-checks". ;)
Include "cassert" in UpgradeExtendedNoteRange.cpp to hopefully fix the
mingw builds.
Extract the code that upgrades the extended note range into its own
class. This hides the helper functions that are related to the upgrade
from the other upgrade methods in DataFile.cpp.
The header file is put into the src/core directory as it is not part of
the public interface and therefore should not be included in the
"global" include directory. The whole thing is just an implementation
detail of the upgrade in DataFile.cpp.
Previously, the Lv2 controls were checked for control types in this
order:
integer?
enum?
toggle?
generic?
This is bad because it goes from generic (integer) to specific (toggle),
and then defaults to most generic. The order should be specific (toggle)
to generic (integer, generic), which is fixed by this PR.
This solves that controls which are marked "toggle" and "integer" were
being displayed as a spinbox (#6798).
Additional improvement: Only show search bar for more than 5 controls,
previously more than 2 (#6798).
Vertically zooming the piano roll caused highlighted semitones to drift from the actual note positions. This 2-line fix ensures the marked semitones are aligned with the grid lines and notes at all allowed vertical zoom levels.
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.
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
Adjust the layout that's created in AudioSndio::setupWidget::setupWidget
by using a QFormLayout.
This was done in a "blind" fashion as I am not able to compile this
code. Adjustments are very similar to the ones done in
AudioPulseAudio::setupWidget::setupWidget with commit b53290344b
though.
Remove the temporary class `AudioDeviceSetupGroupWidget` and move its
functionality into `AudioDeviceSetupWidget`. This means to let
`AudioDeviceSetupWidget` inherit from `QGroupBox` instead of
`TabWidget`.
Adjust all inheriting classes accordingly. Adjust usages in SetupDialog.
The result should be that even the cases for `LMMS_HAVE_SOUNDIO` and
`LMMS_HAVE_SNDIO` should compile again. Although their layout might look
weird.
Adjust the dialogs of most audio driver settings dialogs by showing them
in a QGroupBox and adjusting their layouts. All dialogs now use
`QFormLayout` to layout their labels and input widgets.
Technical details
------------------
Introduce `AudioDeviceSetupGroupWidget` which is intended to
functionally replace `AudioDeviceSetupWidget` in the long run. This is
likely a temporary replacement in the sense that
`AudioDeviceSetupGroupWidget` will be renamed to
`AudioDeviceSetupWidget` once the latter has been replaced everywhere.
Both classes are very similar and the only difference is that the former
inherits from `QGroupBox` instead of `TabWidget`.
Adjust the using of AswMap so that it is now defined as a map from
`QString` to `AudioDeviceSetupGroupWidget`.
Use `QFormLayout` to layout the widgets of the setup dialogs instead of
hard coding geometries and placement.
TODOs
------
Adjust the widgets for the SoundIO and SndIo cases. These will be a bit
more effort as they are not compiled on my machine.
Use group boxes and layouts for the "MIDI interface" and automatic
assignment tabs.
The configuration/information dialogs for the different drivers still
need adjustments.
Adjust the plugins group to also use a QGroupBox and QCheckBoxes. This
finishes the "Performance" page and also finally enables the removal of
the local variables `XDelta` and `YDelta` as well as the lambda
`addLedCheckBox`.
Other changes
--------------
Add a TODO to some unused code for some advanced setting.
Fix layout of the main widget and the buttons widget. Remove an
erroneous ",1" after a statement.
Make the setup dialog resizable and use widgets that dynamically adjust
to the font size set by the user.
Current status of the tabs:
* General: Done
* Performance: Plugins group needs adjustments
* Audio: Individual settings dialogs need adjustments
* MIDI: Not started yet
* Paths: Done
The "Autosave" and "Buffer size" tabs have been slightly redesigned so
that the revert/reset button is next to the slider.
Technical details
------------------
Setting a fixed size has been removed from the setup dialog so that it
can be resized.
The settings widget (`settings_w`) now has a layout to which the sub
dialogs are added. This is done so that the layout sizes are propagated
upwards, i.e. all widgets along the chain now have a layout so that size
hints are determined correctly.
Instances of `TabWidget` are replaced with instances of `QGroupBox`.
Each group box has a layout to which its children, e.g. check boxes, are
added. These group boxes are then added to the layouts of their parents.
Doing so also removes the need to count how many instances have been
added and calculations on where to put the children.
Instances of `LedCheckBox` are replaced with instances of `QCheckBox`.
This is done in the new helper lambda `addCheckBox`. It's very similar
to the previously used `addLedCheckBox` but creates a `QCheckBox`
instead of a `LedCheckBox`. It returns the created `QCheckBox` as a
result. If a layout is provided the created check box is also added to
the layout before it is returned.
The helper lambda `addPathEntry` has been adjusted to create a
`QGroupBox` and to put all its children in a layout.
The helper method `labelWidget` has been adjusted to not set the font
size of the label.
The method `TabBar::addTab` had to be extended with a new default
parameter which controls if the added widget is fixed to the size of
it's parent or not. In the case of the setup dialog we do not want this.
So far the method is only used by the setup dialog and the
`LadspaBrowser` class. So once the `LadspaBrowser` has been made
resizable the default parameter can be removed again and treated as
always being set to false.
Add `QCheckBox` to the `style.css` so that it does not get a green font
due to the palette magic that's done.
* Fixed issue #5734 (FreeBoy Division by zero).
Added comments and used more descriptive variable names for noise
channel initialization block.
Also indented the nested for loop to improve code clarity.
The reasons for doing this can be found in this answer:
https://softwareengineering.stackexchange.com/a/362796
* Better initial div_ratio guess
Allows us to skip r = 0 and a conditional in the loop below.
---------
Co-authored-by: Spekular <Spekular@users.noreply.github.com>
Fix the base notes and automations of B+B tracks.
This fixes for example the problem that when a TripleOscillator had been
put into a B+B track, e.g. with version 1.2 that it sounded too high
when being loaded with a current master version. The cause seems to be
that the notes of the instrument pattern are corrected/transposed too
often (likely due to the collection of all tracks starting from the
song/document root).
The multiple correction of notes is fixed by traversing the song
structure in a more consise way. First all track containers of the song
are collected and for each of them the tracks are collected. These
tracks are then fixed one by one. B+B tracks are getting a special
handling while doing so. It is assumed that a B+B track cannot have
other B+B tracks inside and therefore all sub tracks of the B+B track
are searched for so that they can be fixed recursively.
Refactor some more functionality into static helper methods:
* Everything beneath a track is now fixed by the helper method
`fixTrack`.
* The fix of the base notes of the instruments themselves and the
extraction of the ids of automated base notes has been moved into
`fixInstrumentBaseNoteAndCollectIds`.
* The lambda `affected` has been converted into a static method because
it is must be accessible by one of the static helper methods.
* The code for fixing the automation tracks of a song has been moved
into the helper function `fixAutomationTracks`.
Fix the problem with the nested for loops that all had variables called
"i" by extracting a helper method with a corrected nesting. Due the
extraction we do not have to care anymore if the correction is running
beneath another for loop with potentially the same variable names.
Move the fix for the automated base notes to the code that fixes the
non-automated base notes.
Improve the fix for automation tracks and patterns by potentially
splitting them into two tracks:
* The original track which is adjusted to only contain patterns with
targets that are not base notes.
* A cloned track that only contains patterns with base note targets.
This is done by iterating over all automation tracks and checking which
types of automations they contain:
* Base note automations
* Automations of other targets
The result for each automation track are then evaluated as follows.
* If an automation track does not contain any base note automations it
is kept as it is, i.e. nothing is done.
* If an automation track only contains patterns with base note
automations its patterns are corrected in place.
* If an automation track contains patterns with base note automations
and other targets then the track is duplicated so that we can split it
as described above. This split and correction is done on a per pattern
level. Patterns that would become empty are removed.
Cloned tracks will keep the same names and attributes as their original
tracks.
TODOs
------
* Base notes are read as integers, corrected by an integer value of 12
and then stored back as an integer. In some files base notes have float
values, i.e. if the file was stored after the base notes have been
automated linearly.
* B&B tracks are not corrected although they can contain instruments
with (automated) base notes!
* Nested for-loops with "i" as their running variables. (Fix in a
separate commit)
Fix all base notes that are used in automations and their corresponding
automation values. Base notes that are automated are stored as elements
in the save file whereas non-automated base notes are stored as
attributes. So far the method `upgrade_extendedNoteRange` only upgraded
the non-automated base notes that are stored in attributes. This commit
fixes the automated ones which are stored in elements.
The fix works as follows:
* Collect all base note elements.
* Store their ids in a set so that we can later identify automations
that reference them.
* Collect all automation pattern and check if they reference a base
note.
* Adjust the values and out values of all automations that reference
base notes.
Note: for many older files the out values will be introduced by the
upgrade `method upgrade_automationNodes` and do not appear in the files
themselves!
Fix the uninitialized variable pCurPreset by setting it to nullptr.
Please note that it looks as if the nullptr is now being passed to the
function fluid_sfont_iteration_next_wrapper. However, the function does
not use the parameter anyway and then the variable is set to the result
of that function.
Simplify the logic of the method Model::fullDisplayName.
Please note that this shows that with the current logic if the parent
model has a non-empty name like "parentmodel" and the name of the child
model is empty the result is the name "parentmodel >" which might not be
what's wanted.
Move the implementation of the Model methods into Model.cpp so that
recompiles after changes are much quicker. Make Model::
isDefaultConstructed const.
Fix a crash that occurs if the zooming or snapping model of the Song
Editor is used for automation.
The crash is caused by a failed static_cast to a Model* in
Model::parentModel(). The cast fails because in the constructor of
SongEditor the SongEditor is set as the parent of the zooming and
snapping model:
m_zoomingModel->setParent(this);
m_snappingModel->setParent(this);
This commit is rather a "band aid" fix because it only fixes the crash
by changing the static_cast to a dynamic_cast. However this means that
the name of the automation clip is initially empty.
A better solution would be to not use the Qt parent/child relationships
to implement the model hierarchies.
* Add confirm removal on mixer channels
Add confirm removal popup when the user calls the action "remove channel" on a mixer channel that is in use (receives audio from other channel or track). Set a config variable to keep track if the user don't want to be asked again. Adding a scroll on settings-general tab because there weren't enough space on the area.
* Core Mixer function channel in use
New core Mixer function to check if a given channel is in use (receives audio)
---------
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: saker <sakertooth@Gmail.com>
* Add <QHash> to PluginFactory.h
* Handle one more deprecated QTextStream::endl
* Replace QLayout::setMargin with setContentsMargins
* Replace Qt::MidButton with Qt::MiddleButton
* Replace QPalette::Background with QPalette::Window
* Fix deprecation warnings in LcdFloatSpinBox
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.
Improve the readability of text floats by removing the hard coded pixel
font size. The widget is now composed of three QLabels which are used to
display the title, text and pixmap. Remove the methods paintEvent and
updateSize because the widget is now updated automatically whenever the
QLabels change state.
Merge both versions of TextFloat::displayMessage because one of them was
only called by the other.
The default constructor of TextFloat now delegates to the "full"
constructor. The latter is private because it is only used from within
displayMessage.
The methods setTitle, setText and setPixmap show/hide their
corresponding labels depending on whether there is text or a pixmap to
show.
Adjust the class Fader so that the text float is shown to the right of
the fader. Otherwise the new implementation would have covered the fader
while it is being moved.
The SampleBuffer's sample rate in SampleClip was altered twice during
SampleClip::loadSettings: first when setSampleFile was called,
which set the sample rate of the SampleBuffer to the AudioEngine's
sample rate (good), and a second time when calling setSampleRate,
which set it to the sample rate specified within the project file (bad).
This led to the sample rate of the buffer being different than that of
the project, resulting in it being pitched incorrectly on playback.
* Position line height fits all tracks when line is moved or updated
* Refactor track height calculation; create connection to update position line height
PR #6438 does 2 things:
1. Add check-namespace
2. Fix verify script
This PR contains only part 2 (and does some preparations for part 1). The goal of the PR is to make CI succeed on master.
* Transpose midi clips in song editor
* Fix undo stupidity
* Check boundries when transposing clips
and move transpose function to NoteVector
* Avoid update if nothing has changed
* Make getNoteBounds a separate function
* Rename getNoteBounds to boundsForNotes
* bool operator instead of optional + qobject_cast
* Revert "bool operator instead of optional + qobject_cast"
This reverts commit 98c56a96cf.
* qobject_cast and nullopt
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>
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.
* Make loop markers snap to same increments as clips
* Fix snap size when loop points meet
* Switch to signal-slot based communication for proportional snap changes
* Move end if user clicks at exact center of loop
* Changes from reviews
* More detailed comment
* Properly handle zero length loop when ctrl is held
* More compact selection of action, m_loopPos ordering
* More robust sort
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)
* Update ringbuffer submodule to fix includes
* Remove cyclic includes
* Remove Qt include prefixes
* Include C++ versions of C headers
E.g.: assert.h -> cassert
* Move CLIP_BORDER_WIDTH into ClipView
This allows to remove includes to TrackView.h in ClipView cpp files.
* Elliminate useless includes
This improves the include structure by elliminating includes that are
not used. Most of this was done by using `include-what-you-use` with
`CMAKE_C_INCLUDE_WHAT_YOU_USE` and `CMAKE_CXX_INCLUDE_WHAT_YOU_USE`
set to (broken down here):
```
include-what-you-use;
-Xiwyu;--mapping_file=/usr/share/include-what-you-use/qt5_11.imp;
-Xiwyu;--keep=*/xmmintrin.h;
-Xiwyu;--keep=*/lmmsconfig.h;
-Xiwyu;--keep=*/weak_libjack.h;
-Xiwyu;--keep=*/sys/*;
-Xiwyu;--keep=*/debug.h;
-Xiwyu;--keep=*/SDL/*;
-Xiwyu;--keep=*/alsa/*;
-Xiwyu;--keep=*/FL/x.h;
-Xiwyu;--keep=*/MidiApple.h;
-Xiwyu;--keep=*/MidiWinMM.h;
-Xiwyu;--keep=*/AudioSoundIo.h
```
* Fixup: Remove empty #if-#ifdef pairs
* Remove LMMS_HAVE_STD(LIB|INT)_H
This fixes problems reading from MIDI devices on NetBSD - the
input blocked until a certain number of notes have been read
rather than returning immediately when a single note is received.
Summary:
* `NULL` -> `nullptr`
* `gui` -> Function `getGUI()`
* `pluginFactory` -> Function `getPluginFactory()`
* `assert` (redefinition) -> using `NDEBUG` instead, which standard `assert` respects.
* `powf` (C stdlib symbol clash) -> removed and all expansions replaced with calls to `std::pow`.
* `exp10` (nonstandard function symbol clash) -> removed and all expansions replaced with calls to `std::pow`.
* `PATH_DEV_DSP` -> File-scope QString of identical name and value.
* `VST_SNC_SHM_KEY_FILE` -> constexpr char* with identical name and value.
* `MM_ALLOC` and `MM_FREE` -> Functions with identical name and implementation.
* `INVAL`, `OUTVAL`, etc. for automation nodes -> Functions with identical names and implementations.
* BandLimitedWave.h: All integer constant macros replaced with constexpr ints of same name and value.
* `FAST_RAND_MAX` -> constexpr int of same name and value.
* `QSTR_TO_STDSTR` -> Function with identical name and equivalent implementation.
* `CCONST` -> constexpr function template with identical name and implementation.
* `F_OPEN_UTF8` -> Function with identical name and equivalent implementation.
* `LADSPA_PATH_SEPARATOR` -> constexpr char with identical name and value.
* `UI_CTRL_KEY` -> constexpr char* with identical name and value.
* `ALIGN_SIZE` -> Renamed to `LMMS_ALIGN_SIZE` and converted from a macro to a constexpr size_t.
* `JACK_MIDI_BUFFER_MAX` -> constexpr size_t with identical name and value.
* versioninfo.h: `PLATFORM`, `MACHINE` and `COMPILER_VERSION` -> prefixed with `LMMS_BUILDCONF_` and converted from macros to constexpr char* literals.
* Header guard _OSCILLOSCOPE -> renamed to OSCILLOSCOPE_H
* Header guard _TIME_DISPLAY_WIDGET -> renamed to TIME_DISPLAY_WIDGET_H
* C-style typecasts in DrumSynth.cpp have been replaced with `static_cast`.
* constexpr numerical constants are initialized with assignment notation instead of curly brace intializers.
* In portsmf, `Alg_seq::operator[]` will throw an exception instead of returning null if the operator index is out of range.
Additionally, in many places, global constants that were declared as `const T foo = bar;` were changed from const to constexpr, leaving them const and making them potentially evaluable at compile time.
Some macros that only appeared in single source files and were unused in those files have been removed entirely.
* Speed up sf2 loading by removing redundant code
* Comment
* Skip pointless call to loadFile
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
* Rename updateSampleRate to reloadSynth
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
* TCO coloring: submenu, randomize, undoable, renaming signals/slots
* Track coloring: submenu, undoable, renaming signals/slots
* FX color submenu
* Set modified on color change
* Use lambda to update TCOView after track color change
* More renaming, fix memory leak
Co-authored by DomClark
This replaces `set(CMAKE_CXX_STANDARD 14)` by `set(CMAKE_CXX_STANDARD 17)`
wherever it is required.
Additionally:
* raise `CMAKE_MINIMUM_REQUIRED(VERSION ...)` to `3.8` (the minimum
that supports C++17)
* `stdshims.h` is now unused and thus removed
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.
A new button called "Params" is added to the Carla instrument window; on press
it will open a new sub-window where Carla parameters can be found, ready for
connecting to a automation-track or controller. The exposed parameters in the
sub-window can be filtered by text and there is the ability to display only
parameters that are connected to a automation-track or controller. When there
are multiple plugins loaded inside Carla, the combo-box inside the (LMMS)
parameters sub-window can be used to switch between parameters of a specific
plugin (Carla).
Notes:
- Available when compiled with Carla version 2.1 and up.
- Currently Carla (2.1) will expose a maximum of 110 parameters.
- The param window state isn't stored yet in a LMMS project, this is still
TODO.
- Connected paramters will NOT instantly disappear when they are disconnected
with the "Show only knobs with a connection" filter enabled. See
https://github.com/LMMS/lmms/pull/5846#issuecomment-762666428
* Don't draw BB editor inside Song Editor
Currently, a small BB editor is drawn inside the Song Editor at high zoom levels. As discussed in #3060 this is unintuitive and appears broken (I've seen several other reports of this as a bug). This PR removes this behavior.
* Make removal optional
* Fix bug introduced by #5657
There was a bug introduced by #5657 where reloading a project
and playing it could cause a Segmentation Fault crash. After some
debugging, @DomClark tracked the issue to be likely a use-after-free
being caused by m_oldAutomatedValues not being cleared when the project
was loaded again.
This commit adds a line to clear the m_oldAutomatedValues map on
Song::clearProject(), which is called from Song::loadProject().
Now, instead of using a Signal/Slot connection to move the
control of the models back to the controllers, every time the song is
processing the automations, the control of the models that were
processed in the last cycle are moved back to the controller. The same
is done under Song::stop(), so the last cycle models control is moved
back to the controller.
That removes the need to have a pointer to the controlled model
in the controller object.
Adds mixer model change request to avoid race condition.
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
* Added messagebox when user tries to delete track
* Code review refactorings
* Update Track.h
* Changed message box title to "Confirm removal"
* Merge changes from master
* Add option to disable warning
* Default to showing warning if no config found
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: Spekular <Spekular@users.noreply.github.com>
On the AutomationPattern copy constructor, the automation nodes
were copied from the origin pattern but their "owner pattern" pointers
weren't updated.
Thanks Dom for finding and reporting this bug.
* Adds a baseDir for the local path
Adds a new Base for paths called "local:", which will translate to the dir where the currently opened project file is at. In the future this will allow us to make project bundles and make it easier to export and transfer projects to other people without breaking the paths to samples, presets, plugins and others.
* Starts implementing the makeBundle functionality
For now, to make a bundle LMMS has to be run through CLI with the makeBundle/--makeBundle command, followed by an input file and an output file ('lmms --makeBundle input.mmp output.mmp'). DataFile::writeBundle() is then called. For now, it only saves the mmp/mmpz file normally and also creates a "resources" folder if it doesn't exists. Later it will also manipulate the DataFile so all paths are local and copy all files to the resources folder.
TODO:
-Remove warnings.
-Implement the logic to manipulate the DataFile and copy files.
* Starts implementing logic to go through resources
Starts implementing the logic that will go through all the resources of the project file and add them to the bundle. We use a std::map of QString to std::vector<QString>: The first string is the DOM element tagname that is going to be searched for. The vector of strings holds all attributes this element can have that accesses resources. For now we just print those to the screen.
* Adds logic to copy files and update the project
The raw logic for creating the bundle is finished. It now copies the resource files and update the project to use "local:" paths to the new file now.
Now it's a matter of organizing things and adding safety checks for file operation errors basically.
* Makes the writeBundle method more organized
Improves comments and debugging warnings to make the writeBundle a bit more organized for review.
* Adds a project bundle folder
Adds a project bundle folder, inside which the bundles will be created. Instead of receiving an output project file name, the makeBundle command now receives a bundle name that will be used as the name of the bundle's folder.
Uses a typedef for the std::map with the tags and attributes with resources.
TODO:
- Fix the local: prefix so it works when we don't have the project file open (for CLI usage, or find another way to deal with it).
- Sanitize the bundle name.
- Allow overwriting bundles?
* Handles local paths when a project isn't open
The PathUtil base prefix conversion for "local:" uses the loaded song file name. When we are running the makebundle command from the CLI there isn't a loaded project, so those prefixes aren't converted properly. Now, when there isn't a project open PathUtil will return "local:" again when it tries to convert this base prefix. DataFile can then check if the base prefix is still there, and if it is it knows the conversion wasn't possible, so it does the conversion itself. To do that, a member called m_fileName was added to DataFile, which will hold the file being manipulated if that's where the DataFile originated from, and the local path can be retrieved from it.
* Sanitizes the bundle name
The bundle name is now sanitized. Since it's going to be used as a folder name, we need to keep the user from giving invalid folder names as a bundle's name. The rules for the name are:
1) It must start with a word character (either a digit or letter)
2) It can be followed by any number of letters, digits, whitespaces or hyphens
3) It must end with a word character (either a digit or letter)
A Regexp is used to check for the name validity.
* Moves away from projectbundle folder concept
This commit regresses some functionality. Project bundles will be saved just as any other project, except they will also have the resources folder. It will be up to the user to organize the bundles on their own folders. It's currently not allowed to save a bundle on a folder where there's one already though (if there's a resources folder already). Later it might be allowed to overwrite bundles in that case.
The projectbundles folder was dropped. The user can save project bundles anywhere in the system.
The DataFile::writeBundle was removed. It's functionality was merged into the DataFile::writeFile method, by adding a boolean on the parameters defining whether it should be saved with resources. The logic of copying the resource files and changing the paths inside the project DataFile was moved to DataFile::copyResources, making the methods a little bit less dense.
* Adds an option to save project as bundle
The "Save As" dialog now has an option to save project as a project bundle (with resources), which will save the file as a bundle.
Known bug:
- Because the "local:" base prefix is translated to the filename from the Engine::getSong(), it breaks when Song::guiSaveProjectAs is called, because that method changes the project name before saving. Urgent fix!
* Fix local: prefix saving bug
There was a bug where "local:" prefixes weren't resolved properly during saving because Song::guiSaveProjectAs() changed the project name to the destiny file name before saving. This resulted in the local paths using the destination file as a reference. Both Song::guiSaveProject() and Song::guiSaveProjectAs() were rewritten, and now they only rename the project after it's saved.
* Adds a warning message box
When the user tries to save a project bundle on a folder that already has a project bundle (contains a resources folder) a message box pops up telling the user it's not permitted and that another path should be chosen.
* Removes unused header
Forgot to remove <QRegExp> header when I removed the code that used it.
* Removes Vestige plugins bundling
For safety reasons, remove the possibility to bundle VSTs loaded
through vestige. Also runs a safety check during the project being
loaded (Song::loadProject) to check if either Vestige plugins or effect
plugins are using local paths, and abort the project load if so. That is
to avoid malicious code being run because of bad DLLs being shipped with
a project file.
* Extracts code from loadProject to another method
Extracts code that checks if a DataFile contains local paths to
plugins to another method inside DataFile.
* Removes debug warnings
Removes warnings previously used for debugging. Improves a
warning message on PathUtil.
* Fixes small bug with error logging
Fixes small bug, where a QMessageBox was being used to prompt an
error without checking if the gui is loaded first. Now we check for the
GUI and if we are in CLI mode we use a QTextStream instead.
* Saves the bundle in a newly created folder
Now a folder with the project name is created inside which the
bundle will be saved. This makes the process more convenient.
Some save errors that previously only triggered qWarnings now
trigger message boxes to warn the user of what happened (using a lambda
function that either shows message boxes or trigger qWarnings depending
whether a gui is present).
Makes it so saving a bundle doesn't change the loaded project
path, that way the user won't be able to accidentally "Save" over a
bundle which should not be done for now.
* Enhances the name conflict workaround
Now, instead of replacing the resource names with meaningless
numbers, the bundle save will just append a counter to the end of
filenames that have been repeated.
* Starts addressing Johannes review
* Adds makebundle action to bash completion file
Adds the bash completion code for the made bundle action.
* Improves safety check on project files
Now, instead of checking certain XML tags for local paths,
DataFile::hasLocalPlugin() will return true if ANY tag that isn't on the
RESOURCE_ELEMENTS list contains an attribute that starts with "local:".
The method is now recursive so it can go through all XML tags
during this check.
* Addresses Spekular change request
Uses basePrefix(Base::LocalDir) instead of "local:" on the
return of unresolved local paths.
* Makes hasLocalPlugins method const
* Replaces literal uses of "local:"
Instead of using "local:" we are now retrieving the base prefix
from PathUtil, so if we change the prefix on the future we don't need to
replace every mention to it as well.
* Fix some comments on the header and cpp file
* Changes variable on PathUtil to const
Changes the retrieved pointer to the song object to a const
pointer.
* Leave doxygen comment on CPP file only
There was 2 doxygen comments for the same method, on the header
and CPP file. The latter was kept since it goes into more details about
the functionality of the method.
* Fix doxygen comment @param
Fixes the doxygen comment from hasLocalPlugin().
* Remove assert statements
Some assert statements were being done wrong and are probably
even unnecessary for that piece of code, so they were removed.
* Skips local paths when looking for shortest path
PathUtil::toShortestRelative() was including the local paths on
the candidate paths, which could lead to a unallowed resource (i.e.:
vst plugin) to be assigned a local path even on a regular save.
The local paths are now skipped when looking for the shortest
relative path, since they should only be used by the bundle save on the
allowed resources.
* Address Spekular's review
Changes some of the PathUtil methods to allow a boolean pointer
to be used to return the status of the method, setting it to false if it
failed somewhere.
Also adds a parameter to toShortestRelative to either allow or
forbid local paths in the search for the shortest relative path.
* Replaces "ok" with "error"
* Init
* Suggested changes by @IanCaio, thanks!
* Selecting one file to import is enough.
* Explicit use of TimePos in favour of int where expected, as suggested.
* Make pattern import/export future proof with using DataFile instead of custom code to read/write the pattern file.
* Remove unused/duplicate imports
* Make import/export dialogs file-ext filter consistent.
Co-authored-by: CYBERDEViL <cyberdevil@notabug.org>
* 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
* 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>
m_gridMode was not being initialized on the PianoRoll
constructor. For that reason the first note drag without changing the
GridMode would result in m_gridMode being used unintialized and neither
the Snap nor Nudge mode being used. Here, the result of this was a note
being moved unquantized.
This fixes it by calling changeSnapMode() after setting up the
snapModel on the constructor.
* 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>
* 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>
* 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>
FE_UNDERFLOW gives a fair amount of hits with LMMS but is of lower
importance than the other tests and slows down debugging considerably.
Commenting out for the time being.
* Automatic formatting changes
* Add copy constructor and assignemnt to SampleBuffer
* Add copy constructor to SampleTCO
* Delete SampleTCO copy assignment, initial work on SampleBuffer swap method
* SampleBuffer: Finish(?) swap and use it for copy assignment, lock for read in copy constructor
* Don't forget to unlock in copy assignment!
* Formatting changes
* Lock ordering in swap
* Fix leak and constness
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
* Fix multiplication style, ensure lock is held when necessary
... by switching from an initializer list to manual assignments.
* Fixes from review
* Avoid more undefined behavior
* Update src/tracks/SampleTrack.cpp
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
* Fixes bug with pasting of TCOs (#5840)
TimePos::quantize works for negative values, but ends
up snapping the TCO to the opposite direction. This is because the
snapping happens in the direction of the origin, which is left for
positive values and right for negative values.
That wasn't accounted for in the pasteSelection method
and we ended up with wrong positions when pasting before the
TCO(s) we copied.
This PR fixes the issue by ensuring that we snap in the same direction when halfway through an interval, regardless of negative or positive offset.
* Fixes a calculation on TimePos::quantize
Since we are working with integers, using "offset /
(interval/2)" would be problematic if interval was odd. We instead
multiply both sides by two and use "(2 * offset) / interval" to obtain
the result for snapUp.
Implement `LV2_OPTIONS__options` feature and some buf-size properties.
The code currently assumes that the LMMS buffersize never changes, which
is currently true in the LMMS code base.
* Fix arithmetic overflow in `Lv2Ports::Meta::get()` in case min and
max are not set
* Fix combo boxes with >16 values being wrongly visualized as knobs
* Rename `Lv2Ports::Vis` enum value `None` to `Generic`
This also adds more min/max checks, mostly for logarithmic scales.
Since this raised some warnings for logarithmic CV ports, the CV
metadata is now also read (but CV ports are still not supported).
As requested, this PR extracts the bug fix from #5971. More
details about the bug on the mentioned PR page, but basically the
variable sf_rr was declared with the wrong type causing the conditional
that checks for errors on the loading to return true even when there
were no errors (only noticeable with DEBUG builds).
This renames the variable and uses the correct type.
This multiplies port's min/max value with the processing sample rate
that is used for the plugin. This fixes damaged audio in GLAME
Butterworth High-/Lowpass from #5767.
* Fix for the font of truncated sidebar items (#5714).
For windows platforms, retrieve the system font and set it for the FileBrowserTreeWidget. This makes sure that truncated items will use the font as non-truncated items.
* Add TODO to remove the fix when all builds use a recent enough version of qt.
* Add check on QT version and conditionally include the fix.
Fixes bug from issue #5595. When cloning an automation track, the IDs from the recently created AutomationPatterns weren't being resolved, causing them to show as disconnected automations.
This PR fixes the issue by adding a call to AutomationPattern::resolveAllIDs() on the Track::clone() method. It also fixes the code style on that method.
Hack to take care of the assertion sent by the rpmalloc memory manager. Creates a static "free" function for NotePlayHandleManager and then shoves it right before the program ends.
Co-authored-by: Pause for Affliction <47124830+Epsilon-13@users.noreply.github.com>
* 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.
* Fixes createTCO method on some classes
Classes that inherit from "Track", also inherit the createTCO method. That method takes a MidiTime position as an argument, but except on the class SampleTrack that argument was ignored. That lead to unnecessary calls to TCO->movePosition after creating a TCO in many parts of the codebase (making the argument completely redundant) and even to a bug on the BBEditor, caused by a call to createTCO that expected the position to be set on the constructor (see issue #5673).
That PR adds code to move the TCO to the appropriate position inside the constructor of the classes that didn't have it, fixes the code style on the SampleTrack createTCO method and removes the now unneeded calls to movePosition from source files on src/ and plugins/. On Track::loadSettings there was a call to saveJournallingState(false) followed immediately by restoreJournallingState() which was deleted because it's redundant (probably a left over from copying the code from pasteSelection?).
* Fix code style issues
Fixes code style issues on some files (except for ones where the current statements already had a different code style. In those the used code style was kept for consistency).
* Fixes more code style issues
* Fixes code style issues on the parameter name
Fixes code style issue on the parameter name of createTCO, where _pos was supposed to be just pos. The existing code had the old style and I ended up replicating it on the other methods.
* Code style fixes
Fixes code style in the changed lines.
* Fixes bug with dragging to negative positions
There was a bug (already present before this PR) where dragging
a selection before MidiTime 0 would result in some TCOs being placed on
negative positions. This PR fixes this bug by applying the following
changes:
1) TrackContentObject::movePosition now moves the TCO to
positions equal or above 0 only.
2) Because of the previous change, I removed the line that
calculated the max value between 0 and the new position on
TrackContentObjectView::mouseMoveEvent when dragging a single TCO (and
added a line updating the value to the real new position of the TCO so
the label displays the position correctly).
3) Unrelated to this bug, but removed an unnecessary call to
TrackContentWidget::changePosition on the left resize of sample TCOs
because it will already be called when movePosition triggers the
positionChanged signal.
4) Added some logic to the TrackContentWidget::pasteSelection
method to find the left most TCO being pasted and make sure that the
offset is corrected so it doesn't end up on a negative position (similar
to the logic for the MoveSelection action).
5) Removed another line that calculated the max between 0 and
the new position on Track::removeBar since it's now safe to call
movePosition with negative values.
* Uses std::max instead of a conditional statement
As suggested by Spekular, we use std::max instead of a
conditional statement to correct the value of offset if it positions a
TCO on a negative position.
Prevent triggering of extra notes at the end by not counting trailing
notes shorter than one fifth of the notes arp_frames. This value
being arbitrarily found by trial and error.
Fixes bug from issue #5595. When cloning an automation track, the IDs from the recently created AutomationPatterns weren't being resolved, causing them to show as disconnected automations.
This PR fixes the issue by adding a call to AutomationPattern::resolveAllIDs() on the Track::clone() method. It also fixes the code style on that method.
* 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)
All Atom ports are now being created and connected. Currently only MIDI
input ports are supplied with data.
Major contribution to #562 ("lv2 support").
Tool to glue selected notes together. Selected notes that are
adjacent to each other or overlapping are transformed into one note
stretching over the combined notes on/off times.
Key command: <Shift> + G
Partially fixes: #746 which is part of #4877
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
Co-authored-by: Spekular <Spekularr@gmail.com>
Co-authored-by: Kevin Zander <veratil@gmail.com>
Co-authored-by: Oskar Wallgren <oskar.wallgren13@gmail.com>
* Moves mimeType from StringPairDrag to Clipboard
* Simplifies decodeKey and decodeValue methods
* Adds method to copy a string to clipboard
* Adds method to copy a string pair to the Clipboard
* Adds convenience methods to Clipboard.h to retrieve the QMimeData from the clipboard and checking whether a particular mime type format is present on it
* Uses only the TCOV copy/paste methods on the song editor
To keep consistency on the behavior of the TCOV copy and paste operations, we now only use the TCOV::copy() and TCOV::paste() methods for copying both individual and multiple TCOs.
* Removes obsolete TrackContentObject::cut() and merge copy() and paste() methods to single function TrackContentObject::copyStateTo()
* Adds Clipboard::getString method to get data for particular mime type
* Makes AutomatableModelView.cpp use the Clipboard class instead of calling Qt clipboard directly
This PR updates the remote URL and content of rpmalloc.
Fixes#4752Fixes#4806 (assumably)
Helps #5694
You must now run
```
git submodule sync --recursive
```
once to reflect this change.
This replaces `set(CMAKE_CXX_STANDARD 14)` by `set(CMAKE_CXX_STANDARD 11)`
wherever it is required. Wherever it is superseded by parental
`CMakeLists.txt`, this command is now removed.
- Extract file item preview start and end into new methods `previewFileItem` and `stopPreview`.
- Add event handlers:
- `keyPressEvent` to allow auto preview (on up/down arrow navigation), manual preview (space), and send to editors (enter)
- `keyReleaseEvent` to end previews when preview key is released
- `hideEvent` to end previews when switching sidebar tab or hiding sidebar
- Functions that operate on a `FileItem` now take it as an argument instead of using a member variable
- `getContextActions` provides menu items for sending clips to the song editor and BB editor with minimal duplicate code
- Some formatting changes in affected code
- Replace many instances of `NULL` with `nullptr`
* Fix relativeOrAbsolute bug with baseQDir in PathUtils.cpp
If `base` is `Absolute`, `baseQDir(base)` will point to the working directory. It will result in undefined behaviors.
To fix this, update relativeOrAbsolute to explicitly return an absolute path when the target base is Absolute. Also make baseQDir return QDir::root() for Absolute base instead of QDir(""), because the latter represents the working directory.
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
* Automatic formatting changes
* Give clips an empty name by default, display all names
- Stop giving clips the same name as their parent track on creation
- Stop hiding clip names that match the parent track name
- Never rename clips on track rename
- Never clear clip name when a clip is copied to another track
- Create an upgrade routine to clear default names from old projects (< 1.3.0-alpha-1)
- Bump version to 1.3.0-alpha-1
* Revert now-unnecessary version bump
* Merge with master and fix conflicts
* Formatting changes from review
* Change weird for loop conditions
* Properly revert AutomationPatter.h changes
* Only clear names that match our parent track, be more generous with use of legacyFileVersion
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
... in order to make standard containers be able to store it. Required for
#5532 (#4899) and the recording PR.
This includes:
* removing the `LocklessRingBuffer<sampleFrame>` specialization
* passing samplerame in `StereoDelay::tick` as a reference
Additional cleanups:
* removing already unused typedef `sampleFrameA`
* add some `const_cast` to make code more readable
Add m_conversionFactor to the AutomatableModelView. This factor will be applied to the model->value when displaying
it in the contextmenu of the control for the reset and copy actions. The factor will be applied when copying the value to
the clipboard. When pasting from the clipboard, the value will be divided by the factor.
Remove the model->displayValue() calls when updating the reset/copy/paste action text labels as this gives e.g. in the
Equalizer the wrong action text for the Frequency knobs.
In the Fader class, remove the m_displayConversion variable but rather use the new m_conversionFactor variable.
Rewire the setDisplayConversion() function to set the m_conversionFactor to 1.0 or 100.0.
Faders in FxMixer show now the correct context menu. Copying and pasting values between faders or even volume knobs
in tracks shows consistent behavior. Other faders (like in Eq) show the old behavior.
* First commit
This commit starts the improvements on the upgrade methods. We are going to change both the DataFile and ConfigManager to use separate version values from LMMS release versions, so we can easily bump those versions for new upgrade routines. This first commit starts implementing a new version value for the ConfigManager.
* Change code as per requested on review
As requested, the "configVersion" method was replaced by "legacyConfigVersion" instead, which is only used to return a configuration version if none is present in the configuration file.
The configuration version of the current build is stored in a local variable called CONFIG_VERSION, making version bumping easier.
Uses a switch statement instead of if-else to be able to make use of case-cascading.
TODO:
- Change the CONFIG_VERSION variable to a unsigned int?
- Start working on the DataFile.cpp.
* Changes the upgrade logic on DataFile.cpp
Starts refactoring the upgrade logic on DataFile.cpp. Now the "version" attribute is used to indicate which fileVersion we are loading. If the value of version is "1.0", we have a legacy file and use the legacyFileVersion method to retrieve the integer version using the LMMS version. If the value of version is an integer, we just read it. The integer indicates the position in a list of upgrade methods where we should start from and run the upgrade methods. The file version of the build is held in the FILE_VERSION const on DataFile.h. It HAS TO match the number of upgrade methods that we have on our list.
One of the versions had 2 upgrade routines (upgrade_1_2_0_rc3 and upgrade_1_2_0_rc2_42). They were merged into a single one (upgrade_1_2_0_rc3) because they were both called from a single version check, meaning that they are both part of a single fileVersion.
Two fatal errors were added (which can later be improved to show an error messagebox): One if the version attribute doesn't exist, and another one if we are using a FILE_VERSION that doesn't match the number of upgrade methods (to avoid mistakes while coding new upgrades later).
The configVersion variables and methods were changed to use unsigned int instead of int.
TODO:
- Make the list of upgrade methods static.
- Add debug messages for each upgrade routine for testing purposes.
* Make method vector a static const variable
On DataFile.cpp, we now use the vector list of upgrade methods as a static const variable, so it only has to be constructed once.
* Reorganize vector lists
Reorganize vector lists so they are more easily readable.
Revert changes on upgrade method names from ConfigManager.cpp.
* Makes the file version bumping automatic
The file version bumping on DataFile.cpp is now automatic (using the size of the m_upgradeMethods vector as a reference). FILE_VERSION constant was removed, and with it the qFatal error when it doesn't match the size of the methods vector.
* Improve formatting of version and upgrades lists
Improves the formatting of the vector lists of upgrade routines and LMMS versions (2 upgrade routines per line and 3 LMMS versions per line).
Adds a qWarning for every upgrade routine for testing purposes, plus a qWarning that tells the current fileVersion/configVersion when upgrade is called.
Removes extra space characters after the opening bracket of ConfigManager::upgrade_1_1_91.
* Changes ConfigManager to use a vector of methods
Changes ConfigManager to use a vector of upgrade methods, just like DataFile. The new Config Version can be calculated automatically now, so the CONFIG_VERSION constant was removed.
Corrects a small comment on Datafile.h.
* Addresses Dom's review requests
- Changes legacyConfigVersion and legacyFileVersion from const unsigned int to just unsigned int, since the const is irrelevant in this context.
- Changes the type alias for upgrade methods to start with an uppercase as per the code style guidelines. Moves the aliasing of the type to the class declaration so it can be used on both the method and on the vector list declaration.
- Changes the vector list names from m_upgradeMethods to UPGRADE_METHODS, so it's more visible they are a static constant.
- Move the upgradeVersions list from the legacyFileVersion method to the DataFile class, as an static const called UPGRADE_VERSIONS.
- Uses std::upper_bound instead of std::find_if for the legacyFileVersion method.
* Uses type alias on vector assignment
Uses the UpgradeMethod type alias when defining the upgrade methods vector from both ConfigManager and DataFile.
* Removes debugging warnings
Removes the qWarning() calls that were placed for debugging purposes.
* Fix ProjectVersion handling of pre-releases
* Add workaround for old, non-standard version
* Attempt to fix versioning
* More consistent comments
* Apply suggestions from code review
- Set CompareType's underlying type to int and revert change to ProjectVersion::compare's parameters
- Add "None" and "All" as names elements of CompareType enum
- Preserve hyphens in prerelease identifiers
- Pad invalid (too short) versions to prevent crashes or nasty behavior
- Compare numeric identifiers to non-numeric ones correctly
- Don't interpret identifiers of form "-#" as numeric (where '#' is any number of digits)
- Add tests to ensure fixes in this commit work and won't regress in the future
* CMAKE fixes from code review
Co-authored-by: Tres Finocchiaro <tres.finocchiaro@gmail.com>
* Remove unnecessary changes to CMake logic
* More const, more reference
* Apply suggestions from code review
Co-authored-by: Tres Finocchiaro <tres.finocchiaro@gmail.com>
The internal waveforms of the class Oscillator produces the wrong amplitude when the input is a
negative phase. When doing PM or FM, negative phases may occur. When a negative phase is e.g. passed
to the the saw sample, it produces values less than -1.0, hence going out of range.
Converted all fraction calls to absFraction calls.
Removed the +2 in the function Oscillator::recalcPhase. The comment here was that it was needed to avoid
negative phases in case of PM. But by converting fraction to absFraction in the waveforms, negative phases
are not an issue anymore. On top of that the m_phase variable gains about 2 extra bits in precision.
As side effect of that, it improves the behaviour of the issue #2047 - TripleOscillator: Oscillators are getting out of sync.
Though I did not investigate it thoroughly over different notes and samplerates.
Add documentation to the fraction and absFraction functions in lmms_math.h as it was not immediately clear by the name what the
functions do. Correct the implementation of the functions in case the flag __INTEL_COMPILER is set. (floorf rounds always down).
* Fix for Icons and comboboxes mismatch in arpeggiator in Instrument Editor #5494
(https://github.com/LMMS/lmms/issues/5494)
Introduce a static const int variable for the default height of a ComboBox.
Set this height already in the constructor of the ComboBox object.
Update all modules setting the height of a ComboBox object to make use of the new constant.
* Replace 'const int' by 'constexpr int' after review.
* Change the background color of the selected text in a text box.
The new background color matches the green background of selected items in a tree view.
* Add selection-background-color for QLineEdit widgets in the classic theme, but keep the color as it was.
* Enable mixer color-coding
* Cleanup
* Fix warnings
* Improvements
* Improvements
* Use ColorChooser instead of QColorDialog
* Fix default palette being out of range
* Remove a redundant function
* Rename and make stuff efficient
* Comment on the code
* Make things more efficient
* Fix breaking builds
* Improvements
* Improvements pt. 2
* Improvements pt. 3
* Improvements pt. 4
* Improvements pt. 5
* Apply suggestions from code review
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
* Starts implementing the feature
The idea of this branch is to allow actions triggered through the context menu of a TCO on the song editor to affect all the selected TCOs. With this commit, only the "Mute/unmute" action affects all selected TCOs, while the others retain their old behavior (only affect the TCO that owns the context menu).
For that, a method was created that processes all actions (the triggered action is parsed as a parameter to the method). In the case of the "Mute" action, it checks if the song editor has selected TCOs, and if it does it mutes/unmutes all of them.
* Allows selected TCOs to be removed too
Now the "Remove" action from the context menu will remove all selected TCOs if there are any.
* Starts implementing selected TCO cut and copy
Now, when multiple TCOs are selected, the context menu actions Cut and Copy will write a DataFile to the clipboard containing the TCO information, so it can later be used to paste it.
The Paste action now checks if there's data in the QApplication clipboard. If there is, it will later paste the TCOs (for now it just prints the data with qWarning). If there's not, it uses the regular TCO paste method that uses the internal LMMS clipboard. Because it now have to decide between the QApplication clipboard and the LMMS internal clipboard, the Clipboard::copy() method now clears anything in the QApplication clipboard, making it empty so LMMS can know it should use the internal clipboard instead in that situation.
Adds safety checks for the selected TCO views.
* Overloads TCW paste selection methods
This commit is a step towards implementing the paste feature of the TCO context menu. It overloads the TrackContentWidget::canPasteSelection and TrackContentWidget::pasteSelection methods so they can be called without having a QDropEvent (only the QMimeData with the copied TCOs information). The overloaded canPasteSelection(MidiTime, QMimeData, bool) method required a third argument which says whether pasting over the same bar should be allowed or not, because it shouldn't when the QDropEvent comes from the same application but should when it doesn't. That is defined in the canPasteSelection(MidiTime, QDropEvent) method.
Also, the pasteSelection(MidiTime, QDropEvent) isn't optimal, since it calls canPasteSelection twice (more details in the comments, but it's basically because the two canPasteSelection methods can return different values depending on the origin of QDropEvent). This could later be fixed by calling canPasteSelection before pasteSelection and removing it from inside the method altogether.
Next step is to add the "tco_" key to the mimeData on the Copy/Cut operations and implementing the paste operation using those methods.
* Adds the TCO type to the clipboard
Adds the key with the TCO type ("tco_" + type number + ":" + TCO Data XML) to the clipboard, so it can be later used by the canPasteSelection and pasteSelection methods.
* Apply changes to "src/tracks/SampleTrack.cpp"
Change the SampleTCOView::contextMenuEvent() method so it behaves the same way as the TrackContentObjectView::contextMenuEvent() method. For that, I had to change the ContextMenuAction enum and the contextMenuAction methods to be protected instead of private, so SampleTCOView can access it.
* Implement the paste action
Now that the canPasteSelection and pasteSelection methods were overloaded, it was possible to implement the paste action using the same logic as the Drag&Drop copy/paste.
Other small changes:
- Removes the TCO views AFTER creating the TCO data file, instead of before (which probably resulted in an empty data file).
- Uses the StringPairDrag::mimeType() instead of Clipboard::mimeType() since that's the one the methods from StringPairDrag.cpp recognizes.
* Removes QDebug header
Forgot to remove the QDebug header on the last commit.
* Creates a Context Menu on the TCW for "paste"
Now it's possible to paste a selection of copied TCOs anywhere in the TCW, as long as the rules to paste are met (same rules as Drag&Drop copy/paste). If the rules are not met the "Paste" menu action shows but is disabled.
* Small code refactoring
Saving a few lines of code.
* Avoids double call to canPasteSelection
This commit adds a third parameter to the pasteSelection overloaded method, which will define whether we whould skip the canPasteSelection check. The only situation where we will want to skip it is if we are calling pasteSelection from inside the other pasteSelection method, which will already have checked it. Because of that the default value is false.
Organizes comments as well.
* Separates methods for the actions on selections
Now the remove, copy, cut, paste and toggle mute actions have a separate method for applying them to selections, which are then called from the contextMenuAction method. That made the code more organized and the contextMenuAction method smaller.
Also, the mouse shortcuts for muting and removing (CTRL+middle button, middle button, CTRL+right button) now apply the action on selections as well.
* Fixes small bug and reorganize code
Fixes a small bug where using a mouse shortcut or choosing an action on a TCO that is not selected while other TCOs were selected would result in the selection being affected.
Also reorganizes the code so the conditional for choosing between the selection action and the individual action stays inside the method.
* Move logic to the action methods
Since the methods that called the action+Selection() methods didn't need the list of selectableObjects, I moved it to the inside of the action+Selection() methods and removed the parameter from them.
* Changes logic structure and labels
As suggested by Spekular, the logic structure was changed. Now, the mousePressEvent and contextMenuAction methods determine whether the action should happen to a selection of TCOs or an individual TCO. The list of TCOs to be affected populate a QVector list called "active", which is parsed to the action method that will apply the action to each object in the list.
I changed the method names to removeActive, cutActive, copyActive and toggleMuteActive, since I believe that better describe the behavior. The paste method is still called pasteSelection for now, because the paste behavior isn't related to the active TCOs but to the content of the clipboard.
The contextMenuEvent method on both src/core/Track.cpp and src/tracks/SampleTrack.cpp were changed so they also check if the right-clicked TCO is part of a selection or an individual TCO, and the labels for the actions are changed to better describe the behavior (i.e.: "Delete" for individual TCO and "Delete selection" for multiple TCOs).
* Make removeActive and toggleMuteActive static
removeActive and toggleMuteActive methods are now static so they can be called from anywhere in the code since they don't require a TCO view instance to work. That makes it possible for them to be used in the future if any feature requires this type of action to be called from out of a TCO view instance.
The same couldn't be done for the copyActive and cutActive methods because those require an instance of the TCO view to call them, since when copying to the clipboard some metadata is written using information from the object instance.
* Renamed TCO View paste method
I renamed the TCO View paste method from pasteSelection to just paste, since the TCO view doesn't currently have a paste method (only the TCO class). It's also a name that accurately describes the action: it will paste either a group of TCOVs or a single TCOV on the current TCOV.
I also moved the logic for deciding between the multiple TCOV paste and single TCOV paste inside the paste method.
* Moves repeated code to a new method
This commit adds another method to TrackContentObjectView called getClickedTCOs, which will return a QVector with the TCO views that are supposed to be affected by a context menu action (either the individual right-clicked TCO or the selection of TCOs). Code was updated on the other methods to make use of this new method.
Method names for actions that affect multiple TCOs were changed. Instead of calling them copyActive, cutActive, toggleMuteActive and removeActive, they are just called copy, cut, toggleMute and remove, hence they are overloaded methods for those actions that affect multiple TCOs (their differenciation is the arguments list, which is a QVector list for those).
* Avoid unnecessary calls to getClickedTCOs()
We use a ternary operator inside TrackContentObjectView::mousePressEvent to avoid unnecessary calls to getClickedTCOs when the list is not going to be used.
The contextMenuEvent method on both Track.cpp and SampleTrack.cpp was reformated to use a more appropriate indentation and spacing between method calls.
* Fix indenting in a ternary operator assignment
* Rework PianoRoll paintEvent + some extras
* Split out PositionLine class to own file
* Refactor PianoRoll Q_PROPERTYs
* Reduce code by using Q_PROPERTY's MEMBER function and removing getter/setter functions
After looking at the getters and setters, they did nothing different than what direct
access would allow. Nothing outside of PianoRoll used the public functions as well.
Considering these factors we can reduce the number of functions by 2x the number of
Q_PROPERTIES, and go with direct access instead.
* Remove need for keyboard pixmaps
With the recent change to allow zooming vertically, aligning pixmaps is a PITA. Since
we have themes which can take brushes and colors, it would be simpler to take a solid
color or a gradient with some extra style properties to resize the keys and text colors.
While it will slightly be a downgrade from pixmaps since they can be anything really,
this will allow us to customize the piano roll further moving forward.
* Added the ability to update margins for TimeLineWidget and StepRecorderWidget
These take a X coordinate, which was hardcoded to WHITE_KEY_WIDTH, and never looked
back. Now we can adjust on the fly if we need to. Currently this just allows us to
shift the left margin to the style-defined white key width.
* Fix phantom pixmaps when PianoRoll not focused
* Update PositionLine class changes related to #5543
* Changes the toggleSolo method
- Changes the toggleSolo method so it doesn't mute automation tracks (keeps their original state)
* Stop restoring Automation Track's mute values
- Since Automation Tracks are not affected by enabling solo on other tracks, there's no need (and it's even counter intuitive) to restore their previous mute value.
- Reduces a line by using "else if".
* Saves two lines merging 2 conditionals in 1
* Adds the new solo behavior as a new LED button
To allow the user choosing between the old solo behavior and the new one, a new LED button was added which will be used to enable the solo keeping the automation tracks states, while the red LED will enable the solo with the current behavior.
Changes to the code:
- Added a purple LED image that will be used on the new button.
- Increased the default width of the widget that holds the mute and solo buttons so the third one fits.
- Changed the positioning of the LEDs on both the standard and compact track modes to accomodate them.
- Added a new model called m_soloAutomationsModel, which is connected to the new LED button (m_soloAutomationsBtn). This will dictate the behavior of the toggleSolo method.
- The red LED calls the toggleSolo method as before. The purple LED will change the m_soloAutomationsModel value and toggle the red LED, which will then call toggleSolo. But since the value of m_soloAutomationsModel will be different, the new behavior will be used on the method.
* Revert "Adds the new solo behavior as a new LED button"
This reverts commit fdbc8b2712.
After consulting fellow users and devs about this change to the PR, it was decided that adding a third button for the new solo behavior was not the best approach. This reverts the commit so we go back to just changing the solo behavior. Later an option can be added on LMMS settings to choose between the old and new behaviors.
* Adds an option to use the legacy solo behavior
This commit adds an option on LMMS settings (saved to the config file) to go back to the legacy behavior of the track solo button. The option can be found on Settings>General>"Use solo legacy behavior"
Changes to the code:
- Since there's a change to the configuration file, an upgrade method was created (upgrade_1_3_0) to add the value to the config XML if it isn't already present (safety check).
- An attribute is added to the DOM structure of the app configuration under the "app" tag, called "sololegacybehavior", which can be either 0 or 1.
- Changes were made to include/SetupDialog.h, include/ConfigManager.h and src/core/ConfigManager.cpp to implement this new configuration option.
- The toggleSolo method was changed to behave according to the value of the "sololegacybehavior" configuration.
* Changes the description of the solo setting
Changes the description of the solo setting on the Setup Dialog from "Use solo legacy behavior" to "Mute automation tracks during solo" since the latter is more descriptive and new users wouldn't be confused about what the legacy behavior was.
* Merges "if"s and "if-else"s where possible
A conditional could be merged by using the "||" logical operator and there was a "if" nested inside an "else" that could be merged into a single "if-else".
Very small code format change (keeping code block curly braces in separate lines).
* Uses default value instead of upgrading ConfigFile
Instead of using an upgrade method on the ConfigManager class to set a value to the sololegacybehavior parameter, we now use a default value on every call to ConfigManager::value that requests it.
* Removes repetitive method call
To make the loop more efficient, a local variable was created to hold the behavior of the solo selected in the setup dialog, instead of calling the ConfigManager::value method repeated times.
Observation:
Since no code was added/removed from ConfigManager.cpp, it was restored to its original state. There's however a TAB character in a blank line on line 145, which was there at the beginning of this PR but removed during it. It was written again in this commit to remove ConfigManager.cpp from the "Files changed" list.
* Saves one line of code and adds a comment
There was a variable declared but unused on the SongEditor.cpp file (method SongEditor::keyPressEvent), called QVector<TrackContentObjectView *> tcoViews. The variable was removed.
* Create PathUtils
* Replace old SampleBuffer calls
* Fix automatic track names
* Fix things
* Remove accidental duplicate file
* Add includes
* More incldues
* PhysSong's code review + style
* Fix vestige loading?
Seems more reasonable to convert from relative on load and to relative on save than vice versa.
* Typo fix
* More Bases
* Enable more bases
* Add missing semicolons in prefixes
* Nicer sample track tooltip
* Use correct directories
"userXDir" gives the default dir for ladspa, sf2, and gig. "xDir" gives the user dir.
* Make relative to both default and custom locations
Part 1
* Make relative to both default and custom locations
Part 2
* Typofix
* Typofix
* Fix upgrade function after base renaming
* Fix Tests
* Update tests/src/core/RelativePathsTest.cpp
Co-Authored-By: Hyunjin Song <tteu.ingog@gmail.com>
* Choose UserXBase over DefaultXBase if identical
toShortestRelative sticks with the first base found if two bases give the same path length. By placing UserXBase Bases before DefaultXBase Bases in the relativeBases vector, toShortestRelative will prioritize them.
* Ensure baseLocation always has trailing slash
Otherwise, a user configuring a path without one will break things.
* Move loc declaration out of switch
* Semicolon
* Apply suggestions from code review...
* Include PathUtil and sort includes
* More granular includes
* Apply suggestions from code review
Co-Authored-By: Hyunjin Song <tteu.ingog@gmail.com>
* Update include/PathUtil.h
* Leave empty paths alone
* Fix stupid merge
* Really fix merge. Hopefully
* Switch Base from enum to class enum
* Don't pass Base by reference
* Use QStringLiteral for static QString allocation in basePrefix method
* Make VST loading more similar to previous implementation
* Fix tests after enum change
* Attempt to fix VST loading, nicer name for sample clips
* Fix last review comment
Don't append a "/" that will be removed by cleanPath later
* Apply suggestions from code review
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
* Set default behaviour, correct spelling
* Set default behaviour, correct spelling
* Store stop behaviour in project
* Change how state is saved & loaded
* Change to use enum
Fixes a small bug where projects that are saved with a soloed track can't restore the muted state of other tracks, because it doesn't store the m_mutedBeforeSolo variable on the project file.
With this fix, a new attribute is added to the Track DOM element, containing the muted state of tracks before the solo. When loading older projects that don't contain this attribute m_mutedBeforeSolo will be set to false.
On the PR #5470 (Allows intruments to keep the midi channel information when forwarding), merged on Jun 1st 2020 commit 97680e0, there's a line removed on the src/gui/widgets/InstrumentMidiIOView.cpp file ( m_outputChannelSpinBox->setEnabled( false ); ), because since the output channel is now relevant even when MIDI forwarding is disabled, we need that spinbox always enabled. It was also disconnected from the LedButton to keep it from disabling/enabling it.
On the PR #5171 (Removed the excessive margin in instruments' GUI (#5129)), merged on Jul 9th 2020 commit 9895472, the line was reintroduced, possibly because it was an older PR that wasn't rebased to the latest changes. This broke the output channel spinbox because now it was disabled on the constructor, but it was still disconnected from the LedButton, as a result always disabled.
This hotfix removes the line again to fix the issue.
FxMixerView.cpp and FxMixer.cpp were inconsistent in their use of TrackContainer::TrackList vs QVector<Track *>. The former is a typedef of the latter, so this PR replaces all instances of QVector<Track *> with TrackContainer::TrackList.
Also, we were not including "TrackContainer.h" directly (the typedef was likely being included indirectly through one of the other include files), so we also include this header on both source codes.
The code on FxMixerView.cpp and FxMixer.cpp were using the types TrackContainer::TrackList and QVector<Track *> unconsistently. TrackContainer::TrackList is just a typedef for QVector<Track *> so it makes sense that we use it, specially in terms of readability.
Places where QVector<Track *> were used are now replaced with TrackContainer::TrackList.
Also, we were not including "TrackContainer.h" directly (the typedef was likely being included indirectly through one of the other include files), so we also include this header on both source codes.
* Enable fullscreen with hotkey & hotkey to toggle maximise in internal window
* Fix an obvious blunder
* Add fullscreen menu entry
* Change Alt+F11 to Shift+F11 (fix Windows bug)
* Move F5-F10 to Ctrl+F*, fullscreen by F11 and fix Linux bug
* Remove wrongly placed "fullscreen" attribute
* Remove temporary fixes for redundant bug
* Rename maximise to maximize
* Rename maximise to maximize
* Use fullscreen icon instead of maximise icon
* Actually include the icon in the commit
* Replace .svg icon with .png 16x16 icon
* Migrate editor hotkeys to Ctrl+1-7
* Removed the excessive margin in instruments' GUI (#5129)
* Reduced the font size for "master pitch" label.
* Reduced the layout spacing for MIDI Input and MIDI Output groups
* Shortened labels, so that the LcdSpinBoxes are spaced evenly
* Added translator's comments
* Whitespace fix
* Limit note length to quantization value
Draging a note to it's minimum value of 1 will add this new length to
the note if you later choose to stretch it which will not be clearly
visible in the Piano Roll unless you zoom in a bit. Limit the note
length to the quantization value and use <Alt> key to override and set
a smaller value.
* Update src/gui/editors/PianoRoll.cpp
Co-authored-by: Spekular <Spekular@users.noreply.github.com>
* Remember min note length if shorter than quantization()
* Find note length modulo quantization, pick smallest from selected notes
* Comment on and improve m_minResizeLen calculation
Co-authored-by: Oskar Wallgren <oskar.wallgren13@gmail.com>
* Refactor deleteUnusedChannels in FxMixerView
* Comments + style fix
Co-authored-by: Veratil <veratil@gmail.com>, formatting, suggestions on which lines to comment.
Co-authored-by: Kevin Zander <veratil@gmail.com>
* Update weird deleteChannel loop
* Use vector instead of array
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
Co-authored-by: Kevin Zander <veratil@gmail.com>
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
On the FX mixer, the "Remove unused channels" action only checked for InstrumentTracks on every channel but ignored SampleTracks that could be linked to the particular FX channel. Because of that, if there was a channel where only SampleTracks are forwarded to and we clicked on "Remove unused channels", it was going to be removed. This commit fixes it.
* src/gui/editors/SongEditor.cpp
* Gradient can be toggled and color can be changed.
* Made playback line (and tail) transparent to mouse clicks
* Gradient disappears when paused/stopped; tail length depends on zoom
* Fixes bug where gradient appears when a pattern is played; style corrections
* Cleaned up code
* Rename m_zoomLevels to s_zoomLevels
* Finalising code
* Make positionLine class independent of parent zooming model
* Edit a bug fix to make it more efficient
* Rename m_x and finalise positionLine code
* Rename m_x and finalise positionLine changes
* Rename X to playHeadPos
* Make better use of getSelectedNotes() in PianoRoll.cpp
* Save and reuse selected note vector more often
* Apply review suggestions
Thanks to @Veratil
* Comment, style, consistency
- Changes method name from cloneBBTrackPattern to clonePattern
- Small fix on the comments
- Adds a TODO comment regarding reusing the code from TrackOperationsWidget as a reference, so we can later figure out a way to not repeat the code
Adds a button on the BBEditor that clones the current BB track pattern, but without also cloning the song editor TCOs. That can be useful when an user is editing drumlines and wants to make a section with a slight variation for example.
Now it's possible to forward received MIDI events with their original channel, either to another track or to the instrument plugin itself. To do that, the user must select the channel "--" on the MIDI output widget. In that case, all MIDI events will be forwarded with their original channel, and the MIDI events produced by the track itself will be sent with the default channel.
* Compensate beat note length when stretching
We allow stretching beat notes to normal notes but the length starts
from -192 so there is a lag for one whole note before any change is
seen. Compensate by setting the oldNote value to 1 when stretching
if the note is 0 or below in length.
Co-authored-by: Spekular <Spekular@users.noreply.github.com>
This PR fixes issues on systems where `QCursor::setPos()` has no effect
or is not reliable. These issues included knobs moving to fast on some
operating systems. Affected widgets are `Knob` and `LcdSpinBox`.
With this PR, on all operating systems, the `setPos` calls are removed and
the cursor is not hidden anymore, so the mouse keeps moving normally
when changing values of one of the widgets.
As now the previous pointer position keeps moving (instead of being reset
to the original position using `QCursor::setPos`), the mathematics that
translate pointer pixel distance to `Knob`/`LcdSpinBox` value increase
have to be changed:
* The `Knob` transition function is now linear and uses a new factor.
* `LcdSpinBox` now uses float values and saves the current float remainder
(this is actually a separate issue revealed by this fix), leading to a fluent,
non hanging movement.
Implementation of the Lv2 core, except for CV ports. No features or
extensions are supported yet.
You can now generate sound using Lv2 instruments (restricted to non-piano)
or effects.
For an explenation about the new classes, see Lv2Manager.h
* Fix wrong lengths of exported tracks, when tracks have different lengths.
Song::updateLength() was called in ProjectRenderer::run() after Song::startExport(),
updating m_length too late, resulting in it being used as the length of the wrong track.
* Fix "Export as loop" resetting after rendering the first track
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
This atomically unsets the MidiJack reference in AudioJack right before
MidiJack is destroyed. This avoids AudioJack using a destroyed MidiJack
object.
This patch
* makes `m_stopped` atomic
* initializes `m_stopped` correctly to `true`
* moves the initialization of `m_stopped` to the point where jack ports
are already connected
* Multiple effects: Calculation of `outSum` should be after D/W mixing
* CrossoverEQ.cpp: `outSum` must be divided by frames in the end
* CrossoverEQ.cpp: don't overwrite `outSum` in for loop, but increment it
When selecting a Piano Key to mark semitones in the Piano Roll we
select key from the y position of the pop-up menu and not the mouse.
Incidentally these two are most often the same as the menu builds
from the mouse y positon and down. If there is room for it. If there
is no room downward it will create the menu so the lower part of the
frame aligns with the mouse y position.
Fixed by creating a variable to hold the pressed key before creating
the menu.
This bug was introduced in dff76b2e83.
The function changes [sample_end, sample_begin), but emits the signal
as if [sample_end, sample_begin] has been changed. That bug made
Multitap Echo crash when tweaking the cutoff of the 32nd stage.
This commit fixes the issue by emitting sampleChanged with sample_end - 1.
Move openContainingFolder to the end of the method block.
Adjust FileBrowserTreeWidget::contextMenuEvent to the coding conventions
and also make the code more readable by splitting up some conditions.
Add comments to clarify as to why the member m_contextMenuItem is set to
nullptr at the end of the execution of contextMenuEvent. Please note
that this implementation is not exception safe and should be changed in
the future, e.g. by passing the FileItem as a parameter of the slot.
Add functionality to open the containing folder of a file that's selected
in LMMS' file browser.
Technical details
------------------
Add a new private method openContainingFolder to FileBrowser. Add a new
action to the context menu of a selected file. This action in turn calls
the added method.
The current implementation of openContainingFolder delegates to
QDesktopServices::openUrl with the directory of the selected file. Please
note that this will only open the directory but not select the file as
this is much more complicated due to different implementations that are
needed for the different platforms (Linux/Windows/MacOS).
Using QDesktopServices::openUrl seems to be the most simple cross
platform way which uses functionality that's already available in Qt.
* Do not check if unsigned int is negative
* Reduce scope of some local variables
* Use right types for iterators
* Check conditional returns first
* Remove unused functions
* Utilize a range-based for loop opportunity
Add labeled controls for different types with a common base class
Implement a container for multiple equal groups of linked models and
suiting views. Such groups are suited for representing mono effects where each
Model occurs twice. A group provides Models for one mono processor and is
visually represented with a group box.
This concept is common for LADSPA and Lv2, and useful for any mono effect.
Knob::friendlyUpdate() can be called after the model is deleted
due to signal-slot connections.
Adding a check for the model fixes a crash due to null pointer dereference.
* advanced config: expose hidden constants to user screen
* advanced config: add support for FFT window overlapping
* waterfall: display at native resolution on high-DPI screens
* waterfall: add cursor and improve label density
* FFT: fix normalization so that 0 dBFS matches full-scale sinewave
* FFT: decouple data acquisition from processing and display
* FFT: separate lock for reallocation (to avoid some needless waiting)
* moved ranges and other constants to a separate file
* debug: better performance measurements
* minor fixes
* build the ringbuffer library as part of LMMS core
* Updated plugin artwork.
* Update the formula in the presets to use integrate(f) instead of
t*f, as integrate operation is more robust to frequency changes.
* rename X-Pressive to Xpressive in help window title.
* Xpressive.cpp, spaces to tabs and remove commented code.
`PianoRoll::mouseDoubleClickEvent` wasn't forwarding the event to the base class when not acting on the event. The base class calls `mousePressEvent`.
Fixes#3005
`PianoRoll::mouseDoubleClickEvent` wasn't forwarding the event to the base class when not acting on the event. The base class calls `mousePressEvent`.
Fixes#3005
Calling via QMetaObject::invokeMethod should be thread safe.
Crash callstack:
QWidget::move
SongEditor::updatePosition
Song::stop
Song::stopExport
ProjectRenderer::run
QThreadPrivate::start
Replaces the hard-coded library paths by a method based on CMake's
GetPrerequisites module which recursively finds a binary file's linked
libraries. Advantage: Potentially works on any system without adaption as
long as CMake supports it, so it could be used to create portable Linux
packages as well. Disadvantage: "Potentially".
Co-Authored-By: Hyunjin Song <tteu.ingog@gmail.com>
The VST automation window initially adds a subwindow with a null widget, so we have to check that w isn't nullptr before getting its size hint.
Fixes#5132.
* New default behavior: Preserves offsets when moving clips, resizes in fixed increments.
* Adds shift + drag: Snaps move start position (like current behavior) or end position (new),
based on which is closest to the real position. When moving a selection,
the grabbed clip snaps into position and the rest move relative to it.
* Adds alt + drag: Allows fine adjustment of a clip's position or size,
as an alternative to ctrl + drag.
* Adds a Q dropdown in the song editor to allow finer or coarser snapping (8 bars to 1/16th bar)
* Adds a proportional snap toggle. When enabled, snapping size/Q adjusts based on zoom,
and a label appears showing the current snap size. This is disabled by default.
The EffectRackView in an InstrumentTrackWindow had some parts hidden when
loading files with >= 4 effects. This was now fixed by force-resizing the
EffectRackView to its desired size.
It's a dirty fix, but good enough, plus many Instrument UIs might get
rewritten to be resizable in the future.
* implements drag and drop samples to sampletracks
* clean up / take care of timeLineWidget heigth in songeditor
* unused memeber removed
* clean up
* Update include/TrackContainerView.h
Co-Authored-By: Spekular <Spekular@users.noreply.github.com>
* Update src/gui/TrackContainerView.cpp
Co-Authored-By: Spekular <Spekular@users.noreply.github.com>
* Update src/gui/TrackContainerView.cpp
Co-Authored-By: Spekular <Spekular@users.noreply.github.com>
* Update src/gui/editors/SongEditor.cpp
Co-Authored-By: Spekular <Spekular@users.noreply.github.com>
* load AFP if we don't drop on a sample track
* take care of timeLineWidget size changes
* clean up
* consolidate some code
* requested changes by code review
* move logic to SampleTrackView
* clean up
* clean up
* clean up
This file tells the github online editor to use tabs of width 4 instead
of 8. Open
[this](https://github.com/JohannesLorenz/github_test/blob/master/test.cpp)
test file in your browser to see how it works (the width is 5 in the
example).
Actually, it also tells many other editors...
* Song: add isSavingProject.
* VersionedSaveDialog: Add support for a custom option dialog.
* AutomatableModel: Support the discardMIDIConnections save option.
* InstrumentTrack: Support the discardMIDIConnections save option.
* SaveOptions: Show the save option dialog on "save as".
right place when it not played from the begining.
That has created a difference between the ticks and the metronome and
the sample track.
The cause of the problem was that the calculation of the frame to play
was wrong: we had calculated `framesPerTick` according to the current
engine's sample rate instead of the SampleBuffer's sample rate.
To avoid a race condition between the gui thread which destroys the
samplebuffer and the mixer thread which increases the buffer's ref-
count, we'll make sure to touch the ref-count only when wh're synced
with the mixer.
NotePlayHandleManager::acquire uses a read lock unless the pool is empty.
If two threads try to acquire NotePlayHandle simultaneously
when the value of s_availableIndex is 1, one thread will try to read s_available[-1].
If the acquire action and the release action are done at the same time,
NotePlayHandleManager::acquire may try to read data
before NotePlayHandleManager::release actually writes.
This commit prevents them by always using the write lock when acquiring a NotePlayHandle.
* fix hanging mouse in piano roll (#4822)
* fix hanging mouse in automation & pianoroll (#4822);
* fix hanging mouse in automation & pianoroll (#4822)
removed TODO comment that I forgot in the code
As of https://github.com/probonopd/linuxdeployqt/pull/370/,
the AppRun of linuxdeployqt unsets LD_LIBRARY_PATH.
This behavior isn't suitable for our cases, so we use
the extracted binary directly as a workaround.
@lukas-w reminds in 134dae8 comments that X11Extras help Linux users of
VST effects #3786. Now LMMS builds and runs on Weston without X11
dependencies, though only if WANT_VST is off.
In the instrument plugin tab, there was an orange stripe for
TripleOscillator. This was because internally, TabWidget moves up the
widget by 1 (TabWidget.cpp, line 89).
The size of the whole window is:
```
widget->height() + m_tabbarHeight - 1
```
So this code adds an offset of "-1" to the necessary computations.
Other changes:
* Update TCO position more exact when a drag leaves a TCO and enters `TrackContentWidget` (required to detect that the cursor has really moved when leaving a TCO with length < 1 to the right)
* Use exact length when samples are loaded, don't round it up
* Reset size when reloading same file
This is being done for two reasons:
1. The new Monstro icons (and the icons for Microwave when it's finished) are too large.
2. All ComboBoxes (subjectively) look much nicer this way.
* [Equalizer] Bright analyzer colors, opacity incr
Brightened spectrum analyzer colors and increased opacity a tad to make more visible
* Fixed RGB Value
* Update EqControlsDialog.cpp
* Fixed color change
* Changed colors again
* Fixed colors, now brighter and bluer
* Ok, its actually bright now lol
Fix some assumptions that source and target of a drag actions are the same
track container. Instead of looking up necessary information (track name,
type and container id) by track index, add it to the metadata.
Refactor canPasteSelection to take QDropEvent instead of the drop event's
QMimeData. Coincidentally, this fixes the method to be consistent with its
documentation.
Fixes#4844
hallow clone may break version detection. This is fatal in Debian builds, so use full clone.
Note: This is safe for stable-1.2 but needs review after merging to master due to submodules. See #4888 for more information.
* Support more Wine packagings
* Allow building 64-bit RemoteVstPlugin using 32-bit Wine tools if possible
* Provide suitable library paths for creating AppImages
Fix a crash that occurred on the following steps:
1. Add an AFP track.
2. Open it, and move the waveform display to overlap the track label
button.
3. Close the AFP window and open it again by clicking the track label.
4. Move the mouse pointer.
The problem occurs because the code makes the implicit assumption that
AudioFileProcessorWaveView::enterEvent (and hence
QApplication::setOverrideCursor) is called before
AudioFileProcessorWaveView::mouseMoveEvent. This is not the case when
the waveform display is on top of the track label. In this case the AFP
windows is opened with the mouse being immediately positioned over the
wave form display. There is no enter event and move events are issues
directly. This then leads to a crash in
AudioFileProcessorWaveView::mouseMoveEvent when trying to determine the
value for is_size_cursor because the override cursor is still null but
is dereferenced directly without checking.
Only adding a check would not solve the problem because in that case the
cursor would not change to the hand cursor when being moved inside the
waveform display.
The solution is to remove all calls to the global methods
setOverrideCursor and restoreOverrideCursor and to only set the cursor
locally.
This fix is based on a patch by gi0e5b06 which is committed under 8a10c52
in his repository but for which he never created a pull request.
* Fix uninitialized m_jackClient being used in MidiJack destructor
* Fix destruction order in Mixer.cpp so that MidiJack doesn't access the
deleted AudioJack instance
Fixes#4688
When deciding to polyfill glibc features, check if the standard library claims to be glibc, instead of enumerating platforms in the condition. Unlike master branch which in de3b344 changes math function calls to standard, stable-1.2 keeps their glibc names and fails to build on Linux with another libc such as musl.
(Addresses #1421)
**Behaviour description:**
* Toggle step-recording mode using the dedicated icon.
* This mode is mutually exclusive with other recoding modes (record/record
accompany).
* Step-Recording while song is playing is allowed (and fun! :) ).
* When start recording, the start recording-position will be set where the
timeline curser points (quantized backwards using PianoRoll's current
quantization). If step-recording is started while the pattern is playing the
start recording-position is set to the beginning of the pattern.
* Step length is determined by the Piano Roll's current note-length (can be
changed dynamically during step-recording).
* The record-position can be moved forward/backward using the right/left keys.
* When notes are pressed on keyboard/midi-device, they will be added
temporarily ("recorded") with a length of a step. while still pressed, user
can adjust the length by steps resolution using the arrow keys (e.g. moving
right once will make the note's length 2-steps, another right press will make
the length 3-steps etc.).
* When all pressed-keys are released, the actual recording happen and the
notes are added.
* If the user press multiple notes, and release some of them for some time
which indicates it is intentional i.e. he didn't want to do a full release
to record the step but rather just change what will be recorded (I set the
"intentional release threshold" to 70 milliseconds) - these note will be
removed from current step-recording. e.g.
* Added notes are not quantized, making the addition simpler and WYSIWYG
* Similiarly to adding notes using mouse clicks, an undo-checkpoint is added
per added step and not for the whole recording as in other record modes.
* If we find NaN/inf, we declare the whole buffer bad and set it to 0.0f. This
is because the noise leading up to, or coming from, an infinite or NaN value
is often very large and will create problems later in the sound chain. Especially
if it hits a delay based fx with feedback.
* We bump the clipping level to +/-10.0f.
The former virtuals returned `const char*`, which lead to invalid reads when
`LadspaSubPluginFeatures` returned pointers to temporary `QByteArray::data`.
Lets you set a melody pattern as visible in the background of the Piano Roll
as support when building a new pattern. The pattern is visible throughout
the session or until cleared via the provided button.
Really short notes doesn't work well with delay based effects with the default
decay settings of the FX autoquit system where the effect can cut out. Set
autoquit as disabled by default.
Decay and Gate knobs are now also disabled when autoquit is disabled.
Let CALF's CMakelists apply the name filter only on the basenames of the
files, but not on their directories. This prevents errors if the LMMS folder
is under a directory which contains, e.g., "lv2".
* Move m_key member of Effect into Plugin
* Pass key to Instrument ctors and instantiaters
* Add pluginKeys to all plugin selector widgets, and let them pass the keys
when instantiating the instruments; or, if the keys must be passed over
threads, pass the keys to the Engine using `Engine::setDndPluginKey()`
* As instrument plugin libraries now also need to get their key passed, their
second argument, which was always the same as the first, is now used to pass
the sub plugin keys. This affects *all* instrument plugins.
* Plugin.h: Add more virtuals to `SubPluginFeatures` in order to draw logos
and images into instrument selector widgets
* LadspaSubPluginFeatures: Implement the `displayName` virtual because the
new behaviour to resolve displayNames is to first look at the
SubPluginFeatures, which, without override, returns the superior plugin's
name (Plugin.cpp)
Additional:
* PluginFactory.h: Allow setting up search paths without discovering plugins
yet
* Plugin.h: Add full documentation (should be checked)
Switch back to `ENV{PKG_CONFIG}` to ensure that
FindPkgConfig doesn't overwrite `PKG_CONFIG_EXECUTABLE`.
Since CMake 3.3 supports the environment variable,
it's safe to use that.
Switches some signal-slot connections to Qt::DirectConnection.
Now LMMS can handle loop points correctly and export samples without glitches.
Also tweaks some Mixer-related code to avoid related deadlocks on export.
Resolves the incompatibility between FluidSynth 1.x and 2.x
due to some API changes by shimming some functions.
Note that 1.x and 2.x are not binary compatible.
Previously BBTrackContainerView::dropEvent always deleted
the TCOs of dropped tracks. It made dropped tracks unusable.
As of this commit, the function checks for correct TCOs.
If incorrect TCOs exist, the function remove them and add empty ones.
Due to the wrong condition for GUI handling, empty patterns longer than 1 bar
was treated as BB patterns though they don't really look like.
This commit drops the erroneous check and fixes related GUI issues.
* Save `AutomatableModel` nodename in attribute if it must be quoted
* Loading an `AutomatableModel` with name <name> now means it
- either <name> must be `QDomElement::nodeName()` (as before)
*and* must not have a `nodename` attribute (new)
- or must have a `nodename` attribute with value <name>
Adjust Mixer::getPeakValues so client do not have to allocate the
variables that will store the peak values.
Adjust both existing clients: FxMixer and VisualizationWidget.
* Fix missing CMAKE_UNINSTALL_PREFIX variable
* Use CMAKE_MINIMUM_REQUIRED instead of CMAKE_POLICY for IN_LIST support
* Use FILE(REMOVE …) instead of EXECUTE_PROCESS(…) for better performance
* Control flow changes
Add the option to show note values on notes in the Piano Roll. This
functionality is currently coupled with the option "Enable note labels
in piano roll" which can be found in the main menu.
The notes are rendered at about 80% of the notes height. They are only
rendered if they fit on the whole note and if the font does not become
too tiny.
Enable the configuration of the note value text's color via the
stylesheets and set the value to white for both shipped themes.
Other changes:
* Clean up some warnings about old school casts and implicit casts.
Reverts some changes made in 9db8cbfb31.
The consequences of this changes are unsure, so reverting them for now.
Since a VST plugin's architecture is now detected before trying to load it,
this fix is not needed any more for 64&32-bit VSTs to work, as the
idVstBadDllFormat-message-mechanism was removed.
It should be noted however that the bug still exists, probably rendering
4fd8ecd7e4 ineffective.
* locale: using path instead of individual files to reduce command line size
* remotevstplugin: changed order return type & calling convention (compiler error)
* lmmsobj: removed single quotes for command line defines
* added vcpkg support & std::make_unique for MSVC
* carla: include exports header
* package_linux: corrected RemoteVstPlugin name
* vstbase: toolchain file conditional on MSVC
* Added install for remotevstplugin
* msvc: installer works with vcpkg
Remotevst 64bit install removed due to an ApImage problem
* Bug fix in peak_controller_effect.cpp
This change makes it so that when an LMMS project is loaded, each knob connected to a Peak Controller will be set to the Peak Controller's Base value, rather than its minimum possible value.
* Give our threads names
It helps with debugging.
* Use Q_OBJECT macro to automatically name threads.
By default, QThread sets its name based on the Qt meta class. To get an
accurate metaclass, the class which inherits QThread must declare
Q_OBJECT in its header. Futhermore, Qt's MOC requires that a Qt type be
the primary base class when declaring Q_OBJECT, hence the order of
base classes has been rearranged for some classes.
* Add f2 as a FX mixer rename shortcut. Enter doesn't work yet.
* Add both enter keys, remove code duplication
* Fix renaming with enter/return
* Clean up
* Horizontal mouse-wheel zooming. Ensure zoom center is always on the current mouse position.
* Horizontal zoom using mouse wheel center on the mouse position. For the SongEditor too.
* Wheel center on the Automation editor too.
Moving empty destructors out of the .cpp files and into headers
allows them to be devirtualized in certain cases.
(When the compiler can't "see" a function in a header, it must largely
assume it's some black box that the linker will resolve.)
While we're at it, use C++11's `= default` to define empty virtual
desturctors for us.
For some classes (e.g., Piano), nothing is derived from it, so we can
mark the class as final and remove any explicit virtual dtor.
There are many other places where this can be done, but this is a large
enough patch as-is.
* ThreadableJob: Move from AtomicInt to std::atomic
This is the first in a series of commits that migrates away from
AtomicInt towards the C++11 standard library types.
This would allow the removal of AtomicInt and related Qt
version-specific code.
While we're at it, also make ProcessingState an `enum class` so that
it's not implicitly convertible to integers.
* LocklessAllocator: Switch from AtomicInt to std::atomic_int
If it looks like some assignments around the Compare & Swap loops went
missing, it's because compare_exchange_weak() updates the first argument
to the current value when it fails (i.e., returns false).
* BufferManager: Remove extra AtomicInt include
* MixerWorkerThread: AtomicInt to std::atomic_int
* NotePlayHandle: AtomicInt to std::atomic_int
* Remove AtomicInt.h
* Move from QAtomicPointer to std::atomic<T*>
This removes some #ifdef trickery that was being used to get
load-acquire and store-release from Qt5 and "plain" (presumably
sequentially-consistent) loads and stores from Qt4.
C++11 (and subsequent C++ standards) provide portable ways to issue
atomic hardware instructions, which allow multiple threads to load,
store, and modify integers without taking a lock. The standard also
defines a memory model that lets you express the ordering guarantees
around these atomic operations. (x86 is relatively strongly-ordered, but
many other common architectures, such as ARM, are free to reorder loads
and stores unless told not to.)
This patch removes the lock from shared_object and replaces it with the
standard thread-safe reference counting implementation used in
C++'s std::shared_ptr, Rust's std::sync::Arc, and many others.
Additional resources on the topic:
https://assets.bitbashing.io/papers/concurrency-primer.pdfhttps://www.youtube.com/watch?v=ZQFzMfHIxng
Previously lmms used themed dialogs for project saving/opening, but not
when editing settings (edit -> settings).
With this change, the settings editor also uses themed dialogs.
Adds the function randsv, which gives you persistent upon note plays and waveforms transit in the gui.
Moves lmms exprtk submodule back to latest upstream
Add `PerfTime` class representing a point in CPU time and `PerfLogTimer`, used for measuring and logging a time period. Used in `ProjectRenderer::run()
* Remove DataType.
An AutomatableModel should not need to know what concrete type it is.
Use virtual methods and implement them in the derived class instead of
testing the type in the base class.
* Remove unused method
* Remove m_hasLinkedModels
We can compute it on-the-fly with very little cost, and doing so
simplifies the code.
* Remove extra 'public:'
Probably a remnant of merging master
The Equliser pluging uses biquad filters, These do not like having
there parameters updating during processing, and are know to produce
clicks and DC biasing. A twin filter system has been employed with a
cross fade, to interpolate between parameters.
This has removed for the use of sample exactness, as the filter is only
updated once per frame, with interpolation provided by the crossfade.
The same filters are used as pervious, ensuring unautomated filtering
remains unchanged.
* Use owning types when possible.
Note: the QByteArray s is detached to mimic previous behavior;
detach() guarantees that the QByteArray uniquely owns its data, since
otherwise it's COW. This may be relevant in case Plugin:instantiate
modifies s.data() -- this way the original QString is safe.
* Make m_filter a unique_ptr.
* Make m_activeRenderer a unique_ptr
* use std::string instead of strcpy + buffers
We copy the QString, so it makes sense to accept it by value and _move_
it into the collection instead. This causes the caller to move any
rvalue QString into the function, and then the QString is never actually
copied at all.
Finally remove Song's dependency to MainWindow by moving the window
title update which is triggered due to a changed project file name from
the class Song into MainWindow.
Implementation details:
Add a new signal projectFileNameChanged to Song and connect the new slot
method MainWindow::onProjectFileNameChanged to it. Update the window
title whenever the slot is triggered.
Add a new private method Song::setProjectFileName which sets the project
file name and emits the signal (only if the file name really changes).
Call setProjectFileName everywhere where m_fileName was manipulated
directly. This is done to ensure that the signal can be potentially
emitted in all relevant situations.
Remove the calls to gui->mainWindow from
Song::createNewProjectFromTemplate.
These changes finally remove the include to "MainWindow.h". The include
for "ConfigManager.h" was previously done implicitly through the include
of "MainWindow.h" and therefore had to be added explicitly after the
latter is removed.
Move the window title updates which are triggered due to a changed
modify state from Song to MainWindow.
Implementation details:
Add a new signal modified to Song and connect the new slot method
MainWindow::onSongModified to it.
Currently only the window title is updated in the slot. It is only
updated if the code is executed from the GUI main thread. This
implementation was taken over from the original implementation of
Song::setModified. The assumption here seems to be that the Song might
also be set as modified from other threads (which is a bad design).
Add a new private method Song::setModified(bool) and replace all direct
manipulations of m_modified in Song by calls to this method. This is done
to ensure that the signal can be emitted in all these cases. Make
Song::setModified() delegates to Song::setModified(bool) for the same
reason.
Other changes:
Slightly refactor MainWindow::resetWindowTitle to get rid of an
unnecessary if statement.
Add the new signal Song::stopped which is emitted when the song is
stopped. Connect the new slot method MainWindow::onSongStopped to that
signal. Remove all GUI updates from Song::stop and handle them in
MainWindow::onSongStopped.
Move the showing of save result dialogs, e.g. "The project XYZ is now
saved.", from the class Song into the class MainWindow.
Implementation details:
Add three new methods guiSaveProject, guiSaveProjectAs and
handleSaveResult to MainWindow. The first two correspond to the methods
with the same name in Song which don't do anything GUI related anymore.
The GUI related actions are instead implemented in the two new methods
in MainWindow. The method handleSaveResult shows the dialogs for
successful and failed saves, updates the list of recent files and the
title bar of the main window.
This commit also fixes a problem in Song::guiSaveProject where a failed
saved without a GUI would still have returned true, i.e. success.
Move the functionality of the method Song::importProject into the
MainWindow as it mainly consists of GUI related actions.
Add a new method Song::setLoadOnLauch to ensure that the boolean
Song::m_loadOnLaunch is still set at the end of the import.
The code to export a song and the tracks of a song mainly consisted of
GUI code. Therefore it was moved completely into MainWindow.
Add two new slots and a method that does the actual work to MainWindow.
Make both slots delegate to the worker method.
Move all GUI dependencies out of Song::exportProjectMidi and move them
into the MainWindow.
Show the GUI in the new slot method MainWindow::onExportProjectMidi and
delegate to Song::exportProjectMidi once the file name has been
determined. The file name is given as a parameter to
Song::exportProjectMidi which still contains the business logic of
exporting the data.
Add a check to see if the library "KF5WidgetsAddons" could be loaded and
return if that's not the case.
Also move a using declaration near the place where it is used first.
The "d" suffix used in debug builds breaks plugin loading because LMMS
expects to find a descriptor named e.g. "kickerd_plugin_descriptor" instead
of "kicker_plugin_descriptor" when discovering a plugin with the filename
"kickerd.dll".
Custom CMake module which attempts to automatically clone submodules when they're missing. Uses the `--depth` option if supported, which should be faster than running `--recursive` on initial clone.
* Remove register keyword
Register is meaningless in c++, and removed in c++17
* Fix compiler warningsg
Add missing override, remove unused capture, and remove unused local variablees
Move the initialization of the members belonging to the VCA into
lb302Synth's constructor initializer list. This also removes a
duplication initialization of vca_mode from the code.
* Add FLAC export, based on WAV renderer
* Depend on sndfile>=1.0.18 (previously >=1.0.11)
* Add compression option to FLAC export, if available.
The code related to compression is only generated if LMMS_HAVE_SF_COMPLEVEL is defined(libsndfile>=1.0.26).
* Save into the correct file extension upon single-export.
* Use unique_ptr in FLAC renderer and be more expressive about involved types.
* Use unique_ptr and remove manual memory management in ExportProjectDialog
* Add 'flac' format info to --help and manpage
Don't auto-save while playing by default. On weaker machines (xp?) we
see glitches so better turn this on after need.
Remove the last of Limited Sessin which was removed in 290556e.
[cherry-picked from stable-1.2]
Make the member Song::m_errors a static member to prevent memory leaks.
The member was allocated dynamically when an instance of a Song was
created but was not deleted in the destructor.
Adjust PatternView::update to show the name of the pattern as the tool
tip (regardless of whether it is a beat and bassline or a melody
pattern).
Override the public slot TrackContentObjectView::update for
AutomationPatternView and BBTCOView. Implement it similar to
PatternView::update.
Expose properties to set the colors for note borders and note fills for
patterns to the style sheets. Both properties are exposed for the muted
and not muted case. Use these new properties during rendering.
Adjust the style sheets for the classic and default theme.
Fix a problem with Qt5 by explicitly setting the pen width to 0 after
setting the transformation.
Reorder some of the other code to differentiate better between some
calculations that are in done in preparation for the painting and the
actual painting itself.
Draw notes as lines in case the pattern size is smaller than 64 pixels.
Antialiasing is only used when the notes are drawn as rectangles.
Add a border of four pixels at the top and bottom of the area where the
notes are drawn so they don't get pushed under the pattern borders.
Set the transparency of the text label to 100.
Clean up of some other code:
* Remove an unnecessary assignment to a pixmap
* Move code closer to where it is needed
* Remove an unncessary call to QPainter::end()
Compute the height of the potential text field before rendering the
melody pattern so that we can use that information later.
Transform the painter so that notes drawn into a [0,1] x [0,1]
coordinate system are drawn at the correct position on the pattern
widget. Add code that moves the pattern notes smoothly under the text
label in case there is not much space, i.e. for narrow patterns. Notes
are drawn as filled rectangles with a slightly darker border.
Always draw at least an octave of notes onto the pattern, so that
patterns with just a single note will not look strange, i.e. that they
are not filled completely with the note. If there is additional space to
fill it will be rather filled at the top of the pattern so that single
notes have a high chance of being drawn below the pattern text.
Simplify the drawing of the inner and outer border.
Use numeric_limits to initialize the minimum and maximum key.
Remove some redundant checks whether the pattern holds notes and
decrease the indentation depth by two tabs for most of the code.
* Respect build options in ExportProjectDialog
* Use QItem user data instead of hard ordering to identify export format in ExportProjectDialog
* For compatibility with QVariant, ExportFileFormats is now explicitly an int.
* Don't break out of format identifier loop prematurely in Song export.
Add back the rendering of text shadows for pattern labels. If some
design does not want shadows beneath the text it's always possible to
set the CSS property qproperty-textShadowColor to something completely
transparent.
Render the whole text if the elided text becomes empty or if it only
contains one character, i.e. if it becomes "…". Solved as implemented
because I was not able to check for "…" explicitly, i.e. the comparison
against "…" still failed.
Add a new property "textBackgroundColor" to TrackContentObjectView to
expose the property to the style sheets. Use this property in the code
that renders the text labels.
Adjust the two existing style sheets.
Add the method paintTextLabel to TrackContentObjectView. This methods
implements the painting of a given text on a given painter. The new
implementation does not draw any text label in case the trimmed text
becomes empty.
Use the method paintTextLabel to paint the text for automation patterns,
BB patterns and instrument patterns.
Adjust the style sheet of the classic and default theme by moving the
font definition from PatternView into TrackContentObjectView so that it
can be used by all inheriting classes.
Some changes made in commit e05c82758e
have broken the update of the time display. This commit fixes the problem
by introducing a second version of MidiTime::ticksToMilliseconds which
takes a double as an argument for the ticks. This new method is then
used by the call to ticksToMilliseconds in Song::processNextBuffer which
fixes the problem.
We perform division with some Envelope and LFO variables so they mustn't
be zero. They are given a minimum value of one frame ( f_cnt_t ).
Since #3687 we have a compile flag to turn on debugging of floating point
operations. This will currently not let you pass the Envelope/LFO
initiation and this is also fixed by this PR.
Add a method to convert a MidiTime instance to milliseconds. Also add a
static method to MidiTime that computes the time in milliseconds for a
given number of ticks and a tempo.
Remove the method that sets the milliseconds explicitly from Song.
Replace it by a method that takes a MidiTime instance and one method
that takes an amount of ticks.
Remove several explicit time calculations from the implementation of
Song and TimeLineWidget. Instead use the new methods.
The track height is already stored for every file that is saved. Remove a
condition that prevents its retrieval from files.
The removed condition was added as a fix for an issue with the number
#3585927 but it was not possible anymore to find out what this issue was
about.
Add a new CMake option WANT_DEBUG_FPE which adds the define
LMMS_DEBUG_FPE if activated. Extend lmmsconfig.h.in with regards to that
define. Include information about development options to the CMake
output.
Install a signal handler to trap floating point exceptions when starting
LMMS in case it is compiled using the option described above. The
current implementation of the signal handler prints a stack trace and
then exits the application.
Currently this option is only enabled for Linux builds due to
uncertainty with regards to which of the needed headers are supported by
Windows and Apple.
Use the font properties that are defined in the CSS to draw the pattern
labels. This provides flexibility with regards to the font properties
that are used (size, font family, etc.).
Adjust the CSS for the default theme and the classic theme.
Make the pattern names better readable by rendering them on top of a
semitransparent black rectangle. Elide the text and make it render a bit
more to the right.
Move the search bar on top of the file browser for the following sidebar
windows:
* "My Projects"
* "My Samples"
* "My Presets"
* "My Home"
* "My Computer"
Add the greyed out text "Search" to the search text edit.
The text is only shown as long as no text is entered in the search field.
Also rename some variable names to something more meaningful. Rename the
member m_l of FileBrowser to m_fileBrowserTreeWidget. Rename the
following local variables in the constructor of FileBrowser:
* ops -> searchWidget
* opl -> searchWidgetLayout
* First Preview of the X-Pressive Plugin
(exprtk.hpp is not included, get it from my exprtk fork in the branch
internal_data_functions)
available keys:
f- note's frequency. available only in the output expressions
t- time in seconds. in the Waves (W1,W2,W3) it's in the range [0,1)
key- the note's keyboard key. available only in the output expressions.
v- the note's velocity (divided by 255.0 so it is in the range [0,1]).
available only in the output expressions.
rel- gives 0 while the key is holded, and 1 after the key release.
available only in the output expressions.
A1,A2,A3- general purpose knobs (you can control them with the
automations). available only in the output expressions.
W1,W2,W3- precalculated wave forms. can be also load from file. you can
use them only in the output expressions
available functions:
cent(x)- gives pow(2,x/1200)
rand()- random number generator. in range [-1,1). each call gives other
value.
randv(i)- random vector (with pseudo infinite integer cells). the values
are in range [-1,1). it's stays consistent only across the note
playback. so each note playback will get other vector (even on the same
key).
sinew- sine wave with period of 1.
saww- saw wave with period of 1.
squarew- square wave with period of 1.
trianglew- triangle wave with period of 1.
expw- exponent wave with period of 1.
expnw- another exponent wave with period of 1.
moogw- moog wave with period of 1.
moogsaww- moog-saw wave with period of 1.
you can use * % ^ / + - pow sin log pi etc.
* Xpressive Plug-In:
Added Release transition knob that control the "rel" variable. (the
duration of transit from 0 to 1)
Fixed some problems in the displays. (update display when changing
A1,A2,A3, clear display with invalid expression.
* X-Pressive Plug-In: Few more fixes
Changed the callbacks in exprfront.cpp to be templated.
Added help.
Added ExprTk.hpp.
some bug fixes (inf issues).
Added integrate function.
* Special version of ExprTk with modified license (BSL) for the LMMS project https://github.com/LMMS/lmms
* Xpressive Plug-In- fixed some building errors.
Added the "e" euler's constant.
* Xpressive Plug-In - fix mingw64 issues
* X-Pressive Plug-in:
Added "trel" (time since release) variable.
The integrate function can now have unlimited usage.
Added selective interpolation per wave.
Improved a little the random vector function.
Some other improvements, code cleaning, etc...
* Xpressive Plug-In:
move clearGraph definition into Graph.cpp.
fixed compilation errors. (oops..)
* X-Pressive plug-in: updated presets names
* X-Pressive plug-in
added semitone function, added sample-rate variable
* X-Pressive plug-in, code cleaning, changed the rendering function to
achieve performace gain.
* X-Pressive plug-in - fix the string counting function
* X-Pressive plug-in - until somebody will find a better solution,
exprtk.hpp is patched under the name exprtk.patched.hpp ...
* X-Pressive plug-in - fix compiling errors.
* X-Pressive plug-in - added patch file for exprtk.hpp,
added last function that gives last calculated samples.
moved ExprSynth to be with ExprFront for performance reasons.
* X-Pressive plugin - moved the patched file back to the source tree, added .gitignore file..
* X-Pressive plugin - fix compilation error. (isnan isinf)
* X-Pressive plugin - tried to fix embed.cpp problem,
added new variable to the parser (tempo)
* X-Pressive plugin - fixed cmake script
* X-Pressive plugin - updated the license and the diff file.
* Updates to ExprTk
* Added return statement enable/disable via parser settings
Added exprtk_disable_return_statement macro for disabling return statements and associated exceptions at the source code level.
* X-Pressive plugin - updated CMakeLists.txt to use the correct flags on each platform.
also added exprtk.hpp as a dependency for the patch command.
Updated the exprtk diff file.
* X-Pressive plugin - moved the enhanced features flag to the WIN64 installation.
* X-Pressive plugin - another fix for CMakeLists.txt
* Minor updates to ExprTk
Updated multi-sub expression operator to return final sub-expression type.
Updates to exprtk_disable_return_statement macro for disabling return statements and associated exceptions at the source code level.
* X-Pressive plug-in - added try-block around exprtk calls and enabled the
-fexceptions flag, so patch file is no longer needed.
* X-Pressive plug-in - small fix in CMakeLists.txt
* Update ExprTk to tip of branch.
* X-Pressive plugin - added graph drawing feature..
* Updating exprtk.hpp to the latest upstream version
Implement 24 bit support for WAV export (#3021) and improve the export dialog (only show widgets relevant to output format, add variable bitrates for Ogg)
If the variables bit rate is not enabled the nominal bit rate will be
used for the minimum and maximum bit rate in the encoder.
If the variable bit rate is enabled the current implementation will
compute the minimum bitrate by subtracting 64 kBit/s from the nominal
bit rate. The maximum bit rate is computed by adding 64 kBit/s to it.
Example: The nominal bit rate is set to 160 kBit/s and variable bit rate
is enabled in the export dialog. The minimum bit rate is then set to 96
kBit/s and the maximum bit rate to 224 kBit/s.
Only show widgets on the export dialog that are relevant to the selected
file format (Wave/Ogg):
* Sample rate is always shown.
* Bit depth settings are only shown when Wave is selected.
* Bit rate settings are only shown when Ogg is selected.
Remove the label that informs the user that not all settings apply to
all export formats as it is not needed anymore. The english text of that
label was: "Please note that not all of the parameters above apply for
all file formats."
Pull the class OutputSettings out of the class ProjectRenderer so that
it can be used in other contexts as well. Also move the enum
ProjectRenderer::Depth into the new class OutputSettings and rename it
to BitDepth. Adjust all places that referenced
ProjectRenderer::OutputSettings accordingly.
Adjust the two places where an instance of OutputSettings is created:
the main function and ExportProjectDialog::startExport.
Store an instance of OutputSettings in AudioFileDevice and remove
several members and methods which are now replaced by this instance. Add
a getter for the OutputSettings to AudioFileDevice. Storing an instance
of OutputSettings in the base class AudioFileDevice enables the
simplification of the following constructors and general code in the
following classes:
* AudioFileDevice
* AudioFileOgg
* AudioFileWave
Because OutputSettings contains everything related to sample rate, bit
rate settings and bit depth these parameters could be removed from the
parameter list of the aforementioned constructors.
Simplify the signature of the factory method AudioFileDeviceInstantiaton
(defined in AudioFileDevice.h) and reorder the parameters by significance.
Move the logic of how the minimum and maximum bitrate is calculated
using the nominal bitrate into AudioFileOgg::minBitrate() and
AudioFileOgg::maxBitrate(). Previously this was defined in the
constructor of ProjectRenderer where it does not belong as it an
implementation detail of the OGG export.
Remove the code that converted the bit depth enum to an integer from
ProjectRenderer as it is now solely represented as an enum.
Remove class members for the minimum and maximum bit rate from
AudioFileOgg and adjust the code in the implementation to use the values
stored in OutputSettings.
Add a new value of "24 Bit Float" to the "Depth" combo box in the
project export dialog.
Add a new enum value to ProjectRenderer::Depth and extend the evaluation
of the different enum values in ProjectRenderer.
Add the new case of a depth of 24 to AudioFileWave and remove some
repetition with regards to SF_FORMAT_WAV in the code. It's only set once
now and then the depth is "added" in a switch statement.
* Added support for wine-devel packages.
* Added support for wine-staging packages.
* Staging extra flags.
* Dynamic Wine branch detection (stable, devel, staging).
* Using STRING() to correct WINE_INCLUDE_DIR and WINE_LIBRARY.
* Don't override CMAKE_PREFIX_PATH.
* REPLACE outputs new variables.
* Renamed variables.
* Duration of the beat is defined by the denominator of the time signature
and it does not depend on whether or not you use triplets.
* Fortmatting fixed.
* Remove bin2res, use Qt's resource system
* Use QDir search paths and QImageReader in getIconPixmap
* Don't include "embed.cpp" in plugins
* getIconPixmap: Use QPixmapCache, use QPixmap::fromImageReader
* Require CMake 2.8.9
* Fix ReverbSC embed usage
set(STATUS_VST_64"${STATUS_VST_64}\n\tWARNING: You are using wine ${WINE_VERSION} which cannot disable ASLR, please consider upgrading to wine 10.14 or higher. ASLR may cause crashes with older VSTs.")
endif()
endif()
IF(WANT_DEBUG_FPE)
IF(LMMS_BUILD_LINUXORLMMS_BUILD_APPLE)
SET(LMMS_DEBUG_FPETRUE)
SET(STATUS_DEBUG_FPE"Enabled")
ELSE()
SET(STATUS_DEBUG_FPE"Wanted but disabled due to unsupported platform")
[Artist & User Wiki/Documentation](https://lmms.io/documentation)<br>
[Sound Demos](https://lmms.io/showcase/)<br>
[LMMS Sharing Platform](https://lmms.io/lsp/) Share your songs!
LMMS is an open-source cross-platform digital audio workstation designed for music production. It includes an advanced Piano Roll, Beat Sequencer, Song Editor, and Mixer for composing, arranging, and mixing music. It comes with 15+ synthesizer plugins by default, along with VST2 and SoundFont2 support.
Features
---------
* Song-Editor for composing songs
*A Beat+Bassline-Editor for creating beats and basslines
* Song-Editor for arranging melodies, samples, patterns, and automation
*Pattern-Editor for creating beats and patterns
* An easy-to-use Piano-Roll for editing patterns and melodies
* An FX mixer with unlimited FX channels and arbitrary number of effects
* A Mixer with unlimited mixer channels and arbitrary number of effects
* Many powerful instrument and effect-plugins out of the box
* Full user-defined track-based automation and computer-controlled automation sources
* Compatible with many standards such as SoundFont2, VST(i), LADSPA, GUS Patches, and full MIDI support
* Compatible with many standards such as SoundFont2, VST2 (instruments and effects), LADSPA, LV2, GUS Patches, and full MIDI support
* MIDI file importing and exporting
Building
---------
See [Compiling LMMS](https://github.com/LMMS/lmms/wiki/Compiling) on our
wiki for information on how to build LMMS.
See [Compiling LMMS](https://github.com/LMMS/lmms/wiki/Compiling)
Join LMMS-development
----------------------
If you are interested in LMMS, its programming, artwork, testing, writing demo
songs, (and improving this README...) or something like that, you're welcome
to participate in the development of LMMS!
If you are interested in LMMS, its programming, artwork, testing, writing demo songs, (and improving this README...) or something like that, you're welcome to participate in the development of LMMS!
Information about what you can do and how can be found in the
[wiki](https://github.com/LMMS/lmms/wiki).
Information about what you can do and how can be found in the [wiki](https://github.com/LMMS/lmms/wiki).
Before coding a new big feature, please _always_
[file an issue](https://github.com/LMMS/lmms/issues/new) for your idea and
suggestions about your feature and about the intended implementation on GitHub
or post to the LMMS developers mailinglist (lmms-devel@lists.sourceforge.net)
and wait for replies! Maybe there are different ideas, improvements, hints or
maybe your feature is not welcome/needed at the moment.
Before coding a new big feature, please _always_ [file an issue](https://github.com/LMMS/lmms/issues/new) for your idea and suggestions about your feature and about the intended implementation on GitHub, or ask in one of the tech channels on Discord and wait for replies! Maybe there are different ideas, improvements, or hints, or maybe your feature is not welcome/needed at the moment.
MESSAGE(STATUS"Bash completion script for ${SCRIPT_NAME} will be installed to ${BASHCOMP_PKG_PATH} or fallback to ${BASHCOMP_USER_PATH} if unwritable.")
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.