Merge remote-tracking branch 'origin/master' into feature/recording-stage-one
Conflicts: * src/core/audio/AudioSdl.cpp
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user