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()

View File

@@ -117,7 +117,7 @@ bool BassBoosterEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames
inline void BassBoosterEffect::changeFrequency()
{
const sample_t fac = Engine::mixer()->processingSampleRate() / 44100.0f;
const sample_t fac = Engine::audioEngine()->processingSampleRate() / 44100.0f;
m_bbFX.leftFX().setFrequency( m_bbControls.m_freqModel.value() * fac );
m_bbFX.rightFX().setFrequency( m_bbControls.m_freqModel.value() * fac );

View File

@@ -37,7 +37,7 @@ BassBoosterControls::BassBoosterControls( BassBoosterEffect* effect ) :
m_gainModel( 1.0f, 0.1f, 5.0f, 0.05f, this, tr( "Gain" ) ),
m_ratioModel( 2.0f, 0.1f, 10.0f, 0.1f, this, tr( "Ratio" ) )
{
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( changeFrequency() ) );
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( changeFrequency() ) );
}

View File

@@ -55,10 +55,10 @@ Plugin::Descriptor PLUGIN_EXPORT bitcrush_plugin_descriptor =
BitcrushEffect::BitcrushEffect( Model * parent, const Descriptor::SubPluginFeatures::Key * key ) :
Effect( &bitcrush_plugin_descriptor, parent, key ),
m_controls( this ),
m_sampleRate( Engine::mixer()->processingSampleRate() ),
m_sampleRate( Engine::audioEngine()->processingSampleRate() ),
m_filter( m_sampleRate )
{
m_buffer = MM_ALLOC( sampleFrame, Engine::mixer()->framesPerPeriod() * OS_RATE );
m_buffer = MM_ALLOC( sampleFrame, Engine::audioEngine()->framesPerPeriod() * OS_RATE );
m_filter.setLowpass( m_sampleRate * ( CUTOFF_RATIO * OS_RATIO ) );
m_needsUpdate = true;
@@ -79,7 +79,7 @@ BitcrushEffect::~BitcrushEffect()
void BitcrushEffect::sampleRateChanged()
{
m_sampleRate = Engine::mixer()->processingSampleRate();
m_sampleRate = Engine::audioEngine()->processingSampleRate();
m_filter.setSampleRate( m_sampleRate );
m_filter.setLowpass( m_sampleRate * ( CUTOFF_RATIO * OS_RATIO ) );
m_needsUpdate = true;

View File

@@ -47,7 +47,7 @@ BitcrushControls::BitcrushControls( BitcrushEffect * eff ) :
m_rate.setStrictStepSize( true );
m_levels.setStrictStepSize( true );
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( sampleRateChanged() ) );
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( sampleRateChanged() ) );
}
BitcrushControls::~BitcrushControls()

View File

