Rename Mixer to AudioEngine (#6127)

This commit is contained in:
Alexandre Almeida
2021-09-11 20:00:21 -03:00
committed by GitHub
parent fa407d2530
commit 770d2498b5
157 changed files with 794 additions and 830 deletions

View File

@@ -66,7 +66,7 @@ public:
typedef std::vector<DeviceInfo> DeviceInfoCollection;
public:
AudioAlsa( bool & _success_ful, Mixer* mixer );
AudioAlsa( bool & _success_ful, AudioEngine* audioEngine );
virtual ~AudioAlsa();
inline static QString name()

View File

@@ -1,5 +1,5 @@
/*
* AudioDevice.h - base-class for audio-devices, used by LMMS-mixer
* AudioDevice.h - base-class for audio-devices, used by LMMS audio engine
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -31,15 +31,15 @@
#include "lmms_basics.h"
class AudioEngine;
class AudioPort;
class Mixer;
class QThread;
class AudioDevice
{
public:
AudioDevice( const ch_cnt_t _channels, Mixer* mixer );
AudioDevice( const ch_cnt_t _channels, AudioEngine* audioEngine );
virtual ~AudioDevice();
inline void lock()
@@ -126,9 +126,9 @@ protected:
m_sampleRate = _new_sr;
}
Mixer* mixer()
AudioEngine* audioEngine()
{
return m_mixer;
return m_audioEngine;
}
bool hqAudio() const;
@@ -143,7 +143,7 @@ protected:
private:
sample_rate_t m_sampleRate;
ch_cnt_t m_channels;
Mixer* m_mixer;
AudioEngine* m_audioEngine;
bool m_inProcess;
QMutex m_devMutex;

View File

@@ -27,16 +27,16 @@
#include "AudioDevice.h"
#include "AudioDeviceSetupWidget.h"
#include "AudioEngine.h"
#include "MicroTimer.h"
#include "Mixer.h"
class AudioDummy : public QThread, public AudioDevice
{
Q_OBJECT
public:
AudioDummy( bool & _success_ful, Mixer* mixer ) :
AudioDevice( DEFAULT_CHANNELS, mixer )
AudioDummy( bool & _success_ful, AudioEngine* audioEngine ) :
AudioDevice( DEFAULT_CHANNELS, audioEngine )
{
_success_ful = true;
}
@@ -94,17 +94,17 @@ private:
while( true )
{
timer.reset();
const surroundSampleFrame* b = mixer()->nextBuffer();
const surroundSampleFrame* b = audioEngine()->nextBuffer();
if( !b )
{
break;
}
if( mixer()->hasFifoWriter() )
if( audioEngine()->hasFifoWriter() )
{
delete[] b;
}
const int microseconds = static_cast<int>( mixer()->framesPerPeriod() * 1000000.0f / mixer()->processingSampleRate() - timer.elapsed() );
const int microseconds = static_cast<int>( audioEngine()->framesPerPeriod() * 1000000.0f / audioEngine()->processingSampleRate() - timer.elapsed() );
if( microseconds > 0 )
{
usleep( microseconds );

View File

@@ -1,5 +1,5 @@
/*
* Mixer.h - audio-device-independent mixer for LMMS
* AudioEngine.h - device-independent audio engine for LMMS
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -22,8 +22,8 @@
*
*/
#ifndef MIXER_H
#define MIXER_H
#ifndef AUDIO_ENGINE_H
#define AUDIO_ENGINE_H
#include <QtCore/QMutex>
#include <QtCore/QThread>
@@ -36,7 +36,7 @@
#include "LocklessList.h"
#include "Note.h"
#include "FifoBuffer.h"
#include "MixerProfiler.h"
#include "AudioEngineProfiler.h"
class AudioDevice;
@@ -58,10 +58,10 @@ const float OUTPUT_SAMPLE_MULTIPLIER = 32767.0f;
#include "PlayHandle.h"
class MixerWorkerThread;
class AudioEngineWorkerThread;
class LMMS_EXPORT Mixer : public QObject
class LMMS_EXPORT AudioEngine : public QObject
{
Q_OBJECT
public:
@@ -223,7 +223,7 @@ public:
}
MixerProfiler& profiler()
AudioEngineProfiler& profiler()
{
return m_profiler;
}
@@ -328,25 +328,24 @@ private:
class fifoWriter : public QThread
{
public:
fifoWriter( Mixer * mixer, Fifo * fifo );
fifoWriter( AudioEngine * audioEngine, Fifo * fifo );
void finish();
private:
Mixer * m_mixer;
AudioEngine * m_audioEngine;
Fifo * m_fifo;
volatile bool m_writing;
void run() override;
void write( surroundSampleFrame * buffer );
} ;
Mixer( bool renderOnly );
virtual ~Mixer();
AudioEngine( bool renderOnly );
virtual ~AudioEngine();
void startProcessing(bool needsFifo = true);
void stopProcessing();
@@ -384,7 +383,7 @@ private:
surroundSampleFrame * m_outputBufferWrite;
// worker thread stuff
QVector<MixerWorkerThread *> m_workers;
QVector<AudioEngineWorkerThread *> m_workers;
int m_numWorkers;
// playhandle stuff
@@ -414,7 +413,7 @@ private:
Fifo * m_fifo;
fifoWriter * m_fifoWriter;
MixerProfiler m_profiler;
AudioEngineProfiler m_profiler;
bool m_metronomeActive;
@@ -425,16 +424,14 @@ private:
QMutex m_changesMutex;
QMutex m_doChangesMutex;
QMutex m_waitChangesMutex;
QWaitCondition m_changesMixerCondition;
QWaitCondition m_changesAudioEngineCondition;
QWaitCondition m_changesRequestCondition;
bool m_waitingForWrite;
friend class LmmsCore;
friend class MixerWorkerThread;
friend class AudioEngineWorkerThread;
friend class ProjectRenderer;
} ;
#endif

