Skip to content

Commit 2cb0f16

Browse files
M374LXVeratil
authored andcommitted
Mixer refactor (LMMS#4894)
Co-authored-by: Kevin Zander <veratil@gmail.com>
1 parent a3e92c4 commit 2cb0f16

2 files changed

Lines changed: 131 additions & 129 deletions

File tree

include/Mixer.h

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ class LMMS_EXPORT Mixer : public QObject
9898
Interpolation interpolation;
9999
Oversampling oversampling;
100100

101-
qualitySettings( Mode _m )
101+
qualitySettings(Mode m)
102102
{
103-
switch( _m )
103+
switch (m)
104104
{
105105
case Mode_Draft:
106106
interpolation = Interpolation_Linear;
@@ -118,9 +118,9 @@ class LMMS_EXPORT Mixer : public QObject
118118
}
119119
}
120120

121-
qualitySettings( Interpolation _i, Oversampling _o ) :
122-
interpolation( _i ),
123-
oversampling( _o )
121+
qualitySettings(Interpolation i, Oversampling o) :
122+
interpolation(i),
123+
oversampling(o)
124124
{
125125
}
126126

@@ -186,14 +186,14 @@ class LMMS_EXPORT Mixer : public QObject
186186

187187

188188
// audio-port-stuff
189-
inline void addAudioPort( AudioPort * _port )
189+
inline void addAudioPort(AudioPort * port)
190190
{
191191
requestChangeInModel();
192-
m_audioPorts.push_back( _port );
192+
m_audioPorts.push_back(port);
193193
doneChangeInModel();
194194
}
195195

196-
void removeAudioPort( AudioPort * _port );
196+
void removeAudioPort(AudioPort * port);
197197

198198

199199
// MIDI-client-stuff
@@ -218,7 +218,7 @@ class LMMS_EXPORT Mixer : public QObject
218218
return m_playHandles;
219219
}
220220

221-
void removePlayHandlesOfTypes( Track * _track, const quint8 types );
221+
void removePlayHandlesOfTypes(Track * track, const quint8 types);
222222

223223

224224
// methods providing information for other classes
@@ -255,23 +255,23 @@ class LMMS_EXPORT Mixer : public QObject
255255
return m_masterGain;
256256
}
257257

258-
inline void setMasterGain( const float _mo )
258+
inline void setMasterGain(const float mo)
259259
{
260-
m_masterGain = _mo;
260+
m_masterGain = mo;
261261
}
262262

263263

264-
static inline sample_t clip( const sample_t _s )
264+
static inline sample_t clip(const sample_t s)
265265
{
266-
if( _s > 1.0f )
266+
if (s > 1.0f)
267267
{
268268
return 1.0f;
269269
}
270-
else if( _s < -1.0f )
270+
else if (s < -1.0f)
271271
{
272272
return -1.0f;
273273
}
274-
return _s;
274+
return s;
275275
}
276276

277277

@@ -281,7 +281,7 @@ class LMMS_EXPORT Mixer : public QObject
281281
sample_t left;
282282
sample_t right;
283283
};
284-
StereoSample getPeakValues(sampleFrame * _ab, const f_cnt_t _frames) const;
284+
StereoSample getPeakValues(sampleFrame * ab, const f_cnt_t _frames) const;
285285

286286

287287
bool criticalXRuns() const;
@@ -308,7 +308,7 @@ class LMMS_EXPORT Mixer : public QObject
308308
return hasFifoWriter() ? m_fifo->read() : renderNextBuffer();
309309
}
310310

311-
void changeQuality( const struct qualitySettings & _qs );
311+
void changeQuality(const struct qualitySettings & qs);
312312

313313
inline bool isMetronomeActive() const { return m_metronomeActive; }
314314
inline void setMetronomeActive(bool value = true) { m_metronomeActive = value; }
@@ -333,7 +333,7 @@ class LMMS_EXPORT Mixer : public QObject
333333
class fifoWriter : public QThread
334334
{
335335
public:
336-
fifoWriter( Mixer * _mixer, fifo * _fifo );
336+
fifoWriter(Mixer * mixer, fifo * _fifo);
337337

338338
void finish();
339339

@@ -353,7 +353,7 @@ class LMMS_EXPORT Mixer : public QObject
353353
Mixer( bool renderOnly );
354354
virtual ~Mixer();
355355

356-
void startProcessing( bool _needs_fifo = true );
356+
void startProcessing(bool needsFifo = true);
357357
void stopProcessing();
358358

359359

@@ -363,6 +363,10 @@ class LMMS_EXPORT Mixer : public QObject
363363

364364
const surroundSampleFrame * renderNextBuffer();
365365

366+
void swapBuffers();
367+
368+
void handleMetronome();
369+
366370
void clearInternal();
367371

368372
//! Called by the audio thread to give control to other threads,
@@ -381,13 +385,8 @@ class LMMS_EXPORT Mixer : public QObject
381385
int m_inputBufferRead;
382386
int m_inputBufferWrite;
383387

384-
surroundSampleFrame * m_readBuf;
385-
surroundSampleFrame * m_writeBuf;
386-
387-
QVector<surroundSampleFrame *> m_bufferPool;
388-
int m_readBuffer;
389-
int m_writeBuffer;
390-
int m_poolDepth;
388+
surroundSampleFrame * m_outputBufferRead;
389+
surroundSampleFrame * m_outputBufferWrite;
391390

392391
// worker thread stuff
393392
QVector<MixerWorkerThread *> m_workers;

0 commit comments

Comments
 (0)