Core Refactor: Replace `QVector with std::vector` (#6477)
* Replace QVector with std::vector in AudioEngine * Replace QVector with std::vector in AudioEngineWorkerThread * Replace QVector with std::vector in AudioJack * Replace QVector with std::vector in AutomatableModel * Replace QVector with std::vector in AutomationClip * Replace QVector with std::vector in AutomationEditor * Replace QVector with std::vector in ConfigManager * Replace QVector with std::vector in Controller * Replace QVector with std::vector in ControllerConnection * Replace QVector with std::vector in EffectChain * Replace QVector with std::vector in EnvelopeAndLfoParameters * Replace QVector with std::vector in InstrumentFunctions * Replace QVector with std::vector in MidiClient * Replace QVector with std::vector in Mixer * Replace QVector with std::vector in Note * Replace QVector with std::vector in PeakController * Replace QVector with std::vector in PianoRoll * Replace QVector with std::vector in PluginFactory * Replace QVector with std::vector in RenderManager * Replace QVector with std::vector in StepRecorder * Replace QVector with std::vector in Track * Replace QVector with std::vector in TrackContainer * Replace QVector with std::vector in Song * Adapt QVector to std::vector changes in ControllerConnectionDialog * Phase 2: Use std::abs in panning.h Without this, the QVector changes will make the code not compile. * Phase 2: Replace QVector with std::vector in PeakControllerEffect * Phase 2: Replace QVector with std::vector in AutomatableModel * Phase 2: Replace QVector with std::vector in AutomationClip * Phase 2: Replace QVector with std::vector in ControllerConnection * Phase 2: Replace QVector with std::vector in EffectChain * Phase 2: Replace QVector with std::vector in Mixer * Phase 2: Replace QVector with std::vector in PeakController * Phase 2: Replace QVector with std::vector in RenderManager * Phase 2: Replace QVector with std::vector in Song * Phase 2: Replace QVector with std::vector in StepRecorder * Phase 2: Replace QVector with std::vector in Track * Phase 2: Replace QVector with std::vector in TrackContainer * Phase 2: Adapt QVector changes in EffectRackView * Phase 2: Adapt QVector changes in AutomationClipView * Phase 2: Adapt QVector changes in ClipView * Phase 2: Adapt QVector changes in AutomationEditor * Phase 2: Adapt QVector changes in PianoRoll * Phase 2: Adapt QVector changes in TrackContainerView * Phase 2: Adapt QVector changes in TrackContentWidget * Phase 2: Adapt QVector changes in InstrumentTrack * Phase 2: Adapt QVector changes in MidiClip * Phase 2: Adapt QVector changes in SampleTrack * Fix segmentation fault in ConfigManager::value * Fix unintended faulty std::vector insert in AutomationClip::resolveAllIDs * Resolve trailing whitespace in src/core/StepRecorder.cpp Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com> * Use std::next and std::prev in EffectChain::moveUp/moveDown * Introduce static "combineAllTracks" function in AutomationClip * Adjust variable name in Song::automatedValuesAt * Adjust removal of long step notes in StepRecorder::removeNotesReleasedForTooLong * Iterate over m_chords by const reference in src/core/InstrumentFunctions.cpp Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com> * Fix StepRecorder::removeNotesReleasedForTooLong again * Combine the ConfigManager::value overloads using std::optional * Revise StepRecorder::removeNotesReleasedForTooLong * Remove redundant std::optional in ConfigManager::value * Remove trailing whitespace in ConfigManager::value * Fix: Prevent incorrect use of std::distance when element not found * Chore: Remove trailing whitespace in edited files * Only set the id attribute if the controller was found Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com> * Remove extra indents from 84b8fe8a559855ed263b74cc582eab3655250c5f * Fix compilation issues * Add LMMS_ prefix for header guard in Track.h * Undo changes made to MixerView::deleteUnusedChannels * Simplify code to handle failure of finding tracks Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com> * Split ternary operator into separate if statement Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com> * Undo changes to indentation in MixerRoute * Do general clean-up Some of the changes made: + Use auto where benefical + Fix bug in AutomatableModel::globalAutomationValueAt (for loop should be looping over clips variable, not clipsInRange) + Undo out of focus whitespace changes * Always assign to m_steps regardless if clip is found or not Even when the clip is not found (i.e., currentClip is -1), m_steps still gets assigned to. * Insert at the end of tracks vector in src/core/Mixer.cpp Co-authored-by: Dominic Clark <mrdomclark@gmail.com> * Insert at the end of tracks vector in src/core/Mixer.cpp (2) Co-authored-by: Dominic Clark <mrdomclark@gmail.com> * Remove redundant template parameter * Use std::array for zoomLevels --------- Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com> Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
This commit is contained in:
@@ -32,10 +32,10 @@
|
||||
#endif
|
||||
|
||||
#include <QThread>
|
||||
#include <QVector>
|
||||
#include <QWaitCondition>
|
||||
#include <samplerate.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "lmms_basics.h"
|
||||
#include "LocklessList.h"
|
||||
@@ -416,7 +416,7 @@ private:
|
||||
|
||||
bool m_renderOnly;
|
||||
|
||||
QVector<AudioPort *> m_audioPorts;
|
||||
std::vector<AudioPort *> m_audioPorts;
|
||||
|
||||
fpp_t m_framesPerPeriod;
|
||||
|
||||
@@ -430,7 +430,7 @@ private:
|
||||
surroundSampleFrame * m_outputBufferWrite;
|
||||
|
||||
// worker thread stuff
|
||||
QVector<AudioEngineWorkerThread *> m_workers;
|
||||
std::vector<AudioEngineWorkerThread *> m_workers;
|
||||
int m_numWorkers;
|
||||
|
||||
// playhandle stuff
|
||||
|
||||
@@ -100,9 +100,9 @@ public:
|
||||
JobQueue::OperationMode _opMode = JobQueue::Static )
|
||||
{
|
||||
resetJobQueue( _opMode );
|
||||
for( typename T::ConstIterator it = _vec.begin(); it != _vec.end(); ++it )
|
||||
for (const auto& job : _vec)
|
||||
{
|
||||
addJob( *it );
|
||||
addJob(job);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#endif
|
||||
|
||||
#include <atomic>
|
||||
#include <QVector>
|
||||
#include <vector>
|
||||
|
||||
#include "AudioDevice.h"
|
||||
#include "AudioDeviceSetupWidget.h"
|
||||
@@ -117,7 +117,7 @@ private:
|
||||
std::atomic<bool> m_stopped;
|
||||
|
||||
std::atomic<MidiJack *> m_midiClient;
|
||||
QVector<jack_port_t *> m_outputPorts;
|
||||
std::vector<jack_port_t *> m_outputPorts;
|
||||
jack_default_audio_sample_t * * m_tempOutBufs;
|
||||
surroundSampleFrame * m_outBuf;
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ class LMMS_EXPORT AutomatableModel : public Model, public JournallingObject
|
||||
Q_OBJECT
|
||||
MM_OPERATORS
|
||||
public:
|
||||
using AutoModelVector = QVector<AutomatableModel*>;
|
||||
using AutoModelVector = std::vector<AutomatableModel*>;
|
||||
|
||||
enum ScaleType
|
||||
{
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
} ;
|
||||
|
||||
using timeMap = QMap<int, AutomationNode>;
|
||||
using objectVector = QVector<QPointer<AutomatableModel>>;
|
||||
using objectVector = std::vector<QPointer<AutomatableModel>>;
|
||||
|
||||
using TimemapIterator = timeMap::const_iterator;
|
||||
|
||||
@@ -167,7 +167,7 @@ public:
|
||||
|
||||
|
||||
static bool isAutomated( const AutomatableModel * _m );
|
||||
static QVector<AutomationClip *> clipsForModel( const AutomatableModel * _m );
|
||||
static std::vector<AutomationClip*> clipsForModel(const AutomatableModel* _m);
|
||||
static AutomationClip * globalAutomationClip( AutomatableModel * _m );
|
||||
static void resolveAllIDs();
|
||||
|
||||
@@ -190,6 +190,15 @@ private:
|
||||
void generateTangents(timeMap::iterator it, int numToGenerate);
|
||||
float valueAt( timeMap::const_iterator v, int offset ) const;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* This function combines the song tracks, pattern store tracks,
|
||||
* and the global automation track all in one vector.
|
||||
*
|
||||
* @return std::vector<Track*>
|
||||
*/
|
||||
static std::vector<Track*> combineAllTracks();
|
||||
|
||||
// Mutex to make methods involving automation clips thread safe
|
||||
// Mutable so we can lock it from const objects
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
|
||||
@@ -199,7 +208,7 @@ private:
|
||||
#endif
|
||||
|
||||
AutomationTrack * m_autoTrack;
|
||||
QVector<jo_id_t> m_idsToResolve;
|
||||
std::vector<jo_id_t> m_idsToResolve;
|
||||
objectVector m_objects;
|
||||
timeMap m_timeMap; // actual values
|
||||
timeMap m_oldTimeMap; // old values for storing the values before setDragValue() is called.
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#define LMMS_GUI_AUTOMATION_EDITOR_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <array>
|
||||
|
||||
#include "Editor.h"
|
||||
|
||||
@@ -180,7 +181,7 @@ private:
|
||||
ComboBoxModel m_zoomingYModel;
|
||||
ComboBoxModel m_quantizeModel;
|
||||
|
||||
static const QVector<float> m_zoomXLevels;
|
||||
static const std::array<float, 7> m_zoomXLevels;
|
||||
|
||||
FloatModel * m_tensionModel;
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
#include <QMap>
|
||||
#include <QPair>
|
||||
#include <QStringList>
|
||||
#include <QVector>
|
||||
#include <QObject>
|
||||
|
||||
#include <vector>
|
||||
#include "lmms_export.h"
|
||||
|
||||
|
||||
@@ -239,11 +239,8 @@ public:
|
||||
|
||||
void addRecentlyOpenedProject(const QString & _file);
|
||||
|
||||
const QString & value(const QString & cls,
|
||||
const QString & attribute) const;
|
||||
const QString & value(const QString & cls,
|
||||
const QString & attribute,
|
||||
const QString & defaultVal) const;
|
||||
QString value(const QString& cls, const QString& attribute, const QString& defaultVal = "") const;
|
||||
|
||||
void setValue(const QString & cls, const QString & attribute,
|
||||
const QString & value);
|
||||
void deleteValue(const QString & cls, const QString & attribute);
|
||||
@@ -302,7 +299,7 @@ private:
|
||||
unsigned int m_configVersion;
|
||||
QStringList m_recentlyOpenedProjects;
|
||||
|
||||
using stringPairVector = QVector<QPair<QString, QString>>;
|
||||
using stringPairVector = std::vector<QPair<QString, QString>>;
|
||||
using settingsMap = QMap<QString, stringPairVector>;
|
||||
settingsMap m_settings;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class ControllerDialog;
|
||||
|
||||
} // namespace gui
|
||||
|
||||
using ControllerVector = QVector<Controller*>;
|
||||
using ControllerVector = std::vector<Controller*>;
|
||||
|
||||
class LMMS_EXPORT Controller : public Model, public JournallingObject
|
||||
{
|
||||
|
||||
@@ -30,12 +30,13 @@
|
||||
#define LMMS_CONTROLLER_CONNECTION_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
|
||||
#include "Controller.h"
|
||||
#include "JournallingObject.h"
|
||||
#include "ValueBuffer.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace lmms
|
||||
{
|
||||
|
||||
@@ -46,7 +47,7 @@ namespace gui
|
||||
class ControllerConnectionDialog;
|
||||
}
|
||||
|
||||
using ControllerConnectionVector = QVector<ControllerConnection*>;
|
||||
using ControllerConnectionVector = std::vector<ControllerConnection*>;
|
||||
|
||||
class LMMS_EXPORT ControllerConnection : public QObject, public JournallingObject
|
||||
{
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
using EffectList = QVector<Effect*>;
|
||||
using EffectList = std::vector<Effect*>;
|
||||
EffectList m_effects;
|
||||
|
||||
BoolModel m_enabledModel;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#ifndef LMMS_ENVELOPE_AND_LFO_PARAMETERS_H
|
||||
#define LMMS_ENVELOPE_AND_LFO_PARAMETERS_H
|
||||
|
||||
#include <QVector>
|
||||
#include <vector>
|
||||
|
||||
#include "JournallingObject.h"
|
||||
#include "AutomatableModel.h"
|
||||
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
struct ChordTable : public QVector<Chord>
|
||||
struct ChordTable
|
||||
{
|
||||
private:
|
||||
ChordTable();
|
||||
@@ -131,6 +131,7 @@ public:
|
||||
};
|
||||
|
||||
static std::array<Init, NUM_CHORD_TABLES> s_initTable;
|
||||
std::vector<Chord> m_chords;
|
||||
|
||||
public:
|
||||
static const ChordTable & getInstance()
|
||||
@@ -150,6 +151,11 @@ public:
|
||||
{
|
||||
return getByName( name, false );
|
||||
}
|
||||
|
||||
const std::vector<Chord>& chords() const
|
||||
{
|
||||
return m_chords;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#define LMMS_MIDI_CLIENT_H
|
||||
|
||||
#include <QStringList>
|
||||
#include <QVector>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#include "MidiEvent.h"
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
static MidiClient * openMidiClient();
|
||||
|
||||
protected:
|
||||
QVector<MidiPort *> m_midiPorts;
|
||||
std::vector<MidiPort *> m_midiPorts;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace lmms
|
||||
|
||||
|
||||
class MixerRoute;
|
||||
using MixerRouteVector = QVector<MixerRoute*>;
|
||||
using MixerRouteVector = std::vector<MixerRoute*>;
|
||||
|
||||
class MixerChannel : public ThreadableJob
|
||||
{
|
||||
@@ -219,7 +219,7 @@ public:
|
||||
|
||||
private:
|
||||
// the mixer channels in the mixer. index 0 is always master.
|
||||
QVector<MixerChannel *> m_mixerChannels;
|
||||
std::vector<MixerChannel*> m_mixerChannels;
|
||||
|
||||
// make sure we have at least num channels
|
||||
void allocateChannelsTo(int num);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#define LMMS_NOTE_H
|
||||
|
||||
#include <optional>
|
||||
#include <QVector>
|
||||
#include <vector>
|
||||
|
||||
#include "volume.h"
|
||||
#include "panning.h"
|
||||
@@ -249,7 +249,7 @@ private:
|
||||
DetuningHelper * m_detuning;
|
||||
};
|
||||
|
||||
using NoteVector = QVector<Note*>;
|
||||
using NoteVector = std::vector<Note*>;
|
||||
|
||||
struct NoteBounds
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace lmms
|
||||
|
||||
class PeakControllerEffect;
|
||||
|
||||
using PeakControllerEffectVector = QVector<PeakControllerEffect*>;
|
||||
using PeakControllerEffectVector = std::vector<PeakControllerEffect*>;
|
||||
|
||||
class LMMS_EXPORT PeakController : public Controller
|
||||
{
|
||||
|
||||
@@ -27,9 +27,10 @@
|
||||
#ifndef LMMS_GUI_PIANO_ROLL_H
|
||||
#define LMMS_GUI_PIANO_ROLL_H
|
||||
|
||||
#include <QVector>
|
||||
#include <QWidget>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Editor.h"
|
||||
#include "ComboBoxModel.h"
|
||||
#include "SerializingObject.h"
|
||||
@@ -291,7 +292,7 @@ private:
|
||||
|
||||
PositionLine * m_positionLine;
|
||||
|
||||
QVector<QString> m_nemStr; // gui names of each edit mode
|
||||
std::vector<QString> m_nemStr; // gui names of each edit mode
|
||||
QMenu * m_noteEditMenu; // when you right click below the key area
|
||||
|
||||
QList<int> m_markedSemiTones;
|
||||
@@ -358,8 +359,8 @@ private:
|
||||
ComboBoxModel m_chordModel;
|
||||
ComboBoxModel m_snapModel;
|
||||
|
||||
static const QVector<float> m_zoomLevels;
|
||||
static const QVector<float> m_zoomYLevels;
|
||||
static const std::vector<float> m_zoomLevels;
|
||||
static const std::vector<float> m_zoomYLevels;
|
||||
|
||||
MidiClip* m_midiClip;
|
||||
NoteVector m_ghostNotes;
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
#include "lmms_export.h"
|
||||
#include "Plugin.h"
|
||||
@@ -99,7 +99,7 @@ private:
|
||||
PluginInfoList m_pluginInfos;
|
||||
|
||||
QMap<QString, PluginInfoAndKey> m_pluginByExt;
|
||||
QVector<std::string> m_garbage; //!< cleaned up at destruction
|
||||
std::vector<std::string> m_garbage; //!< cleaned up at destruction
|
||||
|
||||
QHash<QString, QString> m_errors;
|
||||
|
||||
|
||||
@@ -78,8 +78,8 @@ private:
|
||||
|
||||
std::unique_ptr<ProjectRenderer> m_activeRenderer;
|
||||
|
||||
QVector<Track*> m_tracksToRender;
|
||||
QVector<Track*> m_unmuted;
|
||||
std::vector<Track*> m_tracksToRender;
|
||||
std::vector<Track*> m_unmuted;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class StepRecorder : public QObject
|
||||
void setCurrentMidiClip(MidiClip* newMidiClip);
|
||||
void setStepsLength(const TimePos& newLength);
|
||||
|
||||
QVector<Note*> getCurStepNotes();
|
||||
std::vector<Note*> getCurStepNotes();
|
||||
|
||||
bool isRecording() const
|
||||
{
|
||||
@@ -142,7 +142,7 @@ class StepRecorder : public QObject
|
||||
QElapsedTimer releasedTimer;
|
||||
} ;
|
||||
|
||||
QVector<StepNote*> m_curStepNotes; // contains the current recorded step notes (i.e. while user still press the notes; before they are applied to the clip)
|
||||
std::vector<StepNote*> m_curStepNotes; // contains the current recorded step notes (i.e. while user still press the notes; before they are applied to the clip)
|
||||
|
||||
StepNote* findCurStepNote(const int key);
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
#ifndef LMMS_TRACK_H
|
||||
#define LMMS_TRACK_H
|
||||
|
||||
#include <QVector>
|
||||
#include <vector>
|
||||
|
||||
#include <QColor>
|
||||
|
||||
#include "AutomatableModel.h"
|
||||
@@ -69,7 +70,7 @@ class LMMS_EXPORT Track : public Model, public JournallingObject
|
||||
mapPropertyFromModel(bool,isMuted,setMuted,m_mutedModel);
|
||||
mapPropertyFromModel(bool,isSolo,setSolo,m_soloModel);
|
||||
public:
|
||||
using clipVector = QVector<Clip*>;
|
||||
using clipVector = std::vector<Clip*>;
|
||||
|
||||
enum TrackTypes
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ class LMMS_EXPORT TrackContainer : public Model, public JournallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using TrackList = QVector<Track*>;
|
||||
using TrackList = std::vector<Track*>;
|
||||
enum TrackContainerTypes
|
||||
{
|
||||
PatternContainer,
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "Midi.h"
|
||||
#include "volume.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace lmms
|
||||
{
|
||||
|
||||
@@ -40,7 +42,7 @@ inline StereoVolumeVector panningToVolumeVector( panning_t _p,
|
||||
{
|
||||
StereoVolumeVector v = { { _scale, _scale } };
|
||||
const float pf = _p / 100.0f;
|
||||
v.vol[_p >= PanningCenter ? 0 : 1] *= 1.0f - qAbs<float>( pf );
|
||||
v.vol[_p >= PanningCenter ? 0 : 1] *= 1.0f - std::abs(pf);
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user