View File

@@ -1,5 +1,5 @@
/*
* MixerProfiler.h - class for profiling performance of Mixer
* AudioEngineProfiler.h - class for profiling performance of AudioEngine
*
* Copyright (c) 2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -22,19 +22,19 @@
*
*/
#ifndef MIXER_PROFILER_H
#define MIXER_PROFILER_H
#ifndef AUDIO_ENGINE_PROFILER_H
#define AUDIO_ENGINE_PROFILER_H
#include <QFile>
#include "lmms_basics.h"
#include "MicroTimer.h"
class MixerProfiler
class AudioEngineProfiler
{
public:
MixerProfiler();
~MixerProfiler();
AudioEngineProfiler();
~AudioEngineProfiler();
void startPeriod()
{
@@ -55,7 +55,6 @@ private:
MicroTimer m_periodTimer;
int m_cpuLoad;
QFile m_outputFile;
};
#endif

View File

@@ -1,5 +1,5 @@
/*
* MixerWorkerThread.h - declaration of class MixerWorkerThread
* AudioEngineWorkerThread.h - declaration of class AudioEngineWorkerThread
*
* Copyright (c) 2009-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -22,18 +22,18 @@
*
*/
#ifndef MIXER_WORKER_THREAD_H
#define MIXER_WORKER_THREAD_H
#ifndef AUDIO_ENGINE_WORKER_THREAD_H
#define AUDIO_ENGINE_WORKER_THREAD_H
#include <QtCore/QThread>
#include <atomic>
class AudioEngine;
class QWaitCondition;
class Mixer;
class ThreadableJob;
class MixerWorkerThread : public QThread
class AudioEngineWorkerThread : public QThread
{
Q_OBJECT
public:
@@ -69,12 +69,11 @@ public:
std::atomic_int m_writeIndex;
std::atomic_int m_itemsDone;
OperationMode m_opMode;
} ;
MixerWorkerThread( Mixer* mixer );
virtual ~MixerWorkerThread();
AudioEngineWorkerThread( AudioEngine* audioEngine );
virtual ~AudioEngineWorkerThread();
virtual void quit();
@@ -110,10 +109,9 @@ private:
static JobQueue globalJobQueue;
static QWaitCondition * queueReadyWaitCond;
static QList<MixerWorkerThread *> workerThreads;
static QList<AudioEngineWorkerThread *> workerThreads;
volatile bool m_quit;
} ;

View File

@@ -37,7 +37,7 @@ class AudioFileDevice : public AudioDevice
public:
AudioFileDevice(OutputSettings const & outputSettings,
const ch_cnt_t _channels, const QString & _file,
Mixer* mixer );
AudioEngine* audioEngine );
virtual ~AudioFileDevice();
QString outputFile() const
@@ -71,7 +71,7 @@ typedef AudioFileDevice * ( * AudioFileDeviceInstantiaton )
( const QString & outputFilename,
OutputSettings const & outputSettings,
const ch_cnt_t channels,
Mixer* mixer,
AudioEngine* audioEngine,
bool & successful );