@@ -52,7 +52,7 @@ CompressorEffect::CompressorEffect(Model* parent, const Descriptor::SubPluginFea
Effect(&compressor_plugin_descriptor, parent, key),
m_compressorControls(this)
{
m_sampleRate = Engine::mixer()->processingSampleRate();
m_sampleRate = Engine::audioEngine()->processingSampleRate();
m_yL[0] = m_yL[1] = COMP_NOISE_FLOOR;
@@ -86,7 +86,7 @@ CompressorEffect::CompressorEffect(Model* parent, const Descriptor::SubPluginFea
connect(&m_compressorControls.m_kneeModel, SIGNAL(dataChanged()), this, SLOT(calcAutoMakeup()), Qt::DirectConnection);
connect(&m_compressorControls.m_autoMakeupModel, SIGNAL(dataChanged()), this, SLOT(calcAutoMakeup()), Qt::DirectConnection);
connect(Engine::mixer(), SIGNAL(sampleRateChanged()), this, SLOT(changeSampleRate()));
connect(Engine::audioEngine(), SIGNAL(sampleRateChanged()), this, SLOT(changeSampleRate()));
changeSampleRate();
}
@@ -614,7 +614,7 @@ inline void CompressorEffect::calcTiltFilter(sample_t inputSample, sample_t &out
void CompressorEffect::changeSampleRate()
{
m_sampleRate = Engine::mixer()->processingSampleRate();
m_sampleRate = Engine::audioEngine()->processingSampleRate();
m_coeffPrecalc = COMP_LOG / (m_sampleRate * 0.001f);

View File

@@ -51,7 +51,7 @@ Plugin::Descriptor PLUGIN_EXPORT crossovereq_plugin_descriptor =
CrossoverEQEffect::CrossoverEQEffect( Model* parent, const Descriptor::SubPluginFeatures::Key* key ) :
Effect( &crossovereq_plugin_descriptor, parent, key ),
m_controls( this ),
m_sampleRate( Engine::mixer()->processingSampleRate() ),
m_sampleRate( Engine::audioEngine()->processingSampleRate() ),
m_lp1( m_sampleRate ),
m_lp2( m_sampleRate ),
m_lp3( m_sampleRate ),
@@ -60,9 +60,9 @@ CrossoverEQEffect::CrossoverEQEffect( Model* parent, const Descriptor::SubPlugin
m_hp4( m_sampleRate ),
m_needsUpdate( true )
{
m_tmp1 = MM_ALLOC( sampleFrame, Engine::mixer()->framesPerPeriod() );
m_tmp2 = MM_ALLOC( sampleFrame, Engine::mixer()->framesPerPeriod() );
m_work = MM_ALLOC( sampleFrame, Engine::mixer()->framesPerPeriod() );
m_tmp1 = MM_ALLOC( sampleFrame, Engine::audioEngine()->framesPerPeriod() );
m_tmp2 = MM_ALLOC( sampleFrame, Engine::audioEngine()->framesPerPeriod() );
m_work = MM_ALLOC( sampleFrame, Engine::audioEngine()->framesPerPeriod() );
}
CrossoverEQEffect::~CrossoverEQEffect()
@@ -74,7 +74,7 @@ CrossoverEQEffect::~CrossoverEQEffect()
void CrossoverEQEffect::sampleRateChanged()
{
m_sampleRate = Engine::mixer()->processingSampleRate();
m_sampleRate = Engine::audioEngine()->processingSampleRate();
m_lp1.setSampleRate( m_sampleRate );
m_lp2.setSampleRate( m_sampleRate );
m_lp3.setSampleRate( m_sampleRate );

View File

@@ -42,7 +42,7 @@ CrossoverEQControls::CrossoverEQControls( CrossoverEQEffect * eff ) :
m_mute3( true, this, "Mute Band 3" ),
m_mute4( true, this, "Mute Band 4" )
{
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( sampleRateChanged() ) );
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( sampleRateChanged() ) );
connect( &m_xover12, SIGNAL( dataChanged() ), this, SLOT( xover12Changed() ) );
connect( &m_xover23, SIGNAL( dataChanged() ), this, SLOT( xover23Changed() ) );
connect( &m_xover34, SIGNAL( dataChanged() ), this, SLOT( xover34Changed() ) );

View File

@@ -38,7 +38,7 @@ DelayControls::DelayControls( DelayEffect* effect ):
m_lfoAmountModel(0.0, 0.0, 0.5, 0.0001, 2000.0, this, tr ( "LFO amount" ) ),
m_outGainModel( 0.0, -60.0, 20.0, 0.01, this, tr( "Output gain" ) )
{
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( changeSampleRate() ) );
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( changeSampleRate() ) );
m_outPeakL = 0.0;
m_outPeakR = 0.0;
}

View File

@@ -52,8 +52,8 @@ DelayEffect::DelayEffect( Model* parent, const Plugin::Descriptor::SubPluginFeat
m_delayControls( this )
{
m_delay = 0;
m_delay = new StereoDelay( 20, Engine::mixer()->processingSampleRate() );
m_lfo = new Lfo( Engine::mixer()->processingSampleRate() );
m_delay = new StereoDelay( 20, Engine::audioEngine()->processingSampleRate() );
m_lfo = new Lfo( Engine::audioEngine()->processingSampleRate() );
m_outGain = 1.0;
}
@@ -82,7 +82,7 @@ bool DelayEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
return( false );
}
double outSum = 0.0;
const float sr = Engine::mixer()->processingSampleRate();
const float sr = Engine::audioEngine()->processingSampleRate();
const float d = dryLevel();
const float w = wetLevel();
sample_t dryS[2];
@@ -117,7 +117,7 @@ bool DelayEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
m_delay->setFeedback( *feedbackPtr );
m_lfo->setFrequency( *lfoTimePtr );
sampleLength = *lengthPtr * Engine::mixer()->processingSampleRate();
sampleLength = *lengthPtr * Engine::audioEngine()->processingSampleRate();
m_currentLength = sampleLength;
m_delay->setLength( m_currentLength + ( *amplitudePtr * ( float )m_lfo->tick() ) );
m_delay->tick( buf[f] );
@@ -146,8 +146,8 @@ bool DelayEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
void DelayEffect::changeSampleRate()
{
m_lfo->setSampleRate( Engine::mixer()->processingSampleRate() );
m_delay->setSampleRate( Engine::mixer()->processingSampleRate() );
m_lfo->setSampleRate( Engine::audioEngine()->processingSampleRate() );
m_delay->setSampleRate( Engine::audioEngine()->processingSampleRate() );
}

View File

@@ -53,8 +53,8 @@ DualFilterEffect::DualFilterEffect( Model* parent, const Descriptor::SubPluginFe
Effect( &dualfilter_plugin_descriptor, parent, key ),
m_dfControls( this )
{
m_filter1 = new BasicFilters<2>( Engine::mixer()->processingSampleRate() );
m_filter2 = new BasicFilters<2>( Engine::mixer()->processingSampleRate() );
m_filter1 = new BasicFilters<2>( Engine::audioEngine()->processingSampleRate() );
m_filter2 = new BasicFilters<2>( Engine::audioEngine()->processingSampleRate() );
// ensure filters get updated
m_filter1changed = true;

View File

@@ -97,7 +97,7 @@ DualFilterControls::DualFilterControls( DualFilterEffect* effect ) :
m_filter2Model.addItem( tr( "Fast Formant" ), std::make_unique<PixmapLoader>( "filter_hp" ) );
m_filter2Model.addItem( tr( "Tripole" ), std::make_unique<PixmapLoader>( "filter_lp" ) );
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateFilters() ) );
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( updateFilters() ) );
}
@@ -108,8 +108,8 @@ void DualFilterControls::updateFilters()
delete m_effect->m_filter1;
delete m_effect->m_filter2;
m_effect->m_filter1 = new BasicFilters<2>( Engine::mixer()->processingSampleRate() );
m_effect->m_filter2 = new BasicFilters<2>( Engine::mixer()->processingSampleRate() );
m_effect->m_filter1 = new BasicFilters<2>( Engine::audioEngine()->processingSampleRate() );
m_effect->m_filter2 = new BasicFilters<2>( Engine::audioEngine()->processingSampleRate() );
// flag filters as needing recalculation

View File

@@ -190,7 +190,7 @@ bool EqHandle::mousePressed() const
float EqHandle::getPeakCurve( float x )
{
double freqZ = xPixelToFreq( EqHandle::x(), m_width );
const int SR = Engine::mixer()->processingSampleRate();
const int SR = Engine::audioEngine()->processingSampleRate();
double w0 = 2 * LD_PI * freqZ / SR ;
double c = cosf( w0 );
double s = sinf( w0 );
@@ -228,7 +228,7 @@ float EqHandle::getPeakCurve( float x )
float EqHandle::getHighShelfCurve( float x )
{
double freqZ = xPixelToFreq( EqHandle::x(), m_width );
const int SR = Engine::mixer()->processingSampleRate();
const int SR = Engine::audioEngine()->processingSampleRate();
double w0 = 2 * LD_PI * freqZ / SR;
double c = cosf( w0 );
double s = sinf( w0 );
@@ -264,7 +264,7 @@ float EqHandle::getHighShelfCurve( float x )
float EqHandle::getLowShelfCurve( float x )
{
double freqZ = xPixelToFreq( EqHandle::x(), m_width );
const int SR = Engine::mixer()->processingSampleRate();
const int SR = Engine::audioEngine()->processingSampleRate();
double w0 = 2 * LD_PI * freqZ / SR ;
double c = cosf( w0 );
double s = sinf( w0 );
@@ -301,7 +301,7 @@ float EqHandle::getLowShelfCurve( float x )
float EqHandle::getLowCutCurve( float x )
{
double freqZ = xPixelToFreq( EqHandle::x(), m_width );
const int SR = Engine::mixer()->processingSampleRate();
const int SR = Engine::audioEngine()->processingSampleRate();
double w0 = 2 * LD_PI * freqZ / SR ;
double c = cosf( w0 );
double s = sinf( w0 );
@@ -345,7 +345,7 @@ float EqHandle::getLowCutCurve( float x )
float EqHandle::getHighCutCurve( float x )
{
double freqZ = xPixelToFreq( EqHandle::x(), m_width );
const int SR = Engine::mixer()->processingSampleRate();
const int SR = Engine::audioEngine()->processingSampleRate();
double w0 = 2 * LD_PI * freqZ / SR ;
double c = cosf( w0 );
double s = sinf( w0 );
@@ -520,7 +520,7 @@ void EqHandle::setlp48()
double EqHandle::calculateGain(const double freq, const double a1, const double a2, const double b0, const double b1, const double b2 )
{
const int SR = Engine::mixer()->processingSampleRate();
const int SR = Engine::audioEngine()->processingSampleRate();
const double w = 2 * LD_PI * freq / SR ;
const double PHI = pow( sin( w / 2 ), 2 ) * 4;

View File

@@ -71,7 +71,7 @@ EqEffect::~EqEffect()
bool EqEffect::processAudioBuffer( sampleFrame *buf, const fpp_t frames )
{
const int sampleRate = Engine::mixer()->processingSampleRate();
const int sampleRate = Engine::audioEngine()->processingSampleRate();
//wet/dry controls
const float dry = dryLevel();

View File

@@ -22,11 +22,11 @@
#include "EqSpectrumView.h"
#include "AudioEngine.h"
#include "Engine.h"
#include "EqCurve.h"
#include "GuiApplication.h"
#include "MainWindow.h"
#include "Mixer.h"
EqAnalyser::EqAnalyser() :
m_framesFilledUp ( 0 ),
@@ -93,7 +93,7 @@ void EqAnalyser::analyze( sampleFrame *buf, const fpp_t frames )
return;
}
m_sampleRate = Engine::mixer()->processingSampleRate();
m_sampleRate = Engine::audioEngine()->processingSampleRate();
const int LOWEST_FREQ = 0;
const int HIGHEST_FREQ = m_sampleRate / 2;

View File

@@ -43,7 +43,7 @@ FlangerControls::FlangerControls( FlangerEffect *effect ) :
m_invertFeedbackModel ( false, this, tr( "Invert" ) )
{
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( changedSampleRate() ) );
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( changedSampleRate() ) );
connect( Engine::getSong(), SIGNAL( playbackStateChanged() ), this, SLOT( changedPlaybackState() ) );
}

View File

@@ -51,9 +51,9 @@ FlangerEffect::FlangerEffect( Model *parent, const Plugin::Descriptor::SubPlugin
Effect( &flanger_plugin_descriptor, parent, key ),
m_flangerControls( this )
{
m_lfo = new QuadratureLfo( Engine::mixer()->processingSampleRate() );
m_lDelay = new MonoDelay( 1, Engine::mixer()->processingSampleRate() );
m_rDelay = new MonoDelay( 1, Engine::mixer()->processingSampleRate() );
m_lfo = new QuadratureLfo( Engine::audioEngine()->processingSampleRate() );
m_lDelay = new MonoDelay( 1, Engine::audioEngine()->processingSampleRate() );
m_rDelay = new MonoDelay( 1, Engine::audioEngine()->processingSampleRate() );
m_noise = new Noise;
}
@@ -92,9 +92,9 @@ bool FlangerEffect::processAudioBuffer( sampleFrame *buf, const fpp_t frames )
double outSum = 0.0;
const float d = dryLevel();
const float w = wetLevel();
const float length = m_flangerControls.m_delayTimeModel.value() * Engine::mixer()->processingSampleRate();
const float length = m_flangerControls.m_delayTimeModel.value() * Engine::audioEngine()->processingSampleRate();
const float noise = m_flangerControls.m_whiteNoiseAmountModel.value();
float amplitude = m_flangerControls.m_lfoAmountModel.value() * Engine::mixer()->processingSampleRate();
float amplitude = m_flangerControls.m_lfoAmountModel.value() * Engine::audioEngine()->processingSampleRate();
bool invertFeedback = m_flangerControls.m_invertFeedbackModel.value();
m_lfo->setFrequency( 1.0/m_flangerControls.m_lfoFrequencyModel.value() );
m_lfo->setOffset( m_flangerControls.m_lfoPhaseModel.value() / 180 * D_PI );
@@ -135,9 +135,9 @@ bool FlangerEffect::processAudioBuffer( sampleFrame *buf, const fpp_t frames )
void FlangerEffect::changeSampleRate()
{
m_lfo->setSampleRate( Engine::mixer()->processingSampleRate() );
m_lDelay->setSampleRate( Engine::mixer()->processingSampleRate() );
m_rDelay->setSampleRate( Engine::mixer()->processingSampleRate() );
m_lfo->setSampleRate( Engine::audioEngine()->processingSampleRate() );
m_lDelay->setSampleRate( Engine::audioEngine()->processingSampleRate() );
m_rDelay->setSampleRate( Engine::audioEngine()->processingSampleRate() );
}

View File

@@ -33,7 +33,7 @@
#include "base64.h"
#include "InstrumentTrack.h"
#include "Knob.h"
#include "Mixer.h"
#include "AudioEngine.h"
#include "NotePlayHandle.h"
#include "PixmapButton.h"
#include "ToolTip.h"
@@ -224,7 +224,7 @@ QString FreeBoyInstrument::nodeName() const
/*f_cnt_t FreeBoyInstrument::desiredReleaseFrames() const
{
const float samplerate = Engine::mixer()->processingSampleRate();
const float samplerate = Engine::audioEngine()->processingSampleRate();
int maxrel = 0;
for( int i = 0 ; i < 3 ; ++i )
{
@@ -246,7 +246,7 @@ void FreeBoyInstrument::playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer )
{
const f_cnt_t tfp = _n->totalFramesPlayed();
const int samplerate = Engine::mixer()->processingSampleRate();
const int samplerate = Engine::audioEngine()->processingSampleRate();
const fpp_t frames = _n->framesLeftForCurrentPeriod();
const f_cnt_t offset = _n->noteOffset();

View File

@@ -36,6 +36,7 @@
#include <QLabel>
#include <QDomDocument>
#include "AudioEngine.h"
#include "ConfigManager.h"
#include "endian_handling.h"
#include "Engine.h"
@@ -43,7 +44,6 @@
#include "InstrumentTrack.h"
#include "InstrumentPlayHandle.h"
#include "Knob.h"
#include "Mixer.h"
#include "NotePlayHandle.h"
#include "PathUtil.h"
#include "SampleBuffer.h"
@@ -90,13 +90,13 @@ GigInstrument::GigInstrument( InstrumentTrack * _instrument_track ) :
m_currentKeyDimension( 0 )
{
InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, _instrument_track );
Engine::mixer()->addPlayHandle( iph );
Engine::audioEngine()->addPlayHandle( iph );
updateSampleRate();
connect( &m_bankNum, SIGNAL( dataChanged() ), this, SLOT( updatePatch() ) );
connect( &m_patchNum, SIGNAL( dataChanged() ), this, SLOT( updatePatch() ) );
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSampleRate() ) );
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSampleRate() ) );
}
@@ -104,7 +104,7 @@ GigInstrument::GigInstrument( InstrumentTrack * _instrument_track ) :
GigInstrument::~GigInstrument()
{
Engine::mixer()->removePlayHandlesOfTypes( instrumentTrack(),
Engine::audioEngine()->removePlayHandlesOfTypes( instrumentTrack(),
PlayHandle::TypeNotePlayHandle
| PlayHandle::TypeInstrumentPlayHandle );
freeInstance();
@@ -321,8 +321,8 @@ void GigInstrument::playNote( NotePlayHandle * _n, sampleFrame * )
// the preferences)
void GigInstrument::play( sampleFrame * _working_buffer )
{
const fpp_t frames = Engine::mixer()->framesPerPeriod();
const int rate = Engine::mixer()->processingSampleRate();
const fpp_t frames = Engine::audioEngine()->framesPerPeriod();
const int rate = Engine::audioEngine()->processingSampleRate();
// Initialize to zeros
std::memset( &_working_buffer[0][0], 0, DEFAULT_CHANNELS * frames * sizeof( float ) );
@@ -758,7 +758,7 @@ void GigInstrument::addSamples( GigNote & gignote, bool wantReleaseSample )
if( gignote.midiNote >= keyLow && gignote.midiNote <= keyHigh )
{
float attenuation = pDimRegion->GetVelocityAttenuation( gignote.velocity );
float length = (float) pSample->SamplesTotal / Engine::mixer()->processingSampleRate();
float length = (float) pSample->SamplesTotal / Engine::audioEngine()->processingSampleRate();
// TODO: sample panning? crossfade different layers?

View File

@@ -30,11 +30,11 @@
#include "LadspaEffect.h"
#include "DataFile.h"
#include "AudioDevice.h"
#include "AudioEngine.h"
#include "ConfigManager.h"
#include "Ladspa2LMMS.h"
#include "LadspaControl.h"
#include "LadspaSubPluginFeatures.h"
#include "Mixer.h"
#include "EffectChain.h"
#include "AutomationPattern.h"
#include "ControllerConnection.h"
@@ -87,7 +87,7 @@ LadspaEffect::LadspaEffect( Model * _parent,
pluginInstantiation();
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ),
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ),
this, SLOT( changeSampleRate() ) );
}
@@ -142,13 +142,13 @@ bool LadspaEffect::processAudioBuffer( sampleFrame * _buf,
sampleFrame * o_buf = NULL;
QVarLengthArray<sample_t> sBuf(_frames * DEFAULT_CHANNELS);
if( m_maxSampleRate < Engine::mixer()->processingSampleRate() )
if( m_maxSampleRate < Engine::audioEngine()->processingSampleRate() )
{
o_buf = _buf;
_buf = reinterpret_cast<sampleFrame*>(sBuf.data());
sampleDown( o_buf, _buf, m_maxSampleRate );
frames = _frames * m_maxSampleRate /
Engine::mixer()->processingSampleRate();
Engine::audioEngine()->processingSampleRate();
}
// Copy the LMMS audio buffer to the LADSPA input buffer and initialize
@@ -289,7 +289,7 @@ void LadspaEffect::pluginInstantiation()
Ladspa2LMMS * manager = Engine::getLADSPAManager();
// Calculate how many processing units are needed.
const ch_cnt_t lmms_chnls = Engine::mixer()->audioDev()->channels();
const ch_cnt_t lmms_chnls = Engine::audioEngine()->audioDev()->channels();
int effect_channels = manager->getDescription( m_key )->inputChannels;
setProcessorCount( lmms_chnls / effect_channels );
@@ -324,7 +324,7 @@ void LadspaEffect::pluginInstantiation()
manager->isPortInput( m_key, port ) )
{
p->rate = CHANNEL_IN;
p->buffer = MM_ALLOC( LADSPA_Data, Engine::mixer()->framesPerPeriod() );
p->buffer = MM_ALLOC( LADSPA_Data, Engine::audioEngine()->framesPerPeriod() );
inbuf[ inputch ] = p->buffer;
inputch++;
}
@@ -339,19 +339,19 @@ void LadspaEffect::pluginInstantiation()
}
else
{
p->buffer = MM_ALLOC( LADSPA_Data, Engine::mixer()->framesPerPeriod() );
p->buffer = MM_ALLOC( LADSPA_Data, Engine::audioEngine()->framesPerPeriod() );
m_inPlaceBroken = true;
}
}
else if( manager->isPortInput( m_key, port ) )
{
p->rate = AUDIO_RATE_INPUT;
p->buffer = MM_ALLOC( LADSPA_Data, Engine::mixer()->framesPerPeriod() );
p->buffer = MM_ALLOC( LADSPA_Data, Engine::audioEngine()->framesPerPeriod() );
}
else
{
p->rate = AUDIO_RATE_OUTPUT;
p->buffer = MM_ALLOC( LADSPA_Data, Engine::mixer()->framesPerPeriod() );
p->buffer = MM_ALLOC( LADSPA_Data, Engine::audioEngine()->framesPerPeriod() );
}
}
else
@@ -586,7 +586,7 @@ sample_rate_t LadspaEffect::maxSamplerate( const QString & _name )
{
return( __buggy_plugins[_name] );
}
return( Engine::mixer()->processingSampleRate() );
return( Engine::audioEngine()->processingSampleRate() );
}

View File

@@ -30,10 +30,10 @@
#include "LadspaSubPluginFeatures.h"
#include "AudioDevice.h"
#include "AudioEngine.h"
#include "Engine.h"
#include "Ladspa2LMMS.h"
#include "LadspaBase.h"
#include "Mixer.h"
LadspaSubPluginFeatures::LadspaSubPluginFeatures( Plugin::PluginTypes _type ) :
@@ -154,8 +154,7 @@ void LadspaSubPluginFeatures::listSubPluginKeys(
for( l_sortable_plugin_t::const_iterator it = plugins.begin();
it != plugins.end(); ++it )
{
if( lm->getDescription( ( *it ).second )->inputChannels <=
Engine::mixer()->audioDev()->channels() )
if( lm->getDescription( ( *it ).second )->inputChannels <= Engine::audioEngine()->audioDev()->channels() )
{
_kl.push_back( ladspaKeyToSubPluginKey( _desc, ( *it ).first, ( *it ).second ) );
}

View File

@@ -60,7 +60,7 @@ Plugin::Descriptor PLUGIN_EXPORT lv2effect_plugin_descriptor =
Lv2Effect::Lv2Effect(Model* parent, const Descriptor::SubPluginFeatures::Key *key) :
Effect(&lv2effect_plugin_descriptor, parent, key),
m_controls(this, key->attributes["uri"]),
m_tmpOutputSmps(Engine::mixer()->framesPerPeriod())
m_tmpOutputSmps(Engine::audioEngine()->framesPerPeriod())
{
}

View File

@@ -40,7 +40,7 @@ Lv2FxControls::Lv2FxControls(class Lv2Effect *effect, const QString& uri) :
{
if (isValid())
{
connect(Engine::mixer(), &Mixer::sampleRateChanged,
connect(Engine::audioEngine(), &AudioEngine::sampleRateChanged,
this, [this](){Lv2ControlBase::reloadPlugin();});
}
}

View File

@@ -27,11 +27,11 @@
#include <QDebug>
#include <QDragEnterEvent>
#include "AudioEngine.h"
#include "Engine.h"
#include "InstrumentPlayHandle.h"
#include "InstrumentTrack.h"
#include "Lv2SubPluginFeatures.h"
#include "Mixer.h"
#include "StringPairDrag.h"
#include "Clipboard.h"
@@ -80,13 +80,13 @@ Lv2Instrument::Lv2Instrument(InstrumentTrack *instrumentTrackArg,
#endif
connect(instrumentTrack()->pitchRangeModel(), SIGNAL(dataChanged()),
this, SLOT(updatePitchRange()), Qt::DirectConnection);
connect(Engine::mixer(), &Mixer::sampleRateChanged,
connect(Engine::audioEngine(), &AudioEngine::sampleRateChanged,
this, [this](){Lv2ControlBase::reloadPlugin();});
// now we need a play-handle which cares for calling play()
InstrumentPlayHandle *iph =
new InstrumentPlayHandle(this, instrumentTrackArg);
Engine::mixer()->addPlayHandle(iph);
Engine::audioEngine()->addPlayHandle(iph);
}
}
@@ -95,9 +95,8 @@ Lv2Instrument::Lv2Instrument(InstrumentTrack *instrumentTrackArg,
Lv2Instrument::~Lv2Instrument()
{
Engine::mixer()->removePlayHandlesOfTypes(instrumentTrack(),
PlayHandle::TypeNotePlayHandle |
PlayHandle::TypeInstrumentPlayHandle);
Engine::audioEngine()->removePlayHandlesOfTypes(instrumentTrack(),
PlayHandle::TypeNotePlayHandle | PlayHandle::TypeInstrumentPlayHandle);
}
@@ -160,7 +159,7 @@ void Lv2Instrument::play(sampleFrame *buf)
{
copyModelsFromLmms();
fpp_t fpp = Engine::mixer()->framesPerPeriod();
fpp_t fpp = Engine::audioEngine()->framesPerPeriod();
run(fpp);

View File

@@ -51,10 +51,10 @@ MultitapEchoEffect::MultitapEchoEffect( Model* parent, const Descriptor::SubPlug
m_stages( 1 ),
m_controls( this ),
m_buffer( 16100.0f ),
m_sampleRate( Engine::mixer()->processingSampleRate() ),
m_sampleRate( Engine::audioEngine()->processingSampleRate() ),
m_sampleRatio( 1.0f / m_sampleRate )
{
m_work = MM_ALLOC( sampleFrame, Engine::mixer()->framesPerPeriod() );
m_work = MM_ALLOC( sampleFrame, Engine::audioEngine()->framesPerPeriod() );
m_buffer.reset();
m_stages = static_cast<int>( m_controls.m_stages.value() );
updateFilters( 0, 19 );

View File

@@ -48,7 +48,7 @@ MultitapEchoControls::MultitapEchoControls( MultitapEchoEffect * eff ) :
connect( &m_lpGraph, SIGNAL( samplesChanged( int, int ) ), this, SLOT( lpSamplesChanged( int, int ) ) );
connect( &m_steps, SIGNAL( dataChanged() ), this, SLOT( lengthChanged() ) );
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( sampleRateChanged() ) );
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( sampleRateChanged() ) );
setDefaultAmpShape();
setDefaultLpShape();
@@ -174,7 +174,7 @@ void MultitapEchoControls::lengthChanged()
void MultitapEchoControls::sampleRateChanged()
{
m_effect->m_sampleRate = Engine::mixer()->processingSampleRate();
m_effect->m_sampleRate = Engine::audioEngine()->processingSampleRate();
m_effect->m_sampleRatio = 1.0f / m_effect->m_sampleRate;
m_effect->updateFilters( 0, 19 );
}

View File

@@ -35,10 +35,10 @@
#include "OpulenZ.h"
#include "Instrument.h"
#include "AudioEngine.h"
#include "Engine.h"
#include "InstrumentPlayHandle.h"
#include "InstrumentTrack.h"
#include "Mixer.h"
#include <QDomDocument>
#include <QFile>
@@ -139,7 +139,7 @@ OpulenzInstrument::OpulenzInstrument( InstrumentTrack * _instrument_track ) :
// Create an emulator - samplerate, 16 bit, mono
emulatorMutex.lock();
theEmulator = new CTemuopl(Engine::mixer()->processingSampleRate(), true, false);
theEmulator = new CTemuopl(Engine::audioEngine()->processingSampleRate(), true, false);
theEmulator->init();
// Enable waveform selection
theEmulator->write(0x01,0x20);
@@ -158,7 +158,7 @@ OpulenzInstrument::OpulenzInstrument( InstrumentTrack * _instrument_track ) :
updatePatch();
// Can the buffer size change suddenly? I bet that would break lots of stuff
frameCount = Engine::mixer()->framesPerPeriod();
frameCount = Engine::audioEngine()->framesPerPeriod();
renderbuffer = new short[frameCount];
// Some kind of sane defaults
@@ -168,7 +168,7 @@ OpulenzInstrument::OpulenzInstrument( InstrumentTrack * _instrument_track ) :
tuneEqual(69, 440);
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ),
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ),
this, SLOT( reloadEmulator() ) );
// Connect knobs
// This one's for testing...
@@ -213,14 +213,14 @@ OpulenzInstrument::OpulenzInstrument( InstrumentTrack * _instrument_track ) :
MOD_CON( vib_depth_mdl );
MOD_CON( trem_depth_mdl );
// Connect the plugin to the mixer...
// Connect the plugin to the audio engine...
InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, _instrument_track );
Engine::mixer()->addPlayHandle( iph );
Engine::audioEngine()->addPlayHandle( iph );
}
OpulenzInstrument::~OpulenzInstrument() {
delete theEmulator;
Engine::mixer()->removePlayHandlesOfTypes( instrumentTrack(),
Engine::audioEngine()->removePlayHandlesOfTypes( instrumentTrack(),
PlayHandle::TypeNotePlayHandle
| PlayHandle::TypeInstrumentPlayHandle );
delete [] renderbuffer;
@@ -230,7 +230,7 @@ OpulenzInstrument::~OpulenzInstrument() {
void OpulenzInstrument::reloadEmulator() {
delete theEmulator;
emulatorMutex.lock();
theEmulator = new CTemuopl(Engine::mixer()->processingSampleRate(), true, false);
theEmulator = new CTemuopl(Engine::audioEngine()->processingSampleRate(), true, false);
theEmulator->init();
theEmulator->write(0x01,0x20);
emulatorMutex.unlock();

View File

@@ -51,7 +51,7 @@ ReverbSCEffect::ReverbSCEffect( Model* parent, const Descriptor::SubPluginFeatur
m_reverbSCControls( this )
{
sp_create(&sp);
sp->sr = Engine::mixer()->processingSampleRate();
sp->sr = Engine::audioEngine()->processingSampleRate();
sp_revsc_create(&revsc);
sp_revsc_init(sp, revsc);
@@ -59,8 +59,8 @@ ReverbSCEffect::ReverbSCEffect( Model* parent, const Descriptor::SubPluginFeatur
sp_dcblock_create(&dcblk[0]);
sp_dcblock_create(&dcblk[1]);
sp_dcblock_init(sp, dcblk[0], Engine::mixer()->currentQualitySettings().sampleRateMultiplier() );
sp_dcblock_init(sp, dcblk[1], Engine::mixer()->currentQualitySettings().sampleRateMultiplier() );
sp_dcblock_init(sp, dcblk[0], Engine::audioEngine()->currentQualitySettings().sampleRateMultiplier() );
sp_dcblock_init(sp, dcblk[1], Engine::audioEngine()->currentQualitySettings().sampleRateMultiplier() );
}
ReverbSCEffect::~ReverbSCEffect()
@@ -130,7 +130,7 @@ bool ReverbSCEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
void ReverbSCEffect::changeSampleRate()
{
// Change sr variable in Soundpipe. does not need to be destroyed
sp->sr = Engine::mixer()->processingSampleRate();
sp->sr = Engine::audioEngine()->processingSampleRate();
mutex.lock();
sp_revsc_destroy(&revsc);
@@ -143,8 +143,8 @@ void ReverbSCEffect::changeSampleRate()
sp_dcblock_create(&dcblk[0]);
sp_dcblock_create(&dcblk[1]);
sp_dcblock_init(sp, dcblk[0], Engine::mixer()->currentQualitySettings().sampleRateMultiplier() );
sp_dcblock_init(sp, dcblk[1], Engine::mixer()->currentQualitySettings().sampleRateMultiplier() );
sp_dcblock_init(sp, dcblk[0], Engine::audioEngine()->currentQualitySettings().sampleRateMultiplier() );
sp_dcblock_init(sp, dcblk[1], Engine::audioEngine()->currentQualitySettings().sampleRateMultiplier() );
mutex.unlock();
}

View File

@@ -38,7 +38,7 @@ ReverbSCControls::ReverbSCControls( ReverbSCEffect* effect ) :
m_colorModel( 10000.0f, 100.0f, 15000.0f, 0.1f, this, tr( "Color" ) ),
m_outputGainModel( 0.0f, -60.0f, 15, 0.1f, this, tr( "Output gain" ) )
{
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( changeSampleRate() ));
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( changeSampleRate() ));
}
void ReverbSCControls::changeControl()

View File

@@ -33,10 +33,10 @@
#include "sid.h"
#include "SidInstrument.h"
#include "AudioEngine.h"
#include "Engine.h"
#include "InstrumentTrack.h"
#include "Knob.h"
#include "Mixer.h"
#include "NotePlayHandle.h"
#include "PixmapButton.h"
#include "ToolTip.h"
@@ -233,7 +233,7 @@ QString SidInstrument::nodeName() const
f_cnt_t SidInstrument::desiredReleaseFrames() const
{
const float samplerate = Engine::mixer()->processingSampleRate();
const float samplerate = Engine::audioEngine()->processingSampleRate();
int maxrel = 0;
for( int i = 0 ; i < 3 ; ++i )
{
@@ -308,7 +308,7 @@ void SidInstrument::playNote( NotePlayHandle * _n,
const f_cnt_t tfp = _n->totalFramesPlayed();
const int clockrate = C64_PAL_CYCLES_PER_SEC;
const int samplerate = Engine::mixer()->processingSampleRate();
const int samplerate = Engine::audioEngine()->processingSampleRate();
if ( tfp == 0 )
{

View File

@@ -45,7 +45,7 @@ SaProcessor::SaProcessor(const SaControls *controls) :
m_terminate(false),
m_inBlockSize(FFT_BLOCK_SIZES[0]),
m_fftBlockSize(FFT_BLOCK_SIZES[0]),
m_sampleRate(Engine::mixer()->processingSampleRate()),
m_sampleRate(Engine::audioEngine()->processingSampleRate()),
m_framesFilledUp(0),
m_spectrumActive(false),
m_waterfallActive(false),
@@ -158,7 +158,7 @@ void SaProcessor::analyze(LocklessRingBuffer<sampleFrame> &ring_buffer)
#endif
// update sample rate
m_sampleRate = Engine::mixer()->processingSampleRate();
m_sampleRate = Engine::audioEngine()->processingSampleRate();
// apply FFT window
for (unsigned int i = 0; i < m_inBlockSize; i++)

View File

@@ -26,6 +26,7 @@
#include <QDomElement>
#include "AudioEngine.h"
#include "Engine.h"
#include "Graph.h"
#include "GuiApplication.h"
@@ -33,7 +34,6 @@
#include "Knob.h"
#include "LedCheckbox.h"
#include "MainWindow.h"
#include "Mixer.h"
#include "NotePlayHandle.h"
#include "Oscillator.h"
#include "PixmapButton.h"
@@ -204,14 +204,14 @@ void Xpressive::playNote(NotePlayHandle* nph, sampleFrame* working_buffer) {
if (nph->totalFramesPlayed() == 0 || nph->m_pluginData == NULL) {
ExprFront *exprO1 = new ExprFront(m_outputExpression[0].constData(),Engine::mixer()->processingSampleRate());//give the "last" function a whole second
ExprFront *exprO2 = new ExprFront(m_outputExpression[1].constData(),Engine::mixer()->processingSampleRate());
ExprFront *exprO1 = new ExprFront(m_outputExpression[0].constData(),Engine::audioEngine()->processingSampleRate());//give the "last" function a whole second
ExprFront *exprO2 = new ExprFront(m_outputExpression[1].constData(),Engine::audioEngine()->processingSampleRate());
auto init_expression_step1 = [this, nph](ExprFront* e) { //lambda function to init exprO1 and exprO2
//add the constants and the variables to the expression.
e->add_constant("key", nph->key());//the key that was pressed.
e->add_constant("bnote", nph->instrumentTrack()->baseNote()); // the base note
e->add_constant("srate", Engine::mixer()->processingSampleRate());// sample rate of the mixer
e->add_constant("srate", Engine::audioEngine()->processingSampleRate());// sample rate of the audio engine
e->add_constant("v", nph->getVolume() / 255.0); //volume of the note.
e->add_constant("tempo", Engine::getSong()->getTempo());//tempo of the song.
e->add_variable("A1", m_A1);//A1,A2,A3: general purpose input controls.
@@ -225,7 +225,7 @@ void Xpressive::playNote(NotePlayHandle* nph, sampleFrame* working_buffer) {
m_W2.setInterpolate(m_interpolateW2.value());
m_W3.setInterpolate(m_interpolateW3.value());
nph->m_pluginData = new ExprSynth(&m_W1, &m_W2, &m_W3, exprO1, exprO2, nph,
Engine::mixer()->processingSampleRate(), &m_panning1, &m_panning2, m_relTransition.value());
Engine::audioEngine()->processingSampleRate(), &m_panning1, &m_panning2, m_relTransition.value());
}

View File

@@ -32,13 +32,13 @@
#include <samplerate.h>
#include "AudioEngine.h"
#include "ConfigManager.h"
#include "DataFile.h"
#include "Engine.h"
#include "gui_templates.h"
#include "InstrumentTrack.h"
#include "interpolation.h"
#include "Mixer.h"
#include "NotePlayHandle.h"
#include "PathUtil.h"
#include "Song.h"
@@ -305,7 +305,7 @@ int audioFileProcessor::getBeatLen( NotePlayHandle * _n ) const
{
const auto baseFreq = instrumentTrack()->baseFreq();
const float freq_factor = baseFreq / _n->frequency() *
Engine::mixer()->processingSampleRate() / Engine::mixer()->baseSampleRate();
Engine::audioEngine()->processingSampleRate() / Engine::audioEngine()->baseSampleRate();
return static_cast<int>( floorf( ( m_sampleBuffer.endFrame() - m_sampleBuffer.startFrame() ) * freq_factor ) );
}

View File

@@ -26,13 +26,13 @@
#include <QDomElement>
#include "bit_invader.h"
#include "AudioEngine.h"
#include "base64.h"
#include "Engine.h"
#include "Graph.h"
#include "InstrumentTrack.h"
#include "Knob.h"
#include "LedCheckbox.h"
#include "Mixer.h"
#include "NotePlayHandle.h"
#include "Oscillator.h"
#include "PixmapButton.h"
@@ -295,7 +295,7 @@ void bitInvader::playNote( NotePlayHandle * _n,
const_cast<float*>( m_graph.samples() ),
_n,
m_interpolation.value(), factor,
Engine::mixer()->processingSampleRate() );
Engine::audioEngine()->processingSampleRate() );
}
const fpp_t frames = _n->framesLeftForCurrentPeriod();

View File

@@ -24,6 +24,7 @@
#include "carla.h"
#include "AudioEngine.h"
#include "Engine.h"
#include "Song.h"
#include "GuiApplication.h"
@@ -31,7 +32,6 @@
#include "InstrumentTrack.h"
#include "MidiEventToByteSeq.h"
#include "MainWindow.h"
#include "Mixer.h"
#include "Song.h"
#include "gui_templates.h"
@@ -189,7 +189,7 @@ CarlaInstrument::CarlaInstrument(InstrumentTrack* const instrumentTrack, const D
// we need a play-handle which cares for calling play()
InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, instrumentTrack );
Engine::mixer()->addPlayHandle( iph );
Engine::audioEngine()->addPlayHandle( iph );
#if CARLA_VERSION_HEX >= CARLA_MIN_PARAM_VERSION
// text filter completion
@@ -209,12 +209,12 @@ CarlaInstrument::CarlaInstrument(InstrumentTrack* const instrumentTrack, const D
}
#endif
connect(Engine::mixer(), SIGNAL(sampleRateChanged()), this, SLOT(sampleRateChanged()));
connect(Engine::audioEngine(), SIGNAL(sampleRateChanged()), this, SLOT(sampleRateChanged()));
}
CarlaInstrument::~CarlaInstrument()
{
Engine::mixer()->removePlayHandlesOfTypes(instrumentTrack(), PlayHandle::TypeNotePlayHandle | PlayHandle::TypeInstrumentPlayHandle);
Engine::audioEngine()->removePlayHandlesOfTypes(instrumentTrack(), PlayHandle::TypeNotePlayHandle | PlayHandle::TypeInstrumentPlayHandle);
if (fHost.resourceDir != NULL)
{
@@ -248,12 +248,12 @@ CarlaInstrument::~CarlaInstrument()
uint32_t CarlaInstrument::handleGetBufferSize() const
{
return Engine::mixer()->framesPerPeriod();
return Engine::audioEngine()->framesPerPeriod();
}
double CarlaInstrument::handleGetSampleRate() const
{
return Engine::mixer()->processingSampleRate();
return Engine::audioEngine()->processingSampleRate();
}
bool CarlaInstrument::handleIsOffline() const
@@ -496,7 +496,7 @@ void CarlaInstrument::loadSettings(const QDomElement& elem)
void CarlaInstrument::play(sampleFrame* workingBuffer)
{
const uint bufsize = Engine::mixer()->framesPerPeriod();
const uint bufsize = Engine::audioEngine()->framesPerPeriod();
std::memset(workingBuffer, 0, sizeof(sample_t)*bufsize*DEFAULT_CHANNELS);

View File

@@ -59,8 +59,8 @@ dynProcEffect::dynProcEffect( Model * _parent,
m_dpControls( this )
{
m_currentPeak[0] = m_currentPeak[1] = DYN_NOISE_FLOOR;
m_rms[0] = new RmsHelper( 64 * Engine::mixer()->processingSampleRate() / 44100 );
m_rms[1] = new RmsHelper( 64 * Engine::mixer()->processingSampleRate() / 44100 );
m_rms[0] = new RmsHelper( 64 * Engine::audioEngine()->processingSampleRate() / 44100 );
m_rms[1] = new RmsHelper( 64 * Engine::audioEngine()->processingSampleRate() / 44100 );
calcAttack();
calcRelease();
}
@@ -77,12 +77,12 @@ dynProcEffect::~dynProcEffect()
inline void dynProcEffect::calcAttack()
{
m_attCoeff = exp10( ( DNF_LOG / ( m_dpControls.m_attackModel.value() * 0.001 ) ) / Engine::mixer()->processingSampleRate() );
m_attCoeff = exp10( ( DNF_LOG / ( m_dpControls.m_attackModel.value() * 0.001 ) ) / Engine::audioEngine()->processingSampleRate() );
}
inline void dynProcEffect::calcRelease()
{
m_relCoeff = exp10( ( -DNF_LOG / ( m_dpControls.m_releaseModel.value() * 0.001 ) ) / Engine::mixer()->processingSampleRate() );
m_relCoeff = exp10( ( -DNF_LOG / ( m_dpControls.m_releaseModel.value() * 0.001 ) ) / Engine::audioEngine()->processingSampleRate() );
}
@@ -118,8 +118,8 @@ bool dynProcEffect::processAudioBuffer( sampleFrame * _buf,
if( m_needsUpdate )
{
m_rms[0]->setSize( 64 * Engine::mixer()->processingSampleRate() / 44100 );
m_rms[1]->setSize( 64 * Engine::mixer()->processingSampleRate() / 44100 );
m_rms[0]->setSize( 64 * Engine::audioEngine()->processingSampleRate() / 44100 );
m_rms[1]->setSize( 64 * Engine::audioEngine()->processingSampleRate() / 44100 );
calcAttack();
calcRelease();
m_needsUpdate = false;

View File

@@ -48,7 +48,7 @@ dynProcControls::dynProcControls( dynProcEffect * _eff ) :
{
connect( &m_wavegraphModel, SIGNAL( samplesChanged( int, int ) ),
this, SLOT( samplesChanged( int, int ) ) );
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( sampleRateChanged() ) );
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( sampleRateChanged() ) );
setDefaultShape();

View File

@@ -28,10 +28,10 @@
#include <QPainter>
#include "kicker.h"
#include "AudioEngine.h"
#include "Engine.h"
#include "InstrumentTrack.h"
#include "Knob.h"
#include "Mixer.h"
#include "NotePlayHandle.h"
#include "KickerOsc.h"
@@ -166,8 +166,7 @@ void kickerInstrument::playNote( NotePlayHandle * _n,
{
const fpp_t frames = _n->framesLeftForCurrentPeriod();
const f_cnt_t offset = _n->noteOffset();
const float decfr = m_decayModel.value() *
Engine::mixer()->processingSampleRate() / 1000.0f;
const float decfr = m_decayModel.value() * Engine::audioEngine()->processingSampleRate() / 1000.0f;
const f_cnt_t tfp = _n->totalFramesPlayed();
if ( tfp == 0 )
@@ -191,7 +190,7 @@ void kickerInstrument::playNote( NotePlayHandle * _n,
}
SweepOsc * so = static_cast<SweepOsc *>( _n->m_pluginData );
so->update( _working_buffer + offset, frames, Engine::mixer()->processingSampleRate() );
so->update( _working_buffer + offset, frames, Engine::audioEngine()->processingSampleRate() );
if( _n->isReleased() )
{

View File

@@ -31,9 +31,9 @@
#include <QVBoxLayout>
#include "AudioDevice.h"
#include "AudioEngine.h"
#include "Engine.h"
#include "Ladspa2LMMS.h"
#include "Mixer.h"
@@ -74,7 +74,7 @@ ladspaDescription::ladspaDescription( QWidget * _parent,
{
if( _type != VALID ||
manager->getDescription( ( *it ).second )->inputChannels
<= Engine::mixer()->audioDev()->channels() )
<= Engine::audioEngine()->audioDev()->channels() )
{
pluginNames.push_back( ( *it ).first );
m_pluginKeys.push_back( ( *it ).second );

View File

@@ -28,10 +28,10 @@
#include <QLayout>
#include <QTableWidget>
#include "AudioEngine.h"
#include "embed.h"
#include "Engine.h"
#include "Ladspa2LMMS.h"
#include "Mixer.h"
ladspaPortDialog::ladspaPortDialog( const ladspa_key_t & _key )
@@ -87,11 +87,11 @@ ladspaPortDialog::ladspaPortDialog( const ladspa_key_t & _key )
{
if( min != NOHINT )
{
min *= Engine::mixer()->processingSampleRate();
min *= Engine::audioEngine()->processingSampleRate();
}
if( max != NOHINT )
{
max *= Engine::mixer()->processingSampleRate();
max *= Engine::audioEngine()->processingSampleRate();
}
}

View File

@@ -27,8 +27,8 @@ BUG:
without also using LB302, so I do not know if the problem is actually
in the Bass Synth. I have gotten the backtraces a few times:
...
mixer::renderNextBuffer()
mixer::nextAudioBuffer()
audioEngine::renderNextBuffer()
audioEngine::nextAudioBuffer()
QOBject::activate_signal()
??()

View File

@@ -73,7 +73,7 @@
//
//#define engine::mixer()->processingSampleRate() 44100.0f
//#define engine::audioEngine()->processingSampleRate() 44100.0f
const float sampleRateCutoff = 44100.0f;
extern "C"
@@ -112,8 +112,8 @@ void lb302Filter::recalc()
{
vcf_e1 = exp(6.109 + 1.5876*(fs->envmod) + 2.1553*(fs->cutoff) - 1.2*(1.0-(fs->reso)));
vcf_e0 = exp(5.613 - 0.8*(fs->envmod) + 2.1553*(fs->cutoff) - 0.7696*(1.0-(fs->reso)));
vcf_e0*=M_PI/Engine::mixer()->processingSampleRate();
vcf_e1*=M_PI/Engine::mixer()->processingSampleRate();
vcf_e0*=M_PI/Engine::audioEngine()->processingSampleRate();
vcf_e1*=M_PI/Engine::audioEngine()->processingSampleRate();
vcf_e1 -= vcf_e0;
vcf_rescoeff = exp(-1.20 + 3.455*(fs->reso));
@@ -229,7 +229,7 @@ void lb302Filter3Pole::envRecalc()
w = vcf_e0 + vcf_c0;
k = (fs->cutoff > 0.975)?0.975:fs->cutoff;
// sampleRateCutoff should not be changed to anything dynamic that is outside the
// scope of lb302 (like e.g. the mixers sample rate) as this changes the filters cutoff
// scope of lb302 (like e.g. the audio engine's sample rate) as this changes the filter's cutoff
// behavior without any modification to its controls.
kfco = 50.f + (k)*((2300.f-1600.f*(fs->envmod))+(w) *
(700.f+1500.f*(k)+(1500.f+(k)*(sampleRateCutoff/2.f-6000.f)) *
@@ -239,7 +239,7 @@ void lb302Filter3Pole::envRecalc()
#ifdef LB_24_IGNORE_ENVELOPE
// kfcn = fs->cutoff;
kfcn = 2.0 * kfco / Engine::mixer()->processingSampleRate();
kfcn = 2.0 * kfco / Engine::audioEngine()->processingSampleRate();
#else
kfcn = w;
#endif
@@ -294,7 +294,7 @@ lb302Synth::lb302Synth( InstrumentTrack * _instrumentTrack ) :
vca_mode(never_played)
{
connect( Engine::mixer(), SIGNAL( sampleRateChanged( ) ),
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged( ) ),
this, SLOT ( filterChanged( ) ) );
connect( &vcf_cut_knob, SIGNAL( dataChanged( ) ),
@@ -351,7 +351,7 @@ lb302Synth::lb302Synth( InstrumentTrack * _instrumentTrack ) :
filterChanged();
InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, _instrumentTrack );
Engine::mixer()->addPlayHandle( iph );
Engine::audioEngine()->addPlayHandle( iph );
}
@@ -410,7 +410,7 @@ void lb302Synth::filterChanged()
float d = 0.2 + (2.3*vcf_dec_knob.value());
d *= Engine::mixer()->processingSampleRate(); // d *= smpl rate
d *= Engine::audioEngine()->processingSampleRate(); // d *= smpl rate
fs.envdecay = pow(0.1, 1.0/d * ENVINC); // decay is 0.1 to the 1/d * ENVINC
// vcf_envdecay is now adjusted for both
// sampling rate and ENVINC
@@ -444,7 +444,7 @@ void lb302Synth::recalcFilter()
// THIS IS OLD 3pole/24dB code, I may reintegrate it. Don't need it
// right now. Should be toggled by LB_24_RES_TRICK at the moment.
/*kfcn = 2.0 * (((vcf_cutoff*3000))) / engine::mixer()->processingSampleRate();
/*kfcn = 2.0 * (((vcf_cutoff*3000))) / engine::audioEngine()->processingSampleRate();
kp = ((-2.7528*kfcn + 3.0429)*kfcn + 1.718)*kfcn - 0.9984;
kp1 = kp+1.0;
kp1h = 0.5*kp1;
@@ -455,12 +455,12 @@ void lb302Synth::recalcFilter()
}
inline float GET_INC(float freq) {
return freq/Engine::mixer()->processingSampleRate(); // TODO: Use actual sampling rate.
return freq/Engine::audioEngine()->processingSampleRate(); // TODO: Use actual sampling rate.
}
int lb302Synth::process(sampleFrame *outbuf, const int size)
{
const float sampleRatio = 44100.f / Engine::mixer()->processingSampleRate();
const float sampleRatio = 44100.f / Engine::audioEngine()->processingSampleRate();
float w;
float samp;
@@ -635,7 +635,7 @@ int lb302Synth::process(sampleFrame *outbuf, const int size)
// Handle Envelope
if(vca_mode==attack) {
vca_a+=(vca_a0-vca_a)*vca_attack;
if(sample_cnt>=0.5*Engine::mixer()->processingSampleRate())
if(sample_cnt>=0.5*Engine::audioEngine()->processingSampleRate())
vca_mode = idle;
}
else if(vca_mode == decay) {
@@ -787,7 +787,7 @@ void lb302Synth::play( sampleFrame * _working_buffer )
};
m_notesMutex.unlock();
const fpp_t frames = Engine::mixer()->framesPerPeriod();
const fpp_t frames = Engine::audioEngine()->framesPerPeriod();
process( _working_buffer, frames );
instrumentTrack()->processAudioBuffer( _working_buffer, frames, NULL );

View File

@@ -1006,9 +1006,9 @@ MonstroInstrument::MonstroInstrument( InstrumentTrack * _instrument_track ) :
// updateSampleRate
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSamplerate() ) );
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSamplerate() ) );
m_fpp = Engine::mixer()->framesPerPeriod();
m_fpp = Engine::audioEngine()->framesPerPeriod();
updateSamplerate();
updateVolume1();
@@ -1419,7 +1419,7 @@ void MonstroInstrument::updateLFOAtts()
void MonstroInstrument::updateSamplerate()
{
m_samplerate = Engine::mixer()->processingSampleRate();
m_samplerate = Engine::audioEngine()->processingSampleRate();
m_integrator = 0.5f - ( 0.5f - INTEGRATOR ) * 44100.0f / m_samplerate;
m_fmCorrection = 44100.f / m_samplerate * FM_AMOUNT;

View File

@@ -25,13 +25,13 @@
#include <QDomElement>
#include "Nes.h"
#include "AudioEngine.h"
#include "Engine.h"
#include "InstrumentTrack.h"
#include "ToolTip.h"
#include "Song.h"
#include "lmms_math.h"
#include "interpolation.h"
#include "Mixer.h"
#include "Oscillator.h"
#include "embed.h"
@@ -560,7 +560,7 @@ void NesInstrument::playNote( NotePlayHandle * n, sampleFrame * workingBuffer )
if ( n->totalFramesPlayed() == 0 || n->m_pluginData == NULL )
{
NesObject * nes = new NesObject( this, Engine::mixer()->processingSampleRate(), n );
NesObject * nes = new NesObject( this, Engine::audioEngine()->processingSampleRate(), n );
n->m_pluginData = nes;
}

View File

@@ -31,9 +31,9 @@
#include "Engine.h"
#include "AudioEngine.h"
#include "InstrumentTrack.h"
#include "Knob.h"
#include "Mixer.h"
#include "NotePlayHandle.h"
#include "Oscillator.h"
#include "PixmapButton.h"
@@ -143,7 +143,7 @@ organicInstrument::organicInstrument( InstrumentTrack * _instrument_track ) :
}
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ),
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ),
this, SLOT( updateAllDetuning() ) );
}
@@ -622,10 +622,10 @@ void OscillatorObject::updateDetuning()
{
m_detuningLeft = powf( 2.0f, organicInstrument::s_harmonics[ static_cast<int>( m_harmModel.value() ) ]
+ (float)m_detuneModel.value() * CENT ) /
Engine::mixer()->processingSampleRate();
Engine::audioEngine()->processingSampleRate();
m_detuningRight = powf( 2.0f, organicInstrument::s_harmonics[ static_cast<int>( m_harmModel.value() ) ]
- (float)m_detuneModel.value() * CENT ) /
Engine::mixer()->processingSampleRate();
Engine::audioEngine()->processingSampleRate();
}

View File

@@ -30,6 +30,7 @@
#include <QLabel>
#include <QDomDocument>
#include "AudioEngine.h"
#include "ConfigManager.h"
#include "FileDialog.h"
#include "ConfigManager.h"
@@ -37,7 +38,6 @@
#include "InstrumentTrack.h"
#include "InstrumentPlayHandle.h"
#include "Knob.h"
#include "Mixer.h"
#include "NotePlayHandle.h"
#include "PathUtil.h"
#include "SampleBuffer.h"
@@ -124,7 +124,7 @@ sf2Instrument::sf2Instrument( InstrumentTrack * _instrument_track ) :
#endif
m_settings = new_fluid_settings();
//fluid_settings_setint( m_settings, (char *) "audio.period-size", engine::mixer()->framesPerPeriod() );
//fluid_settings_setint( m_settings, (char *) "audio.period-size", engine::audioEngine()->framesPerPeriod() );
// This is just our starting instance of synth. It is recreated
// everytime we load a new soundfont.
@@ -165,7 +165,7 @@ sf2Instrument::sf2Instrument( InstrumentTrack * _instrument_track ) :
connect( &m_bankNum, SIGNAL( dataChanged() ), this, SLOT( updatePatch() ) );
connect( &m_patchNum, SIGNAL( dataChanged() ), this, SLOT( updatePatch() ) );
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSampleRate() ) );
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSampleRate() ) );
// Gain
connect( &m_gain, SIGNAL( dataChanged() ), this, SLOT( updateGain() ) );
@@ -185,14 +185,14 @@ sf2Instrument::sf2Instrument( InstrumentTrack * _instrument_track ) :
connect( &m_chorusDepth, SIGNAL( dataChanged() ), this, SLOT( updateChorus() ) );
InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, _instrument_track );
Engine::mixer()->addPlayHandle( iph );
Engine::audioEngine()->addPlayHandle( iph );
}
sf2Instrument::~sf2Instrument()
{
Engine::mixer()->removePlayHandlesOfTypes( instrumentTrack(),
Engine::audioEngine()->removePlayHandlesOfTypes( instrumentTrack(),
PlayHandle::TypeNotePlayHandle
| PlayHandle::TypeInstrumentPlayHandle );
freeFont();
@@ -549,7 +549,7 @@ void sf2Instrument::updateSampleRate()
double tempRate;
// Set & get, returns the true sample rate
fluid_settings_setnum( m_settings, (char *) "synth.sample-rate", Engine::mixer()->processingSampleRate() );
fluid_settings_setnum( m_settings, (char *) "synth.sample-rate", Engine::audioEngine()->processingSampleRate() );
fluid_settings_getnum( m_settings, (char *) "synth.sample-rate", &tempRate );
m_internalSampleRate = static_cast<int>( tempRate );
@@ -578,8 +578,8 @@ void sf2Instrument::updateSampleRate()
}
m_synthMutex.lock();
if( Engine::mixer()->currentQualitySettings().interpolation >=
Mixer::qualitySettings::Interpolation_SincFastest )
if( Engine::audioEngine()->currentQualitySettings().interpolation >=
AudioEngine::qualitySettings::Interpolation_SincFastest )
{
fluid_synth_set_interp_method( m_synth, -1, FLUID_INTERP_7THORDER );
}
@@ -588,7 +588,7 @@ void sf2Instrument::updateSampleRate()
fluid_synth_set_interp_method( m_synth, -1, FLUID_INTERP_DEFAULT );
}
m_synthMutex.unlock();
if( m_internalSampleRate < Engine::mixer()->processingSampleRate() )
if( m_internalSampleRate < Engine::audioEngine()->processingSampleRate() )
{
m_synthMutex.lock();
if( m_srcState != NULL )
@@ -596,7 +596,7 @@ void sf2Instrument::updateSampleRate()
src_delete( m_srcState );
}
int error;
m_srcState = src_new( Engine::mixer()->currentQualitySettings().libsrcInterpolation(), DEFAULT_CHANNELS, &error );
m_srcState = src_new( Engine::audioEngine()->currentQualitySettings().libsrcInterpolation(), DEFAULT_CHANNELS, &error );
if( m_srcState == NULL || error )
{
qCritical( "error while creating libsamplerate data structure in Sf2Instrument::updateSampleRate()" );
@@ -728,7 +728,7 @@ void sf2Instrument::noteOff( SF2PluginData * n )
void sf2Instrument::play( sampleFrame * _working_buffer )
{
const fpp_t frames = Engine::mixer()->framesPerPeriod();
const fpp_t frames = Engine::audioEngine()->framesPerPeriod();
// set midi pitch for this period
const int currentMidiPitch = instrumentTrack()->midiPitch();
@@ -817,10 +817,10 @@ void sf2Instrument::play( sampleFrame * _working_buffer )
void sf2Instrument::renderFrames( f_cnt_t frames, sampleFrame * buf )
{
m_synthMutex.lock();
if( m_internalSampleRate < Engine::mixer()->processingSampleRate() &&
if( m_internalSampleRate < Engine::audioEngine()->processingSampleRate() &&
m_srcState != NULL )
{
const fpp_t f = frames * m_internalSampleRate / Engine::mixer()->processingSampleRate();
const fpp_t f = frames * m_internalSampleRate / Engine::audioEngine()->processingSampleRate();
#ifdef __GNUC__
sampleFrame tmp[f];
#else

View File

@@ -40,6 +40,7 @@ float frnd(float range)
#include <QDomElement>
#include "sfxr.h"
#include "AudioEngine.h"
#include "Engine.h"
#include "InstrumentTrack.h"
#include "Knob.h"
@@ -49,7 +50,6 @@ float frnd(float range)
#include "ToolTip.h"
#include "Song.h"
#include "MidiEvent.h"
#include "Mixer.h"
#include "embed.h"
@@ -455,7 +455,7 @@ QString sfxrInstrument::nodeName() const
void sfxrInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer )
{
float currentSampleRate = Engine::mixer()->processingSampleRate();
float currentSampleRate = Engine::audioEngine()->processingSampleRate();
fpp_t frameNum = _n->framesLeftForCurrentPeriod();
const f_cnt_t offset = _n->noteOffset();

View File

@@ -33,12 +33,12 @@
#include "ModalBar.h"
#include "TubeBell.h"
#include "AudioEngine.h"
#include "ConfigManager.h"
#include "Engine.h"
#include "gui_templates.h"
#include "GuiApplication.h"
#include "InstrumentTrack.h"
#include "Mixer.h"
#include "embed.h"
#include "plugin_export.h"
@@ -309,7 +309,7 @@ void malletsInstrument::playNote( NotePlayHandle * _n,
m_vibratoFreqModel.value(),
p,
(uint8_t) m_spreadModel.value(),
Engine::mixer()->processingSampleRate() );
Engine::audioEngine()->processingSampleRate() );
}
else if( p == 9 )
{
@@ -322,7 +322,7 @@ void malletsInstrument::playNote( NotePlayHandle * _n,
m_lfoSpeedModel.value(),
m_adsrModel.value(),
(uint8_t) m_spreadModel.value(),
Engine::mixer()->processingSampleRate() );
Engine::audioEngine()->processingSampleRate() );
}
else
{
@@ -335,7 +335,7 @@ void malletsInstrument::playNote( NotePlayHandle * _n,
m_strikeModel.value() * 128.0,
m_velocityModel.value(),
(uint8_t) m_spreadModel.value(),
Engine::mixer()->processingSampleRate() );
Engine::audioEngine()->processingSampleRate() );
}
m.unlock();
static_cast<malletsSynth *>(_n->m_pluginData)->setPresetIndex(p);

View File

@@ -28,12 +28,12 @@
#include <QPainter>
#include "TripleOscillator.h"
#include "AudioEngine.h"
#include "AutomatableButton.h"
#include "debug.h"
#include "Engine.h"
#include "InstrumentTrack.h"
#include "Knob.h"
#include "Mixer.h"
#include "NotePlayHandle.h"
#include "PixmapButton.h"
#include "SampleBuffer.h"
@@ -181,7 +181,7 @@ void OscillatorObject::updateDetuningLeft()
{
m_detuningLeft = powf( 2.0f, ( (float)m_coarseModel.value() * 100.0f
+ (float)m_fineLeftModel.value() ) / 1200.0f )
/ Engine::mixer()->processingSampleRate();
/ Engine::audioEngine()->processingSampleRate();
}
@@ -191,7 +191,7 @@ void OscillatorObject::updateDetuningRight()
{
m_detuningRight = powf( 2.0f, ( (float)m_coarseModel.value() * 100.0f
+ (float)m_fineRightModel.value() ) / 1200.0f )
/ Engine::mixer()->processingSampleRate();
/ Engine::audioEngine()->processingSampleRate();
}
@@ -228,7 +228,7 @@ TripleOscillator::TripleOscillator( InstrumentTrack * _instrument_track ) :
}
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ),
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ),
this, SLOT( updateAllDetuning() ) );
}

View File

@@ -40,6 +40,7 @@
#include <string>
#include "AudioEngine.h"
#include "BufferManager.h"
#include "ConfigManager.h"
#include "Engine.h"
@@ -50,7 +51,6 @@
#include "InstrumentTrack.h"
#include "LocaleHelper.h"
#include "MainWindow.h"
#include "Mixer.h"
#include "PathUtil.h"
#include "PixmapButton.h"
#include "SampleBuffer.h"
@@ -156,7 +156,7 @@ vestigeInstrument::vestigeInstrument( InstrumentTrack * _instrument_track ) :
{
// now we need a play-handle which cares for calling play()
InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, _instrument_track );
Engine::mixer()->addPlayHandle( iph );
Engine::audioEngine()->addPlayHandle( iph );
connect( ConfigManager::inst(), SIGNAL( valueChanged(QString,QString,QString) ),
this, SLOT( handleConfigChange(QString, QString, QString) ),
@@ -178,7 +178,7 @@ vestigeInstrument::~vestigeInstrument()
knobFModel = NULL;
}
Engine::mixer()->removePlayHandlesOfTypes( instrumentTrack(),
Engine::audioEngine()->removePlayHandlesOfTypes( instrumentTrack(),
PlayHandle::TypeNotePlayHandle
| PlayHandle::TypeInstrumentPlayHandle );
closePlugin();
@@ -393,7 +393,7 @@ void vestigeInstrument::play( sampleFrame * _buf )
{
if (!m_pluginMutex.tryLock(Engine::getSong()->isExporting() ? -1 : 0)) {return;}
const fpp_t frames = Engine::mixer()->framesPerPeriod();
const fpp_t frames = Engine::audioEngine()->framesPerPeriod();
if( m_plugin == NULL )
{
@@ -702,7 +702,7 @@ void VestigeInstrumentView::openPlugin()
{
return;
}
Engine::mixer()->requestChangeInModel();
Engine::audioEngine()->requestChangeInModel();
if (m_vi->p_subWindow != NULL) {
delete m_vi->p_subWindow;
@@ -710,7 +710,7 @@ void VestigeInstrumentView::openPlugin()
}
m_vi->loadFile( ofd.selectedFiles()[0] );
Engine::mixer()->doneChangeInModel();
Engine::audioEngine()->doneChangeInModel();
if( m_vi->m_plugin && m_vi->m_plugin->pluginWidget() )
{
m_vi->m_plugin->pluginWidget()->setWindowIcon(

View File

@@ -26,9 +26,9 @@
#include <QMap>
#include "vibed.h"
#include "AudioEngine.h"
#include "Engine.h"
#include "InstrumentTrack.h"
#include "Mixer.h"
#include "NotePlayHandle.h"
#include "ToolTip.h"
#include "base64.h"
@@ -276,7 +276,7 @@ void vibed::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer )
if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL )
{
_n->m_pluginData = new stringContainer( _n->frequency(),
Engine::mixer()->processingSampleRate(),
Engine::audioEngine()->processingSampleRate(),
__sampleLength );
for( int i = 0; i < 9; ++i )

View File

@@ -25,7 +25,7 @@
#include "vibrating_string.h"
#include "interpolation.h"
#include "Mixer.h"
#include "AudioEngine.h"
#include "Engine.h"
@@ -41,7 +41,7 @@ vibratingString::vibratingString( float _pitch,
float _detune,
bool _state ) :
m_oversample( 2 * _oversample / (int)( _sample_rate /
Engine::mixer()->baseSampleRate() ) ),
Engine::audioEngine()->baseSampleRate() ) ),
m_randomize( _randomize ),
m_stringLoss( 1.0f - _string_loss ),
m_state( 0.1f )

View File

@@ -50,11 +50,11 @@
# include <QLayout>
#endif
#include "AudioEngine.h"
#include "ConfigManager.h"
#include "GuiApplication.h"
#include "LocaleHelper.h"
#include "MainWindow.h"
#include "Mixer.h"
#include "PathUtil.h"
#include "Song.h"
#include "FileDialog.h"
@@ -154,7 +154,7 @@ VstPlugin::VstPlugin( const QString & _plugin ) :
connect( Engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ),
this, SLOT( setTempo( bpm_t ) ), Qt::DirectConnection );
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ),
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ),
this, SLOT( updateSampleRate() ) );
// update once per second
@@ -308,7 +308,7 @@ void VstPlugin::updateSampleRate()
{
lock();
sendMessage( message( IdSampleRateInformation ).
addInt( Engine::mixer()->processingSampleRate() ) );
addInt( Engine::audioEngine()->processingSampleRate() ) );
waitForMessage( IdInformationUpdated, true );
unlock();
}

View File

@@ -26,12 +26,12 @@
#include "Watsyn.h"
#include "base64.h"
#include "AudioEngine.h"
#include "Engine.h"
#include "InstrumentTrack.h"
#include "ToolTip.h"
#include "Song.h"
#include "lmms_math.h"
#include "Mixer.h"
#include "interpolation.h"
#include "embed.h"
@@ -338,8 +338,8 @@ void WatsynInstrument::playNote( NotePlayHandle * _n,
&B1_wave[0],
&B2_wave[0],
m_amod.value(), m_bmod.value(),
Engine::mixer()->processingSampleRate(), _n,
Engine::mixer()->framesPerPeriod(), this );
Engine::audioEngine()->processingSampleRate(), _n,
Engine::audioEngine()->framesPerPeriod(), this );
_n->m_pluginData = w;
}
@@ -365,7 +365,7 @@ void WatsynInstrument::playNote( NotePlayHandle * _n,
// if sample-exact is enabled, use sample-exact calculations...
// disabled pending proper implementation of sample-exactness
/* if( engine::mixer()->currentQualitySettings().sampleExactControllers )
/* if( engine::audioEngine()->currentQualitySettings().sampleExactControllers )
{
for( fpp_t f=0; f < frames; f++ )
{

View File

@@ -45,7 +45,7 @@
#include "StringPairDrag.h"
#include "RemoteZynAddSubFx.h"
#include "LocalZynAddSubFx.h"
#include "Mixer.h"
#include "AudioEngine.h"
#include "ControllerConnection.h"
#include "Clipboard.h"
@@ -140,9 +140,9 @@ ZynAddSubFxInstrument::ZynAddSubFxInstrument(
// now we need a play-handle which cares for calling play()
InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, _instrumentTrack );
Engine::mixer()->addPlayHandle( iph );
Engine::audioEngine()->addPlayHandle( iph );
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ),
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ),
this, SLOT( reloadPlugin() ) );
connect( instrumentTrack()->pitchRangeModel(), SIGNAL( dataChanged() ),
@@ -154,7 +154,7 @@ ZynAddSubFxInstrument::ZynAddSubFxInstrument(
ZynAddSubFxInstrument::~ZynAddSubFxInstrument()
{
Engine::mixer()->removePlayHandlesOfTypes( instrumentTrack(),
Engine::audioEngine()->removePlayHandlesOfTypes( instrumentTrack(),
PlayHandle::TypeNotePlayHandle
| PlayHandle::TypeInstrumentPlayHandle );
@@ -345,7 +345,7 @@ void ZynAddSubFxInstrument::play( sampleFrame * _buf )
m_plugin->processAudio( _buf );
}
m_pluginMutex.unlock();
instrumentTrack()->processAudioBuffer( _buf, Engine::mixer()->framesPerPeriod(), NULL );
instrumentTrack()->processAudioBuffer( _buf, Engine::audioEngine()->framesPerPeriod(), NULL );
}
@@ -457,11 +457,11 @@ void ZynAddSubFxInstrument::initPlugin()
QDir( ConfigManager::inst()->factoryPresetsDir() +
"/ZynAddSubFX" ).absolutePath() ) ) );
m_remotePlugin->updateSampleRate( Engine::mixer()->processingSampleRate() );
m_remotePlugin->updateSampleRate( Engine::audioEngine()->processingSampleRate() );
// temporary workaround until the VST synchronization feature gets stripped out of the RemotePluginClient class
// causing not to send buffer size information requests
m_remotePlugin->sendMessage( RemotePlugin::message( IdBufferSizeInformation ).addInt( Engine::mixer()->framesPerPeriod() ) );
m_remotePlugin->sendMessage( RemotePlugin::message( IdBufferSizeInformation ).addInt( Engine::audioEngine()->framesPerPeriod() ) );
m_remotePlugin->showUI();
m_remotePlugin->unlock();
@@ -469,8 +469,8 @@ void ZynAddSubFxInstrument::initPlugin()
else
{
m_plugin = new LocalZynAddSubFx;
m_plugin->setSampleRate( Engine::mixer()->processingSampleRate() );
m_plugin->setBufferSize( Engine::mixer()->framesPerPeriod() );
m_plugin->setSampleRate( Engine::audioEngine()->processingSampleRate() );
m_plugin->setBufferSize( Engine::audioEngine()->framesPerPeriod() );
}
m_pluginMutex.unlock();

View File

@@ -1,5 +1,5 @@
/*
* Mixer.cpp - audio-device-independent mixer for LMMS
* AudioEngine.cpp - device-independent audio engine for LMMS
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -22,15 +22,15 @@
*
*/
#include "Mixer.h"
#include "AudioEngine.h"
#include "denormals.h"
#include "lmmsconfig.h"
#include "AudioEngineWorkerThread.h"
#include "AudioPort.h"
#include "FxMixer.h"
#include "MixerWorkerThread.h"
#include "Song.h"
#include "EnvelopeAndLfoParameters.h"
#include "NotePlayHandle.h"
@@ -69,7 +69,7 @@ static thread_local bool s_renderingThread;
Mixer::Mixer( bool renderOnly ) :
AudioEngine::AudioEngine( bool renderOnly ) :
m_renderOnly( renderOnly ),
m_framesPerPeriod( DEFAULT_BUFFER_SIZE ),
m_inputBufferRead( 0 ),
@@ -145,7 +145,7 @@ Mixer::Mixer( bool renderOnly ) :
for( int i = 0; i < m_numWorkers+1; ++i )
{
MixerWorkerThread * wt = new MixerWorkerThread( this );
AudioEngineWorkerThread * wt = new AudioEngineWorkerThread( this );
if( i < m_numWorkers )
{
wt->start( QThread::TimeCriticalPriority );
@@ -157,7 +157,7 @@ Mixer::Mixer( bool renderOnly ) :
Mixer::~Mixer()
AudioEngine::~AudioEngine()
{
runChangesInModel();
@@ -166,7 +166,7 @@ Mixer::~Mixer()
m_workers[w]->quit();
}
MixerWorkerThread::startAndWaitForJobs();
AudioEngineWorkerThread::startAndWaitForJobs();
for( int w = 0; w < m_numWorkers; ++w )
{
@@ -194,7 +194,7 @@ Mixer::~Mixer()
void Mixer::initDevices()
void AudioEngine::initDevices()
{
bool success_ful = false;
if( m_renderOnly ) {
@@ -213,7 +213,7 @@ void Mixer::initDevices()
void Mixer::startProcessing(bool needsFifo)
void AudioEngine::startProcessing(bool needsFifo)
{
if (needsFifo)
{
@@ -233,7 +233,7 @@ void Mixer::startProcessing(bool needsFifo)
void Mixer::stopProcessing()
void AudioEngine::stopProcessing()
{
m_isProcessing = false;
@@ -254,7 +254,7 @@ void Mixer::stopProcessing()
sample_rate_t Mixer::baseSampleRate() const
sample_rate_t AudioEngine::baseSampleRate() const
{
sample_rate_t sr =
ConfigManager::inst()->value( "mixer", "samplerate" ).toInt();
@@ -268,7 +268,7 @@ sample_rate_t Mixer::baseSampleRate() const
sample_rate_t Mixer::outputSampleRate() const
sample_rate_t AudioEngine::outputSampleRate() const
{
return m_audioDev != NULL ? m_audioDev->sampleRate() :
baseSampleRate();
@@ -277,7 +277,7 @@ sample_rate_t Mixer::outputSampleRate() const
sample_rate_t Mixer::inputSampleRate() const
sample_rate_t AudioEngine::inputSampleRate() const
{
return m_audioDev != NULL ? m_audioDev->sampleRate() :
baseSampleRate();
@@ -286,7 +286,7 @@ sample_rate_t Mixer::inputSampleRate() const
sample_rate_t Mixer::processingSampleRate() const
sample_rate_t AudioEngine::processingSampleRate() const
{
return outputSampleRate() * m_qualitySettings.sampleRateMultiplier();
}
@@ -294,7 +294,7 @@ sample_rate_t Mixer::processingSampleRate() const
bool Mixer::criticalXRuns() const
bool AudioEngine::criticalXRuns() const
{
return cpuLoad() >= 99 && Engine::getSong()->isExporting() == false;
}
@@ -302,7 +302,7 @@ bool Mixer::criticalXRuns() const
void Mixer::pushInputFrames( sampleFrame * _ab, const f_cnt_t _frames )
void AudioEngine::pushInputFrames( sampleFrame * _ab, const f_cnt_t _frames )
{
requestChangeInModel();
@@ -332,7 +332,7 @@ void Mixer::pushInputFrames( sampleFrame * _ab, const f_cnt_t _frames )
const surroundSampleFrame * Mixer::renderNextBuffer()
const surroundSampleFrame * AudioEngine::renderNextBuffer()
{
m_profiler.startPeriod();
@@ -387,8 +387,8 @@ const surroundSampleFrame * Mixer::renderNextBuffer()
}
// STAGE 1: run and render all play handles
MixerWorkerThread::fillJobQueue<PlayHandleList>( m_playHandles );
MixerWorkerThread::startAndWaitForJobs();
AudioEngineWorkerThread::fillJobQueue<PlayHandleList>( m_playHandles );
AudioEngineWorkerThread::startAndWaitForJobs();
// removed all play handles which are done
for( PlayHandleList::Iterator it = m_playHandles.begin();
@@ -417,8 +417,8 @@ const surroundSampleFrame * Mixer::renderNextBuffer()
}
// STAGE 2: process effects of all instrument- and sampletracks
MixerWorkerThread::fillJobQueue<QVector<AudioPort *> >( m_audioPorts );
MixerWorkerThread::startAndWaitForJobs();
AudioEngineWorkerThread::fillJobQueue<QVector<AudioPort *> >( m_audioPorts );
AudioEngineWorkerThread::startAndWaitForJobs();
// STAGE 3: do master mix in FX mixer
@@ -444,7 +444,7 @@ const surroundSampleFrame * Mixer::renderNextBuffer()
void Mixer::swapBuffers()
void AudioEngine::swapBuffers()
{
m_inputBufferWrite = (m_inputBufferWrite + 1) % 2;
m_inputBufferRead = (m_inputBufferRead + 1) % 2;
@@ -457,7 +457,7 @@ void Mixer::swapBuffers()
void Mixer::handleMetronome()
void AudioEngine::handleMetronome()
{
static tick_t lastMetroTicks = -1;
@@ -503,7 +503,7 @@ void Mixer::handleMetronome()
void Mixer::clear()
void AudioEngine::clear()
{
m_clearSignal = true;
}
@@ -511,7 +511,7 @@ void Mixer::clear()
void Mixer::clearNewPlayHandles()
void AudioEngine::clearNewPlayHandles()
{
requestChangeInModel();
for( LocklessListElement * e = m_newPlayHandles.popList(); e; )
@@ -527,7 +527,7 @@ void Mixer::clearNewPlayHandles()
// removes all play-handles. this is necessary, when the song is stopped ->
// all remaining notes etc. would be played until their end
void Mixer::clearInternal()
void AudioEngine::clearInternal()
{
// TODO: m_midiClient->noteOffAll();
for (auto ph : m_playHandles)
@@ -536,14 +536,13 @@ void Mixer::clearInternal()
{
m_playHandlesToRemove.push_back(ph);
}
}
}
Mixer::StereoSample Mixer::getPeakValues(sampleFrame * ab, const f_cnt_t frames) const
AudioEngine::StereoSample AudioEngine::getPeakValues(sampleFrame * ab, const f_cnt_t frames) const
{
sample_t peakLeft = 0.0f;
sample_t peakRight = 0.0f;
@@ -569,7 +568,7 @@ Mixer::StereoSample Mixer::getPeakValues(sampleFrame * ab, const f_cnt_t frames)
void Mixer::changeQuality(const struct qualitySettings & qs)
void AudioEngine::changeQuality(const struct qualitySettings & qs)
{
// don't delete the audio-device
stopProcessing();
@@ -586,7 +585,7 @@ void Mixer::changeQuality(const struct qualitySettings & qs)
void Mixer::doSetAudioDevice( AudioDevice * _dev )
void AudioEngine::doSetAudioDevice( AudioDevice * _dev )
{
// TODO: Use shared_ptr here in the future.
// Currently, this is safe, because this is only called by
@@ -600,7 +599,7 @@ void Mixer::doSetAudioDevice( AudioDevice * _dev )
}
else
{
printf( "param _dev == NULL in Mixer::setAudioDevice(...). "
printf( "param _dev == NULL in AudioEngine::setAudioDevice(...). "
"Trying any working audio-device\n" );
m_audioDev = tryAudioDevices();
}
@@ -609,7 +608,7 @@ void Mixer::doSetAudioDevice( AudioDevice * _dev )
void Mixer::setAudioDevice(AudioDevice * _dev,
void AudioEngine::setAudioDevice(AudioDevice * _dev,
const struct qualitySettings & _qs,
bool _needs_fifo,
bool startNow)
@@ -629,7 +628,7 @@ void Mixer::setAudioDevice(AudioDevice * _dev,
void Mixer::storeAudioDevice()
void AudioEngine::storeAudioDevice()
{
if( !m_oldAudioDev )
{
@@ -640,7 +639,7 @@ void Mixer::storeAudioDevice()
void Mixer::restoreAudioDevice()
void AudioEngine::restoreAudioDevice()
{
if( m_oldAudioDev && m_audioDev != m_oldAudioDev )
{
@@ -658,7 +657,7 @@ void Mixer::restoreAudioDevice()
void Mixer::removeAudioPort(AudioPort * port)
void AudioEngine::removeAudioPort(AudioPort * port)
{
requestChangeInModel();
@@ -671,7 +670,7 @@ void Mixer::removeAudioPort(AudioPort * port)
}
bool Mixer::addPlayHandle( PlayHandle* handle )
bool AudioEngine::addPlayHandle( PlayHandle* handle )
{
if( criticalXRuns() == false )
{
@@ -690,11 +689,11 @@ bool Mixer::addPlayHandle( PlayHandle* handle )
}
void Mixer::removePlayHandle(PlayHandle * ph)
void AudioEngine::removePlayHandle(PlayHandle * ph)
{
requestChangeInModel();
// check thread affinity as we must not delete play-handles
// which were created in a thread different than mixer thread
// which were created in a thread different than the audio engine thread
if (ph->affinityMatters() && ph->affinity() == QThread::currentThread())
{
ph->audioPort()->removePlayHandle(ph);
@@ -748,7 +747,7 @@ void Mixer::removePlayHandle(PlayHandle * ph)
void Mixer::removePlayHandlesOfTypes(Track * track, const quint8 types)
void AudioEngine::removePlayHandlesOfTypes(Track * track, const quint8 types)
{
requestChangeInModel();
PlayHandleList::Iterator it = m_playHandles.begin();
@@ -775,7 +774,7 @@ void Mixer::removePlayHandlesOfTypes(Track * track, const quint8 types)
void Mixer::requestChangeInModel()
void AudioEngine::requestChangeInModel()
{
if( s_renderingThread )
return;
@@ -797,7 +796,7 @@ void Mixer::requestChangeInModel()
void Mixer::doneChangeInModel()
void AudioEngine::doneChangeInModel()
{
if( s_renderingThread )
return;
@@ -809,7 +808,7 @@ void Mixer::doneChangeInModel()
if( !moreChanges )
{
m_changesSignal = false;
m_changesMixerCondition.wakeOne();
m_changesAudioEngineCondition.wakeOne();
}
m_doChangesMutex.unlock();
}
@@ -817,7 +816,7 @@ void Mixer::doneChangeInModel()
void Mixer::runChangesInModel()
void AudioEngine::runChangesInModel()
{
if( m_changesSignal )
{
@@ -825,12 +824,12 @@ void Mixer::runChangesInModel()
// allow changes in the model from other threads ...
m_changesRequestCondition.wakeOne();
// ... and wait until they are done
m_changesMixerCondition.wait( &m_waitChangesMutex );
m_changesAudioEngineCondition.wait( &m_waitChangesMutex );
m_waitChangesMutex.unlock();
}
}
bool Mixer::isAudioDevNameValid(QString name)
bool AudioEngine::isAudioDevNameValid(QString name)
{
#ifdef LMMS_HAVE_SDL
if (name == AudioSdl::name())
@@ -901,7 +900,7 @@ bool Mixer::isAudioDevNameValid(QString name)
return false;
}
bool Mixer::isMidiDevNameValid(QString name)
bool AudioEngine::isMidiDevNameValid(QString name)
{
#ifdef LMMS_HAVE_ALSA
if (name == MidiAlsaSeq::name() || name == MidiAlsaRaw::name())
@@ -953,7 +952,7 @@ bool Mixer::isMidiDevNameValid(QString name)
return false;
}
AudioDevice * Mixer::tryAudioDevices()
AudioDevice * AudioEngine::tryAudioDevices()
{
bool success_ful = false;
AudioDevice * dev = NULL;
@@ -1101,7 +1100,7 @@ AudioDevice * Mixer::tryAudioDevices()
MidiClient * Mixer::tryMidiClients()
MidiClient * AudioEngine::tryMidiClients()
{
QString client_name = ConfigManager::inst()->value( "mixer",
"mididev" );
@@ -1224,18 +1223,18 @@ MidiClient * Mixer::tryMidiClients()
Mixer::fifoWriter::fifoWriter( Mixer* mixer, Fifo * fifo ) :
m_mixer( mixer ),
AudioEngine::fifoWriter::fifoWriter( AudioEngine* audioEngine, Fifo * fifo ) :
m_audioEngine( audioEngine ),
m_fifo( fifo ),
m_writing( true )
{
setObjectName("Mixer::fifoWriter");
setObjectName("AudioEngine::fifoWriter");
}
void Mixer::fifoWriter::finish()
void AudioEngine::fifoWriter::finish()
{
m_writing = false;
}
@@ -1243,7 +1242,7 @@ void Mixer::fifoWriter::finish()
void Mixer::fifoWriter::run()
void AudioEngine::fifoWriter::run()
{
disable_denormals();
@@ -1258,11 +1257,11 @@ void Mixer::fifoWriter::run()
#endif
#endif
const fpp_t frames = m_mixer->framesPerPeriod();
const fpp_t frames = m_audioEngine->framesPerPeriod();
while( m_writing )
{
surroundSampleFrame * buffer = new surroundSampleFrame[frames];
const surroundSampleFrame * b = m_mixer->renderNextBuffer();
const surroundSampleFrame * b = m_audioEngine->renderNextBuffer();
memcpy( buffer, b, frames * sizeof( surroundSampleFrame ) );
write( buffer );
}
@@ -1275,16 +1274,16 @@ void Mixer::fifoWriter::run()
void Mixer::fifoWriter::write( surroundSampleFrame * buffer )
void AudioEngine::fifoWriter::write( surroundSampleFrame * buffer )
{
m_mixer->m_waitChangesMutex.lock();
m_mixer->m_waitingForWrite = true;
m_mixer->m_waitChangesMutex.unlock();
m_mixer->runChangesInModel();
m_audioEngine->m_waitChangesMutex.lock();
m_audioEngine->m_waitingForWrite = true;
m_audioEngine->m_waitChangesMutex.unlock();
m_audioEngine->runChangesInModel();
m_fifo->write( buffer );
m_mixer->m_doChangesMutex.lock();
m_mixer->m_waitingForWrite = false;
m_mixer->m_doChangesMutex.unlock();
m_audioEngine->m_doChangesMutex.lock();
m_audioEngine->m_waitingForWrite = false;
m_audioEngine->m_doChangesMutex.unlock();
}

View File

@@ -1,5 +1,5 @@
/*
* MixerProfiler.cpp - class for profiling performance of Mixer
* AudioEngineProfiler.cpp - class for profiling performance of AudioEngine
*
* Copyright (c) 2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -22,10 +22,10 @@
*
*/
#include "MixerProfiler.h"
#include "AudioEngineProfiler.h"
MixerProfiler::MixerProfiler() :
AudioEngineProfiler::AudioEngineProfiler() :
m_periodTimer(),
m_cpuLoad( 0 ),
m_outputFile()
@@ -34,12 +34,12 @@ MixerProfiler::MixerProfiler() :
MixerProfiler::~MixerProfiler()
AudioEngineProfiler::~AudioEngineProfiler()
{
}
void MixerProfiler::finishPeriod( sample_rate_t sampleRate, fpp_t framesPerPeriod )
void AudioEngineProfiler::finishPeriod( sample_rate_t sampleRate, fpp_t framesPerPeriod )
{
int periodElapsed = m_periodTimer.elapsed();
@@ -54,7 +54,7 @@ void MixerProfiler::finishPeriod( sample_rate_t sampleRate, fpp_t framesPerPerio
void MixerProfiler::setOutputFile( const QString& outputFile )
void AudioEngineProfiler::setOutputFile( const QString& outputFile )
{
m_outputFile.close();
m_outputFile.setFileName( outputFile );

View File

@@ -1,5 +1,5 @@
/*
* MixerWorkerThread.cpp - implementation of MixerWorkerThread
* AudioEngineWorkerThread.cpp - implementation of AudioEngineWorkerThread
*
* Copyright (c) 2009-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -22,26 +22,26 @@
*
*/
#include "MixerWorkerThread.h"
#include "AudioEngineWorkerThread.h"
#include <QDebug>
#include <QMutex>
#include <QWaitCondition>
#include "denormals.h"
#include "AudioEngine.h"
#include "ThreadableJob.h"
#include "Mixer.h"
#if defined(LMMS_HOST_X86) || defined(LMMS_HOST_X86_64)
#include <xmmintrin.h>
#endif
MixerWorkerThread::JobQueue MixerWorkerThread::globalJobQueue;
QWaitCondition * MixerWorkerThread::queueReadyWaitCond = NULL;
QList<MixerWorkerThread *> MixerWorkerThread::workerThreads;
AudioEngineWorkerThread::JobQueue AudioEngineWorkerThread::globalJobQueue;
QWaitCondition * AudioEngineWorkerThread::queueReadyWaitCond = NULL;
QList<AudioEngineWorkerThread *> AudioEngineWorkerThread::workerThreads;
// implementation of internal JobQueue
void MixerWorkerThread::JobQueue::reset( OperationMode _opMode )
void AudioEngineWorkerThread::JobQueue::reset( OperationMode _opMode )
{
m_writeIndex = 0;
m_itemsDone = 0;
@@ -51,7 +51,7 @@ void MixerWorkerThread::JobQueue::reset( OperationMode _opMode )
void MixerWorkerThread::JobQueue::addJob( ThreadableJob * _job )
void AudioEngineWorkerThread::JobQueue::addJob( ThreadableJob * _job )
{
if( _job->requiresProcessing() )
{
@@ -70,7 +70,7 @@ void MixerWorkerThread::JobQueue::addJob( ThreadableJob * _job )
void MixerWorkerThread::JobQueue::run()
void AudioEngineWorkerThread::JobQueue::run()
{
bool processedJob = true;
while (processedJob && m_itemsDone < m_writeIndex)
@@ -94,7 +94,7 @@ void MixerWorkerThread::JobQueue::run()
void MixerWorkerThread::JobQueue::wait()
void AudioEngineWorkerThread::JobQueue::wait()
{
while (m_itemsDone < m_writeIndex)
{
@@ -110,8 +110,8 @@ void MixerWorkerThread::JobQueue::wait()
// implementation of worker threads
MixerWorkerThread::MixerWorkerThread( Mixer* mixer ) :
QThread( mixer ),
AudioEngineWorkerThread::AudioEngineWorkerThread( AudioEngine* audioEngine ) :
QThread( audioEngine ),
m_quit( false )
{
// initialize global static data
@@ -122,7 +122,7 @@ MixerWorkerThread::MixerWorkerThread( Mixer* mixer ) :
// keep track of all instantiated worker threads - this is used for
// processing the last worker thread "inline", see comments in
// MixerWorkerThread::startAndWaitForJobs() for details
// AudioEngineWorkerThread::startAndWaitForJobs() for details
workerThreads << this;
resetJobQueue();
@@ -131,7 +131,7 @@ MixerWorkerThread::MixerWorkerThread( Mixer* mixer ) :
MixerWorkerThread::~MixerWorkerThread()
AudioEngineWorkerThread::~AudioEngineWorkerThread()
{
workerThreads.removeAll( this );
}
@@ -139,7 +139,7 @@ MixerWorkerThread::~MixerWorkerThread()
void MixerWorkerThread::quit()
void AudioEngineWorkerThread::quit()
{
m_quit = true;
resetJobQueue();
@@ -148,11 +148,11 @@ void MixerWorkerThread::quit()
void MixerWorkerThread::startAndWaitForJobs()
void AudioEngineWorkerThread::startAndWaitForJobs()
{
queueReadyWaitCond->wakeAll();
// The last worker-thread is never started. Instead it's processed "inline"
// i.e. within the global Mixer thread. This way we can reduce latencies
// i.e. within the global AudioEngine thread. This way we can reduce latencies
// that otherwise would be caused by synchronizing with another thread.
globalJobQueue.run();
globalJobQueue.wait();
@@ -161,7 +161,7 @@ void MixerWorkerThread::startAndWaitForJobs()
void MixerWorkerThread::run()
void AudioEngineWorkerThread::run()
{
MemoryManager::ThreadGuard mmThreadGuard; Q_UNUSED(mmThreadGuard);
disable_denormals();

View File

@@ -26,10 +26,10 @@
#include "lmms_math.h"
#include "AudioEngine.h"
#include "AutomationPattern.h"
#include "ControllerConnection.h"
#include "LocaleHelper.h"
#include "Mixer.h"
#include "ProjectJournal.h"
#include "Song.h"
@@ -51,7 +51,7 @@ AutomatableModel::AutomatableModel(
m_setValueDepth( 0 ),
m_hasStrictStepSize( false ),
m_controllerConnection( NULL ),
m_valueBuffer( static_cast<int>( Engine::mixer()->framesPerPeriod() ) ),
m_valueBuffer( static_cast<int>( Engine::audioEngine()->framesPerPeriod() ) ),
m_lastUpdatedPeriod( -1 ),
m_hasSampleExactData(false),
m_useControllerValue(true)

View File

@@ -27,7 +27,6 @@
#include "BufferManager.h"
#include "Engine.h"
#include "Mixer.h"
#include "MemoryManager.h"
static fpp_t framesPerPeriod;

View File

@@ -1,6 +1,9 @@
set(LMMS_SRCS
${LMMS_SRCS}
core/AudioEngine.cpp
core/AudioEngineProfiler.cpp
core/AudioEngineWorkerThread.cpp
core/AutomatableModel.cpp
core/AutomationPattern.cpp
core/AutomationNode.cpp
@@ -41,9 +44,6 @@ set(LMMS_SRCS
core/MeterModel.cpp
core/MicroTimer.cpp
core/Microtuner.cpp
core/Mixer.cpp
core/MixerProfiler.cpp
core/MixerWorkerThread.cpp
core/MixHelpers.cpp
core/Model.cpp
core/ModelVisitor.cpp

View File

@@ -30,7 +30,7 @@
#include "Song.h"
#include "Mixer.h"
#include "AudioEngine.h"
#include "ControllerConnection.h"
#include "ControllerDialog.h"
#include "LfoController.h"
@@ -47,7 +47,7 @@ Controller::Controller( ControllerTypes _type, Model * _parent,
const QString & _display_name ) :
Model( _parent, _display_name ),
JournallingObject(),
m_valueBuffer( Engine::mixer()->framesPerPeriod() ),
m_valueBuffer( Engine::audioEngine()->framesPerPeriod() ),
m_bufferLastUpdated( -1 ),
m_connectionCount( 0 ),
m_type( _type )
@@ -140,7 +140,7 @@ void Controller::updateValueBuffer()
// Get position in frames
unsigned int Controller::runningFrames()
{
return s_periods * Engine::mixer()->framesPerPeriod();
return s_periods * Engine::audioEngine()->framesPerPeriod();
}
@@ -148,7 +148,7 @@ unsigned int Controller::runningFrames()
// Get position in seconds
float Controller::runningTime()
{
return runningFrames() / Engine::mixer()->processingSampleRate();
return runningFrames() / Engine::audioEngine()->processingSampleRate();
}

View File

@@ -180,7 +180,7 @@ void Effect::reinitSRC()
}
int error;
if( ( m_srcState[i] = src_new(
Engine::mixer()->currentQualitySettings().
Engine::audioEngine()->currentQualitySettings().
libsrcInterpolation(),
DEFAULT_CHANNELS, &error ) ) == NULL )
{
@@ -202,7 +202,7 @@ void Effect::resample( int _i, const sampleFrame * _src_buf,
return;
}
m_srcData[_i].input_frames = _frames;
m_srcData[_i].output_frames = Engine::mixer()->framesPerPeriod();
m_srcData[_i].output_frames = Engine::audioEngine()->framesPerPeriod();
m_srcData[_i].data_in = const_cast<float*>(_src_buf[0].data());
m_srcData[_i].data_out = _dst_buf[0].data ();
m_srcData[_i].src_ratio = (double) _dst_sr / _src_sr;

View File

@@ -78,7 +78,7 @@ void EffectChain::loadSettings( const QDomElement & _this )
{
clear();
// TODO This method should probably also lock the mixer
// TODO This method should probably also lock the audio engine
m_enabledModel.loadSettings( _this, "enabled" );
@@ -121,9 +121,9 @@ void EffectChain::loadSettings( const QDomElement & _this )
void EffectChain::appendEffect( Effect * _effect )
{
Engine::mixer()->requestChangeInModel();
Engine::audioEngine()->requestChangeInModel();
m_effects.append( _effect );
Engine::mixer()->doneChangeInModel();
Engine::audioEngine()->doneChangeInModel();
m_enabledModel.setValue( true );
@@ -135,17 +135,17 @@ void EffectChain::appendEffect( Effect * _effect )
void EffectChain::removeEffect( Effect * _effect )
{
Engine::mixer()->requestChangeInModel();
Engine::audioEngine()->requestChangeInModel();
Effect ** found = std::find( m_effects.begin(), m_effects.end(), _effect );
if( found == m_effects.end() )
{
Engine::mixer()->doneChangeInModel();
Engine::audioEngine()->doneChangeInModel();
return;
}
m_effects.erase( found );
Engine::mixer()->doneChangeInModel();
Engine::audioEngine()->doneChangeInModel();
if( m_effects.isEmpty() )
{
@@ -228,7 +228,7 @@ void EffectChain::clear()
{
emit aboutToClear();
Engine::mixer()->requestChangeInModel();
Engine::audioEngine()->requestChangeInModel();
while( m_effects.count() )
{
@@ -237,7 +237,7 @@ void EffectChain::clear()
delete e;
}
Engine::mixer()->doneChangeInModel();
Engine::audioEngine()->doneChangeInModel();
m_enabledModel.setValue( false );
}

View File

@@ -24,12 +24,12 @@
#include "Engine.h"
#include "AudioEngine.h"
#include "BBTrackContainer.h"
#include "ConfigManager.h"
#include "FxMixer.h"
#include "Ladspa2LMMS.h"
#include "Lv2Manager.h"
#include "Mixer.h"
#include "Plugin.h"
#include "PresetPreviewPlayHandle.h"
#include "ProjectJournal.h"
@@ -38,7 +38,7 @@
#include "Oscillator.h"
float LmmsCore::s_framesPerTick;
Mixer* LmmsCore::s_mixer = NULL;
AudioEngine* LmmsCore::s_audioEngine = NULL;
FxMixer * LmmsCore::s_fxMixer = NULL;
BBTrackContainer * LmmsCore::s_bbTrackContainer = NULL;
Song * LmmsCore::s_song = NULL;
@@ -64,7 +64,7 @@ void LmmsCore::init( bool renderOnly )
emit engine->initProgress(tr("Initializing data structures"));
s_projectJournal = new ProjectJournal;
s_mixer = new Mixer( renderOnly );
s_audioEngine = new AudioEngine( renderOnly );
s_song = new Song;
s_fxMixer = new FxMixer;
s_bbTrackContainer = new BBTrackContainer;
@@ -78,12 +78,12 @@ void LmmsCore::init( bool renderOnly )
s_projectJournal->setJournalling( true );
emit engine->initProgress(tr("Opening audio and midi devices"));
s_mixer->initDevices();
s_audioEngine->initDevices();
PresetPreviewPlayHandle::init();
emit engine->initProgress(tr("Launching mixer threads"));
s_mixer->startProcessing();
emit engine->initProgress(tr("Launching audio engine threads"));
s_audioEngine->startProcessing();
}
@@ -92,7 +92,7 @@ void LmmsCore::init( bool renderOnly )
void LmmsCore::destroy()
{
s_projectJournal->stopAllJournalling();
s_mixer->stopProcessing();
s_audioEngine->stopProcessing();
PresetPreviewPlayHandle::cleanup();
@@ -101,7 +101,7 @@ void LmmsCore::destroy()
deleteHelper( &s_bbTrackContainer );
deleteHelper( &s_fxMixer );
deleteHelper( &s_mixer );
deleteHelper( &s_audioEngine );
#ifdef LMMS_HAVE_LV2
deleteHelper( &s_lv2Manager );
@@ -143,8 +143,7 @@ float LmmsCore::framesPerTick(sample_rate_t sampleRate)
void LmmsCore::updateFramesPerTick()
{
s_framesPerTick = s_mixer->processingSampleRate() * 60.0f * 4 /
DefaultTicksPerBar / s_song->getTempo();
s_framesPerTick = s_audioEngine->processingSampleRate() * 60.0f * 4 / DefaultTicksPerBar / s_song->getTempo();
}

View File

@@ -25,8 +25,8 @@
#include <QDomElement>
#include "EnvelopeAndLfoParameters.h"
#include "AudioEngine.h"
#include "Engine.h"
#include "Mixer.h"
#include "Oscillator.h"
@@ -47,8 +47,7 @@ void EnvelopeAndLfoParameters::LfoInstances::trigger()
for( LfoList::Iterator it = m_lfos.begin();
it != m_lfos.end(); ++it )
{
( *it )->m_lfoFrame +=
Engine::mixer()->framesPerPeriod();
( *it )->m_lfoFrame += Engine::audioEngine()->framesPerPeriod();
( *it )->m_bad_lfoShapeData = true;
}
}
@@ -158,12 +157,12 @@ EnvelopeAndLfoParameters::EnvelopeAndLfoParameters(
connect( &m_x100Model, SIGNAL( dataChanged() ),
this, SLOT( updateSampleVars() ), Qt::DirectConnection );
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ),
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ),
this, SLOT( updateSampleVars() ) );
m_lfoShapeData =
new sample_t[Engine::mixer()->framesPerPeriod()];
new sample_t[Engine::audioEngine()->framesPerPeriod()];
updateSampleVars();
}
@@ -243,7 +242,7 @@ inline sample_t EnvelopeAndLfoParameters::lfoShapeSample( fpp_t _frame_offset )
void EnvelopeAndLfoParameters::updateLfoShapeData()
{
const fpp_t frames = Engine::mixer()->framesPerPeriod();
const fpp_t frames = Engine::audioEngine()->framesPerPeriod();
for( fpp_t offset = 0; offset < frames; ++offset )
{
m_lfoShapeData[offset] = lfoShapeSample( offset );
@@ -399,7 +398,7 @@ void EnvelopeAndLfoParameters::updateSampleVars()
QMutexLocker m(&m_paramMutex);
const float frames_per_env_seg = SECS_PER_ENV_SEGMENT *
Engine::mixer()->processingSampleRate();
Engine::audioEngine()->processingSampleRate();
// TODO: Remove the expKnobVals, time should be linear
const f_cnt_t predelay_frames = static_cast<f_cnt_t>(
@@ -501,7 +500,7 @@ void EnvelopeAndLfoParameters::updateSampleVars()
const float frames_per_lfo_oscillation = SECS_PER_LFO_OSCILLATION *
Engine::mixer()->processingSampleRate();
Engine::audioEngine()->processingSampleRate();
m_lfoPredelayFrames = static_cast<f_cnt_t>( frames_per_lfo_oscillation *
expKnobVal( m_lfoPredelayModel.value() ) );
m_lfoAttackFrames = static_cast<f_cnt_t>( frames_per_lfo_oscillation *

View File

@@ -24,10 +24,10 @@
#include <QDomElement>
#include "AudioEngine.h"
#include "AudioEngineWorkerThread.h"
#include "BufferManager.h"
#include "FxMixer.h"
#include "Mixer.h"
#include "MixerWorkerThread.h"
#include "MixHelpers.h"
#include "Song.h"
@@ -65,7 +65,7 @@ FxChannel::FxChannel( int idx, Model * _parent ) :
m_stillRunning( false ),
m_peakLeft( 0.0f ),
m_peakRight( 0.0f ),
m_buffer( new sampleFrame[Engine::mixer()->framesPerPeriod()] ),
m_buffer( new sampleFrame[Engine::audioEngine()->framesPerPeriod()] ),
m_muteModel( false, _parent ),
m_soloModel( false, _parent ),
m_volumeModel( 1.0, 0.0, 2.0, 0.001, _parent ),
@@ -76,7 +76,7 @@ FxChannel::FxChannel( int idx, Model * _parent ) :
m_hasColor( false ),
m_dependenciesMet(0)
{
BufferManager::clear( m_buffer, Engine::mixer()->framesPerPeriod() );
BufferManager::clear( m_buffer, Engine::audioEngine()->framesPerPeriod() );
}
@@ -105,7 +105,7 @@ void FxChannel::incrementDeps()
if( i >= m_receives.size() && ! m_queued )
{
m_queued = true;
MixerWorkerThread::addJob( this );
AudioEngineWorkerThread::addJob( this );
}
}
@@ -119,7 +119,7 @@ void FxChannel::unmuteForSolo()
void FxChannel::doProcessing()
{
const fpp_t fpp = Engine::mixer()->framesPerPeriod();
const fpp_t fpp = Engine::audioEngine()->framesPerPeriod();
if( m_muted == false )
{
@@ -173,7 +173,7 @@ void FxChannel::doProcessing()
m_stillRunning = m_fxChain.processAudioBuffer( m_buffer, fpp, m_hasInput );
Mixer::StereoSample peakSamples = Engine::mixer()->getPeakValues(m_buffer, fpp);
AudioEngine::StereoSample peakSamples = Engine::audioEngine()->getPeakValues(m_buffer, fpp);
m_peakLeft = qMax( m_peakLeft, peakSamples.left * v );
m_peakRight = qMax( m_peakRight, peakSamples.right * v );
}
@@ -283,7 +283,7 @@ void FxMixer::toggledSolo()
void FxMixer::deleteChannel( int index )
{
// channel deletion is performed between mixer rounds
Engine::mixer()->requestChangeInModel();
Engine::audioEngine()->requestChangeInModel();
// go through every instrument and adjust for the channel index change
TrackContainer::TrackList tracks;
@@ -365,7 +365,7 @@ void FxMixer::deleteChannel( int index )
}
}
Engine::mixer()->doneChangeInModel();
Engine::audioEngine()->doneChangeInModel();
}
@@ -469,7 +469,7 @@ FxRoute * FxMixer::createRoute( FxChannel * from, FxChannel * to, float amount )
{
return NULL;
}
Engine::mixer()->requestChangeInModel();
Engine::audioEngine()->requestChangeInModel();
FxRoute * route = new FxRoute( from, to, amount );
// add us to from's sends
@@ -480,7 +480,7 @@ FxRoute * FxMixer::createRoute( FxChannel * from, FxChannel * to, float amount )
// add us to fxmixer's list
Engine::fxMixer()->m_fxRoutes.append( route );
Engine::mixer()->doneChangeInModel();
Engine::audioEngine()->doneChangeInModel();
return route;
}
@@ -507,7 +507,7 @@ void FxMixer::deleteChannelSend( fx_ch_t fromChannel, fx_ch_t toChannel )
void FxMixer::deleteChannelSend( FxRoute * route )
{
Engine::mixer()->requestChangeInModel();
Engine::audioEngine()->requestChangeInModel();
// remove us from from's sends
route->sender()->m_sends.remove( route->sender()->m_sends.indexOf( route ) );
// remove us from to's receives
@@ -515,7 +515,7 @@ void FxMixer::deleteChannelSend( FxRoute * route )
// remove us from fxmixer's list
Engine::fxMixer()->m_fxRoutes.remove( Engine::fxMixer()->m_fxRoutes.indexOf( route ) );
delete route;
Engine::mixer()->doneChangeInModel();
Engine::audioEngine()->doneChangeInModel();
}
@@ -585,7 +585,7 @@ void FxMixer::mixToChannel( const sampleFrame * _buf, fx_ch_t _ch )
if( m_fxChannels[_ch]->m_muteModel.value() == false )
{
m_fxChannels[_ch]->m_lock.lock();
MixHelpers::add( m_fxChannels[_ch]->m_buffer, _buf, Engine::mixer()->framesPerPeriod() );
MixHelpers::add( m_fxChannels[_ch]->m_buffer, _buf, Engine::audioEngine()->framesPerPeriod() );
m_fxChannels[_ch]->m_hasInput = true;
m_fxChannels[_ch]->m_lock.unlock();
}
@@ -597,14 +597,14 @@ void FxMixer::mixToChannel( const sampleFrame * _buf, fx_ch_t _ch )
void FxMixer::prepareMasterMix()
{
BufferManager::clear( m_fxChannels[0]->m_buffer,
Engine::mixer()->framesPerPeriod() );
Engine::audioEngine()->framesPerPeriod() );
}
void FxMixer::masterMix( sampleFrame * _buf )
{
const int fpp = Engine::mixer()->framesPerPeriod();
const int fpp = Engine::audioEngine()->framesPerPeriod();
// add the channels that have no dependencies (no incoming senders, ie.
// no receives) to the jobqueue. The channels that have receives get
@@ -613,7 +613,7 @@ void FxMixer::masterMix( sampleFrame * _buf )
// also instantly add all muted channels as they don't need to care
// about their senders, and can just increment the deps of their
// recipients right away.
MixerWorkerThread::resetJobQueue( MixerWorkerThread::JobQueue::Dynamic );
AudioEngineWorkerThread::resetJobQueue( AudioEngineWorkerThread::JobQueue::Dynamic );
for( FxChannel * ch : m_fxChannels )
{
ch->m_muted = ch->m_muteModel.value();
@@ -625,7 +625,7 @@ void FxMixer::masterMix( sampleFrame * _buf )
else if( ch->m_receives.size() == 0 )
{
ch->m_queued = true;
MixerWorkerThread::addJob( ch );
AudioEngineWorkerThread::addJob( ch );
}
}
while (m_fxChannels[0]->state() != ThreadableJob::ProcessingState::Done)
@@ -645,7 +645,7 @@ void FxMixer::masterMix( sampleFrame * _buf )
{
break;
}
MixerWorkerThread::startAndWaitForJobs();
AudioEngineWorkerThread::startAndWaitForJobs();
}
// handle sample-exact data in master volume fader
@@ -670,7 +670,7 @@ void FxMixer::masterMix( sampleFrame * _buf )
for( int i = 0; i < numChannels(); ++i)
{
BufferManager::clear( m_fxChannels[i]->m_buffer,
Engine::mixer()->framesPerPeriod() );
Engine::audioEngine()->framesPerPeriod() );
m_fxChannels[i]->reset();
m_fxChannels[i]->m_queued = false;
// also reset hasInput

View File

@@ -176,7 +176,7 @@ void Instrument::applyFadeIn(sampleFrame * buf, NotePlayHandle * n)
void Instrument::applyRelease( sampleFrame * buf, const NotePlayHandle * _n )
{
const fpp_t frames = _n->framesLeftForCurrentPeriod();
const fpp_t fpp = Engine::mixer()->framesPerPeriod();
const fpp_t fpp = Engine::audioEngine()->framesPerPeriod();
const f_cnt_t fl = _n->framesLeft();
if( fl <= desiredReleaseFrames()+fpp )
{

Some files were not shown because too many files have changed in this diff Show More