61 Commits

Author SHA1 Message Date
Fawn
b1e6d180c7 Make portsmf a git submodule (#7755)
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.
2025-10-24 16:24:46 -06:00
Rossmaxx
7367750823 [Code Cleanup] Cleaned up some header files and move a bit of debugging logic to cmake (#7677)
* 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
2025-03-24 19:07:46 +05:30
Dominic Clark
f10277715f Classier enums (#6760) 2023-08-24 19:16:02 +01:00
Hyunjin Song
e8e54a7ba8 Remove more global automation from MidiImport (#6605) 2023-01-17 21:17:38 +09:00
saker
a876cf9d00 clang-tidy: Apply modernize-avoid-c-arrays everywhere (#6564)
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
2022-12-30 22:18:14 +00:00
saker
2f7a6558a1 clang-tidy: Apply modernize-loop-convert everywhere (#6481)
Co-authored-by: allejok96 <allejok96@gmail.com>
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
2022-09-27 09:27:35 +01:00
saker
0b27497be2 clang-tidy: Apply modernize-use-auto everywhere (#6480)
Note: clang-tidy was run with `--format-style=file`.
2022-09-14 19:27:53 +02:00
Kevin Zander
f39b3d5022 Use automation track for MIDI program change events (#6308) 2022-07-08 13:06:25 -05:00
Levin Oehlmann
28ec71f91a clang-tidy: Apply modernize-use-equals-default everywhere (#6450) 2022-06-26 08:48:24 +02:00
Levin Oehlmann
c5cdab2601 clang-tidy: Apply modernize-use-bool-literals (#6448)
... and remove never-executed code:

This removes a condition that was always true and two statements
guarded by conditions that were always false.
2022-06-24 19:38:44 +02:00
Dominic Clark
96df9b006c Clean up macros a bit (#6444)
* Prefix `STRINGIFY` and `STR` macros with `LMMS_`

* Fix include guard macro names

* Remove unused macros
2022-06-23 12:20:05 +01: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
Alexandre Almeida
55d361fb65 Rename TCO and related to Clip (#6226)
This PR renames

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

The savefiles are not yet modified by this PR.
2022-01-14 05:45:21 +01:00
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
Johannes Lorenz
e0298891e4 clang-format: Prepare plugin descriptor init'ers 2021-09-22 22:46:12 +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
IanCaio
e2bb606341 Fixes createTCO method on some classes (#5699)
* 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.
2020-11-07 13:54:04 +01:00
Veratil
9eb787c9e8 Update MIDI loading and parsing
portsmf fixes:
* Fix allegro warnings as errors
* Fix msvc missing max. Use MAX macro instead
2020-09-12 23:39:07 -05:00
Dominic Clark
5efb3a19cb Fix use of translation functions (#5629) 2020-08-30 19:27:17 +01:00
Hyunjin Song
044c88c271 Merge branch 'stable-1.2'
# Conflicts:
#	.gitmodules
#	.travis.yml
#	.travis/linux..before_install.sh
#	.travis/linux..install.sh
#	CMakeLists.txt
#	cmake/linux/package_linux.sh.in
#	cmake/modules/BuildPlugin.cmake
#	include/AutomatableModel.h
#	plugins/MidiImport/MidiImport.cpp
#	plugins/carlapatchbay/CMakeLists.txt
#	plugins/carlarack/CMakeLists.txt
#	src/core/Song.cpp
#	src/core/Track.cpp
#	src/gui/editors/SongEditor.cpp
#	tests/src/core/AutomatableModelTest.cpp
2020-04-04 12:08:55 +09:00
Hyunjin Song
4bfcc30a71 MIDI import: fix putting notes before the beginning of a pattern (#5343) 2019-12-23 17:33:46 +09:00
Alexandre Almeida
53e6b645c8 Use "bar" instead of "tact"
Closes #4865
2019-10-31 15:13:25 +01:00
Kevin Zander
170d28ffbd Remove global automation from MIDI import (#5223) 2019-10-15 11:22:41 +09:00
Hussam al-Homsi
84d1091100 Rewrite the setup dialog (#3820) 2019-09-05 20:32:17 -04:00
Hyunjin Song
231a8407e8 Merge branch 'stable-1.2'
# Conflicts:
#	.travis.yml
#	.travis/linux..script.sh
#	.travis/linux.win32.script.sh
#	.travis/linux.win64.script.sh
#	.travis/osx..install.sh
#	.travis/osx..script.sh
#	data/locale/en.ts
#	data/locale/id.ts
#	include/Graph.h
#	include/VstSyncController.h
#	include/lmms_math.h
#	plugins/vst_base/RemoteVstPlugin.cpp
#	src/core/RemotePlugin.cpp
#	src/core/Song.cpp
#	src/core/Track.cpp
#	src/gui/SubWindow.cpp
#	src/gui/widgets/Graph.cpp
2019-02-24 20:45:52 +09:00
Hyunjin Song
c1ae1ed5f4 MIDI import/export: map note volume and MIDI velocity with their full range (#4785)
* MIDI export: map volume to MIDI velocity correctly

* MIDI import: map MIDI velocity to note volume with full range
2019-01-21 18:49:25 +01:00
Lukas W
966bf1c6de Use CMake GenerateExportHeader 2018-07-07 11:20:54 +02:00
Lukas W
3c6f200beb Merge branch 'stable-1.2'
# Conflicts:
#	cmake/modules/BuildPlugin.cmake
#	plugins/CMakeLists.txt
#	plugins/LadspaEffect/swh/CMakeLists.txt
#	plugins/LadspaEffect/tap/CMakeLists.txt
#	plugins/zynaddsubfx/zynaddsubfx
#	plugins/zynaddsubfx/zynaddsubfx/src/Misc/QtXmlWrapper.cpp
#	src/gui/MainWindow.cpp
2018-07-06 12:42:15 +02:00
Hyunin Song
3e538d510c Fix MIDI import encoding issue on Windows 2018-07-05 20:16:01 +09:00
Pikamander2
406bbcc2ee Fix grammar on MIDI import dialog (#4457) 2018-07-02 11:37:05 +09:00
Lukas W
ba2ed12f05 MSVC: EXPORT macro fixes 2017-11-22 11:08:47 +01:00
Oskar Wallgren
cded9fb735 MidiImport - set tempo (#3409) 2017-03-08 01:10:07 +01:00
grejppi
9e85d7c66e update all copyright headers to the proper url (#3326) 2017-02-06 02:41:15 +02:00
Tres Finocchiaro
05d4b1398d Merge pull request #2006 from softrabbit/midi_import
Midi import: various small improvements
2015-06-17 15:48:27 -04:00
Colin Wallace
860d419c14 Replace 'Engine::hasGUI()' with 'gui != nullptr' 2015-06-16 05:40:05 +00:00
Raine M. Ekman
c4f4fe3657 MIDI import: i18n in default track names, control names for automation tracks 2015-05-18 21:54:21 +03:00
Raine M. Ekman
22b1e4fb4c Clarified the reason for qApp->processEvents(),
changed an odd type juggling into something slightly saner.
2015-05-05 22:21:33 +03:00
Raine M. Ekman
542250e127 MIDI import: set default pitch bend range to +/-2 semitones
AFAIK, this is how the General MIDI standard says it should be.
2015-05-05 12:25:13 +03:00
Raine M. Ekman
06d87174e4 MIDI import: call qApp->processEvents(); before creating tracks
This should keep LMMS responsive from the window managers POV, unless
the user selects a huge enough default sound font that loading it
takes too long.
2015-05-05 12:25:12 +03:00
Raine M. Ekman
61ab0ed093 MIDI import: add naming of AutomationTracks
Name the automation tracks like "[MIDI trackname] CC ##". And don't
call the automation track creation function for every CC event, as
it now will involve constructing a QString.
2015-05-05 12:25:12 +03:00
Raine M. Ekman
2a72d5f119 MIDI import: ensure minimum note length 1 tick
Too short notes had their duration rounded down to 0 on import,
as MIDI precision allows way shorter notes than LMMS, and
portsmf reports the duration as a double, where a beat == 1.0.

Was going to use ceil() first, but that might round some notes
up to a slightly longer duration.
2015-05-05 12:25:12 +03:00
Raine M. Ekman
ff44854cde MIDI import: don't call AutomationPattern::addObject all the time
Should be enough to add the object to the automation pattern only once,
as the objModel variable that is added will always be the same for the
same value of ccid, which indexes the ccs array.

This will speed up creation of automation tracks for MIDI CCs and pitch
bend.
2015-05-05 12:25:12 +03:00
Michael Gregorius
2d909462b6 Improved debugging output for unhandled MIDI data
Print as much debug info as possible for unhandled data.
2015-04-20 19:52:44 +02:00
Michael Gregorius
19d641f6b4 Might fix 1981 ("Midi Import crash in master branch")
This commit adds checks for conditions that are asserted during calls to
get_atom_value.

It might fix a crash that is described in 1981. Unfortunately no files
have been attached to that issue. However, I was able to crash LMMS
using a local file and this crash is gone with this fix. So hopefully this
change also fixes the crashes described in 1981.
2015-04-19 17:11:03 +02:00
Raine M. Ekman
4d1e8633e1 MIDI import: remove old non-functional track name code. 2015-03-29 17:26:02 +03:00
Raine M. Ekman
c1ad8d0ae2 MIDI import: add support for track names 2015-03-29 17:16:35 +03:00
Raine M. Ekman
26a84837c2 Switch track imported from MIDI channel 10 to bank 128, patch 0 in SF2 player.
(aka. import drum tracks)
2015-01-14 22:01:42 +02:00
Lukas W
1ee93409d1 Move Engine' GUI code to new GuiApplication class 2014-12-17 23:25:55 +01:00