View File

@@ -37,7 +37,7 @@ public:
ch_cnt_t const channels,
bool& successful,
QString const& file,
Mixer* mixer
AudioEngine* audioEngine
);
virtual ~AudioFileFlac();
@@ -45,7 +45,7 @@ public:
static AudioFileDevice* getInst(QString const& outputFilename,
OutputSettings const& outputSettings,
ch_cnt_t const channels,
Mixer* mixer,
AudioEngine* audioEngine,
bool& successful)
{
return new AudioFileFlac(
@@ -53,7 +53,7 @@ public:
channels,
successful,
outputFilename,
mixer
audioEngine
);
}

View File

@@ -42,17 +42,17 @@ public:
const ch_cnt_t _channels,
bool & successful,
const QString & _file,
Mixer* mixer );
AudioEngine* audioEngine );
virtual ~AudioFileMP3();
static AudioFileDevice * getInst( const QString & outputFilename,
OutputSettings const & outputSettings,
const ch_cnt_t channels,
Mixer* mixer,
AudioEngine* audioEngine,
bool & successful )
{
return new AudioFileMP3( outputSettings, channels, successful,
outputFilename, mixer );
outputFilename, audioEngine );
}
protected:

View File

@@ -42,17 +42,16 @@ public:
const ch_cnt_t _channels,
bool & _success_ful,
const QString & _file,
Mixer* mixer );
AudioEngine* audioEngine );
virtual ~AudioFileOgg();
static AudioFileDevice * getInst( const QString & outputFilename,
OutputSettings const & outputSettings,
const ch_cnt_t channels,
Mixer* mixer,
AudioEngine* audioEngine,
bool & successful )
{
return new AudioFileOgg( outputSettings, channels, successful,
outputFilename, mixer );
return new AudioFileOgg( outputSettings, channels, successful, outputFilename, audioEngine );
}

View File

@@ -39,17 +39,17 @@ public:
const ch_cnt_t channels,
bool & successful,
const QString & file,
Mixer* mixer );
AudioEngine* audioEngine );
virtual ~AudioFileWave();
static AudioFileDevice * getInst( const QString & outputFilename,
OutputSettings const & outputSettings,
const ch_cnt_t channels,
Mixer* mixer,
AudioEngine* audioEngine,
bool & successful )
{
return new AudioFileWave( outputSettings, channels, successful,
outputFilename, mixer );
outputFilename, audioEngine );
}

View File

