Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixer refactor #4894

Merged
merged 52 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
3c9e370
Fix merge conflicts
M374LX Nov 27, 2020
017c53d
New swapBuffers method
M374LX Mar 13, 2019
aecafdd
Simplify Mixer buffers
M374LX Mar 13, 2019
9df68a5
Handle tempo change in mixer
M374LX Mar 13, 2019
2d01e3e
Swap buffers with std::swap()
M374LX Mar 14, 2019
5a13c79
Replace verbose for by while
M374LX Mar 16, 2019
ac8fc9a
Remove underscore parameter prefixes
M374LX Mar 16, 2019
62d71e5
Fixes
M374LX Nov 27, 2020
52d520a
Use range-based "for" loop
M374LX Nov 27, 2020
7a8cb43
Revert "Handle tempo change in mixer"
M374LX Nov 29, 2020
e3f1dc4
Rename MidiTime to TimePos (fixes)
M374LX Nov 29, 2020
5d9d9ec
Update style on new Mixer methods
M374LX Nov 29, 2020
0d66ef7
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
27fd6d5
Update include/Mixer.h
M374LX Nov 30, 2020
e9d207c
Update include/Mixer.h
M374LX Nov 30, 2020
3b65290
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
a5dd0bc
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
07f9cc5
Update include/Mixer.h
M374LX Nov 30, 2020
07bcd94
Update include/Mixer.h
M374LX Nov 30, 2020
e7425a2
Update include/Mixer.h
M374LX Nov 30, 2020
dbed523
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
ac56d3f
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
9d0c89c
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
7e59f4e
Update include/Mixer.h
M374LX Nov 30, 2020
d5f5ef8
Update include/Mixer.h
M374LX Nov 30, 2020
87ac69c
Update include/Mixer.h
M374LX Nov 30, 2020
4f320a4
Update include/Mixer.h
M374LX Nov 30, 2020
c49809f
Update include/Mixer.h
M374LX Nov 30, 2020
b3c253e
Update include/Mixer.h
M374LX Nov 30, 2020
2f6974d
Update include/Mixer.h
M374LX Nov 30, 2020
783e8fa
Update include/Mixer.h
M374LX Nov 30, 2020
4c6a0aa
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
6b44c44
Update include/Mixer.h
M374LX Nov 30, 2020
675f0f8
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
2372148
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
94eef9f
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
5d800ea
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
310b11a
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
85aad06
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
77f41b7
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
509a8f0
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
a9930a7
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
05e3043
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
7279325
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
dd043c6
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
d8b5b7e
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
b5f478a
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
aa4e433
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
b7dc727
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
4875451
Update src/core/Mixer.cpp
M374LX Nov 30, 2020
72b879a
Use single lines
M374LX Nov 30, 2020
a200ce5
Use static_cast
M374LX Nov 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 25 additions & 26 deletions include/Mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ class LMMS_EXPORT Mixer : public QObject
Interpolation interpolation;
Oversampling oversampling;

qualitySettings( Mode _m )
qualitySettings(Mode m)
{
switch( _m )
switch (m)
{
case Mode_Draft:
interpolation = Interpolation_Linear;
Expand All @@ -118,9 +118,9 @@ class LMMS_EXPORT Mixer : public QObject
}
}

qualitySettings( Interpolation _i, Oversampling _o ) :
interpolation( _i ),
oversampling( _o )
qualitySettings(Interpolation i, Oversampling o) :
interpolation(i),
oversampling(o)
{
}

Expand Down Expand Up @@ -186,14 +186,14 @@ class LMMS_EXPORT Mixer : public QObject


// audio-port-stuff
inline void addAudioPort( AudioPort * _port )
inline void addAudioPort(AudioPort * port)
{
requestChangeInModel();
m_audioPorts.push_back( _port );
m_audioPorts.push_back(port);
doneChangeInModel();
}

void removeAudioPort( AudioPort * _port );
void removeAudioPort(AudioPort * port);


// MIDI-client-stuff
Expand All @@ -218,7 +218,7 @@ class LMMS_EXPORT Mixer : public QObject
return m_playHandles;
}

void removePlayHandlesOfTypes( Track * _track, const quint8 types );
void removePlayHandlesOfTypes(Track * track, const quint8 types);


// methods providing information for other classes
Expand Down Expand Up @@ -255,23 +255,23 @@ class LMMS_EXPORT Mixer : public QObject
return m_masterGain;
}

inline void setMasterGain( const float _mo )
inline void setMasterGain(const float mo)
{
m_masterGain = _mo;
m_masterGain = mo;
}


static inline sample_t clip( const sample_t _s )
static inline sample_t clip(const sample_t s)
{
if( _s > 1.0f )
if (s > 1.0f)
{
return 1.0f;
}
else if( _s < -1.0f )
else if (s < -1.0f)
{
return -1.0f;
}
return _s;
return s;
}


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


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

void changeQuality( const struct qualitySettings & _qs );
void changeQuality(const struct qualitySettings & qs);

inline bool isMetronomeActive() const { return m_metronomeActive; }
inline void setMetronomeActive(bool value = true) { m_metronomeActive = value; }
Expand All @@ -333,7 +333,7 @@ class LMMS_EXPORT Mixer : public QObject
class fifoWriter : public QThread
{
public:
fifoWriter( Mixer * _mixer, fifo * _fifo );
fifoWriter(Mixer * mixer, fifo * _fifo);

void finish();

Expand All @@ -353,7 +353,7 @@ class LMMS_EXPORT Mixer : public QObject
Mixer( bool renderOnly );
virtual ~Mixer();

void startProcessing( bool _needs_fifo = true );
void startProcessing(bool needsFifo = true);
void stopProcessing();


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

const surroundSampleFrame * renderNextBuffer();

void swapBuffers();

void handleMetronome();

void clearInternal();

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

surroundSampleFrame * m_readBuf;
surroundSampleFrame * m_writeBuf;

QVector<surroundSampleFrame *> m_bufferPool;
int m_readBuffer;
int m_writeBuffer;
int m_poolDepth;
surroundSampleFrame * m_outputBufferRead;
surroundSampleFrame * m_outputBufferWrite;

// worker thread stuff
QVector<MixerWorkerThread *> m_workers;
Expand Down
Loading