Merge remote-tracking branch 'upstream/master' into refactor-samplebuffer

This commit is contained in:
sakertooth
2023-09-04 19:38:44 -04:00
80 changed files with 389 additions and 243 deletions

View File

@@ -275,6 +275,11 @@ public:
return m_profiler.cpuLoad();
}
int detailLoad(const AudioEngineProfiler::DetailType type) const
{
return m_profiler.detailLoad(type);
}
const qualitySettings & currentQualitySettings() const
{
return m_qualitySettings;
@@ -401,6 +406,10 @@ private:
AudioDevice * tryAudioDevices();
MidiClient * tryMidiClients();
void renderStageNoteSetup();
void renderStageInstruments();
void renderStageEffects();
void renderStageMix();
const surroundSampleFrame * renderNextBuffer();

View File

@@ -25,6 +25,8 @@
#ifndef LMMS_AUDIO_ENGINE_PROFILER_H
#define LMMS_AUDIO_ENGINE_PROFILER_H
#include <array>
#include <atomic>
#include <QFile>
#include "lmms_basics.h"
@@ -53,11 +55,55 @@ public:
void setOutputFile( const QString& outputFile );
enum class DetailType {
NoteSetup,
Instruments,
Effects,
Mixing,
Count
};
constexpr static auto DetailCount = static_cast<std::size_t>(DetailType::Count);
int detailLoad(const DetailType type) const
{
return m_detailLoad[static_cast<std::size_t>(type)].load(std::memory_order_relaxed);
}
class Probe
{
public:
Probe(AudioEngineProfiler& profiler, AudioEngineProfiler::DetailType type)
: m_profiler(profiler)
, m_type(type)
{
profiler.startDetail(type);
}
~Probe() { m_profiler.finishDetail(m_type); }
Probe& operator=(const Probe&) = delete;
Probe(const Probe&) = delete;
Probe(Probe&&) = delete;
private:
AudioEngineProfiler &m_profiler;
const AudioEngineProfiler::DetailType m_type;
};
private:
void startDetail(const DetailType type) { m_detailTimer[static_cast<std::size_t>(type)].reset(); }
void finishDetail(const DetailType type)
{
m_detailTime[static_cast<std::size_t>(type)] = m_detailTimer[static_cast<std::size_t>(type)].elapsed();
}
MicroTimer m_periodTimer;
int m_cpuLoad;
std::atomic<float> m_cpuLoad;
QFile m_outputFile;
// Use arrays to avoid dynamic allocations in realtime code
std::array<MicroTimer, DetailCount> m_detailTimer;
std::array<int, DetailCount> m_detailTime{0};
std::array<std::atomic<float>, DetailCount> m_detailLoad{0};
};
} // namespace lmms

View File

@@ -26,6 +26,7 @@
#ifndef LMMS_GUI_CPU_LOAD_WIDGET_H
#define LMMS_GUI_CPU_LOAD_WIDGET_H
#include <algorithm>
#include <QTimer>
#include <QPixmap>
#include <QWidget>
@@ -40,6 +41,7 @@ namespace lmms::gui
class CPULoadWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY(int stepSize MEMBER m_stepSize)
public:
CPULoadWidget( QWidget * _parent );
~CPULoadWidget() override = default;
@@ -54,6 +56,8 @@ protected slots:
private:
int stepSize() const { return std::max(1, m_stepSize); }
int m_currentLoad;
QPixmap m_temp;
@@ -64,6 +68,8 @@ private:
QTimer m_updateTimer;
int m_stepSize;
} ;

View File

@@ -51,7 +51,7 @@ namespace gui
class InstrumentTrackView;
class InstrumentTrackWindow;
class InstrumentMiscView;
class InstrumentTuningView;
class MidiCCRackView;
} // namespace gui
@@ -315,7 +315,7 @@ private:
friend class gui::InstrumentTrackView;
friend class gui::InstrumentTrackWindow;
friend class NotePlayHandle;
friend class gui::InstrumentMiscView;
friend class gui::InstrumentTuningView;
friend class gui::MidiCCRackView;
} ;

View File

