31 Commits

Author SHA1 Message Date
regulus79
11b4a9bddc Pitch Bending Directly in the Piano Roll (#7759)
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>
2026-01-04 14:18:06 -05:00
luzpaz
8c12e47b11 Fix several typos (#8090)
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`
2025-10-20 22:20:01 -04:00
regulus79
7e02795f47 Don't copy DetuningHelper in Note copy constructor (#7888)
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>
2025-05-28 19:28:13 -04:00
regulus79
679f9b848e Add splitting (and resizing) to all types of clips (#7477)
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>
2025-04-29 17:56:13 -04:00
IanCaio
17c919879f Implement Note Types (#5902)
* 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>
2023-11-18 17:14:27 -05:00
Andrés
005ee47d43 pitch wheel recording in the detune pattern (#6297) 2023-08-31 17:17:00 +02:00
Dominic Clark
f10277715f Classier enums (#6760) 2023-08-24 19:16:02 +01:00
saker
3aed361b82 Core: Replace global Qt declarations with standard equivalents (#6821)
* Replace qAbs with std::abs

* Replace qBound with std::clamp

* Replace qMax with std::max

* Replace qMin with std::min

* Replace qRound with std::round

* Replace qgetenv with std::getenv

---------

Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
2023-08-24 17:28:34 +01:00
saker
9a0add49fb Core Refactor: Replace `QVector with std::vector` (#6477)
* 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>
2023-08-22 12:08:56 +09:00
Dalton Messmer
2c6d88f799 Add GUARD_H closing comments 2023-01-05 17:58:49 -05:00
Dalton Messmer
fe6df8dbaf Add namespace prefix to include guards 2023-01-02 19:51:32 -05:00
saker
b451e40b51 clang-tidy: Apply modernize-use-using everywhere (#6453) 2022-07-07 10:54:34 +02:00
Alex
9705c31773 Transpose midi clips in song editor (#6409)
* 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
2022-07-04 10:16:22 +09:00
Levin Oehlmann
5904b249c0 clang-tidy: Apply modernize-use-override everywhere (#6439)
... to mark overriding functions `override` instead of `virtual`.
2022-06-19 23:03:55 +02:00
Levin Oehlmann
7227c89847 Namespace lmms (#6174)
This PR places all LMMS symbols into namespaces to eliminate any potential future name collisions between LMMS and third-party modules.

Also, this PR changes back `LmmsCore` to `Engine`, reverting c519921306 .

Co-authored-by: allejok96 <allejok96@gmail.com>
2022-06-19 20:08:46 +02:00
Johannes Lorenz
7db3fa94a1 Improve includes (#6320)
* 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
2022-03-02 13:30:43 +01:00
Levin Oehlmann
f742710758 Macro cleanup (#6095)
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.
2021-09-30 18:01:27 +02:00
Martin Pavelek
f288137c22 MIDI range MKII (extracted from microtonal PR) (#5868)
* Update MIDI range to match MIDI specification

Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
Co-authored-by: Kevin Zander <veratil@gmail.com>
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: Spekular <Spekular@users.noreply.github.com>
2021-04-21 00:29:47 -05:00
Alexandre Almeida
6e081265ba Rename MidiTime to TimePos (#5684)
Fixes #4866
2020-11-29 19:46:13 +01:00
David CARLIER
dac59a5fa0 C++11 inheritance updates
Add `override` and remove `virtual` where applicable
2019-10-31 20:05:33 +01:00
Lukas W
966bf1c6de Use CMake GenerateExportHeader 2018-07-07 11:20:54 +02:00
Oskar Wallgren
81966fa1a6 Sort note patterns after both position and key 2017-10-18 14:41:00 +02:00
grejppi
9e85d7c66e update all copyright headers to the proper url (#3326) 2017-02-06 02:41:15 +02:00
Amadeus Folego
6e3d4f431d Change behaviour for changing volume/pan on Piano
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
2015-03-07 11:55:36 -03:00
Alexandre
3d46f8a290 Merge branch 'coding'
Conflicts:
	include/Note.h
	include/ProjectVersion.h
	include/TimeLineWidget.h
	include/Track.h
	src/core/Plugin.cpp
	src/core/ProjectVersion.cpp
	src/core/Song.cpp
	src/core/Track.cpp
	src/gui/TimeLineWidget.cpp
2015-03-01 12:55:58 -03:00
Alexandre Almeida
d04076f44d Update coding conventions on Note.h 2015-01-19 23:08:19 -02:00
Lukas W
56055b36b0 Merge branch 'master' into ed_refac
Conflicts:
	src/gui/editors/PianoRoll.cpp
2015-01-11 13:25:55 +01:00
Jonas Trappenberg
87e597510c Minor refactorings and codestyle cleanup. 2015-01-11 00:05:25 -08:00
Alexandre Almeida
87f6dd0a03 Update coding conventions on Note.h 2015-01-05 20:45:46 -02:00
Lukas W
657fb06c49 More Automation refactoring 2014-12-17 11:34:57 +01:00
Lukas W
aaeb5216ad Rename note to Note 2014-11-26 01:14:52 +01:00