Remove MemoryManager (#7128)

Removes `MemoryManager` and the use of rpmalloc in favor of the `new` and `delete` operators found in C++.

---------

Co-authored-by: Veratil <veratil@gmail.com>
This commit is contained in:
TechnoPorg
2024-02-25 11:49:56 -07:00
committed by GitHub
parent 03d067b105
commit c991a85eef
47 changed files with 42 additions and 359 deletions

View File

@@ -31,7 +31,6 @@
#include "Instrument.h"
#include "InstrumentView.h"
#include "Graph.h"
#include "MemoryManager.h"
namespace lmms
{
@@ -48,7 +47,6 @@ class PixmapButton;
class BSynth
{
MM_OPERATORS
public:
BSynth( float * sample, NotePlayHandle * _nph,
bool _interpolation, float factor,

View File

@@ -62,7 +62,7 @@ BitcrushEffect::BitcrushEffect( Model * parent, const Descriptor::SubPluginFeatu
m_sampleRate( Engine::audioEngine()->processingSampleRate() ),
m_filter( m_sampleRate )
{
m_buffer = MM_ALLOC<sampleFrame>( Engine::audioEngine()->framesPerPeriod() * OS_RATE );
m_buffer = new sampleFrame[Engine::audioEngine()->framesPerPeriod() * OS_RATE];
m_filter.setLowpass( m_sampleRate * ( CUTOFF_RATIO * OS_RATIO ) );
m_needsUpdate = true;
@@ -77,7 +77,7 @@ BitcrushEffect::BitcrushEffect( Model * parent, const Descriptor::SubPluginFeatu
BitcrushEffect::~BitcrushEffect()
{
MM_FREE( m_buffer );
delete[] m_buffer;
}

View File

@@ -64,16 +64,16 @@ CrossoverEQEffect::CrossoverEQEffect( Model* parent, const Descriptor::SubPlugin
m_hp4( m_sampleRate ),
m_needsUpdate( true )
{
m_tmp1 = MM_ALLOC<sampleFrame>( Engine::audioEngine()->framesPerPeriod() );
m_tmp2 = MM_ALLOC<sampleFrame>( Engine::audioEngine()->framesPerPeriod() );
m_work = MM_ALLOC<sampleFrame>( Engine::audioEngine()->framesPerPeriod() );
m_tmp2 = new sampleFrame[Engine::audioEngine()->framesPerPeriod()];
m_tmp1 = new sampleFrame[Engine::audioEngine()->framesPerPeriod()];
m_work = new sampleFrame[Engine::audioEngine()->framesPerPeriod()];
}
CrossoverEQEffect::~CrossoverEQEffect()
{
MM_FREE( m_tmp1 );
MM_FREE( m_tmp2 );
MM_FREE( m_work );
delete[] m_tmp1;
delete[] m_tmp2;
delete[] m_work;
}
void CrossoverEQEffect::sampleRateChanged()

View File

@@ -26,7 +26,6 @@
#include "Gb_Apu.h"
#include "Multi_Buffer.h"
#include "MemoryManager.h"
namespace lmms
{
@@ -34,7 +33,6 @@ namespace lmms
class GbApuWrapper : private Gb_Apu
{
MM_OPERATORS
public:
GbApuWrapper() = default;
~GbApuWrapper() = default;

View File

@@ -38,7 +38,6 @@
#include "Knob.h"
#include "LcdSpinBox.h"
#include "LedCheckBox.h"
#include "MemoryManager.h"
#include "gig.h"
@@ -236,7 +235,6 @@ public:
class GigInstrument : public Instrument
{
Q_OBJECT
MM_OPERATORS
mapPropertyFromModel( int, getBank, setBank, m_bankNum );
mapPropertyFromModel( int, getPatch, setPatch, m_patchNum );

View File

@@ -31,7 +31,6 @@
#include "lmms_math.h"
#include "interpolation.h"
#include "MemoryManager.h"
namespace lmms
{
@@ -40,7 +39,6 @@ namespace lmms
template<class FX = DspEffectLibrary::StereoBypass>
class KickerOsc
{
MM_OPERATORS
public:
KickerOsc( const FX & fx, const float start, const float end, const float noise, const float offset,
const float slope, const float env, const float diststart, const float distend, const float length ) :

View File

@@ -36,7 +36,6 @@
#include "LadspaControl.h"
#include "LadspaSubPluginFeatures.h"
#include "AutomationClip.h"
#include "MemoryManager.h"
#include "ValueBuffer.h"
#include "Song.h"
@@ -326,7 +325,7 @@ void LadspaEffect::pluginInstantiation()
manager->isPortInput( m_key, port ) )
{
p->rate = BufferRate::ChannelIn;
p->buffer = MM_ALLOC<LADSPA_Data>( Engine::audioEngine()->framesPerPeriod() );
p->buffer = new LADSPA_Data[Engine::audioEngine()->framesPerPeriod()];
inbuf[ inputch ] = p->buffer;
inputch++;
}
@@ -341,24 +340,24 @@ void LadspaEffect::pluginInstantiation()
}
else
{
p->buffer = MM_ALLOC<LADSPA_Data>( Engine::audioEngine()->framesPerPeriod() );
p->buffer = new LADSPA_Data[Engine::audioEngine()->framesPerPeriod()];
m_inPlaceBroken = true;
}
}
else if( manager->isPortInput( m_key, port ) )
{
p->rate = BufferRate::AudioRateInput;
p->buffer = MM_ALLOC<LADSPA_Data>( Engine::audioEngine()->framesPerPeriod() );
p->buffer = new LADSPA_Data[Engine::audioEngine()->framesPerPeriod()];
}
else
{
p->rate = BufferRate::AudioRateOutput;
p->buffer = MM_ALLOC<LADSPA_Data>( Engine::audioEngine()->framesPerPeriod() );
p->buffer = new LADSPA_Data[Engine::audioEngine()->framesPerPeriod()];
}
}
else
{
p->buffer = MM_ALLOC<LADSPA_Data>( 1 );
p->buffer = new LADSPA_Data[1];
if( manager->isPortInput( m_key, port ) )
{
@@ -557,7 +556,7 @@ void LadspaEffect::pluginDestruction()
port_desc_t * pp = m_ports.at( proc ).at( port );
if( m_inPlaceBroken || pp->rate != BufferRate::ChannelOut )
{
if( pp->buffer) MM_FREE( pp->buffer );
if( pp->buffer) delete[] pp->buffer;
}
delete pp;
}

View File

@@ -173,7 +173,6 @@ class ComboBox;
class MonstroSynth
{
MM_OPERATORS
public:
MonstroSynth( MonstroInstrument * _i, NotePlayHandle * _nph );
virtual ~MonstroSynth() = default;

View File

@@ -58,7 +58,7 @@ MultitapEchoEffect::MultitapEchoEffect( Model* parent, const Descriptor::SubPlug
m_sampleRate( Engine::audioEngine()->processingSampleRate() ),
m_sampleRatio( 1.0f / m_sampleRate )
{
m_work = MM_ALLOC<sampleFrame>( Engine::audioEngine()->framesPerPeriod() );
m_work = new sampleFrame[Engine::audioEngine()->framesPerPeriod()];
m_buffer.reset();
m_stages = static_cast<int>( m_controls.m_stages.value() );
updateFilters( 0, 19 );
@@ -67,7 +67,7 @@ MultitapEchoEffect::MultitapEchoEffect( Model* parent, const Descriptor::SubPlug
MultitapEchoEffect::~MultitapEchoEffect()
{
MM_FREE( m_work );
delete[] m_work;
}

View File

@@ -31,7 +31,6 @@
#include "InstrumentView.h"
#include "AutomatableModel.h"
#include "PixmapButton.h"
#include "MemoryManager.h"
#define makeknob( name, x, y, hint, unit, oname ) \
@@ -92,7 +91,6 @@ class NesInstrumentView;
class NesObject
{
MM_OPERATORS
public:
NesObject( NesInstrument * nes, const sample_rate_t samplerate, NotePlayHandle * nph );
virtual ~NesObject() = default;

View File

@@ -84,7 +84,6 @@ const float CENT = 1.0f / 1200.0f;
class OscillatorObject : public Model
{
Q_OBJECT
MM_OPERATORS
private:
int m_numOscillators;
IntModel m_waveShape;
@@ -159,7 +158,6 @@ private:
struct oscPtr
{
MM_OPERATORS
Oscillator * oscLeft;
Oscillator * oscRight;
float phaseOffsetLeft[NUM_OSCILLATORS];
@@ -196,7 +194,6 @@ private:
struct OscillatorKnobs
{
MM_OPERATORS
OscillatorKnobs(
Knob * h,
Knob * v,

View File

@@ -31,7 +31,6 @@
#include "Sample.h"
#include "SampleBuffer.h"
#include "AutomatableModel.h"
#include "MemoryManager.h"
namespace lmms
{
@@ -87,7 +86,6 @@ public slots:
private:
struct handle_data
{
MM_OPERATORS
Sample::PlaybackState* state;
bool tuned;
std::shared_ptr<Sample> sample;

View File

@@ -34,7 +34,6 @@
#include "Instrument.h"
#include "InstrumentView.h"
#include "LcdSpinBox.h"
#include "MemoryManager.h"
class QLabel;

View File

@@ -31,7 +31,6 @@
#include "AutomatableModel.h"
#include "Instrument.h"
#include "InstrumentView.h"
#include "MemoryManager.h"
namespace lmms
{
@@ -78,7 +77,6 @@ class SfxrInstrumentView;
class SfxrSynth
{
MM_OPERATORS
public:
SfxrSynth( const SfxrInstrument * s );
virtual ~SfxrSynth() = default;

View File

@@ -48,7 +48,6 @@ class PixmapButton;
class VoiceObject : public Model
{
Q_OBJECT
MM_OPERATORS
public:
enum class WaveForm {
Square = 0,

View File

@@ -57,7 +57,6 @@ const int NUM_OF_OSCILLATORS = 3;
class OscillatorObject : public Model
{
MM_OPERATORS
Q_OBJECT
public:
OscillatorObject( Model * _parent, int _idx );
@@ -139,7 +138,6 @@ private:
struct oscPtr
{
MM_OPERATORS
Oscillator * oscLeft;
Oscillator * oscRight;
} ;
@@ -170,7 +168,6 @@ private:
struct OscillatorKnobs
{
MM_OPERATORS
OscillatorKnobs( Knob * v,
Knob * p,
Knob * c,

View File

@@ -33,7 +33,6 @@
#include "InstrumentTrack.h"
#include "NotePlayHandle.h"
#include "VibratingString.h"
#include "MemoryManager.h"
#include "base64.h"
#include "CaptionMenu.h"
#include "volume.h"
@@ -67,7 +66,6 @@ Plugin::Descriptor PLUGIN_EXPORT vibedstrings_plugin_descriptor =
class Vibed::StringContainer
{
MM_OPERATORS
public:
StringContainer(float pitch, sample_rate_t sampleRate, int bufferLength) :
m_pitch(pitch), m_sampleRate(sampleRate), m_bufferLength(bufferLength) {}

View File

@@ -32,7 +32,6 @@
#include "AutomatableModel.h"
#include "TempoSyncKnob.h"
#include <samplerate.h>
#include "MemoryManager.h"
namespace lmms
{
@@ -88,7 +87,6 @@ class WatsynView;
class WatsynObject
{
MM_OPERATORS
public:
WatsynObject( float * _A1wave, float * _A2wave,
float * _B1wave, float * _B2wave,

View File

@@ -30,7 +30,6 @@
#include <limits>
#include "AutomatableModel.h"
#include "Graph.h"
#include "MemoryManager.h"
namespace lmms
{
@@ -102,7 +101,6 @@ public:
class ExprSynth
{
MM_OPERATORS
public:
ExprSynth(const WaveSample* gW1, const WaveSample* gW2, const WaveSample* gW3, ExprFront* exprO1, ExprFront* exprO2, NotePlayHandle* nph,
const sample_rate_t sample_rate, const FloatModel* pan1, const FloatModel* pan2, float rel_trans);