Merge remote-tracking branch 'origin/master' into feature/recording-stage-one
Conflicts: * src/core/audio/AudioSdl.cpp
This commit is contained in:
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@@ -1 +1,2 @@
|
||||
---
|
||||
custom: https://lmms.io/get-involved/#donate
|
||||
|
||||
3
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
3
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -78,7 +78,8 @@ body:
|
||||
label: Screenshots / Minimum Reproducible Project
|
||||
description: |
|
||||
- Upload any screenshots showing the bug in action.
|
||||
- If possible, also include a .mmp/.mmpz project containing the simplest possible setup needed to reproduce the bug.
|
||||
- If possible, also include a .mmp/.mmpz project containing the simplest possible
|
||||
setup needed to reproduce the bug.
|
||||
|
||||
***Note:** To upload a project file to GitHub, it will need to be placed in a .zip archive.*
|
||||
- type: checkboxes
|
||||
|
||||
7
.github/ISSUE_TEMPLATE/config.yml
vendored
7
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,4 +1,5 @@
|
||||
---
|
||||
contact_links:
|
||||
- name: Get help on Discord
|
||||
url: https://lmms.io/chat/
|
||||
about: Need help? Have a question? Reach out to other LMMS users on our Discord server!
|
||||
- name: Get help on Discord
|
||||
url: https://lmms.io/chat/
|
||||
about: Need help? Have a question? Reach out to other LMMS users on our Discord server!
|
||||
|
||||
3
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
3
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
@@ -10,7 +10,8 @@ body:
|
||||
label: Enhancement Summary
|
||||
description: |
|
||||
- Briefly describe the enhancement.
|
||||
- Explain why you believe the proposed enhancement to be a good idea, and (if applicable) how it helps overcome a limitation of LMMS you are currently facing.
|
||||
- Explain why you believe the proposed enhancement to be a good idea, and (if applicable) how it helps
|
||||
overcome a limitation of LMMS you are currently facing.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
|
||||
1
.github/no-response.yml
vendored
1
.github/no-response.yml
vendored
@@ -1,2 +1,3 @@
|
||||
---
|
||||
# Label requiring a response
|
||||
responseRequiredLabel: "response required"
|
||||
|
||||
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -260,12 +260,14 @@ jobs:
|
||||
- name: Cache ccache data
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
# yamllint disable rule:line-length
|
||||
key: "ccache-${{ github.job }}-${{ matrix.arch }}-${{ github.ref }}\
|
||||
-${{ github.run_id }}"
|
||||
restore-keys: |
|
||||
ccache-${{ github.job }}-${{ matrix.arch }}-${{ github.ref }}-
|
||||
ccache-${{ github.job }}-${{ matrix.arch }}-
|
||||
path: ~\AppData\Local\ccache
|
||||
# yamllint enable rule:line-length
|
||||
- name: Install tools
|
||||
run: choco install ccache
|
||||
- name: Install Qt
|
||||
|
||||
7
.github/workflows/checks.yml
vendored
7
.github/workflows/checks.yml
vendored
@@ -31,3 +31,10 @@ jobs:
|
||||
$(find "./cmake/" -type f -name '*.sh' -o -name "*.sh.in") \
|
||||
doc/bash-completion/lmms \
|
||||
buildtools/update_locales
|
||||
yamllint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v3
|
||||
- name: Run yamllint
|
||||
run: for i in $(git ls-files '*.yml'); do yamllint $i; done
|
||||
|
||||
3
.yamllint
Normal file
3
.yamllint
Normal file
@@ -0,0 +1,3 @@
|
||||
rules:
|
||||
line-length:
|
||||
max: 120 # be conforming to LMMS coding rules
|
||||
@@ -630,69 +630,6 @@ ENDIF(WANT_DEBUG_FPE)
|
||||
# check for libsamplerate
|
||||
FIND_PACKAGE(Samplerate 0.1.8 MODULE REQUIRED)
|
||||
|
||||
# Shim the SYSTEM property for older CMake versions
|
||||
if(CMAKE_VERSION VERSION_LESS "3.25")
|
||||
define_property(TARGET
|
||||
PROPERTY SYSTEM
|
||||
INHERITED
|
||||
BRIEF_DOCS "Shim of built-in SYSTEM property for CMake versions less than 3.25"
|
||||
FULL_DOCS "Non-functional, but allows the property to be inherited properly."
|
||||
"See the CMake documentation at https://cmake.org/cmake/help/latest/prop_tgt/SYSTEM.html."
|
||||
)
|
||||
endif()
|
||||
|
||||
# Add warning and error flags
|
||||
option(USE_WERROR "Treat compiler warnings as errors" OFF)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
set(COMPILE_ERROR_FLAGS
|
||||
"-Wall" # Enable most warnings by default
|
||||
"-Werror=unused-function" # Unused functions are an error
|
||||
# TODO: Fix the code and remove the following:
|
||||
"-Wno-sign-compare" # Permit comparisons between signed and unsigned integers
|
||||
"-Wno-strict-overflow" # Permit optimisations assuming no signed overflow
|
||||
)
|
||||
set(THIRD_PARTY_COMPILE_ERROR_FLAGS
|
||||
"-w" # Disable all warnings
|
||||
)
|
||||
|
||||
# Due to a regression in gcc-4.8.X, we need to disable array-bounds check
|
||||
# TODO: Is this still necessary?
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
list(APPEND COMPILE_ERROR_FLAGS
|
||||
"-Wno-array-bounds" # Permit out-of-bounds array subscripts
|
||||
"-Wno-attributes" # Permit unrecognised attributes
|
||||
)
|
||||
endif()
|
||||
|
||||
if(USE_WERROR)
|
||||
list(APPEND COMPILE_ERROR_FLAGS
|
||||
"-Werror" # Treat warnings as errors
|
||||
)
|
||||
endif()
|
||||
elseif(MSVC)
|
||||
set(COMPILE_ERROR_FLAGS
|
||||
"/W2" # Enable some warnings by default
|
||||
"/external:W0" # Don't emit warnings for third-party code
|
||||
"/external:anglebrackets" # Consider headers included with angle brackets to be third-party
|
||||
"/external:templates-" # Still emit warnings from first-party instantiations of third-party templates
|
||||
# Silence "class X needs to have DLL-interface to be used by clients of
|
||||
# class Y" warnings. These aren't trivial to address, and don't pose a
|
||||
# problem for us since we build all modules with the same compiler and
|
||||
# options, and dynamically link the CRT.
|
||||
"/wd4251"
|
||||
)
|
||||
set(THIRD_PARTY_COMPILE_ERROR_FLAGS
|
||||
"/W0" # Disable all warnings
|
||||
)
|
||||
|
||||
if(USE_WERROR)
|
||||
list(APPEND COMPILE_ERROR_FLAGS
|
||||
"/WX" # Treat warnings as errors
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
add_compile_options("$<IF:$<BOOL:$<TARGET_PROPERTY:SYSTEM>>,${THIRD_PARTY_COMPILE_ERROR_FLAGS},${COMPILE_ERROR_FLAGS}>")
|
||||
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
message(STATUS "Setting build type to 'Release' as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
|
||||
@@ -774,6 +711,8 @@ add_sanitizer(memory "Clang" WANT_DEBUG_MSAN STATUS_DEBUG_MSAN -fno-omit-frame-p
|
||||
# not being found by PeakController
|
||||
add_sanitizer(undefined "GNU|Clang" WANT_DEBUG_UBSAN STATUS_DEBUG_UBSAN -fno-sanitize=vptr)
|
||||
|
||||
# Add warning and error flags
|
||||
include(ErrorFlags)
|
||||
|
||||
# use ccache
|
||||
include(CompileCache)
|
||||
|
||||
72
cmake/modules/ErrorFlags.cmake
Normal file
72
cmake/modules/ErrorFlags.cmake
Normal file
@@ -0,0 +1,72 @@
|
||||
# Shim the SYSTEM property for older CMake versions - we rely on this property
|
||||
# to determine which set of error flags to use.
|
||||
if(CMAKE_VERSION VERSION_LESS "3.25")
|
||||
define_property(TARGET
|
||||
PROPERTY SYSTEM
|
||||
INHERITED
|
||||
BRIEF_DOCS "Shim of built-in SYSTEM property for CMake versions less than 3.25"
|
||||
FULL_DOCS "Non-functional, but allows the property to be inherited properly."
|
||||
"See the CMake documentation at https://cmake.org/cmake/help/latest/prop_tgt/SYSTEM.html."
|
||||
)
|
||||
endif()
|
||||
|
||||
# Allow the user to control whether to treat warnings as errors
|
||||
option(USE_WERROR "Treat compiler warnings as errors" OFF)
|
||||
|
||||
# Compute the appropriate flags for the current compiler and options
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
set(COMPILE_ERROR_FLAGS
|
||||
"-Wall" # Enable most warnings by default
|
||||
)
|
||||
set(THIRD_PARTY_COMPILE_ERROR_FLAGS
|
||||
"-w" # Disable all warnings
|
||||
)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
list(APPEND COMPILE_ERROR_FLAGS
|
||||
# The following warning generates false positives that are difficult
|
||||
# to work around, in particular when inlining calls to standard
|
||||
# algorithms performed on single-element arrays. See, for example,
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111273.
|
||||
"-Wno-array-bounds" # Permit out-of-bounds array subscripts
|
||||
)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11")
|
||||
list(APPEND COMPILE_ERROR_FLAGS
|
||||
# This has the same problems described above for "array-bounds".
|
||||
"-Wno-stringop-overread" # Permit string functions overreading the source
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_WERROR)
|
||||
list(APPEND COMPILE_ERROR_FLAGS
|
||||
"-Werror" # Treat warnings as errors
|
||||
)
|
||||
endif()
|
||||
elseif(MSVC)
|
||||
set(COMPILE_ERROR_FLAGS
|
||||
"/W2" # Enable some warnings by default
|
||||
"/external:W0" # Don't emit warnings for third-party code
|
||||
"/external:anglebrackets" # Consider headers included with angle brackets to be third-party
|
||||
"/external:templates-" # Still emit warnings from first-party instantiations of third-party templates
|
||||
# Silence "class X needs to have DLL-interface to be used by clients of
|
||||
# class Y" warnings. These aren't trivial to address, and don't pose a
|
||||
# problem for us since we build all modules with the same compiler and
|
||||
# options, and dynamically link the CRT.
|
||||
"/wd4251"
|
||||
)
|
||||
set(THIRD_PARTY_COMPILE_ERROR_FLAGS
|
||||
"/W0" # Disable all warnings
|
||||
)
|
||||
|
||||
if(USE_WERROR)
|
||||
list(APPEND COMPILE_ERROR_FLAGS
|
||||
"/WX" # Treat warnings as errors
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Add the flags to the whole directory tree. We use the third-party flags for
|
||||
# targets whose SYSTEM property is true, and the normal flags otherwise.
|
||||
add_compile_options("$<IF:$<BOOL:$<TARGET_PROPERTY:SYSTEM>>,${THIRD_PARTY_COMPILE_ERROR_FLAGS},${COMPILE_ERROR_FLAGS}>")
|
||||
BIN
data/themes/classic/autoscroll_continuous_on.png
Normal file
BIN
data/themes/classic/autoscroll_continuous_on.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.5 KiB |
BIN
data/themes/classic/autoscroll_stepped_on.png
Normal file
BIN
data/themes/classic/autoscroll_stepped_on.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
data/themes/default/autoscroll_continuous_on.png
Normal file
BIN
data/themes/default/autoscroll_continuous_on.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
BIN
data/themes/default/autoscroll_stepped_on.png
Normal file
BIN
data/themes/default/autoscroll_stepped_on.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
@@ -71,8 +71,8 @@ public:
|
||||
|
||||
private:
|
||||
std::atomic<ThreadableJob*> m_items[JOB_QUEUE_SIZE];
|
||||
std::atomic_int m_writeIndex;
|
||||
std::atomic_int m_itemsDone;
|
||||
std::atomic_size_t m_writeIndex;
|
||||
std::atomic_size_t m_itemsDone;
|
||||
OperationMode m_opMode;
|
||||
} ;
|
||||
|
||||
|
||||
@@ -84,11 +84,7 @@ public:
|
||||
return QT_TRANSLATE_NOOP( "AudioDeviceSetupWidget", "PortAudio" );
|
||||
}
|
||||
|
||||
|
||||
int process_callback( const float *_inputBuffer,
|
||||
float * _outputBuffer,
|
||||
unsigned long _framesPerBuffer );
|
||||
|
||||
int process_callback(const float* _inputBuffer, float* _outputBuffer, f_cnt_t _framesPerBuffer);
|
||||
|
||||
class setupWidget : public gui::AudioDeviceSetupWidget
|
||||
{
|
||||
@@ -151,8 +147,8 @@ private:
|
||||
bool m_wasPAInitError;
|
||||
|
||||
SampleFrame* m_outBuf;
|
||||
int m_outBufPos;
|
||||
int m_outBufSize;
|
||||
std::size_t m_outBufPos;
|
||||
fpp_t m_outBufSize;
|
||||
|
||||
bool m_stopped;
|
||||
|
||||
|
||||
@@ -64,6 +64,10 @@ public:
|
||||
~setupWidget() override = default;
|
||||
|
||||
void saveSettings() override;
|
||||
|
||||
private:
|
||||
void populatePlaybackDeviceComboBox();
|
||||
void populateInputDeviceComboBox();
|
||||
|
||||
private:
|
||||
QComboBox* m_playbackDeviceComboBox = nullptr;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#endif
|
||||
|
||||
#include <cmath>
|
||||
#include <array>
|
||||
|
||||
#include "lmms_basics.h"
|
||||
#include "lmms_constants.h"
|
||||
|
||||
@@ -39,10 +39,6 @@ class LMMS_EXPORT BufferManager
|
||||
public:
|
||||
static void init( fpp_t fpp );
|
||||
static SampleFrame* acquire();
|
||||
// audio-buffer-mgm
|
||||
static void clear( SampleFrame* ab, const f_cnt_t frames,
|
||||
const f_cnt_t offset = 0 );
|
||||
|
||||
static void release( SampleFrame* buf );
|
||||
|
||||
private:
|
||||
|
||||
@@ -230,6 +230,7 @@ public:
|
||||
|
||||
QString defaultVersion() const;
|
||||
|
||||
static bool enableBlockedPlugins();
|
||||
|
||||
static QStringList availableVstEmbedMethods();
|
||||
QString vstEmbedMethod() const;
|
||||
|
||||
@@ -133,6 +133,7 @@ private:
|
||||
void upgrade_noteTypes();
|
||||
void upgrade_fixCMTDelays();
|
||||
void upgrade_fixBassLoopsTypo();
|
||||
void findProblematicLadspaPlugins();
|
||||
|
||||
// List of all upgrade methods
|
||||
static const std::vector<UpgradeMethod> UPGRADE_METHODS;
|
||||
|
||||
@@ -64,6 +64,8 @@ private slots:
|
||||
|
||||
private:
|
||||
void modelChanged() override;
|
||||
QSize sizeHint() const override;
|
||||
QSize minimumSizeHint() const override { return sizeHint(); }
|
||||
|
||||
inline EffectChain* fxChain()
|
||||
{
|
||||
|
||||
@@ -81,8 +81,6 @@ public:
|
||||
return s_projectJournal;
|
||||
}
|
||||
|
||||
static bool ignorePluginBlacklist();
|
||||
|
||||
#ifdef LMMS_HAVE_LV2
|
||||
static class Lv2Manager * getLv2Manager()
|
||||
{
|
||||
|
||||
@@ -25,11 +25,12 @@
|
||||
#ifndef LMMS_INSTRUMENT_FUNCTIONS_H
|
||||
#define LMMS_INSTRUMENT_FUNCTIONS_H
|
||||
|
||||
#include "JournallingObject.h"
|
||||
#include "lmms_basics.h"
|
||||
#include <array>
|
||||
|
||||
#include "AutomatableModel.h"
|
||||
#include "TempoSyncKnobModel.h"
|
||||
#include "ComboBoxModel.h"
|
||||
#include "JournallingObject.h"
|
||||
#include "TempoSyncKnobModel.h"
|
||||
|
||||
namespace lmms
|
||||
{
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#ifndef LMMS_INSTRUMENT_TRACK_H
|
||||
#define LMMS_INSTRUMENT_TRACK_H
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "AudioPort.h"
|
||||
#include "InstrumentFunctions.h"
|
||||
#include "InstrumentSoundShaping.h"
|
||||
|
||||
@@ -50,8 +50,8 @@ private:
|
||||
std::atomic_int * m_freeState;
|
||||
size_t m_freeStateSets;
|
||||
|
||||
std::atomic_int m_available;
|
||||
std::atomic_int m_startIndex;
|
||||
std::atomic_size_t m_available;
|
||||
std::atomic_size_t m_startIndex;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Lv2Basics.h - basic Lv2 utils
|
||||
*
|
||||
* Copyright (c) 2018-2023 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
|
||||
* Copyright (c) 2018-2024 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
@@ -37,6 +37,12 @@
|
||||
namespace lmms
|
||||
{
|
||||
|
||||
template<class T>
|
||||
struct LilvPtrDeleter
|
||||
{
|
||||
void operator()(T* n) { lilv_free(static_cast<void*>(n)); }
|
||||
};
|
||||
|
||||
struct LilvNodeDeleter
|
||||
{
|
||||
void operator()(LilvNode* n) { lilv_node_free(n); }
|
||||
@@ -52,6 +58,8 @@ struct LilvScalePointsDeleter
|
||||
void operator()(LilvScalePoints* s) { lilv_scale_points_free(s); }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
using AutoLilvPtr = std::unique_ptr<T, LilvPtrDeleter<T>>;
|
||||
using AutoLilvNode = std::unique_ptr<LilvNode, LilvNodeDeleter>;
|
||||
using AutoLilvNodes = std::unique_ptr<LilvNodes, LilvNodesDeleter>;
|
||||
using AutoLilvScalePoints = std::unique_ptr<LilvScalePoints, LilvScalePointsDeleter>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Lv2Manager.h - Implementation of Lv2Manager class
|
||||
*
|
||||
* Copyright (c) 2018-2023 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
|
||||
* Copyright (c) 2018-2024 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
@@ -131,14 +131,23 @@ public:
|
||||
AutoLilvNodes findNodes(const LilvNode *subject,
|
||||
const LilvNode *predicate, const LilvNode *object);
|
||||
|
||||
static const std::set<std::string_view>& getPluginBlacklist()
|
||||
static bool pluginIsUnstable(const char* pluginUri)
|
||||
{
|
||||
return pluginBlacklist;
|
||||
return unstablePlugins.find(pluginUri) != unstablePlugins.end();
|
||||
}
|
||||
static const std::set<std::string_view>& getPluginBlacklistBuffersizeLessThan32()
|
||||
static bool pluginIsOnlyUsefulWithUi(const char* pluginUri)
|
||||
{
|
||||
return pluginBlacklistBuffersizeLessThan32;
|
||||
return pluginsOnlyUsefulWithUi.find(pluginUri) != pluginsOnlyUsefulWithUi.end();
|
||||
}
|
||||
static bool pluginIsUnstableWithBuffersizeLessEqual32(const char* pluginUri)
|
||||
{
|
||||
return unstablePluginsBuffersizeLessEqual32.find(pluginUri) !=
|
||||
unstablePluginsBuffersizeLessEqual32.end();
|
||||
}
|
||||
|
||||
//! Whether the user generally wants a UI (and we generally support that)
|
||||
//! Since we do not generally support UI right now, this will always return false...
|
||||
static bool wantUi();
|
||||
|
||||
private:
|
||||
// general data
|
||||
@@ -154,8 +163,9 @@ private:
|
||||
Lv2UridCache m_uridCache;
|
||||
|
||||
// static
|
||||
static const std::set<std::string_view>
|
||||
pluginBlacklist, pluginBlacklistBuffersizeLessThan32;
|
||||
static const std::set<std::string_view> unstablePlugins;
|
||||
static const std::set<std::string_view> pluginsOnlyUsefulWithUi;
|
||||
static const std::set<std::string_view> unstablePluginsBuffersizeLessEqual32;
|
||||
|
||||
// functions
|
||||
bool isSubclassOf(const LilvPluginClass *clvss, const char *uriStr);
|
||||
|
||||
@@ -190,6 +190,8 @@ public:
|
||||
setParam( 0, pitchBend );
|
||||
}
|
||||
|
||||
auto sysExData() const -> const char* { return m_sysExData; }
|
||||
|
||||
Source source() const
|
||||
{
|
||||
return m_source;
|
||||
@@ -212,7 +214,7 @@ private:
|
||||
int32_t m_sysExDataLen; // len of m_sysExData
|
||||
} m_data;
|
||||
|
||||
[[maybe_unused]] const char* m_sysExData;
|
||||
const char* m_sysExData;
|
||||
const void* m_sourcePort;
|
||||
|
||||
// Stores the source of the MidiEvent: Internal or External (hardware controllers).
|
||||
|
||||
@@ -79,7 +79,7 @@ class MixerChannel : public ThreadableJob
|
||||
auto color() const -> const std::optional<QColor>& { return m_color; }
|
||||
void setColor(const std::optional<QColor>& color) { m_color = color; }
|
||||
|
||||
std::atomic_int m_dependenciesMet;
|
||||
std::atomic_size_t m_dependenciesMet;
|
||||
void incrementDeps();
|
||||
void processed();
|
||||
|
||||
|
||||
@@ -170,12 +170,8 @@ public:
|
||||
{
|
||||
if (buffer == nullptr || buffer->size() == 0) { return 0; }
|
||||
const auto frames = buffer->size();
|
||||
const auto frame = sample * frames;
|
||||
auto f1 = static_cast<f_cnt_t>(frame) % frames;
|
||||
if (f1 < 0)
|
||||
{
|
||||
f1 += frames;
|
||||
}
|
||||
const auto frame = absFraction(sample) * frames;
|
||||
const auto f1 = static_cast<f_cnt_t>(frame);
|
||||
|
||||
return linearInterpolate(buffer->data()[f1][0], buffer->data()[(f1 + 1) % frames][0], fraction(frame));
|
||||
}
|
||||
@@ -190,12 +186,8 @@ public:
|
||||
inline wtSampleControl getWtSampleControl(const float sample) const
|
||||
{
|
||||
wtSampleControl control;
|
||||
control.frame = sample * OscillatorConstants::WAVETABLE_LENGTH;
|
||||
control.f1 = static_cast<f_cnt_t>(control.frame) % OscillatorConstants::WAVETABLE_LENGTH;
|
||||
if (control.f1 < 0)
|
||||
{
|
||||
control.f1 += OscillatorConstants::WAVETABLE_LENGTH;
|
||||
}
|
||||
control.frame = absFraction(sample) * OscillatorConstants::WAVETABLE_LENGTH;
|
||||
control.f1 = static_cast<f_cnt_t>(control.frame);
|
||||
control.f2 = control.f1 < OscillatorConstants::WAVETABLE_LENGTH - 1 ?
|
||||
control.f1 + 1 :
|
||||
0;
|
||||
|
||||
@@ -25,8 +25,10 @@
|
||||
#ifndef LMMS_PIANO_H
|
||||
#define LMMS_PIANO_H
|
||||
|
||||
#include "Note.h"
|
||||
#include <array>
|
||||
|
||||
#include "Model.h"
|
||||
#include "Note.h"
|
||||
|
||||
namespace lmms
|
||||
{
|
||||
|
||||
@@ -57,7 +57,7 @@ enum class PluginIssueType
|
||||
FeatureNotSupported, //!< plugin requires functionality LMMS can't offer
|
||||
// misc
|
||||
BadPortType, //!< port type not supported
|
||||
Blacklisted,
|
||||
Blocked,
|
||||
NoIssue
|
||||
};
|
||||
|
||||
|
||||
@@ -189,13 +189,11 @@ private slots:
|
||||
void processErrored(QProcess::ProcessError err );
|
||||
} ;
|
||||
|
||||
|
||||
LMMS_EXPORT inline std::string QSTR_TO_STDSTR(QString const& qstr)
|
||||
inline std::string QSTR_TO_STDSTR(QString const& qstr)
|
||||
{
|
||||
return qstr.toStdString();
|
||||
}
|
||||
|
||||
|
||||
} // namespace lmms
|
||||
|
||||
#endif // LMMS_REMOTE_PLUGIN_H
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace lmms
|
||||
class RmsHelper
|
||||
{
|
||||
public:
|
||||
RmsHelper( int size ) :
|
||||
RmsHelper(std::size_t size) :
|
||||
m_buffer( nullptr )
|
||||
{
|
||||
setSize( size );
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
if( m_buffer ) delete[] m_buffer;
|
||||
}
|
||||
|
||||
inline void setSize( int size )
|
||||
void setSize(std::size_t size)
|
||||
{
|
||||
if( m_buffer )
|
||||
{
|
||||
@@ -90,8 +90,8 @@ public:
|
||||
private:
|
||||
float * m_buffer;
|
||||
float m_sum;
|
||||
unsigned int m_pos;
|
||||
unsigned int m_size;
|
||||
std::size_t m_pos;
|
||||
std::size_t m_size;
|
||||
float m_sizef;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,8 +28,9 @@
|
||||
|
||||
#include "lmms_basics.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cmath>
|
||||
|
||||
|
||||
namespace lmms
|
||||
|
||||
@@ -73,7 +73,8 @@ public:
|
||||
|
||||
enum class AutoScrollState
|
||||
{
|
||||
Enabled,
|
||||
Stepped,
|
||||
Continuous,
|
||||
Disabled
|
||||
};
|
||||
|
||||
@@ -212,7 +213,7 @@ private:
|
||||
QCursor m_cursorSelectLeft = QCursor{embed::getIconPixmap("cursor_select_left"), 0, 16};
|
||||
QCursor m_cursorSelectRight = QCursor{embed::getIconPixmap("cursor_select_right"), 32, 16};
|
||||
|
||||
AutoScrollState m_autoScroll = AutoScrollState::Enabled;
|
||||
AutoScrollState m_autoScroll = AutoScrollState::Stepped;
|
||||
|
||||
// Width of the unused region on the widget's left (above track labels or piano)
|
||||
int m_xOffset;
|
||||
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
void deleteClips();
|
||||
|
||||
int numOfClips();
|
||||
Clip * getClip( int clipNum );
|
||||
auto getClip(std::size_t clipNum) -> Clip*;
|
||||
int getClipNum(const Clip* clip );
|
||||
|
||||
const clipVector & getClips() const
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace lmms
|
||||
// NOTE: FFT_BUFFER_SIZE should be considered deprecated!
|
||||
// It is used by Eq plugin and some older code here, but this should be a user
|
||||
// switchable parameter, not a constant. Use a value from FFT_BLOCK_SIZES
|
||||
const unsigned int FFT_BUFFER_SIZE = 2048;
|
||||
constexpr auto FFT_BUFFER_SIZE = std::size_t{2048};
|
||||
|
||||
// Allowed FFT block sizes. Ranging from barely useful to barely acceptable
|
||||
// because of performance and latency reasons.
|
||||
|
||||
@@ -26,15 +26,11 @@
|
||||
#define LMMS_TYPES_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
|
||||
#include "lmmsconfig.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <array>
|
||||
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace lmms
|
||||
@@ -49,8 +45,8 @@ using sample_t = float; // standard sample-type
|
||||
using int_sample_t = int16_t; // 16-bit-int-sample
|
||||
|
||||
using sample_rate_t = uint32_t; // sample-rate
|
||||
using fpp_t = int16_t; // frames per period (0-16384)
|
||||
using f_cnt_t = int32_t; // standard frame-count
|
||||
using fpp_t = size_t; // frames per period (0-16384)
|
||||
using f_cnt_t = size_t; // standard frame-count
|
||||
using ch_cnt_t = uint8_t; // channel-count (0-DEFAULT_CHANNELS)
|
||||
using bpm_t = uint16_t; // tempo (MIN_BPM to MAX_BPM)
|
||||
using bitrate_t = uint16_t; // bitrate in kbps
|
||||
@@ -58,57 +54,6 @@ using mix_ch_t = uint16_t; // Mixer-channel (0 to MAX_CHANNEL)
|
||||
|
||||
using jo_id_t = uint32_t; // (unique) ID of a journalling object
|
||||
|
||||
// windows headers define "min" and "max" macros, breaking the methods bwloe
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
template<typename T>
|
||||
struct typeInfo
|
||||
{
|
||||
static inline T min()
|
||||
{
|
||||
return std::numeric_limits<T>::min();
|
||||
}
|
||||
|
||||
static inline T max()
|
||||
{
|
||||
return std::numeric_limits<T>::max();
|
||||
}
|
||||
|
||||
static inline T minEps()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline bool isEqual( T x, T y )
|
||||
{
|
||||
return x == y;
|
||||
}
|
||||
|
||||
static inline T absVal( T t )
|
||||
{
|
||||
return t >= 0 ? t : -t;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
template<>
|
||||
inline float typeInfo<float>::minEps()
|
||||
{
|
||||
return 1.0e-10f;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline bool typeInfo<float>::isEqual( float x, float y )
|
||||
{
|
||||
if( x == y )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return absVal( x - y ) < minEps();
|
||||
}
|
||||
|
||||
|
||||
|
||||
constexpr ch_cnt_t DEFAULT_CHANNELS = 2;
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@ constexpr float F_E = (float) LD_E;
|
||||
constexpr float F_E_R = (float) LD_E_R;
|
||||
constexpr float F_SQRT_2 = (float) LD_SQRT_2;
|
||||
|
||||
constexpr float F_EPSILON = 1.0e-10f; // 10^-10
|
||||
|
||||
// Microtuner
|
||||
constexpr unsigned int MaxScaleCount = 10; //!< number of scales per project
|
||||
constexpr unsigned int MaxKeymapCount = 10; //!< number of keyboard mappings per project
|
||||
|
||||
@@ -37,6 +37,11 @@
|
||||
namespace lmms
|
||||
{
|
||||
|
||||
static inline bool approximatelyEqual(float x, float y)
|
||||
{
|
||||
return x == y ? true : std::abs(x - y) < F_EPSILON;
|
||||
}
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
|
||||
static inline float absFraction( const float _x )
|
||||
@@ -61,10 +66,9 @@ static inline float fraction( const float _x )
|
||||
* If the result is interpreted as a phase of an oscillator, it makes that negative phases are
|
||||
* converted to positive phases.
|
||||
*/
|
||||
static inline float absFraction( const float _x )
|
||||
static inline float absFraction(const float x)
|
||||
{
|
||||
return( _x - ( _x >= 0.0f ? static_cast<int>( _x ) :
|
||||
static_cast<int>( _x ) - 1 ) );
|
||||
return x - std::floor(x);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "SampleLoader.h"
|
||||
#include "Song.h"
|
||||
|
||||
#include "lmms_basics.h"
|
||||
#include "plugin_export.h"
|
||||
|
||||
#include <QDomElement>
|
||||
@@ -122,7 +123,7 @@ void AudioFileProcessor::playNote( NotePlayHandle * _n,
|
||||
|
||||
if( !_n->m_pluginData )
|
||||
{
|
||||
if (m_stutterModel.value() == true && m_nextPlayStartPoint >= m_sample.endFrame())
|
||||
if (m_stutterModel.value() == true && m_nextPlayStartPoint >= static_cast<std::size_t>(m_sample.endFrame()))
|
||||
{
|
||||
// Restart playing the note if in stutter mode, not in loop mode,
|
||||
// and we're at the end of the sample.
|
||||
@@ -276,7 +277,7 @@ QString AudioFileProcessor::nodeName() const
|
||||
|
||||
|
||||
|
||||
auto AudioFileProcessor::beatLen(NotePlayHandle* note) const -> int
|
||||
auto AudioFileProcessor::beatLen(NotePlayHandle* note) const -> f_cnt_t
|
||||
{
|
||||
// If we can play indefinitely, use the default beat note duration
|
||||
if (static_cast<Sample::Loop>(m_loopModel.value()) != Sample::Loop::Off) { return 0; }
|
||||
@@ -287,12 +288,12 @@ auto AudioFileProcessor::beatLen(NotePlayHandle* note) const -> int
|
||||
* Engine::audioEngine()->outputSampleRate()
|
||||
/ Engine::audioEngine()->baseSampleRate();
|
||||
|
||||
const auto startFrame = m_nextPlayStartPoint >= m_sample.endFrame()
|
||||
const auto startFrame = m_nextPlayStartPoint >= static_cast<std::size_t>(m_sample.endFrame())
|
||||
? m_sample.startFrame()
|
||||
: m_nextPlayStartPoint;
|
||||
const auto duration = m_sample.endFrame() - startFrame;
|
||||
|
||||
return static_cast<int>(std::floor(duration * freqFactor));
|
||||
return static_cast<f_cnt_t>(std::floor(duration * freqFactor));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "Instrument.h"
|
||||
#include "Sample.h"
|
||||
#include "lmms_basics.h"
|
||||
|
||||
|
||||
namespace lmms
|
||||
@@ -54,7 +55,7 @@ public:
|
||||
|
||||
QString nodeName() const override;
|
||||
|
||||
auto beatLen(NotePlayHandle* note) const -> int override;
|
||||
auto beatLen(NotePlayHandle* note) const -> f_cnt_t override;
|
||||
|
||||
float desiredReleaseTimeMs() const override
|
||||
{
|
||||
|
||||
@@ -44,23 +44,23 @@ void AudioFileProcessorWaveView::updateSampleRange()
|
||||
{
|
||||
if (m_sample->sampleSize() > 1)
|
||||
{
|
||||
const f_cnt_t marging = (m_sample->endFrame() - m_sample->startFrame()) * 0.1;
|
||||
const auto marging = (m_sample->endFrame() - m_sample->startFrame()) * 0.1;
|
||||
setFrom(m_sample->startFrame() - marging);
|
||||
setTo(m_sample->endFrame() + marging);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioFileProcessorWaveView::setTo(f_cnt_t to)
|
||||
void AudioFileProcessorWaveView::setTo(int to)
|
||||
{
|
||||
m_to = std::min(to, static_cast<lmms::f_cnt_t>(m_sample->sampleSize()));
|
||||
m_to = std::min(to, static_cast<int>(m_sample->sampleSize()));
|
||||
}
|
||||
|
||||
void AudioFileProcessorWaveView::setFrom(f_cnt_t from)
|
||||
void AudioFileProcessorWaveView::setFrom(int from)
|
||||
{
|
||||
m_from = std::max(from, 0);
|
||||
}
|
||||
|
||||
f_cnt_t AudioFileProcessorWaveView::range() const
|
||||
int AudioFileProcessorWaveView::range() const
|
||||
{
|
||||
return m_to - m_from;
|
||||
}
|
||||
@@ -196,7 +196,7 @@ void AudioFileProcessorWaveView::paintEvent(QPaintEvent * pe)
|
||||
p.drawPixmap(s_padding, s_padding, m_graph);
|
||||
|
||||
const QRect graph_rect(s_padding, s_padding, width() - 2 * s_padding, height() - 2 * s_padding);
|
||||
const f_cnt_t frames = range();
|
||||
const auto frames = range();
|
||||
m_startFrameX = graph_rect.x() + (m_sample->startFrame() - m_from) *
|
||||
double(graph_rect.width()) / frames;
|
||||
m_endFrameX = graph_rect.x() + (m_sample->endFrame() - m_from) *
|
||||
@@ -341,31 +341,32 @@ void AudioFileProcessorWaveView::updateGraph()
|
||||
|
||||
void AudioFileProcessorWaveView::zoom(const bool out)
|
||||
{
|
||||
const f_cnt_t start = m_sample->startFrame();
|
||||
const f_cnt_t end = m_sample->endFrame();
|
||||
const f_cnt_t frames = m_sample->sampleSize();
|
||||
const f_cnt_t d_from = start - m_from;
|
||||
const f_cnt_t d_to = m_to - end;
|
||||
const auto start = m_sample->startFrame();
|
||||
const auto end = m_sample->endFrame();
|
||||
const auto frames = m_sample->sampleSize();
|
||||
|
||||
const f_cnt_t step = qMax(1, qMax(d_from, d_to) / 10);
|
||||
const f_cnt_t step_from = (out ? - step : step);
|
||||
const f_cnt_t step_to = (out ? step : - step);
|
||||
const auto dFrom = start - m_from;
|
||||
const auto dTo = m_to - end;
|
||||
|
||||
const double comp_ratio = double(qMin(d_from, d_to))
|
||||
/ qMax(1, qMax(d_from, d_to));
|
||||
const auto step = std::max(1.0, std::max(dFrom, dTo) / 10.0);
|
||||
const auto stepFrom = out ? -step : step;
|
||||
const auto stepTo = out ? step : -step;
|
||||
|
||||
const auto boundedFrom = std::clamp(m_from + step_from, 0, start);
|
||||
const auto boundedTo = std::clamp(m_to + step_to, end, frames);
|
||||
const auto boundedFrom = std::clamp(m_from + stepFrom, 0.0, static_cast<double>(start));
|
||||
const auto boundedTo = std::clamp(m_to + stepTo, static_cast<double>(end), static_cast<double>(frames));
|
||||
|
||||
const auto toStep = static_cast<f_cnt_t>(step_from * (boundedTo == m_to ? 1 : comp_ratio));
|
||||
const auto newFrom
|
||||
= (out && d_from < d_to) || (!out && d_to < d_from) ? boundedFrom : std::clamp(m_from + toStep, 0, start);
|
||||
const auto compRatio = std::min(dFrom, dTo) / static_cast<double>(std::max(1, std::max(dFrom, dTo)));
|
||||
const auto toStep = stepFrom * (boundedTo == m_to ? 1 : compRatio);
|
||||
const auto newFrom = (out && dFrom < dTo) || (!out && dTo < dFrom)
|
||||
? boundedFrom
|
||||
: std::clamp(m_from + toStep, 0.0, static_cast<double>(start));
|
||||
|
||||
const auto fromStep = static_cast<f_cnt_t>(step_to * (boundedFrom == m_from ? 1 : comp_ratio));
|
||||
const auto newTo
|
||||
= (out && d_from < d_to) || (!out && d_to < d_from) ? std::clamp(m_to + fromStep, end, frames) : boundedTo;
|
||||
const auto fromStep = stepTo * (boundedFrom == m_from ? 1 : compRatio);
|
||||
const auto newTo = (out && dFrom < dTo) || (!out && dTo < dFrom)
|
||||
? std::clamp(m_to + fromStep, static_cast<double>(end), static_cast<double>(frames))
|
||||
: boundedTo;
|
||||
|
||||
if (static_cast<double>(newTo - newFrom) / m_sample->sampleRate() > 0.05)
|
||||
if ((newTo - newFrom) / m_sample->sampleRate() > 0.05)
|
||||
{
|
||||
setFrom(newFrom);
|
||||
setTo(newTo);
|
||||
@@ -375,16 +376,11 @@ void AudioFileProcessorWaveView::zoom(const bool out)
|
||||
void AudioFileProcessorWaveView::slide(int px)
|
||||
{
|
||||
const double fact = qAbs(double(px) / width());
|
||||
f_cnt_t step = range() * fact;
|
||||
if (px > 0)
|
||||
{
|
||||
step = -step;
|
||||
}
|
||||
auto step = range() * fact * (px > 0 ? -1 : 1);
|
||||
|
||||
f_cnt_t step_from = qBound<size_t>(0, m_from + step, m_sample->sampleSize()) - m_from;
|
||||
f_cnt_t step_to = qBound<size_t>(m_from + 1, m_to + step, m_sample->sampleSize()) - m_to;
|
||||
|
||||
step = qAbs(step_from) < qAbs(step_to) ? step_from : step_to;
|
||||
const auto stepFrom = std::clamp(m_from + step, 0.0, static_cast<double>(m_sample->sampleSize())) - m_from;
|
||||
const auto stepTo = std::clamp(m_to + step, m_from + 1.0, static_cast<double>(m_sample->sampleSize())) - m_to;
|
||||
step = std::abs(stepFrom) < std::abs(stepTo) ? stepFrom : stepTo;
|
||||
|
||||
setFrom(m_from + step);
|
||||
setTo(m_to + step);
|
||||
@@ -465,10 +461,8 @@ void AudioFileProcessorWaveView::reverse()
|
||||
- m_sample->startFrame()
|
||||
);
|
||||
|
||||
const f_cnt_t from = m_from;
|
||||
setFrom(m_sample->sampleSize() - m_to);
|
||||
setTo(m_sample->sampleSize() - from);
|
||||
|
||||
setTo(m_sample->sampleSize() - m_from);
|
||||
m_reversed = ! m_reversed;
|
||||
}
|
||||
|
||||
|
||||
@@ -125,17 +125,17 @@ private:
|
||||
|
||||
Sample const* m_sample;
|
||||
QPixmap m_graph;
|
||||
f_cnt_t m_from;
|
||||
f_cnt_t m_to;
|
||||
f_cnt_t m_last_from;
|
||||
f_cnt_t m_last_to;
|
||||
int m_from;
|
||||
int m_to;
|
||||
int m_last_from;
|
||||
int m_last_to;
|
||||
float m_last_amp;
|
||||
knob* m_startKnob;
|
||||
knob* m_endKnob;
|
||||
knob* m_loopKnob;
|
||||
f_cnt_t m_startFrameX;
|
||||
f_cnt_t m_endFrameX;
|
||||
f_cnt_t m_loopFrameX;
|
||||
int m_startFrameX;
|
||||
int m_endFrameX;
|
||||
int m_loopFrameX;
|
||||
bool m_isDragging;
|
||||
QPoint m_draggingLastPoint;
|
||||
DraggingType m_draggingType;
|
||||
@@ -152,9 +152,9 @@ public:
|
||||
|
||||
void updateSampleRange();
|
||||
private:
|
||||
void setTo(f_cnt_t to);
|
||||
void setFrom(f_cnt_t from);
|
||||
f_cnt_t range() const;
|
||||
void setTo(int to);
|
||||
void setFrom(int from);
|
||||
int range() const;
|
||||
void zoom(const bool out = false);
|
||||
void slide(int px);
|
||||
void slideSamplePointByPx(Point point, int px);
|
||||
|
||||
@@ -153,7 +153,7 @@ bool BitcrushEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames )
|
||||
// read input buffer and write it to oversampled buffer
|
||||
if( m_rateEnabled ) // rate crushing enabled so do that
|
||||
{
|
||||
for( int f = 0; f < frames; ++f )
|
||||
for (auto f = std::size_t{0}; f < frames; ++f)
|
||||
{
|
||||
for( int o = 0; o < OS_RATE; ++o )
|
||||
{
|
||||
@@ -180,7 +180,7 @@ bool BitcrushEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames )
|
||||
}
|
||||
else // rate crushing disabled: simply oversample with zero-order hold
|
||||
{
|
||||
for( int f = 0; f < frames; ++f )
|
||||
for (auto f = std::size_t{0}; f < frames; ++f)
|
||||
{
|
||||
for( int o = 0; o < OS_RATE; ++o )
|
||||
{
|
||||
@@ -196,7 +196,7 @@ bool BitcrushEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames )
|
||||
|
||||
// the oversampled buffer is now written, so filter it to reduce aliasing
|
||||
|
||||
for( int f = 0; f < frames * OS_RATE; ++f )
|
||||
for (auto f = std::size_t{0}; f < frames * OS_RATE; ++f)
|
||||
{
|
||||
if( qMax( qAbs( m_buffer[f][0] ), qAbs( m_buffer[f][1] ) ) >= 1.0e-10f )
|
||||
{
|
||||
@@ -225,7 +225,7 @@ bool BitcrushEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames )
|
||||
double outSum = 0.0;
|
||||
const float d = dryLevel();
|
||||
const float w = wetLevel();
|
||||
for( int f = 0; f < frames; ++f )
|
||||
for (auto f = std::size_t{0}; f < frames; ++f)
|
||||
{
|
||||
float lsum = 0.0f;
|
||||
float rsum = 0.0f;
|
||||
|
||||
@@ -205,9 +205,9 @@ CarlaInstrument::CarlaInstrument(InstrumentTrack* const instrumentTrack, const D
|
||||
m_paramsCompleter->setCompletionMode(QCompleter::PopupCompletion);
|
||||
|
||||
// Add static amount of CarlaParamFloatModel's.
|
||||
int paramCount = fDescriptor->get_parameter_count(fHandle);
|
||||
const auto paramCount = fDescriptor->get_parameter_count(fHandle);
|
||||
m_paramModels.reserve(paramCount);
|
||||
for (int i=0; i < paramCount; ++i)
|
||||
for (auto i = std::size_t{0}; i < paramCount; ++i)
|
||||
{
|
||||
m_paramModels.push_back(new CarlaParamFloatModel(this));
|
||||
connect(m_paramModels[i], &CarlaParamFloatModel::dataChanged,
|
||||
@@ -274,7 +274,7 @@ const NativeTimeInfo* CarlaInstrument::handleGetTimeInfo() const
|
||||
|
||||
void CarlaInstrument::handleUiParameterChanged(const uint32_t index, const float value) const
|
||||
{
|
||||
if (m_paramModels.count() > index)
|
||||
if (m_paramModels.size() > index)
|
||||
{
|
||||
m_paramModels[index]->setValue(value);
|
||||
}
|
||||
@@ -369,7 +369,7 @@ void CarlaInstrument::saveSettings(QDomDocument& doc, QDomElement& parent)
|
||||
std::free(state);
|
||||
|
||||
#if CARLA_VERSION_HEX >= CARLA_MIN_PARAM_VERSION
|
||||
for (uint32_t index = 0; index < m_paramModels.count(); ++index)
|
||||
for (uint32_t index = 0; index < m_paramModels.size(); ++index)
|
||||
{
|
||||
QString idStr = CARLA_SETTING_PREFIX + QString::number(index);
|
||||
m_paramModels[index]->saveSettings(doc, parent, idStr);
|
||||
@@ -439,7 +439,7 @@ void CarlaInstrument::refreshParams(bool init)
|
||||
void CarlaInstrument::clearParamModels()
|
||||
{
|
||||
//Delete the models, this also disconnects all connections (automation and controller connections)
|
||||
for (uint32_t index=0; index < m_paramModels.count(); ++index)
|
||||
for (uint32_t index = 0; index < m_paramModels.size(); ++index)
|
||||
{
|
||||
delete m_paramModels[index];
|
||||
}
|
||||
@@ -899,7 +899,7 @@ CarlaParamsView::~CarlaParamsView()
|
||||
m_carlaInstrumentView->m_paramsView = nullptr;
|
||||
|
||||
// Clear models
|
||||
if (m_carlaInstrument->m_paramModels.isEmpty() == false)
|
||||
if (!m_carlaInstrument->m_paramModels.empty())
|
||||
{
|
||||
m_carlaInstrument->clearParamModels();
|
||||
}
|
||||
@@ -930,7 +930,7 @@ void CarlaParamsView::filterKnobs()
|
||||
m_maxColumns = m_inputScrollArea->width() / maxKnobWidth;
|
||||
|
||||
QString text = m_paramsFilterLineEdit->text();
|
||||
for (uint32_t i=0; i < m_knobs.count(); ++i)
|
||||
for (uint32_t i = 0; i < m_knobs.size(); ++i)
|
||||
{
|
||||
// Don't show disabled (unused) knobs.
|
||||
if (!m_carlaInstrument->m_paramModels[i]->enabled())
|
||||
@@ -975,7 +975,7 @@ void CarlaParamsView::filterKnobs()
|
||||
void CarlaParamsView::refreshKnobs()
|
||||
{
|
||||
// Make sure all the knobs are deleted.
|
||||
for (uint32_t i=0; i < m_knobs.count(); ++i)
|
||||
for (uint32_t i = 0; i < m_knobs.size(); ++i)
|
||||
{
|
||||
delete m_knobs[i]; // Delete knob widgets itself.
|
||||
}
|
||||
@@ -996,15 +996,15 @@ void CarlaParamsView::refreshKnobs()
|
||||
m_maxKnobWidthPerGroup[i] = 0;
|
||||
}
|
||||
|
||||
if (!m_carlaInstrument->m_paramModels.count()) { return; }
|
||||
if (m_carlaInstrument->m_paramModels.empty()) { return; }
|
||||
|
||||
// Make room in QList m_knobs
|
||||
m_knobs.reserve(m_carlaInstrument->m_paramModels.count());
|
||||
m_knobs.reserve(m_carlaInstrument->m_paramModels.size());
|
||||
|
||||
QStringList groupNameList;
|
||||
groupNameList.reserve(m_carlaInstrument->m_paramGroupCount);
|
||||
|
||||
for (uint32_t i=0; i < m_carlaInstrument->m_paramModels.count(); ++i)
|
||||
for (uint32_t i = 0; i < m_carlaInstrument->m_paramModels.size(); ++i)
|
||||
{
|
||||
bool enabled = m_carlaInstrument->m_paramModels[i]->enabled();
|
||||
m_knobs.push_back(new Knob(KnobType::Dark28, m_inputScrollAreaWidgetContent));
|
||||
@@ -1105,7 +1105,7 @@ void CarlaParamsView::addKnob(uint32_t index)
|
||||
void CarlaParamsView::clearKnobs()
|
||||
{
|
||||
// Remove knobs from layout.
|
||||
for (uint16_t i=0; i < m_knobs.count(); ++i)
|
||||
for (uint16_t i = 0; i < m_knobs.size(); ++i)
|
||||
{
|
||||
m_knobs[i]->close();
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#define CARLA_MIN_PARAM_VERSION 0x020090
|
||||
#define CARLA_VERSION_HEX_3 0x30000
|
||||
|
||||
#include <vector>
|
||||
|
||||
// qt
|
||||
#include <QCloseEvent>
|
||||
#include <QDomElement>
|
||||
@@ -223,7 +225,7 @@ private:
|
||||
QMutex fMutex;
|
||||
|
||||
uint8_t m_paramGroupCount;
|
||||
QList<CarlaParamFloatModel*> m_paramModels;
|
||||
std::vector<CarlaParamFloatModel*> m_paramModels;
|
||||
QDomElement m_settingsElem;
|
||||
|
||||
QCompleter* m_paramsCompleter;
|
||||
@@ -351,7 +353,7 @@ private:
|
||||
|
||||
CarlaInstrument* const m_carlaInstrument;
|
||||
CarlaInstrumentView* const m_carlaInstrumentView;
|
||||
QList<Knob*> m_knobs;
|
||||
std::vector<Knob*> m_knobs;
|
||||
|
||||
// Keep track of the biggest knob width per group
|
||||
QList<uint16_t> m_maxKnobWidthPerGroup;
|
||||
|
||||
@@ -142,7 +142,7 @@ bool CrossoverEQEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames
|
||||
zeroSampleFrames(m_work, frames);
|
||||
|
||||
// run temp bands
|
||||
for( int f = 0; f < frames; ++f )
|
||||
for (auto f = std::size_t{0}; f < frames; ++f)
|
||||
{
|
||||
m_tmp1[f][0] = m_lp2.update( buf[f][0], 0 );
|
||||
m_tmp1[f][1] = m_lp2.update( buf[f][1], 1 );
|
||||
@@ -153,7 +153,7 @@ bool CrossoverEQEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames
|
||||
// run band 1
|
||||
if( mute1 )
|
||||
{
|
||||
for( int f = 0; f < frames; ++f )
|
||||
for (auto f = std::size_t{0}; f < frames; ++f)
|
||||
{
|
||||
m_work[f][0] += m_lp1.update( m_tmp1[f][0], 0 ) * m_gain1;
|
||||
m_work[f][1] += m_lp1.update( m_tmp1[f][1], 1 ) * m_gain1;
|
||||
@@ -163,7 +163,7 @@ bool CrossoverEQEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames
|
||||
// run band 2
|
||||
if( mute2 )
|
||||
{
|
||||
for( int f = 0; f < frames; ++f )
|
||||
for (auto f = std::size_t{0}; f < frames; ++f)
|
||||
{
|
||||
m_work[f][0] += m_hp2.update( m_tmp1[f][0], 0 ) * m_gain2;
|
||||
m_work[f][1] += m_hp2.update( m_tmp1[f][1], 1 ) * m_gain2;
|
||||
@@ -173,7 +173,7 @@ bool CrossoverEQEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames
|
||||
// run band 3
|
||||
if( mute3 )
|
||||
{
|
||||
for( int f = 0; f < frames; ++f )
|
||||
for (auto f = std::size_t{0}; f < frames; ++f)
|
||||
{
|
||||
m_work[f][0] += m_lp3.update( m_tmp2[f][0], 0 ) * m_gain3;
|
||||
m_work[f][1] += m_lp3.update( m_tmp2[f][1], 1 ) * m_gain3;
|
||||
@@ -183,7 +183,7 @@ bool CrossoverEQEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames
|
||||
// run band 4
|
||||
if( mute4 )
|
||||
{
|
||||
for( int f = 0; f < frames; ++f )
|
||||
for (auto f = std::size_t{0}; f < frames; ++f)
|
||||
{
|
||||
m_work[f][0] += m_hp4.update( m_tmp2[f][0], 0 ) * m_gain4;
|
||||
m_work[f][1] += m_hp4.update( m_tmp2[f][1], 1 ) * m_gain4;
|
||||
@@ -193,7 +193,7 @@ bool CrossoverEQEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames
|
||||
const float d = dryLevel();
|
||||
const float w = wetLevel();
|
||||
double outSum = 0.0;
|
||||
for( int f = 0; f < frames; ++f )
|
||||
for (auto f = std::size_t{0}; f < frames; ++f)
|
||||
{
|
||||
buf[f][0] = d * buf[f][0] + w * m_work[f][0];
|
||||
buf[f][1] = d * buf[f][1] + w * m_work[f][1];
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "embed.h"
|
||||
#include "Engine.h"
|
||||
#include "lmms_constants.h"
|
||||
#include "lmms_math.h"
|
||||
|
||||
|
||||
namespace lmms::gui
|
||||
@@ -65,7 +66,7 @@ QRectF EqHandle::boundingRect() const
|
||||
|
||||
float EqHandle::freqToXPixel( float freq , int w )
|
||||
{
|
||||
if (typeInfo<float>::isEqual(freq, 0.0f)) { return 0.0f; }
|
||||
if (approximatelyEqual(freq, 0.0f)) { return 0.0f; }
|
||||
float min = log10f( 20 );
|
||||
float max = log10f( 20000 );
|
||||
float range = max - min;
|
||||
|
||||
@@ -54,7 +54,7 @@ EqAnalyser::EqAnalyser() :
|
||||
const float a2 = 0.14128f;
|
||||
const float a3 = 0.01168f;
|
||||
|
||||
for (int i = 0; i < FFT_BUFFER_SIZE; i++)
|
||||
for (auto i = std::size_t{0}; i < FFT_BUFFER_SIZE; i++)
|
||||
{
|
||||
m_fftWindow[i] = (a0 - a1 * cos(2 * F_PI * i / ((float)FFT_BUFFER_SIZE - 1.0))
|
||||
+ a2 * cos(4 * F_PI * i / ((float)FFT_BUFFER_SIZE - 1.0))
|
||||
|
||||
@@ -380,9 +380,8 @@ void FreeBoyInstrument::playNote(NotePlayHandle* nph, SampleFrame* workingBuffer
|
||||
papu->writeRegister(0xff23, 128);
|
||||
}
|
||||
|
||||
constexpr int bufSize = 2048;
|
||||
int framesLeft = frames;
|
||||
int dataLen = 0;
|
||||
constexpr auto bufSize = f_cnt_t{2048};
|
||||
auto framesLeft = frames;
|
||||
auto buf = std::array<blip_sample_t, bufSize * 2>{};
|
||||
while (framesLeft > 0)
|
||||
{
|
||||
@@ -392,12 +391,11 @@ void FreeBoyInstrument::playNote(NotePlayHandle* nph, SampleFrame* workingBuffer
|
||||
papu->endFrame(FRAME_LENGTH);
|
||||
avail = papu->samplesAvail();
|
||||
}
|
||||
dataLen = framesLeft > avail ? avail : framesLeft;
|
||||
dataLen = dataLen > bufSize ? bufSize : dataLen;
|
||||
const auto dataLen = std::min({static_cast<f_cnt_t>(avail), framesLeft, bufSize});
|
||||
|
||||
long count = papu->readSamples(buf.data(), dataLen * 2) / 2;
|
||||
const auto count = static_cast<f_cnt_t>(papu->readSamples(buf.data(), dataLen * 2) / 2);
|
||||
|
||||
for (fpp_t frame = 0; frame < count; ++frame)
|
||||
for (auto frame = std::size_t{0}; frame < count; ++frame)
|
||||
{
|
||||
for (ch_cnt_t ch = 0; ch < DEFAULT_CHANNELS; ++ch)
|
||||
{
|
||||
|
||||
@@ -6,11 +6,6 @@ if(LMMS_HAVE_GIG)
|
||||
# Required for not crashing loading files with libgig
|
||||
add_compile_options("-fexceptions")
|
||||
|
||||
# disable deprecated check for mingw-x-libgig
|
||||
if(LMMS_BUILD_WIN32)
|
||||
add_compile_options("-Wno-deprecated")
|
||||
endif(LMMS_BUILD_WIN32)
|
||||
|
||||
link_directories(${GIG_LIBRARY_DIRS})
|
||||
link_libraries(${GIG_LIBRARIES})
|
||||
build_plugin(gigplayer
|
||||
|
||||
@@ -323,7 +323,7 @@ void GigInstrument::playNote( NotePlayHandle * _n, SampleFrame* )
|
||||
void GigInstrument::play( SampleFrame* _working_buffer )
|
||||
{
|
||||
const fpp_t frames = Engine::audioEngine()->framesPerPeriod();
|
||||
const int rate = Engine::audioEngine()->outputSampleRate();
|
||||
const auto rate = Engine::audioEngine()->outputSampleRate();
|
||||
|
||||
// Initialize to zeros
|
||||
std::memset( &_working_buffer[0][0], 0, DEFAULT_CHANNELS * frames * sizeof( float ) );
|
||||
@@ -1216,7 +1216,7 @@ bool GigSample::convertSampleRate( SampleFrame & oldBuf, SampleFrame & newBuf,
|
||||
return false;
|
||||
}
|
||||
|
||||
if( src_data.output_frames_gen > 0 && src_data.output_frames_gen < newSize )
|
||||
if (src_data.output_frames_gen > 0 && static_cast<f_cnt_t>(src_data.output_frames_gen) < newSize)
|
||||
{
|
||||
qCritical() << "GigInstrument: not enough frames, wanted"
|
||||
<< newSize << "generated" << src_data.output_frames_gen;
|
||||
|
||||
@@ -258,7 +258,7 @@ void GranularPitchShifterEffect::changeSampleRate()
|
||||
|
||||
m_ringBufLength = m_sampleRate * ringBufLength;
|
||||
m_ringBuf.resize(m_ringBufLength);
|
||||
for (size_t i = 0; i < m_ringBufLength; ++i)
|
||||
for (size_t i = 0; i < static_cast<std::size_t>(m_ringBufLength); ++i)
|
||||
{
|
||||
m_ringBuf[i][0] = 0;
|
||||
m_ringBuf[i][1] = 0;
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
// double index and fraction are required for good quality
|
||||
float getHermiteSample(double index, int ch)
|
||||
{
|
||||
const int index_floor = static_cast<int>(index);
|
||||
const auto index_floor = static_cast<std::size_t>(index);
|
||||
const double fraction = index - index_floor;
|
||||
|
||||
float v0, v1, v2, v3;
|
||||
|
||||
@@ -139,7 +139,7 @@ bool LadspaEffect::processAudioBuffer( SampleFrame* _buf,
|
||||
return( false );
|
||||
}
|
||||
|
||||
int frames = _frames;
|
||||
auto frames = _frames;
|
||||
SampleFrame* o_buf = nullptr;
|
||||
QVarLengthArray<SampleFrame> sBuf(_frames);
|
||||
|
||||
|
||||
@@ -750,8 +750,8 @@ void Lb302Synth::playNote( NotePlayHandle * _n, SampleFrame* _working_buffer )
|
||||
m_notes.prepend( _n );
|
||||
}
|
||||
m_notesMutex.unlock();
|
||||
|
||||
release_frame = qMax( release_frame, _n->framesLeft() + _n->offset() );
|
||||
|
||||
release_frame = std::max(release_frame, static_cast<int>(_n->framesLeft()) + static_cast<int>(_n->offset()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,12 +26,13 @@
|
||||
#define LV2_INSTRUMENT_H
|
||||
|
||||
#include <QString>
|
||||
#include <array>
|
||||
|
||||
#include "Instrument.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "Note.h"
|
||||
#include "Lv2ControlBase.h"
|
||||
#include "Lv2ViewBase.h"
|
||||
#include "Note.h"
|
||||
|
||||
// whether to use MIDI vs playHandle
|
||||
// currently only MIDI works
|
||||
|
||||
@@ -685,7 +685,7 @@ void MonstroSynth::renderOutput( fpp_t _frames, SampleFrame* _buf )
|
||||
}
|
||||
|
||||
|
||||
inline void MonstroSynth::updateModulators( float * env1, float * env2, float * lfo1, float * lfo2, int frames )
|
||||
inline void MonstroSynth::updateModulators(float * env1, float * env2, float * lfo1, float * lfo2, f_cnt_t frames)
|
||||
{
|
||||
// frames played before
|
||||
const f_cnt_t tfp = m_nph->totalFramesPlayed();
|
||||
@@ -790,7 +790,7 @@ inline void MonstroSynth::updateModulators( float * env1, float * env2, float *
|
||||
// attack
|
||||
for( f_cnt_t f = 0; f < frames; ++f )
|
||||
{
|
||||
if( tfp + f < m_lfoatt[i] ) lfo[i][f] *= ( static_cast<sample_t>( tfp ) / m_lfoatt[i] );
|
||||
if (tfp + f < static_cast<f_cnt_t>(m_lfoatt[i])) { lfo[i][f] *= static_cast<sample_t>(tfp) / m_lfoatt[i]; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ private:
|
||||
MonstroInstrument * m_parent;
|
||||
NotePlayHandle * m_nph;
|
||||
|
||||
inline void updateModulators( float * env1, float * env2, float * lfo1, float * lfo2, int frames );
|
||||
inline void updateModulators(float * env1, float * env2, float * lfo1, float * lfo2, f_cnt_t frames);
|
||||
|
||||
// linear interpolation
|
||||
/* inline sample_t interpolate( sample_t s1, sample_t s2, float x )
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "MultitapEcho.h"
|
||||
#include "embed.h"
|
||||
#include "lmms_basics.h"
|
||||
#include "plugin_export.h"
|
||||
|
||||
namespace lmms
|
||||
@@ -85,7 +86,7 @@ void MultitapEchoEffect::updateFilters( int begin, int end )
|
||||
|
||||
void MultitapEchoEffect::runFilter( SampleFrame* dst, SampleFrame* src, StereoOnePole & filter, const fpp_t frames )
|
||||
{
|
||||
for( int f = 0; f < frames; ++f )
|
||||
for (auto f = std::size_t{0}; f < frames; ++f)
|
||||
{
|
||||
dst[f][0] = filter.update( src[f][0], 0 );
|
||||
dst[f][1] = filter.update( src[f][1], 1 );
|
||||
@@ -118,8 +119,8 @@ bool MultitapEchoEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frame
|
||||
}
|
||||
|
||||
// add dry buffer - never swap inputs for dry
|
||||
m_buffer.writeAddingMultiplied( buf, 0, frames, dryGain );
|
||||
|
||||
m_buffer.writeAddingMultiplied(buf, f_cnt_t{0}, frames, dryGain);
|
||||
|
||||
// swapped inputs?
|
||||
if( swapInputs )
|
||||
{
|
||||
@@ -151,7 +152,7 @@ bool MultitapEchoEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frame
|
||||
// pop the buffer and mix it into output
|
||||
m_buffer.pop( m_work );
|
||||
|
||||
for( int f = 0; f < frames; ++f )
|
||||
for (auto f = std::size_t{0}; f < frames; ++f)
|
||||
{
|
||||
buf[f][0] = d * buf[f][0] + w * m_work[f][0];
|
||||
buf[f][1] = d * buf[f][1] + w * m_work[f][1];
|
||||
@@ -176,4 +177,4 @@ PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* parent, void* data )
|
||||
}
|
||||
|
||||
|
||||
} // namespace lmms
|
||||
} // namespace lmms
|
||||
|
||||
@@ -302,7 +302,7 @@ void OrganicInstrument::playNote( NotePlayHandle * _n,
|
||||
// fxKnob is [0;1]
|
||||
float t = m_fx1Model.value();
|
||||
|
||||
for (int i=0 ; i < frames + offset ; i++)
|
||||
for (auto i = std::size_t{0}; i < frames + offset; i++)
|
||||
{
|
||||
_working_buffer[i][0] = waveshape( _working_buffer[i][0], t ) *
|
||||
m_volModel.value() / 100.0f;
|
||||
|
||||
@@ -110,7 +110,7 @@ bool PeakControllerEffect::processAudioBuffer( SampleFrame* _buf,
|
||||
|
||||
if( c.m_absModel.value() )
|
||||
{
|
||||
for( int i = 0; i < _frames; ++i )
|
||||
for (auto i = std::size_t{0}; i < _frames; ++i)
|
||||
{
|
||||
// absolute value is achieved because the squares are > 0
|
||||
sum += _buf[i][0]*_buf[i][0] + _buf[i][1]*_buf[i][1];
|
||||
@@ -118,7 +118,7 @@ bool PeakControllerEffect::processAudioBuffer( SampleFrame* _buf,
|
||||
}
|
||||
else
|
||||
{
|
||||
for( int i = 0; i < _frames; ++i )
|
||||
for (auto i = std::size_t{0}; i < _frames; ++i)
|
||||
{
|
||||
// the value is absolute because of squaring,
|
||||
// so we need to correct it
|
||||
@@ -131,7 +131,7 @@ bool PeakControllerEffect::processAudioBuffer( SampleFrame* _buf,
|
||||
// this will mute the output after the values were measured
|
||||
if( c.m_muteModel.value() )
|
||||
{
|
||||
for( int i = 0; i < _frames; ++i )
|
||||
for (auto i = std::size_t{0}; i < _frames; ++i)
|
||||
{
|
||||
_buf[i][0] = _buf[i][1] = 0.0f;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ int sp_set(sp_param *p, SPFLOAT val) {
|
||||
|
||||
int sp_out(sp_data *sp, uint32_t chan, SPFLOAT val)
|
||||
{
|
||||
if(chan > sp->nchan - 1) {
|
||||
if (chan >= (uint32_t) sp->nchan) {
|
||||
fprintf(stderr, "sp_out: Invalid channel\n");
|
||||
return SP_NOT_OK;
|
||||
}
|
||||
|
||||
@@ -499,44 +499,58 @@ void Sf2Instrument::updateGain()
|
||||
fluid_synth_set_gain( m_synth, m_gain.value() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define FLUIDSYNTH_VERSION_HEX ((FLUIDSYNTH_VERSION_MAJOR << 16) \
|
||||
| (FLUIDSYNTH_VERSION_MINOR << 8) \
|
||||
| FLUIDSYNTH_VERSION_MICRO)
|
||||
#define USE_NEW_EFFECT_API (FLUIDSYNTH_VERSION_HEX >= 0x020200)
|
||||
|
||||
void Sf2Instrument::updateReverbOn()
|
||||
{
|
||||
fluid_synth_set_reverb_on( m_synth, m_reverbOn.value() ? 1 : 0 );
|
||||
#if USE_NEW_EFFECT_API
|
||||
fluid_synth_reverb_on(m_synth, -1, m_reverbOn.value() ? 1 : 0);
|
||||
#else
|
||||
fluid_synth_set_reverb_on(m_synth, m_reverbOn.value() ? 1 : 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Sf2Instrument::updateReverb()
|
||||
{
|
||||
fluid_synth_set_reverb( m_synth, m_reverbRoomSize.value(),
|
||||
#if USE_NEW_EFFECT_API
|
||||
fluid_synth_set_reverb_group_roomsize(m_synth, -1, m_reverbRoomSize.value());
|
||||
fluid_synth_set_reverb_group_damp(m_synth, -1, m_reverbDamping.value());
|
||||
fluid_synth_set_reverb_group_width(m_synth, -1, m_reverbWidth.value());
|
||||
fluid_synth_set_reverb_group_level(m_synth, -1, m_reverbLevel.value());
|
||||
#else
|
||||
fluid_synth_set_reverb(m_synth, m_reverbRoomSize.value(),
|
||||
m_reverbDamping.value(), m_reverbWidth.value(),
|
||||
m_reverbLevel.value() );
|
||||
m_reverbLevel.value());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Sf2Instrument::updateChorusOn()
|
||||
void Sf2Instrument::updateChorusOn()
|
||||
{
|
||||
fluid_synth_set_chorus_on( m_synth, m_chorusOn.value() ? 1 : 0 );
|
||||
#if USE_NEW_EFFECT_API
|
||||
fluid_synth_chorus_on(m_synth, -1, m_chorusOn.value() ? 1 : 0);
|
||||
#else
|
||||
fluid_synth_set_chorus_on(m_synth, m_chorusOn.value() ? 1 : 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Sf2Instrument::updateChorus()
|
||||
void Sf2Instrument::updateChorus()
|
||||
{
|
||||
fluid_synth_set_chorus( m_synth, static_cast<int>( m_chorusNum.value() ),
|
||||
#if USE_NEW_EFFECT_API
|
||||
fluid_synth_set_chorus_group_nr(m_synth, -1, static_cast<int>(m_chorusNum.value()));
|
||||
fluid_synth_set_chorus_group_level(m_synth, -1, m_chorusLevel.value());
|
||||
fluid_synth_set_chorus_group_speed(m_synth, -1, m_chorusSpeed.value());
|
||||
fluid_synth_set_chorus_group_depth(m_synth, -1, m_chorusDepth.value());
|
||||
fluid_synth_set_chorus_group_type(m_synth, -1, FLUID_CHORUS_MOD_SINE);
|
||||
#else
|
||||
fluid_synth_set_chorus(m_synth, static_cast<int>(m_chorusNum.value()),
|
||||
m_chorusLevel.value(), m_chorusSpeed.value(),
|
||||
m_chorusDepth.value(), 0 );
|
||||
m_chorusDepth.value(), FLUID_CHORUS_MOD_SINE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Sf2Instrument::updateTuning()
|
||||
{
|
||||
if (instrumentTrack()->microtuner()->enabledModel()->value())
|
||||
@@ -898,9 +912,9 @@ void Sf2Instrument::renderFrames( f_cnt_t frames, SampleFrame* buf )
|
||||
{
|
||||
qCritical( "Sf2Instrument: error while resampling: %s", src_strerror( error ) );
|
||||
}
|
||||
if( src_data.output_frames_gen > frames )
|
||||
if (static_cast<f_cnt_t>(src_data.output_frames_gen) < frames)
|
||||
{
|
||||
qCritical( "Sf2Instrument: not enough frames: %ld / %d", src_data.output_frames_gen, frames );
|
||||
qCritical("Sf2Instrument: not enough frames: %ld / %zu", src_data.output_frames_gen, frames);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#ifndef SF2_PLAYER_H
|
||||
#define SF2_PLAYER_H
|
||||
|
||||
#include <array>
|
||||
#include <fluidsynth/types.h>
|
||||
#include <QMutex>
|
||||
#include <samplerate.h>
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#ifndef SFXR_H
|
||||
#define SFXR_H
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "AutomatableModel.h"
|
||||
#include "Instrument.h"
|
||||
#include "InstrumentView.h"
|
||||
|
||||
@@ -305,8 +305,11 @@ void SidInstrument::playNote( NotePlayHandle * _n,
|
||||
|
||||
auto sid = static_cast<reSID::SID*>(_n->m_pluginData);
|
||||
int delta_t = clockrate * frames / samplerate + 4;
|
||||
// avoid variable length array for msvc compat
|
||||
auto buf = reinterpret_cast<short*>(_working_buffer + offset);
|
||||
#ifndef _MSC_VER
|
||||
short buf[frames];
|
||||
#else
|
||||
const auto buf = static_cast<short*>(_alloca(frames * sizeof(short)));
|
||||
#endif
|
||||
auto sidreg = std::array<unsigned char, NUMSIDREGS>{};
|
||||
|
||||
for (auto& reg : sidreg)
|
||||
@@ -407,12 +410,13 @@ void SidInstrument::playNote( NotePlayHandle * _n,
|
||||
|
||||
sidreg[24] = data8&0x00FF;
|
||||
|
||||
int num = sid_fillbuffer(sidreg.data(), sid, delta_t, buf, frames);
|
||||
if(num!=frames)
|
||||
const auto num = static_cast<f_cnt_t>(sid_fillbuffer(sidreg.data(), sid, delta_t, buf, frames));
|
||||
if (num != frames) {
|
||||
printf("!!!Not enough samples\n");
|
||||
}
|
||||
|
||||
// loop backwards to avoid overwriting data in the short-to-float conversion
|
||||
for( fpp_t frame = frames - 1; frame >= 0; frame-- )
|
||||
for (auto frame = std::size_t{0}; frame < frames; ++frame)
|
||||
{
|
||||
sample_t s = float(buf[frame])/32768.0;
|
||||
for( ch_cnt_t ch = 0; ch < DEFAULT_CHANNELS; ++ch )
|
||||
|
||||
@@ -96,7 +96,7 @@ void SlicerT::playNote(NotePlayHandle* handle, SampleFrame* workingBuffer)
|
||||
sliceStart = 0;
|
||||
sliceEnd = 1;
|
||||
}
|
||||
else if (noteIndex > 0 && noteIndex < m_slicePoints.size())
|
||||
else if (noteIndex > 0 && static_cast<std::size_t>(noteIndex) < m_slicePoints.size())
|
||||
{
|
||||
noteIndex -= 1;
|
||||
sliceStart = m_slicePoints[noteIndex];
|
||||
@@ -134,9 +134,9 @@ void SlicerT::playNote(NotePlayHandle* handle, SampleFrame* workingBuffer)
|
||||
// exponential fade out, applyRelease() not used since it extends the note length
|
||||
int fadeOutFrames = m_fadeOutFrames.value() / 1000.0f * Engine::audioEngine()->outputSampleRate();
|
||||
int noteFramesLeft = noteLeft * m_originalSample.sampleSize() * speedRatio;
|
||||
for (int i = 0; i < frames; i++)
|
||||
for (auto i = std::size_t{0}; i < frames; i++)
|
||||
{
|
||||
float fadeValue = static_cast<float>(noteFramesLeft - i) / fadeOutFrames;
|
||||
float fadeValue = static_cast<float>(noteFramesLeft - static_cast<int>(i)) / fadeOutFrames;
|
||||
fadeValue = std::clamp(fadeValue, 0.0f, 1.0f);
|
||||
fadeValue = cosinusInterpolate(0, 1, fadeValue);
|
||||
|
||||
@@ -170,7 +170,7 @@ void SlicerT::findSlices()
|
||||
|
||||
float maxMag = -1;
|
||||
std::vector<float> singleChannel(m_originalSample.sampleSize(), 0);
|
||||
for (int i = 0; i < m_originalSample.sampleSize(); i++)
|
||||
for (auto i = std::size_t{0}; i < m_originalSample.sampleSize(); i++)
|
||||
{
|
||||
singleChannel[i] = (m_originalSample.data()[i][0] + m_originalSample.data()[i][1]) / 2;
|
||||
maxMag = std::max(maxMag, singleChannel[i]);
|
||||
@@ -179,7 +179,7 @@ void SlicerT::findSlices()
|
||||
// normalize and find 0 crossings
|
||||
std::vector<int> zeroCrossings;
|
||||
float lastValue = 1;
|
||||
for (int i = 0; i < singleChannel.size(); i++)
|
||||
for (auto i = std::size_t{0}; i < singleChannel.size(); i++)
|
||||
{
|
||||
singleChannel[i] /= maxMag;
|
||||
if (sign(lastValue) != sign(singleChannel[i]))
|
||||
@@ -199,7 +199,7 @@ void SlicerT::findSlices()
|
||||
float spectralFlux = 0;
|
||||
float prevFlux = 1E-10f; // small value, no divison by zero
|
||||
|
||||
for (int i = 0; i < singleChannel.size() - windowSize; i += windowSize)
|
||||
for (int i = 0; i < static_cast<int>(singleChannel.size()) - windowSize; i += windowSize)
|
||||
{
|
||||
// fft
|
||||
std::copy_n(singleChannel.data() + i, windowSize, fftIn.data());
|
||||
@@ -300,7 +300,7 @@ std::vector<Note> SlicerT::getMidi()
|
||||
float totalTicks = outFrames / framesPerTick;
|
||||
float lastEnd = 0;
|
||||
|
||||
for (int i = 0; i < m_slicePoints.size() - 1; i++)
|
||||
for (auto i = std::size_t{0}; i < m_slicePoints.size() - 1; i++)
|
||||
{
|
||||
float sliceStart = lastEnd;
|
||||
float sliceEnd = totalTicks * m_slicePoints[i + 1];
|
||||
@@ -342,7 +342,7 @@ void SlicerT::saveSettings(QDomDocument& document, QDomElement& element)
|
||||
}
|
||||
|
||||
element.setAttribute("totalSlices", static_cast<int>(m_slicePoints.size()));
|
||||
for (int i = 0; i < m_slicePoints.size(); i++)
|
||||
for (auto i = std::size_t{0}; i < m_slicePoints.size(); i++)
|
||||
{
|
||||
element.setAttribute(tr("slice_%1").arg(i), m_slicePoints[i]);
|
||||
}
|
||||
|
||||
@@ -195,11 +195,11 @@ void SlicerTWaveform::drawEditor()
|
||||
|
||||
brush.setPen(QPen(s_sliceColor, 2));
|
||||
|
||||
for (int i = 0; i < m_slicerTParent->m_slicePoints.size(); i++)
|
||||
for (auto i = std::size_t{0}; i < m_slicerTParent->m_slicePoints.size(); i++)
|
||||
{
|
||||
float xPos = (m_slicerTParent->m_slicePoints.at(i) - startFrame) / numFramesToDraw * m_editorWidth;
|
||||
|
||||
if (i == m_closestSlice)
|
||||
if (i == static_cast<std::size_t>(m_closestSlice))
|
||||
{
|
||||
brush.setPen(QPen(s_sliceHighlightColor, 2));
|
||||
brush.drawLine(xPos, 0, xPos, m_editorHeight);
|
||||
@@ -268,7 +268,7 @@ void SlicerTWaveform::updateClosest(QMouseEvent* me)
|
||||
m_closestSlice = -1;
|
||||
float startFrame = m_seekerStart;
|
||||
float endFrame = m_seekerEnd;
|
||||
for (int i = 0; i < m_slicerTParent->m_slicePoints.size(); i++)
|
||||
for (auto i = std::size_t{0}; i < m_slicerTParent->m_slicePoints.size(); i++)
|
||||
{
|
||||
float sliceIndex = m_slicerTParent->m_slicePoints.at(i);
|
||||
float xPos = (sliceIndex - startFrame) / (endFrame - startFrame);
|
||||
|
||||
@@ -232,7 +232,7 @@ void SaProcessor::analyze(LocklessRingBuffer<SampleFrame> &ring_buffer)
|
||||
if (band_end - band_start > 1.0)
|
||||
{
|
||||
// band spans multiple pixels: draw all pixels it covers
|
||||
for (int target = std::max(static_cast<int>(band_start), 0);
|
||||
for (auto target = static_cast<std::size_t>(std::max(band_start, 0.f));
|
||||
target < band_end && target < waterfallWidth(); target++)
|
||||
{
|
||||
pixel[target] = makePixel(m_normSpectrumL[i], m_normSpectrumR[i]);
|
||||
@@ -259,7 +259,9 @@ void SaProcessor::analyze(LocklessRingBuffer<SampleFrame> &ring_buffer)
|
||||
accL += ((int)band_end - band_start) * m_normSpectrumL[i];
|
||||
accR += ((int)band_end - band_start) * m_normSpectrumR[i];
|
||||
|
||||
if (target >= 0 && target < waterfallWidth()) {pixel[target] = makePixel(accL, accR);}
|
||||
if (target >= 0 && static_cast<std::size_t>(target) < waterfallWidth()) {
|
||||
pixel[target] = makePixel(accL, accR);
|
||||
}
|
||||
|
||||
// save remaining portion of the band for the following band / pixel
|
||||
accL = (band_end - (int)band_end) * m_normSpectrumL[i];
|
||||
@@ -270,7 +272,7 @@ void SaProcessor::analyze(LocklessRingBuffer<SampleFrame> &ring_buffer)
|
||||
else
|
||||
{
|
||||
// Linear: always draws one or more pixels per band
|
||||
for (int target = std::max(static_cast<int>(band_start), 0);
|
||||
for (auto target = static_cast<std::size_t>(std::max(band_start, 0.f));
|
||||
target < band_end && target < waterfallWidth(); target++)
|
||||
{
|
||||
pixel[target] = makePixel(m_normSpectrumL[i], m_normSpectrumR[i]);
|
||||
|
||||
@@ -302,7 +302,7 @@ void SaSpectrumView::refreshPaths()
|
||||
// part new, part old. At reasonable frame rate, such difference is invisible..
|
||||
void SaSpectrumView::updateBuffers(const float *spectrum, float *displayBuffer, float *peakBuffer)
|
||||
{
|
||||
for (int n = 0; n < m_processor->binCount(); n++)
|
||||
for (auto n = std::size_t{0}; n < m_processor->binCount(); n++)
|
||||
{
|
||||
// Update the exponential average if enabled, or simply copy the value.
|
||||
if (!m_controls->m_pauseModel.value())
|
||||
|
||||
@@ -145,7 +145,7 @@ bool StereoEnhancerEffect::processAudioBuffer( SampleFrame* _buf,
|
||||
|
||||
void StereoEnhancerEffect::clearMyBuffer()
|
||||
{
|
||||
for (int i = 0; i < DEFAULT_BUFFER_SIZE; i++)
|
||||
for (auto i = std::size_t{0}; i < DEFAULT_BUFFER_SIZE; i++)
|
||||
{
|
||||
m_delayBuffer[i][0] = 0.0f;
|
||||
m_delayBuffer[i][1] = 0.0f;
|
||||
|
||||
@@ -72,11 +72,11 @@ public:
|
||||
|
||||
~StringContainer() = default;
|
||||
|
||||
void addString(int harm, float pick, float pickup, const float* impulse, float randomize,
|
||||
void addString(std::size_t harm, float pick, float pickup, const float* impulse, float randomize,
|
||||
float stringLoss, float detune, int oversample, bool state, int id)
|
||||
{
|
||||
constexpr auto octave = std::array{0.25f, 0.5f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f};
|
||||
assert(harm >= 0 && harm < octave.size());
|
||||
assert(harm < octave.size());
|
||||
|
||||
m_strings[id] = VibratingString{m_pitch * octave[harm], pick, pickup, impulse, m_bufferLength,
|
||||
m_sampleRate, oversample, randomize, stringLoss, detune, state};
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "interpolation.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "Engine.h"
|
||||
#include "lmms_basics.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
@@ -99,7 +100,7 @@ void VibratingString::resample(const float* src, f_cnt_t srcFrames, f_cnt_t dstF
|
||||
{
|
||||
const float srcFrameFloat = frame * static_cast<float>(srcFrames) / dstFrames;
|
||||
const float fracPos = srcFrameFloat - static_cast<f_cnt_t>(srcFrameFloat);
|
||||
const f_cnt_t srcFrame = std::clamp(static_cast<f_cnt_t>(srcFrameFloat), 1, srcFrames - 3);
|
||||
const f_cnt_t srcFrame = std::clamp(static_cast<f_cnt_t>(srcFrameFloat), f_cnt_t{1}, srcFrames - 3);
|
||||
m_impulse[frame] = cubicInterpolate(
|
||||
src[srcFrame - 1],
|
||||
src[srcFrame + 0],
|
||||
|
||||
@@ -33,6 +33,7 @@ set(export_variables
|
||||
"LMMS_BUILD_WIN32"
|
||||
"PLUGIN_DIR"
|
||||
"LMMS_HAVE_LIBRT"
|
||||
"USE_WERROR"
|
||||
)
|
||||
|
||||
SET(EXTERNALPROJECT_CMAKE_ARGS
|
||||
|
||||
@@ -265,7 +265,7 @@ public:
|
||||
void saveChunkToFile( const std::string & _file );
|
||||
|
||||
// restore settings chunk of plugin from file
|
||||
void loadChunkFromFile( const std::string & _file, int _len );
|
||||
void loadChunkFromFile(const std::string& _file, std::size_t _len);
|
||||
|
||||
// restore settings chunk of plugin from file
|
||||
void loadPresetFile( const std::string & _file );
|
||||
@@ -842,7 +842,6 @@ void RemoteVstPlugin::initEditor()
|
||||
#endif
|
||||
|
||||
#else
|
||||
XEvent e;
|
||||
Atom prop_atom, val_atom;
|
||||
|
||||
if (m_display == nullptr)
|
||||
@@ -1303,7 +1302,7 @@ void RemoteVstPlugin::saveChunkToFile( const std::string & _file )
|
||||
"Error opening file for saving chunk.\n" );
|
||||
return;
|
||||
}
|
||||
if ( fwrite( chunk, 1, len, fp ) != len )
|
||||
if (fwrite(chunk, 1, len, fp) != static_cast<std::size_t>(len))
|
||||
{
|
||||
fprintf( stderr,
|
||||
"Error saving chunk to file.\n" );
|
||||
@@ -1541,7 +1540,7 @@ void RemoteVstPlugin::loadPresetFile( const std::string & _file )
|
||||
unsigned int toUInt;
|
||||
float * pFloat;
|
||||
|
||||
if (m_plugin->uniqueID != pBank->fxID) {
|
||||
if (static_cast<std::uint_fast32_t>(m_plugin->uniqueID) != pBank->fxID) {
|
||||
sendMessage( message( IdVstCurrentProgramName ).
|
||||
addString( "Error: Plugin UniqID not match" ) );
|
||||
fclose( stream );
|
||||
@@ -1577,7 +1576,7 @@ void RemoteVstPlugin::loadPresetFile( const std::string & _file )
|
||||
else
|
||||
{
|
||||
auto toUIntArray = reinterpret_cast<unsigned int*>(chunk);
|
||||
for (int i = 0; i < pBank->numPrograms; i++ )
|
||||
for (auto i = 0u; i < pBank->numPrograms; i++)
|
||||
{
|
||||
toUInt = endian_swap( toUIntArray[ i ] );
|
||||
pFloat = ( float* ) &toUInt;
|
||||
@@ -1625,10 +1624,7 @@ void RemoteVstPlugin::loadPresetFile( const std::string & _file )
|
||||
delete[] (char*)chunk;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void RemoteVstPlugin::loadChunkFromFile( const std::string & _file, int _len )
|
||||
void RemoteVstPlugin::loadChunkFromFile(const std::string& _file, std::size_t _len)
|
||||
{
|
||||
auto chunk = new char[_len];
|
||||
|
||||
@@ -2304,7 +2300,7 @@ void RemoteVstPlugin::guiEventLoop()
|
||||
{
|
||||
XNextEvent(m_display, &e);
|
||||
|
||||
if (e.type == ClientMessage && e.xclient.data.l[0] == m_wmDeleteMessage)
|
||||
if (e.type == ClientMessage && static_cast<Atom>(e.xclient.data.l[0]) == m_wmDeleteMessage)
|
||||
{
|
||||
hideEditor();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
if(POLICY "CMP0092")
|
||||
cmake_policy(SET CMP0092 NEW) # MSVC warning flags are not in CMAKE_<LANG>_FLAGS by default.
|
||||
endif()
|
||||
|
||||
project(RemoteVstPlugin
|
||||
LANGUAGES CXX)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
@@ -22,6 +27,9 @@ FOREACH( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
|
||||
SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
|
||||
ENDFOREACH()
|
||||
|
||||
# Add warning and error flags
|
||||
include(ErrorFlags)
|
||||
|
||||
# Import of windows.h breaks min()/max()
|
||||
add_definitions(-DNOMINMAX)
|
||||
|
||||
|
||||
@@ -147,13 +147,8 @@ struct LastSampleFunction : public exprtk::ifunction<T>
|
||||
|
||||
inline T operator()(const T& x) override
|
||||
{
|
||||
if (!std::isnan(x) && !std::isinf(x))
|
||||
{
|
||||
const int ix=(int)x;
|
||||
if (ix>=1 && ix<=m_history_size)
|
||||
{
|
||||
return m_samples[(ix + m_pivot_last) % m_history_size];
|
||||
}
|
||||
if (!std::isnan(x) && x >= 1 && x <= m_history_size) {
|
||||
return m_samples[(static_cast<std::size_t>(x) + m_pivot_last) % m_history_size];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -579,9 +579,9 @@ void XpressiveView::expressionChanged() {
|
||||
|
||||
if (parse_ok) {
|
||||
e->exprValid().setValue(0);
|
||||
const int length = m_raw_graph->length();
|
||||
const auto length = static_cast<std::size_t>(m_raw_graph->length());
|
||||
auto const samples = new float[length];
|
||||
for (i = 0; i < length; i++) {
|
||||
for (auto i = std::size_t{0}; i < length; i++) {
|
||||
t = i / (float) length;
|
||||
samples[i] = expr.evaluate();
|
||||
if (std::isinf(samples[i]) != 0 || std::isnan(samples[i]) != 0)
|
||||
|
||||
@@ -25,13 +25,9 @@ endif()
|
||||
|
||||
# build ZynAddSubFX with full optimizations
|
||||
if(NOT MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wno-write-strings -Wno-deprecated-declarations -fpermissive")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -fpermissive")
|
||||
endif()
|
||||
|
||||
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "6.0.0")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation -Wno-format-truncation")
|
||||
ENDIF()
|
||||
|
||||
IF(MINGW_PREFIX)
|
||||
SET(FLTK_FLUID_EXECUTABLE "${MINGW_PREFIX}/bin/fluid")
|
||||
ENDIF()
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#ifndef LOCAL_ZYNADDSUBFX_H
|
||||
#define LOCAL_ZYNADDSUBFX_H
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "Note.h"
|
||||
|
||||
class Master;
|
||||
|
||||
@@ -108,7 +108,7 @@ ZynAddSubFxInstrument::ZynAddSubFxInstrument(
|
||||
m_plugin( nullptr ),
|
||||
m_remotePlugin( nullptr ),
|
||||
m_portamentoModel( 0, 0, 127, 1, this, tr( "Portamento" ) ),
|
||||
m_filterFreqModel( 64, 0, 127, 1, this, tr( "Filter frequency" ) ),
|
||||
m_filterFreqModel( 127, 0, 127, 1, this, tr( "Filter frequency" ) ),
|
||||
m_filterQModel( 64, 0, 127, 1, this, tr( "Filter resonance" ) ),
|
||||
m_bandwidthModel( 64, 0, 127, 1, this, tr( "Bandwidth" ) ),
|
||||
m_fmGainModel( 127, 0, 127, 1, this, tr( "FM gain" ) ),
|
||||
@@ -142,6 +142,11 @@ ZynAddSubFxInstrument::ZynAddSubFxInstrument(
|
||||
|
||||
connect( instrumentTrack()->pitchRangeModel(), SIGNAL( dataChanged() ),
|
||||
this, SLOT( updatePitchRange() ), Qt::DirectConnection );
|
||||
|
||||
// ZynAddSubFX's internal value that LMMS's FREQ knob controls
|
||||
// isn't set properly when the instrument is first loaded in,
|
||||
// and doesn't update until the FREQ knob is moved
|
||||
updateFilterFreq();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Submodule plugins/ZynAddSubFx/zynaddsubfx updated: aac04bc55c...d958c3668c
@@ -95,7 +95,7 @@ AudioEngine::AudioEngine( bool renderOnly ) :
|
||||
m_inputBufferFrames[i] = 0;
|
||||
m_inputBufferSize[i] = DEFAULT_BUFFER_SIZE * 100;
|
||||
m_inputBuffer[i] = new SampleFrame[ DEFAULT_BUFFER_SIZE * 100 ];
|
||||
BufferManager::clear( m_inputBuffer[i], m_inputBufferSize[i] );
|
||||
zeroSampleFrames(m_inputBuffer[i], m_inputBufferSize[i]);
|
||||
}
|
||||
|
||||
// determine FIFO size and number of frames per period
|
||||
@@ -283,7 +283,7 @@ void AudioEngine::pushInputFrames( SampleFrame* _ab, const f_cnt_t _frames )
|
||||
requestChangeInModel();
|
||||
|
||||
f_cnt_t frames = m_inputBufferFrames[ m_inputBufferWrite ];
|
||||
int size = m_inputBufferSize[ m_inputBufferWrite ];
|
||||
auto size = m_inputBufferSize[m_inputBufferWrite];
|
||||
SampleFrame* buf = m_inputBuffer[ m_inputBufferWrite ];
|
||||
|
||||
if( frames + _frames > size )
|
||||
|
||||
@@ -79,7 +79,7 @@ void AudioEngineWorkerThread::JobQueue::run()
|
||||
while (processedJob && m_itemsDone < m_writeIndex)
|
||||
{
|
||||
processedJob = false;
|
||||
for( int i = 0; i < m_writeIndex && i < JOB_QUEUE_SIZE; ++i )
|
||||
for (auto i = std::size_t{0}; i < m_writeIndex && i < JOB_QUEUE_SIZE; ++i)
|
||||
{
|
||||
ThreadableJob * job = m_items[i].exchange(nullptr);
|
||||
if( job )
|
||||
|
||||
@@ -354,8 +354,7 @@ float AutomatableModel::inverseScaledValue( float value ) const
|
||||
template<class T>
|
||||
void roundAt( T& value, const T& where, const T& step_size )
|
||||
{
|
||||
if (std::abs(value - where)
|
||||
< typeInfo<float>::minEps() * std::abs(step_size))
|
||||
if (std::abs(value - where) < F_EPSILON * std::abs(step_size))
|
||||
{
|
||||
value = where;
|
||||
}
|
||||
@@ -583,7 +582,7 @@ float AutomatableModel::controllerValue( int frameOffset ) const
|
||||
"lacks implementation for a scale type");
|
||||
break;
|
||||
}
|
||||
if( typeInfo<float>::isEqual( m_step, 1 ) && m_hasStrictStepSize )
|
||||
if (approximatelyEqual(m_step, 1) && m_hasStrictStepSize)
|
||||
{
|
||||
return std::round(v);
|
||||
}
|
||||
|
||||
@@ -47,10 +47,6 @@ SampleFrame* BufferManager::acquire()
|
||||
return new SampleFrame[s_framesPerPeriod];
|
||||
}
|
||||
|
||||
void BufferManager::clear( SampleFrame* ab, const f_cnt_t frames, const f_cnt_t offset )
|
||||
{
|
||||
zeroSampleFrames(ab + offset, frames);
|
||||
}
|
||||
|
||||
|
||||
void BufferManager::release( SampleFrame* buf )
|
||||
|
||||
@@ -188,6 +188,12 @@ QString ConfigManager::defaultVersion() const
|
||||
return LMMS_VERSION;
|
||||
}
|
||||
|
||||
bool ConfigManager::enableBlockedPlugins()
|
||||
{
|
||||
const char* envVar = getenv("LMMS_ENABLE_BLOCKED_PLUGINS");
|
||||
return (envVar && *envVar);
|
||||
}
|
||||
|
||||
QStringList ConfigManager::availableVstEmbedMethods()
|
||||
{
|
||||
QStringList methods;
|
||||
@@ -512,7 +518,7 @@ void ConfigManager::loadConfigFile(const QString & configFile)
|
||||
cfg_file.close();
|
||||
}
|
||||
|
||||
// Plugins are searched recursively, blacklist problematic locations
|
||||
// Plugins are searched recursively, block problematic locations
|
||||
if( m_vstDir.isEmpty() || m_vstDir == QDir::separator() || m_vstDir == "/" ||
|
||||
m_vstDir == ensureTrailingSlash( QDir::homePath() ) ||
|
||||
!QDir( m_vstDir ).exists() )
|
||||
|
||||
@@ -159,11 +159,10 @@ inline void ControllerConnection::setTargetName( const QString & _name )
|
||||
*/
|
||||
void ControllerConnection::finalizeConnections()
|
||||
{
|
||||
for( int i = 0; i < s_connections.size(); ++i )
|
||||
for (auto i = std::size_t{0}; i < s_connections.size(); ++i)
|
||||
{
|
||||
ControllerConnection * c = s_connections[i];
|
||||
if ( !c->isFinalized() && c->m_controllerId <
|
||||
Engine::getSong()->controllers().size() )
|
||||
if (!c->isFinalized() && static_cast<std::size_t>(c->m_controllerId) < Engine::getSong()->controllers().size())
|
||||
{
|
||||
c->setController( Engine::getSong()->
|
||||
controllers().at( c->m_controllerId ) );
|
||||
@@ -221,7 +220,7 @@ void ControllerConnection::loadSettings( const QDomElement & _this )
|
||||
|
||||
if (!Engine::getSong()->isLoadingProject()
|
||||
&& m_controllerId != -1
|
||||
&& m_controllerId < Engine::getSong()->controllers().size())
|
||||
&& static_cast<std::size_t>(m_controllerId) < Engine::getSong()->controllers().size())
|
||||
{
|
||||
setController( Engine::getSong()->
|
||||
controllers().at( m_controllerId ) );
|
||||
|
||||
@@ -85,6 +85,7 @@ const std::vector<DataFile::UpgradeMethod> DataFile::UPGRADE_METHODS = {
|
||||
&DataFile::upgrade_sampleAndHold , &DataFile::upgrade_midiCCIndexing,
|
||||
&DataFile::upgrade_loopsRename , &DataFile::upgrade_noteTypes,
|
||||
&DataFile::upgrade_fixCMTDelays , &DataFile::upgrade_fixBassLoopsTypo,
|
||||
&DataFile::findProblematicLadspaPlugins
|
||||
};
|
||||
|
||||
// Vector of all versions that have upgrade routines.
|
||||
@@ -1082,7 +1083,6 @@ void DataFile::upgrade_0_4_0_rc2()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DataFile::upgrade_1_0_99()
|
||||
{
|
||||
jo_id_t last_assigned_id = 0;
|
||||
@@ -1194,7 +1194,7 @@ static void upgradeElement_1_2_0_rc2_42( QDomElement & el )
|
||||
int syncmode = el.attribute( "syncmode" ).toInt();
|
||||
QStringList names;
|
||||
QDomNamedNodeMap atts = el.attributes();
|
||||
for( uint i = 0; i < atts.length(); i++ )
|
||||
for (auto i = 0; i < atts.length(); i++)
|
||||
{
|
||||
QString name = atts.item( i ).nodeName();
|
||||
if( name.endsWith( "_numerator" ) )
|
||||
@@ -1989,6 +1989,39 @@ void DataFile::upgrade_midiCCIndexing()
|
||||
}
|
||||
}
|
||||
|
||||
void DataFile::findProblematicLadspaPlugins()
|
||||
{
|
||||
// This is not an upgrade but a check for potentially problematic LADSPA
|
||||
// controls. See #5738 for more details.
|
||||
|
||||
const QDomNodeList ladspacontrols = elementsByTagName("ladspacontrols");
|
||||
|
||||
uint numberOfProblematicPlugins = 0;
|
||||
|
||||
for (int i = 0; i < ladspacontrols.size(); ++i)
|
||||
{
|
||||
const QDomElement ladspacontrol = ladspacontrols.item(i).toElement();
|
||||
|
||||
const auto attributes = ladspacontrol.attributes();
|
||||
for (int j = 0; j < attributes.length(); ++j)
|
||||
{
|
||||
const auto attribute = attributes.item(j);
|
||||
const auto name = attribute.nodeName();
|
||||
if (name != "ports" && name.startsWith("port"))
|
||||
{
|
||||
++numberOfProblematicPlugins;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (numberOfProblematicPlugins > 0)
|
||||
{
|
||||
QMessageBox::warning(nullptr, QObject::tr("LADSPA plugins"),
|
||||
QObject::tr("The project contains %1 LADSPA plugin(s) which might have not been restored correctly! Please check the project.").arg(numberOfProblematicPlugins));
|
||||
}
|
||||
}
|
||||
|
||||
void DataFile::upgrade_fixBassLoopsTypo()
|
||||
{
|
||||
static const QMap<QString, QString> replacementMap = {
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "ConfigManager.h"
|
||||
#include "SampleFrame.h"
|
||||
#include "lmms_constants.h"
|
||||
|
||||
namespace lmms
|
||||
{
|
||||
@@ -154,7 +155,7 @@ void Effect::checkGate( double _out_sum )
|
||||
|
||||
// Check whether we need to continue processing input. Restart the
|
||||
// counter if the threshold has been exceeded.
|
||||
if( _out_sum - gate() <= typeInfo<float>::minEps() )
|
||||
if (_out_sum - gate() <= F_EPSILON)
|
||||
{
|
||||
incrementBufferCount();
|
||||
if( bufferCount() > timeout() )
|
||||
|
||||
@@ -126,15 +126,6 @@ void Engine::destroy()
|
||||
|
||||
|
||||
|
||||
bool Engine::ignorePluginBlacklist()
|
||||
{
|
||||
const char* envVar = getenv("LMMS_IGNORE_BLACKLIST");
|
||||
return (envVar && *envVar);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
float Engine::framesPerTick(sample_rate_t sampleRate)
|
||||
{
|
||||
return sampleRate * 60.0f * 4 /
|
||||
@@ -171,4 +162,4 @@ void *Engine::pickDndPluginKey()
|
||||
|
||||
Engine * Engine::s_instanceOfMe = nullptr;
|
||||
|
||||
} // namespace lmms
|
||||
} // namespace lmms
|
||||
|
||||
@@ -299,11 +299,6 @@ void EnvelopeAndLfoParameters::fillLevel( float * _buf, f_cnt_t _frame,
|
||||
{
|
||||
QMutexLocker m(&m_paramMutex);
|
||||
|
||||
if( _frame < 0 || _release_begin < 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
fillLfoLevel( _buf, _frame, _frames );
|
||||
|
||||
for( fpp_t offset = 0; offset < _frames; ++offset, ++_buf, ++_frame )
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "DummyInstrument.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "lmms_basics.h"
|
||||
#include "lmms_constants.h"
|
||||
|
||||
|
||||
@@ -185,7 +186,7 @@ void Instrument::applyRelease( SampleFrame* buf, const NotePlayHandle * _n )
|
||||
const auto releaseFrames = desiredReleaseFrames();
|
||||
|
||||
const auto endFrame = _n->framesLeft();
|
||||
const auto startFrame = std::max(0, endFrame - releaseFrames);
|
||||
const auto startFrame = endFrame - std::min(endFrame, releaseFrames);
|
||||
|
||||
for (auto f = startFrame; f < endFrame && f < fpp; f++)
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ InstrumentSoundShaping::InstrumentSoundShaping(
|
||||
m_filterCutModel( 14000.0, 1.0, 14000.0, 1.0, this, tr( "Cutoff frequency" ) ),
|
||||
m_filterResModel(0.5f, BasicFilters<>::minQ(), 10.f, 0.01f, this, tr("Q/Resonance"))
|
||||
{
|
||||
for( int i = 0; i < NumTargets; ++i )
|
||||
for (auto i = std::size_t{0}; i < NumTargets; ++i)
|
||||
{
|
||||
float value_for_zero_amount = 0.0;
|
||||
if( static_cast<Target>(i) == Target::Volume )
|
||||
@@ -279,7 +279,7 @@ f_cnt_t InstrumentSoundShaping::envFrames( const bool _only_vol ) const
|
||||
|
||||
if( _only_vol == false )
|
||||
{
|
||||
for( int i = static_cast<std::size_t>(Target::Volume)+1; i < NumTargets; ++i )
|
||||
for (auto i = static_cast<std::size_t>(Target::Volume) + 1; i < NumTargets; ++i)
|
||||
{
|
||||
if( m_envLfoParameters[i]->isUsed() &&
|
||||
m_envLfoParameters[i]->PAHD_Frames() > ret_val )
|
||||
@@ -313,7 +313,7 @@ f_cnt_t InstrumentSoundShaping::releaseFrames() const
|
||||
return m_envLfoParameters[static_cast<std::size_t>(Target::Volume)]->releaseFrames();
|
||||
}
|
||||
|
||||
for( int i = static_cast<std::size_t>(Target::Volume)+1; i < NumTargets; ++i )
|
||||
for (auto i = static_cast<std::size_t>(Target::Volume) + 1; i < NumTargets; ++i)
|
||||
{
|
||||
if( m_envLfoParameters[i]->isUsed() )
|
||||
{
|
||||
@@ -333,7 +333,7 @@ void InstrumentSoundShaping::saveSettings( QDomDocument & _doc, QDomElement & _t
|
||||
m_filterResModel.saveSettings( _doc, _this, "fres" );
|
||||
m_filterEnabledModel.saveSettings( _doc, _this, "fwet" );
|
||||
|
||||
for( int i = 0; i < NumTargets; ++i )
|
||||
for (auto i = std::size_t{0}; i < NumTargets; ++i)
|
||||
{
|
||||
m_envLfoParameters[i]->saveState( _doc, _this ).setTagName(
|
||||
m_envLfoParameters[i]->nodeName() +
|
||||
@@ -356,7 +356,7 @@ void InstrumentSoundShaping::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
if( node.isElement() )
|
||||
{
|
||||
for( int i = 0; i < NumTargets; ++i )
|
||||
for (auto i = std::size_t{0}; i < NumTargets; ++i)
|
||||
{
|
||||
if( node.nodeName() ==
|
||||
m_envLfoParameters[i]->nodeName() +
|
||||
|
||||
@@ -71,8 +71,7 @@ LocklessAllocator::LocklessAllocator( size_t nmemb, size_t size )
|
||||
|
||||
LocklessAllocator::~LocklessAllocator()
|
||||
{
|
||||
int available = m_available;
|
||||
if( available != m_capacity )
|
||||
if (m_available != m_capacity)
|
||||
{
|
||||
fprintf( stderr, "LocklessAllocator: "
|
||||
"Destroying with elements still allocated\n" );
|
||||
@@ -110,7 +109,7 @@ void * LocklessAllocator::alloc()
|
||||
// Some of these CAS loops could probably use relaxed atomics, as discussed
|
||||
// in http://en.cppreference.com/w/cpp/atomic/atomic/compare_exchange.
|
||||
// Let's use sequentially-consistent ops to be safe for now.
|
||||
int available = m_available.load();
|
||||
auto available = m_available.load();
|
||||
do
|
||||
{
|
||||
if( !available )
|
||||
|
||||
@@ -126,14 +126,14 @@ int Microtuner::octaveSize() const
|
||||
*/
|
||||
void Microtuner::updateScaleList(int index)
|
||||
{
|
||||
if (index >= 0 && index < MaxScaleCount)
|
||||
if (index >= 0 && static_cast<std::size_t>(index) < MaxScaleCount)
|
||||
{
|
||||
m_scaleModel.replaceItem(index,
|
||||
QString::number(index) + ": " + Engine::getSong()->getScale(index)->getDescription());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < MaxScaleCount; i++)
|
||||
for (auto i = std::size_t{0}; i < MaxScaleCount; i++)
|
||||
{
|
||||
m_scaleModel.replaceItem(i,
|
||||
QString::number(i) + ": " + Engine::getSong()->getScale(i)->getDescription());
|
||||
@@ -147,14 +147,14 @@ void Microtuner::updateScaleList(int index)
|
||||
*/
|
||||
void Microtuner::updateKeymapList(int index)
|
||||
{
|
||||
if (index >= 0 && index < MaxKeymapCount)
|
||||
if (index >= 0 && static_cast<std::size_t>(index) < MaxKeymapCount)
|
||||
{
|
||||
m_keymapModel.replaceItem(index,
|
||||
QString::number(index) + ": " + Engine::getSong()->getKeymap(index)->getDescription());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < MaxKeymapCount; i++)
|
||||
for (auto i = std::size_t{0}; i < MaxKeymapCount; i++)
|
||||
{
|
||||
m_keymapModel.replaceItem(i,
|
||||
QString::number(i) + ": " + Engine::getSong()->getKeymap(i)->getDescription());
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user