@@ -47,7 +47,7 @@ class MixerLineLcdSpinBox;
class InstrumentFunctionArpeggioView;
class InstrumentFunctionNoteStackingView;
class InstrumentMidiIOView;
class InstrumentMiscView;
class InstrumentTuningView;
class InstrumentSoundShapingView;
class InstrumentTrackShapingView;
class InstrumentTrackView;
@@ -154,7 +154,7 @@ private:
InstrumentFunctionArpeggioView* m_arpeggioView;
InstrumentMidiIOView * m_midiView;
EffectRackView * m_effectView;
InstrumentMiscView *m_miscView;
InstrumentTuningView *m_tuningView;
// test-piano at the bottom of every instrument-settings-window

View File

@@ -1,9 +1,9 @@
/*
* InstrumentMiscView.h - widget in instrument-track-window for setting up
* miscellaneous options not covered by other tabs
* InstrumentTuningView.h - widget in instrument-track-window for setting up
* tuning and transposition options
*
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2020 Martin Pavelek <he29.HS/at/gmail.com>
* Copyright (c) 2020-2022 Martin Pavelek <he29.HS/at/gmail.com>
*
* This file is part of LMMS - https://lmms.io
*
@@ -24,11 +24,13 @@
*
*/
#ifndef LMMS_GUI_INSTRUMENT_MISC_VIEW_H
#define LMMS_GUI_INSTRUMENT_MISC_VIEW_H
#ifndef LMMS_GUI_INSTRUMENT_TUNING_VIEW_H
#define LMMS_GUI_INSTRUMENT_TUNING_VIEW_H
#include <QWidget>
class QLabel;
namespace lmms
{
@@ -42,15 +44,17 @@ class GroupBox;
class LedCheckBox;
class InstrumentMiscView : public QWidget
class InstrumentTuningView : public QWidget
{
Q_OBJECT
public:
InstrumentMiscView(InstrumentTrack *it, QWidget *parent);
InstrumentTuningView(InstrumentTrack *it, QWidget *parent);
GroupBox *pitchGroupBox() {return m_pitchGroupBox;}
GroupBox *microtunerGroupBox() {return m_microtunerGroupBox;}
QLabel *microtunerNotSupportedLabel() {return m_microtunerNotSupportedLabel;}
ComboBox *scaleCombo() {return m_scaleCombo;}
ComboBox *keymapCombo() {return m_keymapCombo;}
@@ -60,6 +64,8 @@ private:
GroupBox *m_pitchGroupBox;
GroupBox *m_microtunerGroupBox;
QLabel *m_microtunerNotSupportedLabel;
ComboBox *m_scaleCombo;
ComboBox *m_keymapCombo;
@@ -71,4 +77,4 @@ private:
} // namespace lmms
#endif // LMMS_GUI_INSTRUMENT_MISC_VIEW_H
#endif // LMMS_GUI_INSTRUMENT_TUNING_VIEW_H

View File

@@ -79,7 +79,7 @@ public:
void setStep( int step, bool enabled );
// Split the list of notes on the given position
void splitNotes(NoteVector notes, TimePos pos);
void splitNotes(const NoteVector& notes, TimePos pos);
// clip-type stuff
inline Type type() const

View File

@@ -91,7 +91,7 @@ const int DefaultMiddleKey = Octave::Octave_4 + Key::C;
const int DefaultBaseKey = Octave::Octave_4 + Key::A;
const float DefaultBaseFreq = 440.f;
const float MaxDetuning = 4 * 12.0f;
const float MaxDetuning = 5 * 12.0f;

View File

@@ -248,7 +248,7 @@ public:
}
/*! Process note detuning automation */
void processTimePos( const TimePos& time );
void processTimePos(const TimePos& time, float pitchValue, bool isRecording);
/*! Updates total length (m_frames) depending on a new tempo */
void resize( const bpm_t newTempo );

View File

@@ -308,9 +308,9 @@ private:
TimePos newNoteLen() const;
void shiftPos(int amount);
void shiftPos(NoteVector notes, int amount);
void shiftPos(const NoteVector& notes, int amount);
void shiftSemiTone(int amount);
void shiftSemiTone(NoteVector notes, int amount);
void shiftSemiTone(const NoteVector& notes, int amount);
bool isSelection() const;
int selectionCount() const;
void testPlayNote( Note * n );