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>
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`
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>
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>
* 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>
* 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>
* 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>
* 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
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.
All the selected notes are changed by default for the 3 possible events:
- Mouse dragging the volume/pan meter
- Rolling the mouse wheel over the meter
- Double-clicking the meter
The user can still change each note individually by holding alt before
performing the desired action