@@ -51,7 +51,7 @@ class AudioJack : public QObject, public AudioDevice
{
Q_OBJECT
public:
AudioJack( bool & _success_ful, Mixer* mixer );
AudioJack( bool & _success_ful, AudioEngine* audioEngine );
virtual ~AudioJack();
// this is to allow the jack midi connection to use the same jack client connection

View File

@@ -43,7 +43,7 @@ class AudioOss : public QThread, public AudioDevice
{
Q_OBJECT
public:
AudioOss( bool & _success_ful, Mixer* mixer );
AudioOss( bool & _success_ful, AudioEngine* audioEngine );
virtual ~AudioOss();
inline static QString name()

View File

@@ -129,8 +129,8 @@ private:
FloatModel * m_panningModel;
BoolModel * m_mutedModel;
friend class Mixer;
friend class MixerWorkerThread;
friend class AudioEngine;
friend class AudioEngineWorkerThread;
} ;

View File

@@ -67,7 +67,7 @@ class LcdSpinBox;
class AudioPortAudio : public AudioDevice
{
public:
AudioPortAudio( bool & _success_ful, Mixer* mixer );
AudioPortAudio( bool & _success_ful, AudioEngine* audioEngine );
virtual ~AudioPortAudio();
inline static QString name()

View File

@@ -45,7 +45,7 @@ class AudioPulseAudio : public QThread, public AudioDevice
{
Q_OBJECT
public:
AudioPulseAudio( bool & _success_ful, Mixer* mixer );
AudioPulseAudio( bool & _success_ful, AudioEngine* audioEngine );
virtual ~AudioPulseAudio();
inline static QString name()

View File

@@ -37,8 +37,7 @@ class SampleBuffer;
class AudioSampleRecorder : public AudioDevice
{
public:
AudioSampleRecorder( const ch_cnt_t _channels, bool & _success_ful,
Mixer* mixer );
AudioSampleRecorder( const ch_cnt_t _channels, bool & _success_ful, AudioEngine* audioEngine );
virtual ~AudioSampleRecorder();
f_cnt_t framesRecorded() const;

View File

@@ -46,7 +46,7 @@ class QLineEdit;
class AudioSdl : public AudioDevice
{
public:
AudioSdl( bool & _success_ful, Mixer* mixer );
AudioSdl( bool & _success_ful, AudioEngine* audioEngine );
virtual ~AudioSdl();
inline static QString name()

View File

@@ -44,7 +44,7 @@ class AudioSndio : public QThread, public AudioDevice
{
Q_OBJECT
public:
AudioSndio( bool & _success_ful, Mixer * _mixer );
AudioSndio( bool & _success_ful, AudioEngine * _audioEngine );
virtual ~AudioSndio();
inline static QString name( void )

View File

@@ -56,7 +56,7 @@ public slots:
class AudioSoundIo : public AudioDevice
{
public:
AudioSoundIo( bool & _success_ful, Mixer* mixer );
AudioSoundIo( bool & _success_ful, AudioEngine* audioEngine );
virtual ~AudioSoundIo();
inline static QString name()

View File

@@ -34,7 +34,7 @@ class QString;
#include "lmms_basics.h"
#include "lmms_math.h"
#include "Engine.h"
#include "Mixer.h"
#include "AudioEngine.h"
#define MAXLEN 11
#define MIPMAPSIZE 2 << ( MAXLEN + 1 )
@@ -102,7 +102,7 @@ public:
*/
static inline float freqToLen( float f )
{
return freqToLen( f, Engine::mixer()->processingSampleRate() );
return freqToLen( f, Engine::audioEngine()->processingSampleRate() );
}
/*! \brief This method converts frequency to wavelength, but you can use any custom sample rate with it.

View File

@@ -166,7 +166,7 @@ protected:
signals:
// The value changed while the mixer isn't running (i.e: MIDI CC)
// The value changed while the audio engine isn't running (i.e: MIDI CC)
void valueChanged();
friend class ControllerDialog;

View File

@@ -112,7 +112,7 @@ protected:
static ControllerConnectionVector s_connections;
signals:
// The value changed while the mixer isn't running (i.e: MIDI CC)
// The value changed while the audio engine isn't running (i.e: MIDI CC)
void valueChanged();
friend class ControllerConnectionDialog;

View File

@@ -32,7 +32,7 @@
#include <string.h>
#include "Mixer.h"
#include "AudioEngine.h"
class DummyInstrument : public Instrument
@@ -50,7 +50,7 @@ public:
void playNote( NotePlayHandle *, sampleFrame * buffer ) override
{
memset( buffer, 0, sizeof( sampleFrame ) *
Engine::mixer()->framesPerPeriod() );
Engine::audioEngine()->framesPerPeriod() );
}
void saveSettings( QDomDocument &, QDomElement & ) override

View File

@@ -28,7 +28,7 @@
#include "Plugin.h"
#include "Engine.h"
#include "Mixer.h"
#include "AudioEngine.h"
#include "AutomatableModel.h"
#include "TempoSyncKnobModel.h"
#include "MemoryManager.h"
@@ -103,8 +103,8 @@ public:
inline f_cnt_t timeout() const
{
const float samples = Engine::mixer()->processingSampleRate() * m_autoQuitModel.value() / 1000.0f;
return 1 + ( static_cast<int>( samples ) / Engine::mixer()->framesPerPeriod() );
const float samples = Engine::audioEngine()->processingSampleRate() * m_autoQuitModel.value() / 1000.0f;
return 1 + ( static_cast<int>( samples ) / Engine::audioEngine()->framesPerPeriod() );
}
inline float wetLevel() const
@@ -179,9 +179,9 @@ protected:
sample_rate_t _dst_sr )
{
resample( 0, _src_buf,
Engine::mixer()->processingSampleRate(),
Engine::audioEngine()->processingSampleRate(),
_dst_buf, _dst_sr,
Engine::mixer()->framesPerPeriod() );
Engine::audioEngine()->framesPerPeriod() );
}
inline void sampleBack( const sampleFrame * _src_buf,
@@ -189,9 +189,9 @@ protected:
sample_rate_t _src_sr )
{
resample( 1, _src_buf, _src_sr, _dst_buf,
Engine::mixer()->processingSampleRate(),
Engine::mixer()->framesPerPeriod() * _src_sr /
Engine::mixer()->processingSampleRate() );
Engine::audioEngine()->processingSampleRate(),
Engine::audioEngine()->framesPerPeriod() * _src_sr /
Engine::audioEngine()->processingSampleRate() );
}
void reinitSRC();

View File

@@ -34,10 +34,10 @@
#include "lmms_export.h"
#include "lmms_basics.h"
class AudioEngine;
class BBTrackContainer;
class FxMixer;
class ProjectJournal;
class Mixer;
class Song;
class Ladspa2LMMS;
@@ -62,9 +62,9 @@ public:
static void destroy();
// core
static Mixer *mixer()
static AudioEngine *audioEngine()
{
return s_mixer;
return s_audioEngine;
}
static FxMixer * fxMixer()
@@ -140,7 +140,7 @@ private:
static float s_framesPerTick;
// core
static Mixer *s_mixer;
static AudioEngine *s_audioEngine;
static FxMixer * s_fxMixer;
static Song * s_song;
static BBTrackContainer * s_bbTrackContainer;

View File

@@ -68,7 +68,7 @@ public:
// if the plugin doesn't play each note, it can create an instrument-
// play-handle and re-implement this method, so that it mixes its
// output buffer only once per mixer-period
// output buffer only once per audio engine period
virtual void play( sampleFrame * _working_buffer );
// to be implemented by actual plugin

View File

@@ -37,7 +37,7 @@
#include "Engine.h"
#include "lmms_constants.h"
#include "lmmsconfig.h"
#include "Mixer.h"
#include "AudioEngine.h"
#include "OscillatorConstants.h"
#include "SampleBuffer.h"
@@ -185,7 +185,8 @@ public:
control.f2 = control.f1 < OscillatorConstants::WAVETABLE_LENGTH - 1 ?
control.f1 + 1 :
0;
control.band = waveTableBandFromFreq(m_freq * m_detuning_div_samplerate * Engine::mixer()->processingSampleRate());
control.band = waveTableBandFromFreq(
m_freq * m_detuning_div_samplerate * Engine::audioEngine()->processingSampleRate());
return control;
}

View File

@@ -27,7 +27,7 @@
#include "AudioFileDevice.h"
#include "lmmsconfig.h"
#include "Mixer.h"
#include "AudioEngine.h"
#include "OutputSettings.h"
#include "lmms_export.h"
@@ -56,7 +56,7 @@ public:
} ;
ProjectRenderer( const Mixer::qualitySettings & _qs,
ProjectRenderer( const AudioEngine::qualitySettings & _qs,
const OutputSettings & _os,
ExportFileFormats _file_format,
const QString & _out_file );
@@ -89,7 +89,7 @@ private:
void run() override;
AudioFileDevice * m_fileDev;
Mixer::qualitySettings m_qualitySettings;
AudioEngine::qualitySettings m_qualitySettings;
volatile int m_progress;
volatile bool m_abort;

View File

@@ -37,7 +37,7 @@ class RenderManager : public QObject
Q_OBJECT
public:
RenderManager(
const Mixer::qualitySettings & qualitySettings,
const AudioEngine::qualitySettings & qualitySettings,
const OutputSettings & outputSettings,
ProjectRenderer::ExportFileFormats fmt,
QString outputPath);
@@ -66,8 +66,8 @@ private:
void render( QString outputPath );
const Mixer::qualitySettings m_qualitySettings;
const Mixer::qualitySettings m_oldQualitySettings;
const AudioEngine::qualitySettings m_qualitySettings;
const AudioEngine::qualitySettings m_oldQualitySettings;
const OutputSettings m_outputSettings;
ProjectRenderer::ExportFileFormats m_format;
QString m_outputPath;

View File

@@ -288,7 +288,7 @@ public slots:
void sampleRateChanged();
private:
static sample_rate_t mixerSampleRate();
static sample_rate_t audioEngineSampleRate();
void update(bool keepSettings = false);

View File

@@ -34,11 +34,11 @@
#include <QString>
#include "TrackContainer.h"
#include "AudioEngine.h"
#include "Controller.h"
#include "Keymap.h"
#include "lmms_constants.h"
#include "MeterModel.h"
#include "Mixer.h"
#include "Scale.h"
#include "VstSyncController.h"
@@ -307,7 +307,7 @@ public:
void loadingCancelled()
{
m_isCancelled = true;
Engine::mixer()->clearNewPlayHandles();
Engine::audioEngine()->clearNewPlayHandles();
}
bool isCancelled()