* Render the mixer levels in a dB FS scale
Adds the option to render the mixer levels in dB FS. By default this
option is disabled so that classes which inherit from Fader are not
affected by this change. However, in the code of the FxMixerView this
feature is enabled so that the mixer shows the levels in dB FS.
The ability to render in dB FS is exported as a property so that it can
also be set in a style sheet (not used as of now). The new property is
called "levelsDisplayedInDBFS".
There are now setters and getters for the min and max level.
Showing the levels in dB FS (which is a logarithmic scale) gives a less
"fidgety" impression when the levels are moving.
* Introduction of an init method in Fader
An init method was added to unify the initialization of the two Fader
constructors.
In Qt, it is not safe to delete a QObject inside a signal emitted by that
QObject. This happened with FxLine when removing an FX channel using the
context menu. This commit changes that by using deleteLater() instead of
delete on the FxLine. It also hides the FxLine to prevent a ghost of it
being drawn when deleting the last non-master FX channel.
This prevents a race condition with Qt5. A foreach loop makes a copy of its
Qt container, increasing the reference count to the container's internal
data. Qt5 often asserts isDetached(), which requires the reference count to
be <= 1. This assertion fails when the foreach loop increases the reference
count at exactly the wrong moment. Using a range-based for loop prevents an
unnecessary copy from being made and ensures this race condition isn't
triggered.
This commit addresses a lot of issues, namely:
1. When the "Move left/right" action was selected on a mixer channel
menu sometimes it would segfault due to the fxline object being
deleted before it returned to a method inside itself
2. The Fader was declaring a new variable for the model whereas it
should used the inherited model from FloatModelView < AutomatableModelView
3. Some methods were doing more things than they should be and
performing unnecessary actions. A little cleanup/refactor was made
Please notice that a bug of the same class as the one referred at point 1
still exists: clicking on "Remove channel". This commit does not
addresses this issue.
Fixes#1584
Fixes the following two errors I spotted using valgrind:
When deleting a channel;
==936== Invalid read of size 8
==936== at 0x56FA1D: FxMixerView::deleteChannel(int) (FxMixerView.cpp:374)
==936== by 0x60E9A79: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.6)
==936== by 0x5216BF1: QAction::triggered(bool) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==936== by 0x52185C2: QAction::activate(QAction::ActionEvent) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==936== Address 0x14d51b90 is 32 bytes inside a block of size 40 free'd
==936== at 0x4C2C2E0: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==936== by 0x56F9ED: FxMixerView::deleteChannel(int) (FxMixerView.cpp:370)
==936== by 0x60E9A79: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.6)
==936== by 0x5216BF1: QAction::triggered(bool) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
When loading a new project after adding some channels:
==936== Invalid read of size 8
==936== at 0x570785: FxMixerView::refreshDisplay() (FxMixerView.cpp:202)
==936== by 0x4B590E: Song::clearProject() (Song.cpp:740)
==936== by 0x4B7885: Song::createNewProject() (Song.cpp:817)
==936== by 0x60E9A79: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.6)
==936== Address 0x56a12ab0 is 32 bytes inside a block of size 40 free'd
==936== at 0x4C2C2E0: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==936== by 0x57075B: FxMixerView::refreshDisplay() (FxMixerView.cpp:201)
==936== by 0x4B590E: Song::clearProject() (Song.cpp:740)
==936== by 0x4B7885: Song::createNewProject() (Song.cpp:817)
LMMS now properly builds and runs with Qt5. Various deprecated functions
had to be replaced like QString::toAscii()/fromAscii(). Also occurences
of FALSE/TRUE have been replaced with false/true.
LmmsStyle now derives from QProxyStyle and sets a style instance as base
style (Plastique for Qt4, Fusion for Qt5).
MOC files are not included anymore but added as regular source files.
What's missing is support for embedding VST plugins into a subwindow
inside LMMS on Linux/X11 due to missing QX11EmbedContainer class in Qt5.
Build instructions can be found in INSTALL.Qt5
Minimum version requirement for Qt4 has been raised to 4.6.0 for best
API compatibility between Qt4 and Qt5.
We lost short peaks because the display update rate usually is much lower
than the number of audio buffers processed per second which lead to lost
peaks. We mitigate this issue by caching the maximum peak value until the
next display update where it is reset.