diff --git a/include/AutomatableModel.h b/include/AutomatableModel.h index 49e66c762..92f7df68e 100644 --- a/include/AutomatableModel.h +++ b/include/AutomatableModel.h @@ -32,7 +32,7 @@ #include "Model.h" #include "MidiTime.h" #include "ValueBuffer.h" - +#include "MemoryManager.h" // simple way to map a property of a view to a model #define mapPropertyFromModelPtr(type,getfunc,setfunc,modelname) \ @@ -66,6 +66,7 @@ class ControllerConnection; class EXPORT AutomatableModel : public Model, public JournallingObject { Q_OBJECT + MM_OPERATORS public: typedef QVector AutoModelVector; diff --git a/include/DataFile.h b/include/DataFile.h index 651bd275e..57db8905f 100644 --- a/include/DataFile.h +++ b/include/DataFile.h @@ -32,10 +32,11 @@ #include "export.h" #include "lmms_basics.h" - +#include "MemoryManager.h" class EXPORT DataFile : public QDomDocument { + MM_OPERATORS public: enum Types { diff --git a/include/Effect.h b/include/Effect.h index 44aabbacb..ded15c14e 100644 --- a/include/Effect.h +++ b/include/Effect.h @@ -39,6 +39,7 @@ class EffectControls; class EXPORT Effect : public Plugin { + MM_OPERATORS public: Effect( const Plugin::Descriptor * _desc, Model * _parent, diff --git a/include/Instrument.h b/include/Instrument.h index 904cf01fd..7d367e5ce 100644 --- a/include/Instrument.h +++ b/include/Instrument.h @@ -43,6 +43,7 @@ class track; class EXPORT Instrument : public Plugin { + MM_OPERATORS public: enum Flag { diff --git a/include/RingBuffer.h b/include/RingBuffer.h index c668d1c33..ec4aa1619 100644 --- a/include/RingBuffer.h +++ b/include/RingBuffer.h @@ -31,10 +31,12 @@ #include #include "lmms_basics.h" #include "lmms_math.h" +#include "MemoryManager.h" class RingBuffer : public QObject { Q_OBJECT + MM_OPERATORS public: /** \brief Constructs a ringbuffer of specified size, will not care about samplerate changes * \param size The size of the buffer in frames. The actual size will be size + period size diff --git a/include/SampleBuffer.h b/include/SampleBuffer.h index b1b8e5fd3..cb5d53c90 100644 --- a/include/SampleBuffer.h +++ b/include/SampleBuffer.h @@ -52,6 +52,7 @@ const f_cnt_t MARGIN[] = { 64, 64, 64, 4, 4 }; class EXPORT SampleBuffer : public QObject, public sharedObject { Q_OBJECT + MM_OPERATORS public: enum LoopMode { LoopOff = 0, diff --git a/include/ValueBuffer.h b/include/ValueBuffer.h index 7d9778721..9c5e8bf45 100644 --- a/include/ValueBuffer.h +++ b/include/ValueBuffer.h @@ -29,9 +29,11 @@ #include #include "interpolation.h" #include +#include "MemoryManager.h" class ValueBuffer { + MM_OPERATORS public: ValueBuffer() { diff --git a/plugins/organic/organic.h b/plugins/organic/organic.h index 92bd79cff..14418d283 100644 --- a/plugins/organic/organic.h +++ b/plugins/organic/organic.h @@ -75,6 +75,7 @@ const float CENT = 1.0f / 1200.0f; class OscillatorObject : public Model { Q_OBJECT + MM_OPERATORS private: int m_numOscillators; IntModel m_waveShape; diff --git a/plugins/sid/sid_instrument.h b/plugins/sid/sid_instrument.h index e6e733743..45b6e7d4d 100644 --- a/plugins/sid/sid_instrument.h +++ b/plugins/sid/sid_instrument.h @@ -41,6 +41,7 @@ class pixmapButton; class voiceObject : public Model { Q_OBJECT + MM_OPERATORS public: enum WaveForm { SquareWave = 0, diff --git a/plugins/triple_oscillator/TripleOscillator.h b/plugins/triple_oscillator/TripleOscillator.h index a271c23e5..c10b733bb 100644 --- a/plugins/triple_oscillator/TripleOscillator.h +++ b/plugins/triple_oscillator/TripleOscillator.h @@ -43,6 +43,7 @@ const int NUM_OF_OSCILLATORS = 3; class OscillatorObject : public Model { + MM_OPERATORS Q_OBJECT public: OscillatorObject( Model * _parent, int _idx ); diff --git a/src/core/MemoryManager.cpp b/src/core/MemoryManager.cpp index 09a3215c3..72310a9a0 100644 --- a/src/core/MemoryManager.cpp +++ b/src/core/MemoryManager.cpp @@ -106,7 +106,7 @@ void MemoryManager::free( void * ptr ) s_pointerMutex.lock(); if( ! s_pointerInfo.contains( ptr ) ) // if we have no info on ptr, fail loudly { - qFatal( "MemoryManager.cpp: Couldn't find pointer info for pointer: %d", (int)ptr ); + qFatal( "MemoryManager.cpp: Couldn't find pointer info for pointer: %d", (intptr_t)ptr ); } PtrInfo p = s_pointerInfo[ptr]; s_pointerInfo.remove( ptr ); @@ -198,7 +198,7 @@ void MemoryPool::releaseChunks( void * ptr, int chunks ) { m_mutex.lock(); - int start = ( (int)ptr - (int)m_pool ) / MM_CHUNK_SIZE; + int start = ( (intptr_t)ptr - (intptr_t)m_pool ) / MM_CHUNK_SIZE; if( start < 0 ) { qFatal( "MemoryManager: error at releaseChunks() - corrupt pointer info?" ); diff --git a/src/core/SampleBuffer.cpp b/src/core/SampleBuffer.cpp index 957e638ae..3612554f3 100644 --- a/src/core/SampleBuffer.cpp +++ b/src/core/SampleBuffer.cpp @@ -753,7 +753,10 @@ bool SampleBuffer::play( sampleFrame * _ab, handleState * _state, } } - if( tmp != NULL ) delete[] tmp; + if( tmp != NULL ) + { + MM_FREE( tmp ); + } _state->setBackwards( is_backwards ); _state->setFrameIndex( play_frame ); @@ -795,7 +798,7 @@ sampleFrame * SampleBuffer::getSampleFragment( f_cnt_t _index, return m_data + _index; } - *_tmp = new sampleFrame[_frames]; + *_tmp = MM_ALLOC( sampleFrame, _frames ); if( _loopmode == LoopOff ) {