Rename Mixer to AudioEngine (#6127)
This commit is contained in:
committed by
GitHub
parent
fa407d2530
commit
770d2498b5
@@ -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();
|
||||
}
|
||||
@@ -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 );
|
||||
@@ -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();
|
||||
@@ -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)
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "BufferManager.h"
|
||||
|
||||
#include "Engine.h"
|
||||
#include "Mixer.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
static fpp_t framesPerPeriod;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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 *
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
#include <QDomElement>
|
||||
|
||||
#include "InstrumentFunctions.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "embed.h"
|
||||
#include "Engine.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "Mixer.h"
|
||||
#include "PresetPreviewPlayHandle.h"
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ void InstrumentFunctionNoteStacking::processNote( NotePlayHandle * _n )
|
||||
|
||||
// create sub-note-play-handle, only note is
|
||||
// different
|
||||
Engine::mixer()->addPlayHandle(
|
||||
Engine::audioEngine()->addPlayHandle(
|
||||
NotePlayHandleManager::acquire( _n->instrumentTrack(), _n->offset(), _n->frames(), note_copy,
|
||||
_n, -1, NotePlayHandle::OriginNoteStacking )
|
||||
);
|
||||
@@ -374,7 +374,7 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
|
||||
const int total_range = range * cnphv.size();
|
||||
|
||||
// number of frames that every note should be played
|
||||
const f_cnt_t arp_frames = (f_cnt_t)( m_arpTimeModel.value() / 1000.0f * Engine::mixer()->processingSampleRate() );
|
||||
const f_cnt_t arp_frames = (f_cnt_t)( m_arpTimeModel.value() / 1000.0f * Engine::audioEngine()->processingSampleRate() );
|
||||
const f_cnt_t gated_frames = (f_cnt_t)( m_arpGateModel.value() * arp_frames / 100.0f );
|
||||
|
||||
// used for calculating remaining frames for arp-note, we have to add
|
||||
@@ -386,12 +386,12 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
|
||||
// used for loop
|
||||
f_cnt_t frames_processed = ( m_arpModeModel.value() != FreeMode ) ? cnphv.first()->noteOffset() : _n->noteOffset();
|
||||
|
||||
while( frames_processed < Engine::mixer()->framesPerPeriod() )
|
||||
while( frames_processed < Engine::audioEngine()->framesPerPeriod() )
|
||||
{
|
||||
const f_cnt_t remaining_frames_for_cur_arp = arp_frames - ( cur_frame % arp_frames );
|
||||
// does current arp-note fill whole audio-buffer or is the remaining time just
|
||||
// a short bit that we can discard?
|
||||
if( remaining_frames_for_cur_arp > Engine::mixer()->framesPerPeriod() ||
|
||||
if( remaining_frames_for_cur_arp > Engine::audioEngine()->framesPerPeriod() ||
|
||||
_n->frames() - _n->totalFramesPlayed() < arp_frames / 5 )
|
||||
{
|
||||
// then we don't have to do something!
|
||||
@@ -497,7 +497,7 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
|
||||
// range-checking
|
||||
if( sub_note_key >= NumKeys ||
|
||||
sub_note_key < 0 ||
|
||||
Engine::mixer()->criticalXRuns() )
|
||||
Engine::audioEngine()->criticalXRuns() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -506,7 +506,7 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
|
||||
|
||||
// create sub-note-play-handle, only ptr to note is different
|
||||
// and is_arp_note=true
|
||||
Engine::mixer()->addPlayHandle(
|
||||
Engine::audioEngine()->addPlayHandle(
|
||||
NotePlayHandleManager::acquire( _n->instrumentTrack(),
|
||||
frames_processed,
|
||||
gated_frames,
|
||||
|
||||
@@ -26,13 +26,13 @@
|
||||
#include <QDomElement>
|
||||
|
||||
#include "InstrumentSoundShaping.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "BasicFilters.h"
|
||||
#include "embed.h"
|
||||
#include "Engine.h"
|
||||
#include "EnvelopeAndLfoParameters.h"
|
||||
#include "Instrument.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "Mixer.h"
|
||||
|
||||
|
||||
const float CUT_FREQ_MULTIPLIER = 6000.0f;
|
||||
@@ -117,7 +117,7 @@ float InstrumentSoundShaping::volumeLevel( NotePlayHandle* n, const f_cnt_t fram
|
||||
|
||||
if( n->isReleased() == false )
|
||||
{
|
||||
envReleaseBegin += Engine::mixer()->framesPerPeriod();
|
||||
envReleaseBegin += Engine::audioEngine()->framesPerPeriod();
|
||||
}
|
||||
|
||||
float level;
|
||||
@@ -160,7 +160,7 @@ void InstrumentSoundShaping::processAudioBuffer( sampleFrame* buffer,
|
||||
|
||||
if( n->m_filter == nullptr )
|
||||
{
|
||||
n->m_filter = std::make_unique<BasicFilters<>>( Engine::mixer()->processingSampleRate() );
|
||||
n->m_filter = std::make_unique<BasicFilters<>>( Engine::audioEngine()->processingSampleRate() );
|
||||
}
|
||||
n->m_filter->setFilterType( m_filterModel.value() );
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
#include <QObject>
|
||||
|
||||
|
||||
#include "Song.h"
|
||||
#include "Mixer.h"
|
||||
#include "LfoController.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "Song.h"
|
||||
|
||||
|
||||
LfoController::LfoController( Model * _parent ) :
|
||||
@@ -55,7 +55,7 @@ LfoController::LfoController( Model * _parent ) :
|
||||
this, SLOT( updateDuration() ), Qt::DirectConnection );
|
||||
connect( &m_multiplierModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateDuration() ), Qt::DirectConnection );
|
||||
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ),
|
||||
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ),
|
||||
this, SLOT( updateDuration() ) );
|
||||
|
||||
connect( Engine::getSong(), SIGNAL( playbackStateChanged() ),
|
||||
@@ -91,7 +91,7 @@ void LfoController::updateValueBuffer()
|
||||
if( m_bufferLastUpdated < s_periods )
|
||||
{
|
||||
int diff = s_periods - m_bufferLastUpdated;
|
||||
phase += static_cast<float>( Engine::mixer()->framesPerPeriod() * diff ) / m_duration;
|
||||
phase += static_cast<float>( Engine::audioEngine()->framesPerPeriod() * diff ) / m_duration;
|
||||
m_bufferLastUpdated += diff;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ void LfoController::updatePhase()
|
||||
|
||||
void LfoController::updateDuration()
|
||||
{
|
||||
float newDurationF = Engine::mixer()->processingSampleRate() * m_speedModel.value();
|
||||
float newDurationF = Engine::audioEngine()->processingSampleRate() * m_speedModel.value();
|
||||
|
||||
switch(m_multiplierModel.value() )
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "NotePlayHandle.h"
|
||||
|
||||
#include "lmms_constants.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "BasicFilters.h"
|
||||
#include "DetuningHelper.h"
|
||||
#include "InstrumentSoundShaping.h"
|
||||
@@ -188,9 +189,9 @@ void NotePlayHandle::play( sampleFrame * _working_buffer )
|
||||
}
|
||||
|
||||
// if the note offset falls over to next period, then don't start playback yet
|
||||
if( offset() >= Engine::mixer()->framesPerPeriod() )
|
||||
if( offset() >= Engine::audioEngine()->framesPerPeriod() )
|
||||
{
|
||||
setOffset( offset() - Engine::mixer()->framesPerPeriod() );
|
||||
setOffset( offset() - Engine::audioEngine()->framesPerPeriod() );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -238,8 +239,8 @@ void NotePlayHandle::play( sampleFrame * _working_buffer )
|
||||
|
||||
// number of frames that can be played this period
|
||||
f_cnt_t framesThisPeriod = m_totalFramesPlayed == 0
|
||||
? Engine::mixer()->framesPerPeriod() - offset()
|
||||
: Engine::mixer()->framesPerPeriod();
|
||||
? Engine::audioEngine()->framesPerPeriod() - offset()
|
||||
: Engine::audioEngine()->framesPerPeriod();
|
||||
|
||||
// check if we start release during this period
|
||||
if( m_released == false &&
|
||||
@@ -274,7 +275,7 @@ void NotePlayHandle::play( sampleFrame * _working_buffer )
|
||||
// are inserted by arpAndChordsTabWidget::processNote()
|
||||
if( ! m_subNotes.isEmpty() )
|
||||
{
|
||||
m_releaseFramesToDo = m_releaseFramesDone + 2 * Engine::mixer()->framesPerPeriod();
|
||||
m_releaseFramesToDo = m_releaseFramesDone + 2 * Engine::audioEngine()->framesPerPeriod();
|
||||
}
|
||||
// look whether we have frames left to be done before release
|
||||
if( m_framesBeforeRelease )
|
||||
@@ -327,7 +328,7 @@ f_cnt_t NotePlayHandle::framesLeft() const
|
||||
{
|
||||
if( instrumentTrack()->isSustainPedalPressed() )
|
||||
{
|
||||
return 4*Engine::mixer()->framesPerPeriod();
|
||||
return 4 * Engine::audioEngine()->framesPerPeriod();
|
||||
}
|
||||
else if( m_released && actualReleaseFramesToDo() == 0 )
|
||||
{
|
||||
@@ -347,9 +348,9 @@ fpp_t NotePlayHandle::framesLeftForCurrentPeriod() const
|
||||
{
|
||||
if( m_totalFramesPlayed == 0 )
|
||||
{
|
||||
return (fpp_t) qMin<f_cnt_t>( framesLeft(), Engine::mixer()->framesPerPeriod() - offset() );
|
||||
return (fpp_t) qMin<f_cnt_t>( framesLeft(), Engine::audioEngine()->framesPerPeriod() - offset() );
|
||||
}
|
||||
return (fpp_t) qMin<f_cnt_t>( framesLeft(), Engine::mixer()->framesPerPeriod() );
|
||||
return (fpp_t) qMin<f_cnt_t>( framesLeft(), Engine::audioEngine()->framesPerPeriod() );
|
||||
}
|
||||
|
||||
|
||||
@@ -452,7 +453,7 @@ void NotePlayHandle::mute()
|
||||
|
||||
int NotePlayHandle::index() const
|
||||
{
|
||||
const PlayHandleList & playHandles = Engine::mixer()->playHandles();
|
||||
const PlayHandleList & playHandles = Engine::audioEngine()->playHandles();
|
||||
int idx = 0;
|
||||
for( PlayHandleList::ConstIterator it = playHandles.begin(); it != playHandles.end(); ++it )
|
||||
{
|
||||
@@ -475,7 +476,7 @@ int NotePlayHandle::index() const
|
||||
|
||||
ConstNotePlayHandleList NotePlayHandle::nphsOfInstrumentTrack( const InstrumentTrack * _it, bool _all_ph )
|
||||
{
|
||||
const PlayHandleList & playHandles = Engine::mixer()->playHandles();
|
||||
const PlayHandleList & playHandles = Engine::audioEngine()->playHandles();
|
||||
ConstNotePlayHandleList cnphv;
|
||||
|
||||
for( PlayHandleList::ConstIterator it = playHandles.begin(); it != playHandles.end(); ++it )
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include "BufferManager.h"
|
||||
#include "Engine.h"
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "AutomatableModel.h"
|
||||
#include "fftw3.h"
|
||||
#include "fft_helpers.h"
|
||||
@@ -76,7 +76,7 @@ Oscillator::Oscillator(const IntModel *wave_shape_model,
|
||||
|
||||
void Oscillator::update(sampleFrame* ab, const fpp_t frames, const ch_cnt_t chnl, bool modulator)
|
||||
{
|
||||
if (m_freq >= Engine::mixer()->processingSampleRate() / 2)
|
||||
if (m_freq >= Engine::audioEngine()->processingSampleRate() / 2)
|
||||
{
|
||||
BufferManager::clear(ab, frames);
|
||||
return;
|
||||
@@ -673,8 +673,7 @@ void Oscillator::updateFM( sampleFrame * _ab, const fpp_t _frames,
|
||||
m_subOsc->update( _ab, _frames, _chnl, true );
|
||||
recalcPhase();
|
||||
const float osc_coeff = m_freq * m_detuning_div_samplerate;
|
||||
const float sampleRateCorrection = 44100.0f /
|
||||
Engine::mixer()->processingSampleRate();
|
||||
const float sampleRateCorrection = 44100.0f / Engine::audioEngine()->processingSampleRate();
|
||||
|
||||
for( fpp_t frame = 0; frame < _frames; ++frame )
|
||||
{
|
||||
@@ -690,7 +689,7 @@ void Oscillator::updateFM( sampleFrame * _ab, const fpp_t _frames,
|
||||
template<>
|
||||
inline sample_t Oscillator::getSample<Oscillator::SineWave>(const float sample)
|
||||
{
|
||||
const float current_freq = m_freq * m_detuning_div_samplerate * Engine::mixer()->processingSampleRate();
|
||||
const float current_freq = m_freq * m_detuning_div_samplerate * Engine::audioEngine()->processingSampleRate();
|
||||
|
||||
if (!m_useWaveTable || current_freq < OscillatorConstants::MAX_FREQ)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <QDomElement>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "EffectChain.h"
|
||||
#include "plugins/peak_controller_effect/peak_controller_effect.h"
|
||||
|
||||
@@ -52,7 +52,7 @@ PeakController::PeakController( Model * _parent,
|
||||
connect( m_peakEffect, SIGNAL( destroyed( ) ),
|
||||
this, SLOT( handleDestroyedEffect( ) ) );
|
||||
}
|
||||
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateCoeffs() ) );
|
||||
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( updateCoeffs() ) );
|
||||
connect( m_peakEffect->attackModel(), SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateCoeffs() ), Qt::DirectConnection );
|
||||
connect( m_peakEffect->decayModel(), SIGNAL( dataChanged() ),
|
||||
@@ -76,7 +76,7 @@ void PeakController::updateValueBuffer()
|
||||
{
|
||||
if( m_coeffNeedsUpdate )
|
||||
{
|
||||
const float ratio = 44100.0f / Engine::mixer()->processingSampleRate();
|
||||
const float ratio = 44100.0f / Engine::audioEngine()->processingSampleRate();
|
||||
m_attackCoeff = 1.0f - powf( 2.0f, -0.3f * ( 1.0f - m_peakEffect->attackModel()->value() ) * ratio );
|
||||
m_decayCoeff = 1.0f - powf( 2.0f, -0.3f * ( 1.0f - m_peakEffect->decayModel()->value() ) * ratio );
|
||||
m_coeffNeedsUpdate = false;
|
||||
@@ -87,7 +87,7 @@ void PeakController::updateValueBuffer()
|
||||
float targetSample = m_peakEffect->lastSample();
|
||||
if( m_currentSample != targetSample )
|
||||
{
|
||||
const f_cnt_t frames = Engine::mixer()->framesPerPeriod();
|
||||
const f_cnt_t frames = Engine::audioEngine()->framesPerPeriod();
|
||||
float * values = m_valueBuffer.values();
|
||||
|
||||
for( f_cnt_t f = 0; f < frames; ++f )
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
*/
|
||||
|
||||
#include "PlayHandle.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "BufferManager.h"
|
||||
#include "Engine.h"
|
||||
#include "Mixer.h"
|
||||
|
||||
#include <QtCore/QThread>
|
||||
#include <QDebug>
|
||||
@@ -54,7 +54,7 @@ void PlayHandle::doProcessing()
|
||||
if( m_usesBuffer )
|
||||
{
|
||||
m_bufferReleased = false;
|
||||
BufferManager::clear(m_playHandleBuffer, Engine::mixer()->framesPerPeriod());
|
||||
BufferManager::clear(m_playHandleBuffer, Engine::audioEngine()->framesPerPeriod());
|
||||
play( buffer() );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "PresetPreviewPlayHandle.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "Engine.h"
|
||||
#include "Instrument.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "Mixer.h"
|
||||
#include "PluginFactory.h"
|
||||
#include "ProjectJournal.h"
|
||||
#include "TrackContainer.h"
|
||||
@@ -122,10 +122,10 @@ PresetPreviewPlayHandle::PresetPreviewPlayHandle( const QString & _preset_file,
|
||||
|
||||
s_previewTC->lockData();
|
||||
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
s_previewTC->setPreviewNote( nullptr );
|
||||
s_previewTC->previewInstrumentTrack()->silenceAllNotes();
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
|
||||
const bool j = Engine::projectJournal()->isJournalling();
|
||||
Engine::projectJournal()->setJournalling( false );
|
||||
@@ -170,7 +170,7 @@ PresetPreviewPlayHandle::PresetPreviewPlayHandle( const QString & _preset_file,
|
||||
s_previewTC->previewInstrumentTrack()->
|
||||
midiPort()->setMode( MidiPort::Disabled );
|
||||
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
// create note-play-handle for it
|
||||
m_previewNote = NotePlayHandleManager::acquire(
|
||||
s_previewTC->previewInstrumentTrack(), 0,
|
||||
@@ -181,9 +181,9 @@ PresetPreviewPlayHandle::PresetPreviewPlayHandle( const QString & _preset_file,
|
||||
|
||||
s_previewTC->setPreviewNote( m_previewNote );
|
||||
|
||||
Engine::mixer()->addPlayHandle( m_previewNote );
|
||||
Engine::audioEngine()->addPlayHandle( m_previewNote );
|
||||
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
s_previewTC->unlockData();
|
||||
Engine::projectJournal()->setJournalling( j );
|
||||
}
|
||||
@@ -193,13 +193,13 @@ PresetPreviewPlayHandle::PresetPreviewPlayHandle( const QString & _preset_file,
|
||||
|
||||
PresetPreviewPlayHandle::~PresetPreviewPlayHandle()
|
||||
{
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
// not muted by other preset-preview-handle?
|
||||
if (s_previewTC->testAndSetPreviewNote(m_previewNote, nullptr))
|
||||
{
|
||||
m_previewNote->noteOff();
|
||||
}
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ PresetPreviewPlayHandle::~PresetPreviewPlayHandle()
|
||||
void PresetPreviewPlayHandle::play( sampleFrame * _working_buffer )
|
||||
{
|
||||
// Do nothing; the preview instrument is played by m_previewNote, which
|
||||
// has been added to the mixer
|
||||
// has been added to the audio engine
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -77,11 +77,11 @@ const ProjectRenderer::FileEncodeDevice ProjectRenderer::fileEncodeDevices[] =
|
||||
|
||||
|
||||
|
||||
ProjectRenderer::ProjectRenderer( const Mixer::qualitySettings & qualitySettings,
|
||||
ProjectRenderer::ProjectRenderer( const AudioEngine::qualitySettings & qualitySettings,
|
||||
const OutputSettings & outputSettings,
|
||||
ExportFileFormats exportFileFormat,
|
||||
const QString & outputFilename ) :
|
||||
QThread( Engine::mixer() ),
|
||||
QThread( Engine::audioEngine() ),
|
||||
m_fileDev( NULL ),
|
||||
m_qualitySettings( qualitySettings ),
|
||||
m_progress( 0 ),
|
||||
@@ -95,7 +95,7 @@ ProjectRenderer::ProjectRenderer( const Mixer::qualitySettings & qualitySettings
|
||||
|
||||
m_fileDev = audioEncoderFactory(
|
||||
outputFilename, outputSettings, DEFAULT_CHANNELS,
|
||||
Engine::mixer(), successful );
|
||||
Engine::audioEngine(), successful );
|
||||
if( !successful )
|
||||
{
|
||||
delete m_fileDev;
|
||||
@@ -149,10 +149,9 @@ void ProjectRenderer::startProcessing()
|
||||
|
||||
if( isReady() )
|
||||
{
|
||||
// Have to do mixer stuff with GUI-thread affinity in order to
|
||||
// Have to do audio engine stuff with GUI-thread affinity in order to
|
||||
// make slots connected to sampleRateChanged()-signals being called immediately.
|
||||
Engine::mixer()->setAudioDevice( m_fileDev,
|
||||
m_qualitySettings, false, false );
|
||||
Engine::audioEngine()->setAudioDevice( m_fileDev, m_qualitySettings, false, false );
|
||||
|
||||
start(
|
||||
#ifndef LMMS_BUILD_WIN32
|
||||
@@ -182,12 +181,12 @@ void ProjectRenderer::run()
|
||||
|
||||
Engine::getSong()->startExport();
|
||||
// Skip first empty buffer.
|
||||
Engine::mixer()->nextBuffer();
|
||||
Engine::audioEngine()->nextBuffer();
|
||||
|
||||
m_progress = 0;
|
||||
|
||||
// Now start processing
|
||||
Engine::mixer()->startProcessing(false);
|
||||
Engine::audioEngine()->startProcessing(false);
|
||||
|
||||
// Continually track and emit progress percentage to listeners.
|
||||
while (!Engine::getSong()->isExportDone() && !m_abort)
|
||||
@@ -201,8 +200,8 @@ void ProjectRenderer::run()
|
||||
}
|
||||
}
|
||||
|
||||
// Notify mixer of the end of processing.
|
||||
Engine::mixer()->stopProcessing();
|
||||
// Notify the audio engine of the end of processing.
|
||||
Engine::audioEngine()->stopProcessing();
|
||||
|
||||
Engine::getSong()->stopExport();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "BufferManager.h"
|
||||
#include "RemotePlugin.h"
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "Engine.h"
|
||||
|
||||
#include <QDebug>
|
||||
@@ -278,10 +278,9 @@ bool RemotePlugin::init(const QString &pluginExecutable,
|
||||
|
||||
|
||||
|
||||
bool RemotePlugin::process( const sampleFrame * _in_buf,
|
||||
sampleFrame * _out_buf )
|
||||
bool RemotePlugin::process( const sampleFrame * _in_buf, sampleFrame * _out_buf )
|
||||
{
|
||||
const fpp_t frames = Engine::mixer()->framesPerPeriod();
|
||||
const fpp_t frames = Engine::audioEngine()->framesPerPeriod();
|
||||
|
||||
if( m_failed || !isRunning() )
|
||||
{
|
||||
@@ -431,9 +430,7 @@ void RemotePlugin::hideUI()
|
||||
|
||||
void RemotePlugin::resizeSharedProcessingMemory()
|
||||
{
|
||||
const size_t s = ( m_inputCount+m_outputCount ) *
|
||||
Engine::mixer()->framesPerPeriod() *
|
||||
sizeof( float );
|
||||
const size_t s = ( m_inputCount+m_outputCount ) * Engine::audioEngine()->framesPerPeriod() * sizeof( float );
|
||||
if( m_shm != NULL )
|
||||
{
|
||||
#ifdef USE_QT_SHMEM
|
||||
@@ -510,12 +507,12 @@ bool RemotePlugin::processMessage( const message & _m )
|
||||
|
||||
case IdSampleRateInformation:
|
||||
reply = true;
|
||||
reply_message.addInt( Engine::mixer()->processingSampleRate() );
|
||||
reply_message.addInt( Engine::audioEngine()->processingSampleRate() );
|
||||
break;
|
||||
|
||||
case IdBufferSizeInformation:
|
||||
reply = true;
|
||||
reply_message.addInt( Engine::mixer()->framesPerPeriod() );
|
||||
reply_message.addInt( Engine::audioEngine()->framesPerPeriod() );
|
||||
break;
|
||||
|
||||
case IdChangeInputCount:
|
||||
|
||||
@@ -32,23 +32,23 @@
|
||||
|
||||
|
||||
RenderManager::RenderManager(
|
||||
const Mixer::qualitySettings & qualitySettings,
|
||||
const AudioEngine::qualitySettings & qualitySettings,
|
||||
const OutputSettings & outputSettings,
|
||||
ProjectRenderer::ExportFileFormats fmt,
|
||||
QString outputPath) :
|
||||
m_qualitySettings(qualitySettings),
|
||||
m_oldQualitySettings( Engine::mixer()->currentQualitySettings() ),
|
||||
m_oldQualitySettings( Engine::audioEngine()->currentQualitySettings() ),
|
||||
m_outputSettings(outputSettings),
|
||||
m_format(fmt),
|
||||
m_outputPath(outputPath)
|
||||
{
|
||||
Engine::mixer()->storeAudioDevice();
|
||||
Engine::audioEngine()->storeAudioDevice();
|
||||
}
|
||||
|
||||
RenderManager::~RenderManager()
|
||||
{
|
||||
Engine::mixer()->restoreAudioDevice(); // Also deletes audio dev.
|
||||
Engine::mixer()->changeQuality( m_oldQualitySettings );
|
||||
Engine::audioEngine()->restoreAudioDevice(); // Also deletes audio dev.
|
||||
Engine::audioEngine()->changeQuality( m_oldQualitySettings );
|
||||
}
|
||||
|
||||
void RenderManager::abortProcessing()
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
*/
|
||||
|
||||
#include "RingBuffer.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "Engine.h"
|
||||
#include "Mixer.h"
|
||||
#include "MixHelpers.h"
|
||||
|
||||
|
||||
RingBuffer::RingBuffer( f_cnt_t size ) :
|
||||
m_fpp( Engine::mixer()->framesPerPeriod() ),
|
||||
m_samplerate( Engine::mixer()->processingSampleRate() ),
|
||||
m_fpp( Engine::audioEngine()->framesPerPeriod() ),
|
||||
m_samplerate( Engine::audioEngine()->processingSampleRate() ),
|
||||
m_size( size + m_fpp )
|
||||
{
|
||||
m_buffer = new sampleFrame[ m_size ];
|
||||
@@ -41,8 +41,8 @@ RingBuffer::RingBuffer( f_cnt_t size ) :
|
||||
|
||||
|
||||
RingBuffer::RingBuffer( float size ) :
|
||||
m_fpp( Engine::mixer()->framesPerPeriod() ),
|
||||
m_samplerate( Engine::mixer()->processingSampleRate() )
|
||||
m_fpp( Engine::audioEngine()->framesPerPeriod() ),
|
||||
m_samplerate( Engine::audioEngine()->processingSampleRate() )
|
||||
{
|
||||
m_size = msToFrames( size ) + m_fpp;
|
||||
m_buffer = new sampleFrame[ m_size ];
|
||||
@@ -88,11 +88,11 @@ void RingBuffer::setSamplerateAware( bool b )
|
||||
{
|
||||
if( b )
|
||||
{
|
||||
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSamplerate() ), Qt::UniqueConnection );
|
||||
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSamplerate() ), Qt::UniqueConnection );
|
||||
}
|
||||
else
|
||||
{
|
||||
disconnect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSamplerate() ) );
|
||||
disconnect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSamplerate() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,9 +304,9 @@ void RingBuffer::writeSwappedAddingMultiplied( sampleFrame * src, float offset,
|
||||
|
||||
void RingBuffer::updateSamplerate()
|
||||
{
|
||||
float newsize = static_cast<float>( ( m_size - m_fpp ) * Engine::mixer()->processingSampleRate() ) / m_samplerate;
|
||||
float newsize = static_cast<float>( ( m_size - m_fpp ) * Engine::audioEngine()->processingSampleRate() ) / m_samplerate;
|
||||
m_size = static_cast<f_cnt_t>( ceilf( newsize ) ) + m_fpp;
|
||||
m_samplerate = Engine::mixer()->processingSampleRate();
|
||||
m_samplerate = Engine::audioEngine()->processingSampleRate();
|
||||
delete[] m_buffer;
|
||||
m_buffer = new sampleFrame[ m_size ];
|
||||
memset( m_buffer, 0, m_size * sizeof( sampleFrame ) );
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#include "AudioEngine.h"
|
||||
#include "base64.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "DrumSynth.h"
|
||||
@@ -57,7 +58,6 @@
|
||||
#include "Engine.h"
|
||||
#include "GuiApplication.h"
|
||||
#include "lmms_constants.h"
|
||||
#include "Mixer.h"
|
||||
#include "PathUtil.h"
|
||||
|
||||
#include "FileDialog.h"
|
||||
@@ -77,10 +77,10 @@ SampleBuffer::SampleBuffer() :
|
||||
m_amplification(1.0f),
|
||||
m_reversed(false),
|
||||
m_frequency(DefaultBaseFreq),
|
||||
m_sampleRate(mixerSampleRate())
|
||||
m_sampleRate(audioEngineSampleRate())
|
||||
{
|
||||
|
||||
connect(Engine::mixer(), SIGNAL(sampleRateChanged()), this, SLOT(sampleRateChanged()));
|
||||
connect(Engine::audioEngine(), SIGNAL(sampleRateChanged()), this, SLOT(sampleRateChanged()));
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -226,9 +226,9 @@ void SampleBuffer::sampleRateChanged()
|
||||
update(true);
|
||||
}
|
||||
|
||||
sample_rate_t SampleBuffer::mixerSampleRate()
|
||||
sample_rate_t SampleBuffer::audioEngineSampleRate()
|
||||
{
|
||||
return Engine::mixer()->processingSampleRate();
|
||||
return Engine::audioEngine()->processingSampleRate();
|
||||
}
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ void SampleBuffer::update(bool keepSettings)
|
||||
const bool lock = (m_data != nullptr);
|
||||
if (lock)
|
||||
{
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
m_varLock.lockForWrite();
|
||||
MM_FREE(m_data);
|
||||
}
|
||||
@@ -266,7 +266,7 @@ void SampleBuffer::update(bool keepSettings)
|
||||
int_sample_t * buf = nullptr;
|
||||
sample_t * fbuf = nullptr;
|
||||
ch_cnt_t channels = DEFAULT_CHANNELS;
|
||||
sample_rate_t samplerate = mixerSampleRate();
|
||||
sample_rate_t samplerate = audioEngineSampleRate();
|
||||
m_frames = 0;
|
||||
|
||||
const QFileInfo fileInfo(file);
|
||||
@@ -350,7 +350,7 @@ void SampleBuffer::update(bool keepSettings)
|
||||
if (lock)
|
||||
{
|
||||
m_varLock.unlock();
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
}
|
||||
|
||||
emit sampleUpdated();
|
||||
@@ -433,11 +433,11 @@ void SampleBuffer::normalizeSampleRate(const sample_rate_t srcSR, bool keepSetti
|
||||
{
|
||||
const sample_rate_t oldRate = m_sampleRate;
|
||||
// do samplerate-conversion to our default-samplerate
|
||||
if (srcSR != mixerSampleRate())
|
||||
if (srcSR != audioEngineSampleRate())
|
||||
{
|
||||
SampleBuffer * resampled = resample(srcSR, mixerSampleRate());
|
||||
SampleBuffer * resampled = resample(srcSR, audioEngineSampleRate());
|
||||
|
||||
m_sampleRate = mixerSampleRate();
|
||||
m_sampleRate = audioEngineSampleRate();
|
||||
MM_FREE(m_data);
|
||||
m_frames = resampled->frames();
|
||||
m_data = MM_ALLOC(sampleFrame, m_frames);
|
||||
@@ -451,15 +451,15 @@ void SampleBuffer::normalizeSampleRate(const sample_rate_t srcSR, bool keepSetti
|
||||
m_loopStartFrame = m_startFrame = 0;
|
||||
m_loopEndFrame = m_endFrame = m_frames;
|
||||
}
|
||||
else if (oldRate != mixerSampleRate())
|
||||
else if (oldRate != audioEngineSampleRate())
|
||||
{
|
||||
auto oldRateToNewRateRatio = static_cast<float>(mixerSampleRate()) / oldRate;
|
||||
auto oldRateToNewRateRatio = static_cast<float>(audioEngineSampleRate()) / oldRate;
|
||||
|
||||
m_startFrame = qBound(0, f_cnt_t(m_startFrame * oldRateToNewRateRatio), m_frames);
|
||||
m_endFrame = qBound(m_startFrame, f_cnt_t(m_endFrame * oldRateToNewRateRatio), m_frames);
|
||||
m_loopStartFrame = qBound(0, f_cnt_t(m_loopStartFrame * oldRateToNewRateRatio), m_frames);
|
||||
m_loopEndFrame = qBound(m_loopStartFrame, f_cnt_t(m_loopEndFrame * oldRateToNewRateRatio), m_frames);
|
||||
m_sampleRate = mixerSampleRate();
|
||||
m_sampleRate = audioEngineSampleRate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -723,7 +723,7 @@ bool SampleBuffer::play(
|
||||
// samples that contain a tone that matches the default base note frequency of 440 Hz will
|
||||
// produce the exact requested pitch in [Hz].
|
||||
const double freqFactor = (double) freq / (double) m_frequency *
|
||||
m_sampleRate / Engine::mixer()->processingSampleRate();
|
||||
m_sampleRate / Engine::audioEngine()->processingSampleRate();
|
||||
|
||||
// calculate how many frames we have in requested pitch
|
||||
const f_cnt_t totalFramesForCurrentPitch = static_cast<f_cnt_t>(
|
||||
@@ -1272,7 +1272,7 @@ QString & SampleBuffer::toBase64(QString & dst) const
|
||||
/* FLAC__stream_encoder_set_do_exhaustive_model_search(flacEnc, true);
|
||||
FLAC__stream_encoder_set_do_mid_side_stereo(flacEnc, true);*/
|
||||
FLAC__stream_encoder_set_sample_rate(flacEnc,
|
||||
Engine::mixer()->sampleRate());
|
||||
Engine::audioEngine()->sampleRate());
|
||||
|
||||
QBuffer baWriter;
|
||||
baWriter.open(QBuffer::WriteOnly);
|
||||
@@ -1299,7 +1299,7 @@ QString & SampleBuffer::toBase64(QString & dst) const
|
||||
for (ch_cnt_t ch = 0; ch < DEFAULT_CHANNELS; ++ch)
|
||||
{
|
||||
buf[f*DEFAULT_CHANNELS+ch] = (FLAC__int32)(
|
||||
Mixer::clip(m_data[f+frameCnt][ch]) *
|
||||
AudioEngine::clip(m_data[f+frameCnt][ch]) *
|
||||
OUTPUT_SAMPLE_MULTIPLIER);
|
||||
}
|
||||
}
|
||||
@@ -1554,12 +1554,12 @@ void SampleBuffer::setAmplification(float a)
|
||||
|
||||
void SampleBuffer::setReversed(bool on)
|
||||
{
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
m_varLock.lockForWrite();
|
||||
if (m_reversed != on) { std::reverse(m_data, m_data + m_frames); }
|
||||
m_reversed = on;
|
||||
m_varLock.unlock();
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
emit sampleUpdated();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
*/
|
||||
|
||||
#include "SamplePlayHandle.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "AudioPort.h"
|
||||
#include "BBTrack.h"
|
||||
#include "Engine.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "lmms_constants.h"
|
||||
#include "Mixer.h"
|
||||
#include "SampleTCO.h"
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ SamplePlayHandle::~SamplePlayHandle()
|
||||
|
||||
void SamplePlayHandle::play( sampleFrame * buffer )
|
||||
{
|
||||
const fpp_t fpp = Engine::mixer()->framesPerPeriod();
|
||||
const fpp_t fpp = Engine::audioEngine()->framesPerPeriod();
|
||||
//play( 0, _try_parallelizing );
|
||||
if( framesDone() >= totalFrames() )
|
||||
{
|
||||
@@ -143,7 +143,8 @@ bool SamplePlayHandle::isFromTrack( const Track * _track ) const
|
||||
|
||||
f_cnt_t SamplePlayHandle::totalFrames() const
|
||||
{
|
||||
return ( m_sampleBuffer->endFrame() - m_sampleBuffer->startFrame() ) * ( Engine::mixer()->processingSampleRate() / m_sampleBuffer->sampleRate() );
|
||||
return ( m_sampleBuffer->endFrame() - m_sampleBuffer->startFrame() ) *
|
||||
( Engine::audioEngine()->processingSampleRate() / m_sampleBuffer->sampleRate() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
|
||||
|
||||
#include "SampleRecordHandle.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "BBTrack.h"
|
||||
#include "Engine.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "Mixer.h"
|
||||
#include "SampleBuffer.h"
|
||||
#include "SampleTrack.h"
|
||||
#include "debug.h"
|
||||
@@ -68,8 +68,8 @@ SampleRecordHandle::~SampleRecordHandle()
|
||||
|
||||
void SampleRecordHandle::play( sampleFrame * /*_working_buffer*/ )
|
||||
{
|
||||
const sampleFrame * recbuf = Engine::mixer()->inputBuffer();
|
||||
const f_cnt_t frames = Engine::mixer()->inputBufferFrames();
|
||||
const sampleFrame * recbuf = Engine::audioEngine()->inputBuffer();
|
||||
const f_cnt_t frames = Engine::audioEngine()->inputBufferFrames();
|
||||
writeBuffer( recbuf, frames );
|
||||
m_framesRecorded += frames;
|
||||
|
||||
@@ -120,8 +120,7 @@ void SampleRecordHandle::createSampleBuffer( SampleBuffer** sampleBuf )
|
||||
assert( data != NULL );
|
||||
|
||||
// now copy all buffers into big buffer
|
||||
for( bufferList::const_iterator it = m_buffers.begin();
|
||||
it != m_buffers.end(); ++it )
|
||||
for( bufferList::const_iterator it = m_buffers.begin(); it != m_buffers.end(); ++it )
|
||||
{
|
||||
memcpy( data_ptr, ( *it ).first, ( *it ).second *
|
||||
sizeof( sampleFrame ) );
|
||||
@@ -129,15 +128,14 @@ void SampleRecordHandle::createSampleBuffer( SampleBuffer** sampleBuf )
|
||||
}
|
||||
// create according sample-buffer out of big buffer
|
||||
*sampleBuf = new SampleBuffer( data, frames );
|
||||
( *sampleBuf)->setSampleRate( Engine::mixer()->inputSampleRate() );
|
||||
( *sampleBuf)->setSampleRate( Engine::audioEngine()->inputSampleRate() );
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void SampleRecordHandle::writeBuffer( const sampleFrame * _ab,
|
||||
const f_cnt_t _frames )
|
||||
void SampleRecordHandle::writeBuffer( const sampleFrame * _ab, const f_cnt_t _frames )
|
||||
{
|
||||
sampleFrame * buf = new sampleFrame[_frames];
|
||||
for( f_cnt_t frame = 0; frame < _frames; ++frame )
|
||||
|
||||
@@ -100,9 +100,9 @@ SampleTCO::~SampleTCO()
|
||||
{
|
||||
sampletrack->updateTcos();
|
||||
}
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
sharedObject::unref( m_sampleBuffer );
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
}
|
||||
|
||||
|
||||
@@ -125,9 +125,9 @@ const QString & SampleTCO::sampleFile() const
|
||||
|
||||
void SampleTCO::setSampleBuffer( SampleBuffer* sb )
|
||||
{
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
sharedObject::unref( m_sampleBuffer );
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
m_sampleBuffer = sb;
|
||||
updateLength();
|
||||
|
||||
@@ -172,7 +172,7 @@ void SampleTCO::toggleRecord()
|
||||
|
||||
void SampleTCO::playbackPositionChanged()
|
||||
{
|
||||
Engine::mixer()->removePlayHandlesOfTypes( getTrack(), PlayHandle::TypeSamplePlayHandle );
|
||||
Engine::audioEngine()->removePlayHandlesOfTypes( getTrack(), PlayHandle::TypeSamplePlayHandle );
|
||||
SampleTrack * st = dynamic_cast<SampleTrack*>( getTrack() );
|
||||
st->setPlayingTcos( false );
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ Song::Song() :
|
||||
this, SLOT( setTimeSignature() ), Qt::DirectConnection );
|
||||
|
||||
|
||||
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this,
|
||||
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this,
|
||||
SLOT( updateFramesPerTick() ) );
|
||||
|
||||
connect( &m_masterVolumeModel, SIGNAL( dataChanged() ),
|
||||
@@ -135,8 +135,7 @@ Song::~Song()
|
||||
|
||||
void Song::masterVolumeChanged()
|
||||
{
|
||||
Engine::mixer()->setMasterGain( m_masterVolumeModel.value() /
|
||||
100.0f );
|
||||
Engine::audioEngine()->setMasterGain( m_masterVolumeModel.value() / 100.0f );
|
||||
}
|
||||
|
||||
|
||||
@@ -144,9 +143,9 @@ void Song::masterVolumeChanged()
|
||||
|
||||
void Song::setTempo()
|
||||
{
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
const bpm_t tempo = ( bpm_t ) m_tempoModel.value();
|
||||
PlayHandleList & playHandles = Engine::mixer()->playHandles();
|
||||
PlayHandleList & playHandles = Engine::audioEngine()->playHandles();
|
||||
for( PlayHandleList::Iterator it = playHandles.begin();
|
||||
it != playHandles.end(); ++it )
|
||||
{
|
||||
@@ -158,7 +157,7 @@ void Song::setTempo()
|
||||
nph->unlock();
|
||||
}
|
||||
}
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
|
||||
Engine::updateFramesPerTick();
|
||||
|
||||
@@ -272,7 +271,7 @@ void Song::processNextBuffer()
|
||||
}
|
||||
|
||||
const auto framesPerTick = Engine::framesPerTick();
|
||||
const auto framesPerPeriod = Engine::mixer()->framesPerPeriod();
|
||||
const auto framesPerPeriod = Engine::audioEngine()->framesPerPeriod();
|
||||
|
||||
f_cnt_t frameOffsetInPeriod = 0;
|
||||
|
||||
@@ -640,7 +639,7 @@ void Song::stop()
|
||||
}
|
||||
|
||||
// To avoid race conditions with the processing threads
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
|
||||
TimeLineWidget * tl = m_playPos[m_playMode].m_timeLine;
|
||||
m_paused = false;
|
||||
@@ -688,7 +687,7 @@ void Song::stop()
|
||||
/ (double) Engine::framesPerTick() );
|
||||
|
||||
// remove all note-play-handles that are active
|
||||
Engine::mixer()->clear();
|
||||
Engine::audioEngine()->clear();
|
||||
|
||||
// Moves the control of the models that were processed on the last frame
|
||||
// back to their controllers.
|
||||
@@ -701,7 +700,7 @@ void Song::stop()
|
||||
|
||||
m_playMode = Mode_None;
|
||||
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
|
||||
emit stopped();
|
||||
emit playbackStateChanged();
|
||||
@@ -865,7 +864,7 @@ void Song::clearProject()
|
||||
}
|
||||
|
||||
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
|
||||
if( gui && gui->getBBEditor() )
|
||||
{
|
||||
@@ -909,7 +908,7 @@ void Song::clearProject()
|
||||
AutomationPattern::globalAutomationPattern( &m_masterPitchModel )->
|
||||
clear();
|
||||
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
|
||||
if( gui && gui->getProjectNotes() )
|
||||
{
|
||||
@@ -1066,7 +1065,7 @@ void Song::loadProject( const QString & fileName )
|
||||
|
||||
clearErrors();
|
||||
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
|
||||
// get the header information from the DOM
|
||||
m_tempoModel.loadSettings( dataFile.head(), "bpm" );
|
||||
@@ -1187,7 +1186,7 @@ void Song::loadProject( const QString & fileName )
|
||||
AutomationPattern::resolveAllIDs();
|
||||
|
||||
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
|
||||
ConfigManager::inst()->addRecentlyOpenedProject( fileName );
|
||||
|
||||
@@ -1538,10 +1537,10 @@ void Song::setScale(unsigned int index, std::shared_ptr<Scale> newScale)
|
||||
{
|
||||
if (index >= MaxScaleCount) {index = 0;}
|
||||
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
std::atomic_store(&m_scales[index], newScale);
|
||||
emit scaleListChanged(index);
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
}
|
||||
|
||||
|
||||
@@ -1549,8 +1548,8 @@ void Song::setKeymap(unsigned int index, std::shared_ptr<Keymap> newMap)
|
||||
{
|
||||
if (index >= MaxKeymapCount) {index = 0;}
|
||||
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
std::atomic_store(&m_keymaps[index], newMap);
|
||||
emit keymapListChanged(index);
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ Track::~Track()
|
||||
*/
|
||||
Track * Track::create( TrackTypes tt, TrackContainer * tc )
|
||||
{
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
|
||||
Track * t = NULL;
|
||||
|
||||
@@ -130,7 +130,7 @@ Track * Track::create( TrackTypes tt, TrackContainer * tc )
|
||||
|
||||
tc->updateAfterTrackAdd();
|
||||
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
|
||||
return t;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ Track * Track::create( TrackTypes tt, TrackContainer * tc )
|
||||
*/
|
||||
Track * Track::create( const QDomElement & element, TrackContainer * tc )
|
||||
{
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
|
||||
Track * t = create(
|
||||
static_cast<TrackTypes>( element.attribute( "type" ).toInt() ),
|
||||
@@ -155,7 +155,7 @@ Track * Track::create( const QDomElement & element, TrackContainer * tc )
|
||||
t->restoreState( element );
|
||||
}
|
||||
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -92,9 +92,9 @@ void TrackContentObject::movePosition( const TimePos & pos )
|
||||
TimePos newPos = qMax(0, pos.getTicks());
|
||||
if (m_startPosition != newPos)
|
||||
{
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
m_startPosition = newPos;
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
Engine::getSong()->updateLength();
|
||||
emit positionChanged();
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "AudioEngine.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "Engine.h"
|
||||
#include "Mixer.h"
|
||||
#include "VstSyncController.h"
|
||||
#include "RemotePlugin.h"
|
||||
|
||||
@@ -48,7 +48,7 @@ VstSyncController::VstSyncController() :
|
||||
{
|
||||
if( ConfigManager::inst()->value( "ui", "syncvstplugins" ).toInt() )
|
||||
{
|
||||
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSampleRate() ) );
|
||||
connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSampleRate() ) );
|
||||
|
||||
#ifdef USE_QT_SHMEM
|
||||
if ( m_shm.create( sizeof( VstSyncData ) ) )
|
||||
@@ -98,7 +98,7 @@ VstSyncController::VstSyncController() :
|
||||
}
|
||||
|
||||
m_syncData->isPlaying = false;
|
||||
m_syncData->m_bufferSize = Engine::mixer()->framesPerPeriod();
|
||||
m_syncData->m_bufferSize = Engine::audioEngine()->framesPerPeriod();
|
||||
m_syncData->timeSigNumer = 4;
|
||||
m_syncData->timeSigDenom = 4;
|
||||
|
||||
@@ -170,7 +170,7 @@ void VstSyncController::startCycle( int startTick, int endTick )
|
||||
|
||||
void VstSyncController::update()
|
||||
{
|
||||
m_syncData->m_bufferSize = Engine::mixer()->framesPerPeriod();
|
||||
m_syncData->m_bufferSize = Engine::audioEngine()->framesPerPeriod();
|
||||
|
||||
#ifdef VST_SNC_LATENCY
|
||||
m_syncData->m_latency = m_syncData->m_bufferSize * m_syncData->m_bpm / ( (float) m_syncData->m_sampleRate * 60 );
|
||||
@@ -181,7 +181,7 @@ void VstSyncController::update()
|
||||
|
||||
void VstSyncController::updateSampleRate()
|
||||
{
|
||||
m_syncData->m_sampleRate = Engine::mixer()->processingSampleRate();
|
||||
m_syncData->m_sampleRate = Engine::audioEngine()->processingSampleRate();
|
||||
|
||||
#ifdef VST_SNC_LATENCY
|
||||
m_syncData->m_latency = m_syncData->m_bufferSize * m_syncData->m_bpm / ( (float) m_syncData->m_sampleRate * 60 );
|
||||
|
||||
@@ -30,17 +30,17 @@
|
||||
#ifdef LMMS_HAVE_ALSA
|
||||
|
||||
#include "endian_handling.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "Engine.h"
|
||||
#include "Mixer.h"
|
||||
#include "gui_templates.h"
|
||||
|
||||
|
||||
AudioAlsa::AudioAlsa( bool & _success_ful, Mixer* _mixer ) :
|
||||
AudioAlsa::AudioAlsa( bool & _success_ful, AudioEngine* _audioEngine ) :
|
||||
AudioDevice( qBound<ch_cnt_t>(
|
||||
DEFAULT_CHANNELS,
|
||||
ConfigManager::inst()->value( "audioalsa", "channels" ).toInt(),
|
||||
SURROUND_CHANNELS ), _mixer ),
|
||||
SURROUND_CHANNELS ), _audioEngine ),
|
||||
m_handle( NULL ),
|
||||
m_hwParams( NULL ),
|
||||
m_swParams( NULL ),
|
||||
@@ -255,7 +255,7 @@ void AudioAlsa::applyQualitySettings()
|
||||
{
|
||||
if( hqAudio() )
|
||||
{
|
||||
setSampleRate( Engine::mixer()->processingSampleRate() );
|
||||
setSampleRate( Engine::audioEngine()->processingSampleRate() );
|
||||
|
||||
if( m_handle != NULL )
|
||||
{
|
||||
@@ -296,14 +296,11 @@ void AudioAlsa::applyQualitySettings()
|
||||
|
||||
void AudioAlsa::run()
|
||||
{
|
||||
surroundSampleFrame * temp =
|
||||
new surroundSampleFrame[mixer()->framesPerPeriod()];
|
||||
int_sample_t * outbuf =
|
||||
new int_sample_t[mixer()->framesPerPeriod() *
|
||||
channels()];
|
||||
surroundSampleFrame * temp = new surroundSampleFrame[audioEngine()->framesPerPeriod()];
|
||||
int_sample_t * outbuf = new int_sample_t[audioEngine()->framesPerPeriod() * channels()];
|
||||
int_sample_t * pcmbuf = new int_sample_t[m_periodSize * channels()];
|
||||
|
||||
int outbuf_size = mixer()->framesPerPeriod() * channels();
|
||||
int outbuf_size = audioEngine()->framesPerPeriod() * channels();
|
||||
int outbuf_pos = 0;
|
||||
int pcmbuf_size = m_periodSize * channels();
|
||||
|
||||
@@ -328,7 +325,7 @@ void AudioAlsa::run()
|
||||
outbuf_size = frames * channels();
|
||||
|
||||
convertToS16( temp, frames,
|
||||
mixer()->masterGain(),
|
||||
audioEngine()->masterGain(),
|
||||
outbuf,
|
||||
m_convertEndian );
|
||||
}
|
||||
@@ -429,7 +426,7 @@ int AudioAlsa::setHWParams( const ch_cnt_t _channels, snd_pcm_access_t _access )
|
||||
sampleRate(), 0 ) ) < 0 )
|
||||
{
|
||||
if( ( err = snd_pcm_hw_params_set_rate( m_handle, m_hwParams,
|
||||
mixer()->baseSampleRate(), 0 ) ) < 0 )
|
||||
audioEngine()->baseSampleRate(), 0 ) ) < 0 )
|
||||
{
|
||||
printf( "Could not set sample rate: %s\n",
|
||||
snd_strerror( err ) );
|
||||
@@ -437,7 +434,7 @@ int AudioAlsa::setHWParams( const ch_cnt_t _channels, snd_pcm_access_t _access )
|
||||
}
|
||||
}
|
||||
|
||||
m_periodSize = mixer()->framesPerPeriod();
|
||||
m_periodSize = audioEngine()->framesPerPeriod();
|
||||
m_bufferSize = m_periodSize * 8;
|
||||
dir = 0;
|
||||
err = snd_pcm_hw_params_set_period_size_near( m_handle, m_hwParams,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* AudioDevice.cpp - base-class for audio-devices used by LMMS-mixer
|
||||
* AudioDevice.cpp - base-class for audio-devices used by LMMS audio engine
|
||||
*
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
@@ -25,22 +25,22 @@
|
||||
#include <cstring>
|
||||
|
||||
#include "AudioDevice.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "debug.h"
|
||||
#include "Mixer.h"
|
||||
|
||||
|
||||
|
||||
AudioDevice::AudioDevice( const ch_cnt_t _channels, Mixer* _mixer ) :
|
||||
AudioDevice::AudioDevice( const ch_cnt_t _channels, AudioEngine* _audioEngine ) :
|
||||
m_supportsCapture( false ),
|
||||
m_sampleRate( _mixer->processingSampleRate() ),
|
||||
m_sampleRate( _audioEngine->processingSampleRate() ),
|
||||
m_channels( _channels ),
|
||||
m_mixer( _mixer ),
|
||||
m_buffer( new surroundSampleFrame[mixer()->framesPerPeriod()] )
|
||||
m_audioEngine( _audioEngine ),
|
||||
m_buffer( new surroundSampleFrame[audioEngine()->framesPerPeriod()] )
|
||||
{
|
||||
int error;
|
||||
if( ( m_srcState = src_new(
|
||||
mixer()->currentQualitySettings().libsrcInterpolation(),
|
||||
audioEngine()->currentQualitySettings().libsrcInterpolation(),
|
||||
SURROUND_CHANNELS, &error ) ) == NULL )
|
||||
{
|
||||
printf( "Error: src_new() failed in audio_device.cpp!\n" );
|
||||
@@ -67,7 +67,7 @@ void AudioDevice::processNextBuffer()
|
||||
const fpp_t frames = getNextBuffer( m_buffer );
|
||||
if( frames )
|
||||
{
|
||||
writeBuffer( m_buffer, frames, mixer()->masterGain() );
|
||||
writeBuffer( m_buffer, frames, audioEngine()->masterGain() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -80,8 +80,8 @@ void AudioDevice::processNextBuffer()
|
||||
|
||||
fpp_t AudioDevice::getNextBuffer( surroundSampleFrame * _ab )
|
||||
{
|
||||
fpp_t frames = mixer()->framesPerPeriod();
|
||||
const surroundSampleFrame * b = mixer()->nextBuffer();
|
||||
fpp_t frames = audioEngine()->framesPerPeriod();
|
||||
const surroundSampleFrame * b = audioEngine()->nextBuffer();
|
||||
if( !b )
|
||||
{
|
||||
return 0;
|
||||
@@ -91,10 +91,9 @@ fpp_t AudioDevice::getNextBuffer( surroundSampleFrame * _ab )
|
||||
lock();
|
||||
|
||||
// resample if necessary
|
||||
if( mixer()->processingSampleRate() != m_sampleRate )
|
||||
if( audioEngine()->processingSampleRate() != m_sampleRate )
|
||||
{
|
||||
frames = resample( b, frames, _ab, mixer()->processingSampleRate(),
|
||||
m_sampleRate );
|
||||
frames = resample( b, frames, _ab, audioEngine()->processingSampleRate(), m_sampleRate );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -104,7 +103,7 @@ fpp_t AudioDevice::getNextBuffer( surroundSampleFrame * _ab )
|
||||
// release lock
|
||||
unlock();
|
||||
|
||||
if( mixer()->hasFifoWriter() )
|
||||
if( audioEngine()->hasFifoWriter() )
|
||||
{
|
||||
delete[] b;
|
||||
}
|
||||
@@ -117,7 +116,7 @@ fpp_t AudioDevice::getNextBuffer( surroundSampleFrame * _ab )
|
||||
|
||||
void AudioDevice::stopProcessing()
|
||||
{
|
||||
if( mixer()->hasFifoWriter() )
|
||||
if( audioEngine()->hasFifoWriter() )
|
||||
{
|
||||
while( m_inProcess )
|
||||
{
|
||||
@@ -151,7 +150,7 @@ void AudioDevice::applyQualitySettings()
|
||||
|
||||
int error;
|
||||
if( ( m_srcState = src_new(
|
||||
mixer()->currentQualitySettings().libsrcInterpolation(),
|
||||
audioEngine()->currentQualitySettings().libsrcInterpolation(),
|
||||
SURROUND_CHANNELS, &error ) ) == NULL )
|
||||
{
|
||||
printf( "Error: src_new() failed in audio_device.cpp!\n" );
|
||||
@@ -222,7 +221,7 @@ int AudioDevice::convertToS16( const surroundSampleFrame * _ab,
|
||||
{
|
||||
for( ch_cnt_t chnl = 0; chnl < channels(); ++chnl )
|
||||
{
|
||||
temp = static_cast<int_sample_t>( Mixer::clip( _ab[frame][chnl] * _master_gain ) * OUTPUT_SAMPLE_MULTIPLIER );
|
||||
temp = static_cast<int_sample_t>( AudioEngine::clip( _ab[frame][chnl] * _master_gain ) * OUTPUT_SAMPLE_MULTIPLIER );
|
||||
|
||||
( _output_buffer + frame * channels() )[chnl] =
|
||||
( temp & 0x00ff ) << 8 |
|
||||
@@ -238,7 +237,7 @@ int AudioDevice::convertToS16( const surroundSampleFrame * _ab,
|
||||
{
|
||||
( _output_buffer + frame * channels() )[chnl] =
|
||||
static_cast<int_sample_t>(
|
||||
Mixer::clip( _ab[frame][chnl] *
|
||||
AudioEngine::clip( _ab[frame][chnl] *
|
||||
_master_gain ) *
|
||||
OUTPUT_SAMPLE_MULTIPLIER );
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
AudioFileDevice::AudioFileDevice( OutputSettings const & outputSettings,
|
||||
const ch_cnt_t _channels,
|
||||
const QString & _file,
|
||||
Mixer* _mixer ) :
|
||||
AudioDevice( _channels, _mixer ),
|
||||
AudioEngine* _audioEngine ) :
|
||||
AudioDevice( _channels, _audioEngine ),
|
||||
m_outputFile( _file ),
|
||||
m_outputSettings(outputSettings)
|
||||
{
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
|
||||
#include "AudioFileFlac.h"
|
||||
#include "endian_handling.h"
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
|
||||
AudioFileFlac::AudioFileFlac(OutputSettings const& outputSettings, ch_cnt_t const channels, bool& successful, QString const& file, Mixer* mixer):
|
||||
AudioFileDevice(outputSettings,channels,file,mixer),
|
||||
AudioFileFlac::AudioFileFlac(OutputSettings const& outputSettings, ch_cnt_t const channels, bool& successful, QString const& file, AudioEngine* audioEngine):
|
||||
AudioFileDevice(outputSettings,channels,file,audioEngine),
|
||||
m_sf(nullptr)
|
||||
{
|
||||
successful = outputFileOpened() && startEncoding();
|
||||
@@ -47,7 +47,7 @@ bool AudioFileFlac::startEncoding()
|
||||
{
|
||||
m_sfinfo.samplerate=sampleRate();
|
||||
m_sfinfo.channels=channels();
|
||||
m_sfinfo.frames = mixer()->framesPerPeriod();
|
||||
m_sfinfo.frames = audioEngine()->framesPerPeriod();
|
||||
m_sfinfo.sections=1;
|
||||
m_sfinfo.seekable=0;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#ifdef LMMS_HAVE_MP3LAME
|
||||
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
@@ -36,8 +36,8 @@ AudioFileMP3::AudioFileMP3( OutputSettings const & outputSettings,
|
||||
const ch_cnt_t channels,
|
||||
bool & successful,
|
||||
const QString & file,
|
||||
Mixer* mixer ) :
|
||||
AudioFileDevice( outputSettings, channels, file, mixer )
|
||||
AudioEngine* audioEngine ) :
|
||||
AudioFileDevice( outputSettings, channels, file, audioEngine )
|
||||
{
|
||||
successful = true;
|
||||
// For now only accept stereo sources
|
||||
|
||||
@@ -36,15 +36,15 @@
|
||||
#include <string>
|
||||
#include <vorbis/vorbisenc.h>
|
||||
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
|
||||
|
||||
AudioFileOgg::AudioFileOgg( OutputSettings const & outputSettings,
|
||||
const ch_cnt_t channels,
|
||||
bool & successful,
|
||||
const QString & file,
|
||||
Mixer* mixer ) :
|
||||
AudioFileDevice( outputSettings, channels, file, mixer )
|
||||
AudioEngine* audioEngine ) :
|
||||
AudioFileDevice( outputSettings, channels, file, audioEngine )
|
||||
{
|
||||
m_ok = successful = outputFileOpened() && startEncoding();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include "AudioFileWave.h"
|
||||
#include "endian_handling.h"
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
@@ -34,8 +34,8 @@
|
||||
AudioFileWave::AudioFileWave( OutputSettings const & outputSettings,
|
||||
const ch_cnt_t channels, bool & successful,
|
||||
const QString & file,
|
||||
Mixer* mixer ) :
|
||||
AudioFileDevice( outputSettings, channels, file, mixer ),
|
||||
AudioEngine* audioEngine ) :
|
||||
AudioFileDevice( outputSettings, channels, file, audioEngine ),
|
||||
m_sf( NULL )
|
||||
{
|
||||
successful = outputFileOpened() && startEncoding();
|
||||
@@ -56,7 +56,7 @@ bool AudioFileWave::startEncoding()
|
||||
{
|
||||
m_si.samplerate = sampleRate();
|
||||
m_si.channels = channels();
|
||||
m_si.frames = mixer()->framesPerPeriod();
|
||||
m_si.frames = audioEngine()->framesPerPeriod();
|
||||
m_si.sections = 1;
|
||||
m_si.seekable = 0;
|
||||
|
||||
|
||||
@@ -37,21 +37,21 @@
|
||||
#include "LcdSpinBox.h"
|
||||
#include "AudioPort.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "MidiJack.h"
|
||||
|
||||
|
||||
|
||||
AudioJack::AudioJack( bool & _success_ful, Mixer* _mixer ) :
|
||||
AudioJack::AudioJack( bool & _success_ful, AudioEngine* _audioEngine ) :
|
||||
AudioDevice( qBound<int>(
|
||||
DEFAULT_CHANNELS,
|
||||
ConfigManager::inst()->value( "audiojack", "channels" ).toInt(),
|
||||
SURROUND_CHANNELS ), _mixer ),
|
||||
SURROUND_CHANNELS ), _audioEngine ),
|
||||
m_client( NULL ),
|
||||
m_active( false ),
|
||||
m_midiClient( NULL ),
|
||||
m_tempOutBufs( new jack_default_audio_sample_t *[channels()] ),
|
||||
m_outBuf( new surroundSampleFrame[mixer()->framesPerPeriod()] ),
|
||||
m_outBuf( new surroundSampleFrame[audioEngine()->framesPerPeriod()] ),
|
||||
m_framesDoneInCurBuf( 0 ),
|
||||
m_framesToDoInCurBuf( 0 )
|
||||
{
|
||||
@@ -218,7 +218,7 @@ void AudioJack::startProcessing()
|
||||
|
||||
|
||||
// try to sync JACK's and LMMS's buffer-size
|
||||
// jack_set_buffer_size( m_client, mixer()->framesPerPeriod() );
|
||||
// jack_set_buffer_size( m_client, audioEngine()->framesPerPeriod() );
|
||||
|
||||
|
||||
|
||||
@@ -264,7 +264,7 @@ void AudioJack::applyQualitySettings()
|
||||
{
|
||||
if( hqAudio() )
|
||||
{
|
||||
setSampleRate( Engine::mixer()->processingSampleRate() );
|
||||
setSampleRate( Engine::audioEngine()->processingSampleRate() );
|
||||
|
||||
if( jack_get_sample_rate( m_client ) != sampleRate() )
|
||||
{
|
||||
@@ -363,7 +363,7 @@ int AudioJack::processCallback( jack_nframes_t _nframes, void * _udata )
|
||||
}
|
||||
|
||||
#ifdef AUDIO_PORT_SUPPORT
|
||||
const int frames = qMin<int>( _nframes, mixer()->framesPerPeriod() );
|
||||
const int frames = qMin<int>( _nframes, audioEngine()->framesPerPeriod() );
|
||||
for( JackPortMap::iterator it = m_portMap.begin();
|
||||
it != m_portMap.end(); ++it )
|
||||
{
|
||||
@@ -392,7 +392,7 @@ int AudioJack::processCallback( jack_nframes_t _nframes, void * _udata )
|
||||
_nframes,
|
||||
m_framesToDoInCurBuf -
|
||||
m_framesDoneInCurBuf );
|
||||
const float gain = mixer()->masterGain();
|
||||
const float gain = audioEngine()->masterGain();
|
||||
for( int c = 0; c < channels(); ++c )
|
||||
{
|
||||
jack_default_audio_sample_t * o = m_tempOutBufs[c];
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include "endian_handling.h"
|
||||
#include "LcdSpinBox.h"
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "Engine.h"
|
||||
#include "gui_templates.h"
|
||||
|
||||
@@ -68,11 +68,11 @@
|
||||
|
||||
|
||||
|
||||
AudioOss::AudioOss( bool & _success_ful, Mixer* _mixer ) :
|
||||
AudioOss::AudioOss( bool & _success_ful, AudioEngine* _audioEngine ) :
|
||||
AudioDevice( qBound<ch_cnt_t>(
|
||||
DEFAULT_CHANNELS,
|
||||
ConfigManager::inst()->value( "audiooss", "channels" ).toInt(),
|
||||
SURROUND_CHANNELS ), _mixer ),
|
||||
SURROUND_CHANNELS ), _audioEngine ),
|
||||
m_convertEndian( false )
|
||||
{
|
||||
_success_ful = false;
|
||||
@@ -100,7 +100,7 @@ AudioOss::AudioOss( bool & _success_ful, Mixer* _mixer ) :
|
||||
|
||||
int frag_spec;
|
||||
for( frag_spec = 0; static_cast<int>( 0x01 << frag_spec ) <
|
||||
mixer()->framesPerPeriod() * channels() *
|
||||
audioEngine()->framesPerPeriod() * channels() *
|
||||
BYTES_PER_INT_SAMPLE;
|
||||
++frag_spec )
|
||||
{
|
||||
@@ -172,7 +172,7 @@ AudioOss::AudioOss( bool & _success_ful, Mixer* _mixer ) :
|
||||
}
|
||||
if( value != sampleRate() )
|
||||
{
|
||||
value = mixer()->baseSampleRate();
|
||||
value = audioEngine()->baseSampleRate();
|
||||
if ( ioctl( m_audioFD, SNDCTL_DSP_SPEED, &value ) < 0 )
|
||||
{
|
||||
perror( "SNDCTL_DSP_SPEED" );
|
||||
@@ -261,7 +261,7 @@ void AudioOss::applyQualitySettings()
|
||||
{
|
||||
if( hqAudio() )
|
||||
{
|
||||
setSampleRate( Engine::mixer()->processingSampleRate() );
|
||||
setSampleRate( Engine::audioEngine()->processingSampleRate() );
|
||||
|
||||
unsigned int value = sampleRate();
|
||||
if ( ioctl( m_audioFD, SNDCTL_DSP_SPEED, &value ) < 0 )
|
||||
@@ -272,7 +272,7 @@ void AudioOss::applyQualitySettings()
|
||||
}
|
||||
if( value != sampleRate() )
|
||||
{
|
||||
value = mixer()->baseSampleRate();
|
||||
value = audioEngine()->baseSampleRate();
|
||||
if ( ioctl( m_audioFD, SNDCTL_DSP_SPEED, &value ) < 0 )
|
||||
{
|
||||
perror( "SNDCTL_DSP_SPEED" );
|
||||
@@ -291,11 +291,8 @@ void AudioOss::applyQualitySettings()
|
||||
|
||||
void AudioOss::run()
|
||||
{
|
||||
surroundSampleFrame * temp =
|
||||
new surroundSampleFrame[mixer()->framesPerPeriod()];
|
||||
int_sample_t * outbuf =
|
||||
new int_sample_t[mixer()->framesPerPeriod() *
|
||||
channels()];
|
||||
surroundSampleFrame * temp = new surroundSampleFrame[audioEngine()->framesPerPeriod()];
|
||||
int_sample_t * outbuf = new int_sample_t[audioEngine()->framesPerPeriod() * channels()];
|
||||
|
||||
while( true )
|
||||
{
|
||||
@@ -305,9 +302,7 @@ void AudioOss::run()
|
||||
break;
|
||||
}
|
||||
|
||||
int bytes = convertToS16( temp, frames,
|
||||
mixer()->masterGain(), outbuf,
|
||||
m_convertEndian );
|
||||
int bytes = convertToS16( temp, frames, audioEngine()->masterGain(), outbuf, m_convertEndian );
|
||||
if( write( m_audioFD, outbuf, bytes ) != bytes )
|
||||
{
|
||||
break;
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
|
||||
#include "AudioPort.h"
|
||||
#include "AudioDevice.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "EffectChain.h"
|
||||
#include "FxMixer.h"
|
||||
#include "Engine.h"
|
||||
#include "Mixer.h"
|
||||
#include "MixHelpers.h"
|
||||
#include "BufferManager.h"
|
||||
|
||||
@@ -45,7 +45,7 @@ AudioPort::AudioPort( const QString & _name, bool _has_effect_chain,
|
||||
m_panningModel( panningModel ),
|
||||
m_mutedModel( mutedModel )
|
||||
{
|
||||
Engine::mixer()->addAudioPort( this );
|
||||
Engine::audioEngine()->addAudioPort( this );
|
||||
setExtOutputEnabled( true );
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ AudioPort::AudioPort( const QString & _name, bool _has_effect_chain,
|
||||
AudioPort::~AudioPort()
|
||||
{
|
||||
setExtOutputEnabled( false );
|
||||
Engine::mixer()->removeAudioPort( this );
|
||||
Engine::audioEngine()->removeAudioPort( this );
|
||||
BufferManager::release( m_portBuffer );
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ void AudioPort::setExtOutputEnabled( bool _enabled )
|
||||
m_extOutputEnabled = _enabled;
|
||||
if( m_extOutputEnabled )
|
||||
{
|
||||
Engine::mixer()->audioDev()->registerPort( this );
|
||||
Engine::audioEngine()->audioDev()->registerPort( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
Engine::mixer()->audioDev()->unregisterPort( this );
|
||||
Engine::audioEngine()->audioDev()->unregisterPort( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ void AudioPort::setExtOutputEnabled( bool _enabled )
|
||||
void AudioPort::setName( const QString & _name )
|
||||
{
|
||||
m_name = _name;
|
||||
Engine::mixer()->audioDev()->renamePort( this );
|
||||
Engine::audioEngine()->audioDev()->renamePort( this );
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ bool AudioPort::processEffects()
|
||||
{
|
||||
if( m_effects )
|
||||
{
|
||||
bool more = m_effects->processAudioBuffer( m_portBuffer, Engine::mixer()->framesPerPeriod(), m_bufferUsage );
|
||||
bool more = m_effects->processAudioBuffer( m_portBuffer, Engine::audioEngine()->framesPerPeriod(), m_bufferUsage );
|
||||
return more;
|
||||
}
|
||||
return false;
|
||||
@@ -108,7 +108,7 @@ void AudioPort::doProcessing()
|
||||
return;
|
||||
}
|
||||
|
||||
const fpp_t fpp = Engine::mixer()->framesPerPeriod();
|
||||
const fpp_t fpp = Engine::audioEngine()->framesPerPeriod();
|
||||
|
||||
// clear the buffer
|
||||
BufferManager::clear( m_portBuffer, fpp );
|
||||
|
||||
@@ -49,22 +49,22 @@ void AudioPortAudioSetupUtil::updateChannels()
|
||||
#include "ConfigManager.h"
|
||||
#include "gui_templates.h"
|
||||
#include "ComboBox.h"
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
|
||||
|
||||
AudioPortAudio::AudioPortAudio( bool & _success_ful, Mixer * _mixer ) :
|
||||
AudioPortAudio::AudioPortAudio( bool & _success_ful, AudioEngine * _audioEngine ) :
|
||||
AudioDevice( qBound<ch_cnt_t>(
|
||||
DEFAULT_CHANNELS,
|
||||
ConfigManager::inst()->value( "audioportaudio", "channels" ).toInt(),
|
||||
SURROUND_CHANNELS ), _mixer ),
|
||||
SURROUND_CHANNELS ), _audioEngine ),
|
||||
m_paStream( NULL ),
|
||||
m_wasPAInitError( false ),
|
||||
m_outBuf( new surroundSampleFrame[mixer()->framesPerPeriod()] ),
|
||||
m_outBuf( new surroundSampleFrame[audioEngine()->framesPerPeriod()] ),
|
||||
m_outBufPos( 0 )
|
||||
{
|
||||
_success_ful = false;
|
||||
|
||||
m_outBufSize = mixer()->framesPerPeriod();
|
||||
m_outBufSize = audioEngine()->framesPerPeriod();
|
||||
|
||||
PaError err = Pa_Initialize();
|
||||
|
||||
@@ -111,12 +111,12 @@ AudioPortAudio::AudioPortAudio( bool & _success_ful, Mixer * _mixer ) :
|
||||
return;
|
||||
}
|
||||
|
||||
double inLatency = 0;//(double)mixer()->framesPerPeriod() / (double)sampleRate();
|
||||
double outLatency = 0;//(double)mixer()->framesPerPeriod() / (double)sampleRate();
|
||||
double inLatency = 0;//(double)audioEngine()->framesPerPeriod() / (double)sampleRate();
|
||||
double outLatency = 0;//(double)audioEngine()->framesPerPeriod() / (double)sampleRate();
|
||||
|
||||
//inLatency = Pa_GetDeviceInfo( inDevIdx )->defaultLowInputLatency;
|
||||
//outLatency = Pa_GetDeviceInfo( outDevIdx )->defaultLowOutputLatency;
|
||||
const int samples = mixer()->framesPerPeriod();
|
||||
const int samples = audioEngine()->framesPerPeriod();
|
||||
|
||||
// Configure output parameters.
|
||||
m_outputParameters.device = outDevIdx;
|
||||
@@ -169,7 +169,7 @@ AudioPortAudio::AudioPortAudio( bool & _success_ful, Mixer * _mixer ) :
|
||||
printf( "Input device: '%s' backend: '%s'\n", Pa_GetDeviceInfo( inDevIdx )->name, Pa_GetHostApiInfo( Pa_GetDeviceInfo( inDevIdx )->hostApi )->name );
|
||||
printf( "Output device: '%s' backend: '%s'\n", Pa_GetDeviceInfo( outDevIdx )->name, Pa_GetHostApiInfo( Pa_GetDeviceInfo( outDevIdx )->hostApi )->name );
|
||||
|
||||
// TODO: debug Mixer::pushInputFrames()
|
||||
// TODO: debug AudioEngine::pushInputFrames()
|
||||
//m_supportsCapture = true;
|
||||
|
||||
_success_ful = true;
|
||||
@@ -229,8 +229,8 @@ void AudioPortAudio::applyQualitySettings()
|
||||
if( hqAudio() )
|
||||
{
|
||||
|
||||
setSampleRate( Engine::mixer()->processingSampleRate() );
|
||||
int samples = mixer()->framesPerPeriod();
|
||||
setSampleRate( Engine::audioEngine()->processingSampleRate() );
|
||||
int samples = audioEngine()->framesPerPeriod();
|
||||
|
||||
PaError err = Pa_OpenStream(
|
||||
&m_paStream,
|
||||
@@ -261,8 +261,7 @@ int AudioPortAudio::process_callback(
|
||||
{
|
||||
if( supportsCapture() )
|
||||
{
|
||||
mixer()->pushInputFrames( (sampleFrame*)_inputBuffer,
|
||||
_framesPerBuffer );
|
||||
audioEngine()->pushInputFrames( (sampleFrame*)_inputBuffer, _framesPerBuffer );
|
||||
}
|
||||
|
||||
if( m_stopped )
|
||||
@@ -290,14 +289,14 @@ int AudioPortAudio::process_callback(
|
||||
const int min_len = qMin( (int)_framesPerBuffer,
|
||||
m_outBufSize - m_outBufPos );
|
||||
|
||||
float master_gain = mixer()->masterGain();
|
||||
float master_gain = audioEngine()->masterGain();
|
||||
|
||||
for( fpp_t frame = 0; frame < min_len; ++frame )
|
||||
{
|
||||
for( ch_cnt_t chnl = 0; chnl < channels(); ++chnl )
|
||||
{
|
||||
( _outputBuffer + frame * channels() )[chnl] =
|
||||
Mixer::clip( m_outBuf[frame][chnl] *
|
||||
AudioEngine::clip( m_outBuf[frame][chnl] *
|
||||
master_gain );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include "ConfigManager.h"
|
||||
#include "LcdSpinBox.h"
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "gui_templates.h"
|
||||
#include "Engine.h"
|
||||
|
||||
@@ -44,11 +44,11 @@ static void stream_write_callback(pa_stream *s, size_t length, void *userdata)
|
||||
|
||||
|
||||
|
||||
AudioPulseAudio::AudioPulseAudio( bool & _success_ful, Mixer* _mixer ) :
|
||||
AudioPulseAudio::AudioPulseAudio( bool & _success_ful, AudioEngine* _audioEngine ) :
|
||||
AudioDevice( qBound<ch_cnt_t>(
|
||||
DEFAULT_CHANNELS,
|
||||
ConfigManager::inst()->value( "audiopa", "channels" ).toInt(),
|
||||
SURROUND_CHANNELS ), _mixer ),
|
||||
SURROUND_CHANNELS ), _audioEngine ),
|
||||
m_s( NULL ),
|
||||
m_quit( false ),
|
||||
m_convertEndian( false )
|
||||
@@ -114,7 +114,7 @@ void AudioPulseAudio::applyQualitySettings()
|
||||
{
|
||||
if( hqAudio() )
|
||||
{
|
||||
// setSampleRate( engine::mixer()->processingSampleRate() );
|
||||
// setSampleRate( engine::audioEngine()->processingSampleRate() );
|
||||
|
||||
}
|
||||
|
||||
@@ -175,8 +175,7 @@ static void context_state_callback(pa_context *c, void *userdata)
|
||||
buffer_attr.minreq = (uint32_t)(-1);
|
||||
buffer_attr.fragsize = (uint32_t)(-1);
|
||||
|
||||
double latency = (double)( Engine::mixer()->framesPerPeriod() ) /
|
||||
(double)_this->sampleRate();
|
||||
double latency = (double)( Engine::audioEngine()->framesPerPeriod() ) / (double)_this->sampleRate();
|
||||
|
||||
// ask PulseAudio for the desired latency (which might not be approved)
|
||||
buffer_attr.tlength = pa_usec_to_bytes( latency * PA_USEC_PER_MSEC,
|
||||
@@ -245,7 +244,7 @@ void AudioPulseAudio::run()
|
||||
}
|
||||
else
|
||||
{
|
||||
const fpp_t fpp = mixer()->framesPerPeriod();
|
||||
const fpp_t fpp = audioEngine()->framesPerPeriod();
|
||||
surroundSampleFrame * temp = new surroundSampleFrame[fpp];
|
||||
while( getNextBuffer( temp ) )
|
||||
{
|
||||
@@ -264,7 +263,7 @@ void AudioPulseAudio::run()
|
||||
|
||||
void AudioPulseAudio::streamWriteCallback( pa_stream *s, size_t length )
|
||||
{
|
||||
const fpp_t fpp = mixer()->framesPerPeriod();
|
||||
const fpp_t fpp = audioEngine()->framesPerPeriod();
|
||||
surroundSampleFrame * temp = new surroundSampleFrame[fpp];
|
||||
int_sample_t* pcmbuf = (int_sample_t *)pa_xmalloc( fpp * channels() * sizeof(int_sample_t) );
|
||||
|
||||
@@ -278,7 +277,7 @@ void AudioPulseAudio::streamWriteCallback( pa_stream *s, size_t length )
|
||||
break;
|
||||
}
|
||||
int bytes = convertToS16( temp, frames,
|
||||
mixer()->masterGain(),
|
||||
audioEngine()->masterGain(),
|
||||
pcmbuf,
|
||||
m_convertEndian );
|
||||
if( bytes > 0 )
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
|
||||
AudioSampleRecorder::AudioSampleRecorder( const ch_cnt_t _channels,
|
||||
bool & _success_ful,
|
||||
Mixer * _mixer ) :
|
||||
AudioDevice( _channels, _mixer ),
|
||||
AudioEngine * _audioEngine ) :
|
||||
AudioDevice( _channels, _audioEngine ),
|
||||
m_buffers()
|
||||
{
|
||||
_success_ful = true;
|
||||
|
||||
@@ -29,14 +29,14 @@
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
|
||||
#include "AudioEngine.h"
|
||||
#include "Engine.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "gui_templates.h"
|
||||
#include "Mixer.h"
|
||||
|
||||
AudioSdl::AudioSdl( bool & _success_ful, Mixer* _mixer ) :
|
||||
AudioDevice( DEFAULT_CHANNELS, _mixer ),
|
||||
m_outBuf( new surroundSampleFrame[mixer()->framesPerPeriod()] )
|
||||
AudioSdl::AudioSdl( bool & _success_ful, AudioEngine* _audioEngine ) :
|
||||
AudioDevice( DEFAULT_CHANNELS, _audioEngine ),
|
||||
m_outBuf( new surroundSampleFrame[audioEngine()->framesPerPeriod()] )
|
||||
{
|
||||
_success_ful = false;
|
||||
|
||||
@@ -44,7 +44,7 @@ AudioSdl::AudioSdl( bool & _success_ful, Mixer* _mixer ) :
|
||||
m_currentBufferFramesCount = 0;
|
||||
m_currentBufferFramePos = 0;
|
||||
#else
|
||||
m_convertedBufSize = mixer()->framesPerPeriod() * channels()
|
||||
m_convertedBufSize = audioEngine()->framesPerPeriod() * channels()
|
||||
* sizeof( int_sample_t );
|
||||
m_convertedBufPos = 0;
|
||||
m_convertedBuf = new Uint8[m_convertedBufSize];
|
||||
@@ -67,7 +67,7 @@ AudioSdl::AudioSdl( bool & _success_ful, Mixer* _mixer ) :
|
||||
// to convert the buffers
|
||||
#endif
|
||||
m_audioHandle.channels = channels();
|
||||
m_audioHandle.samples = qMax( 1024, mixer()->framesPerPeriod()*2 );
|
||||
m_audioHandle.samples = qMax( 1024, audioEngine()->framesPerPeriod()*2 );
|
||||
|
||||
m_audioHandle.callback = sdlAudioCallback;
|
||||
m_audioHandle.userdata = this;
|
||||
@@ -200,7 +200,7 @@ void AudioSdl::applyQualitySettings()
|
||||
{
|
||||
SDL_CloseAudio();
|
||||
|
||||
setSampleRate( Engine::mixer()->processingSampleRate() );
|
||||
setSampleRate( Engine::audioEngine()->processingSampleRate() );
|
||||
|
||||
m_audioHandle.freq = sampleRate();
|
||||
|
||||
@@ -258,7 +258,7 @@ void AudioSdl::sdlAudioCallback( Uint8 * _buf, int _len )
|
||||
m_currentBufferFramesCount
|
||||
- m_currentBufferFramePos );
|
||||
|
||||
const float gain = mixer()->masterGain();
|
||||
const float gain = audioEngine()->masterGain();
|
||||
for (uint f = 0; f < min_frames_count; f++)
|
||||
{
|
||||
(m_outBuf + m_currentBufferFramePos)[f][0] *= gain;
|
||||
@@ -289,7 +289,7 @@ void AudioSdl::sdlAudioCallback( Uint8 * _buf, int _len )
|
||||
* sizeof( int_sample_t );
|
||||
|
||||
convertToS16( m_outBuf, frames,
|
||||
mixer()->masterGain(),
|
||||
audioEngine()->masterGain(),
|
||||
(int_sample_t *)m_convertedBuf,
|
||||
m_outConvertEndian );
|
||||
}
|
||||
@@ -316,7 +316,7 @@ void AudioSdl::sdlInputAudioCallback(Uint8 *_buf, int _len) {
|
||||
sampleFrame *samples_buffer = (sampleFrame *) _buf;
|
||||
fpp_t frames = _len / sizeof ( sampleFrame );
|
||||
|
||||
mixer()->pushInputFrames (samples_buffer, frames);
|
||||
audioEngine()->pushInputFrames (samples_buffer, frames);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "endian_handling.h"
|
||||
#include "LcdSpinBox.h"
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "Engine.h"
|
||||
#include "gui_templates.h"
|
||||
|
||||
@@ -48,11 +48,11 @@
|
||||
|
||||
|
||||
|
||||
AudioSndio::AudioSndio(bool & _success_ful, Mixer * _mixer) :
|
||||
AudioSndio::AudioSndio(bool & _success_ful, AudioEngine * _audioEngine) :
|
||||
AudioDevice( qBound<ch_cnt_t>(
|
||||
DEFAULT_CHANNELS,
|
||||
ConfigManager::inst()->value( "audiosndio", "channels" ).toInt(),
|
||||
SURROUND_CHANNELS ), _mixer ),
|
||||
SURROUND_CHANNELS ), _audioEngine ),
|
||||
m_convertEndian ( false )
|
||||
{
|
||||
_success_ful = false;
|
||||
@@ -80,7 +80,7 @@ AudioSndio::AudioSndio(bool & _success_ful, Mixer * _mixer) :
|
||||
m_par.bits = 16;
|
||||
m_par.le = SIO_LE_NATIVE;
|
||||
m_par.rate = sampleRate();
|
||||
m_par.round = mixer()->framesPerPeriod();
|
||||
m_par.round = audioEngine()->framesPerPeriod();
|
||||
m_par.appbufsz = m_par.round * 2;
|
||||
|
||||
if ( (isLittleEndian() && (m_par.le == 0)) ||
|
||||
@@ -150,7 +150,7 @@ void AudioSndio::applyQualitySettings( void )
|
||||
{
|
||||
if( hqAudio() )
|
||||
{
|
||||
setSampleRate( Engine::mixer()->processingSampleRate() );
|
||||
setSampleRate( Engine::audioEngine()->processingSampleRate() );
|
||||
|
||||
/* change sample rate to sampleRate() */
|
||||
}
|
||||
@@ -161,10 +161,8 @@ void AudioSndio::applyQualitySettings( void )
|
||||
|
||||
void AudioSndio::run( void )
|
||||
{
|
||||
surroundSampleFrame * temp =
|
||||
new surroundSampleFrame[mixer()->framesPerPeriod()];
|
||||
int_sample_t * outbuf =
|
||||
new int_sample_t[mixer()->framesPerPeriod() * channels()];
|
||||
surroundSampleFrame * temp = new surroundSampleFrame[audioEngine()->framesPerPeriod()];
|
||||
int_sample_t * outbuf = new int_sample_t[audioEngine()->framesPerPeriod() * channels()];
|
||||
|
||||
while( true )
|
||||
{
|
||||
@@ -175,7 +173,7 @@ void AudioSndio::run( void )
|
||||
}
|
||||
|
||||
uint bytes = convertToS16( temp, frames,
|
||||
mixer()->masterGain(), outbuf, m_convertEndian );
|
||||
audioEngine()->masterGain(), outbuf, m_convertEndian );
|
||||
if( sio_write( m_hdl, outbuf, bytes ) != bytes )
|
||||
{
|
||||
break;
|
||||
|
||||
@@ -34,13 +34,13 @@
|
||||
#include "ConfigManager.h"
|
||||
#include "gui_templates.h"
|
||||
#include "ComboBox.h"
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
|
||||
AudioSoundIo::AudioSoundIo( bool & outSuccessful, Mixer * _mixer ) :
|
||||
AudioSoundIo::AudioSoundIo( bool & outSuccessful, AudioEngine * _audioEngine ) :
|
||||
AudioDevice( qBound<ch_cnt_t>(
|
||||
DEFAULT_CHANNELS,
|
||||
ConfigManager::inst()->value( "audiosoundio", "channels" ).toInt(),
|
||||
SURROUND_CHANNELS ), _mixer )
|
||||
SURROUND_CHANNELS ), _audioEngine )
|
||||
{
|
||||
outSuccessful = false;
|
||||
m_soundio = NULL;
|
||||
@@ -168,7 +168,7 @@ AudioSoundIo::AudioSoundIo( bool & outSuccessful, Mixer * _mixer ) :
|
||||
}
|
||||
|
||||
m_outstream->name = "LMMS";
|
||||
m_outstream->software_latency = (double)mixer()->framesPerPeriod() / (double)currentSampleRate;
|
||||
m_outstream->software_latency = (double)audioEngine()->framesPerPeriod() / (double)currentSampleRate;
|
||||
m_outstream->userdata = this;
|
||||
m_outstream->write_callback = staticWriteCallback;
|
||||
m_outstream->error_callback = staticErrorCallback;
|
||||
@@ -216,7 +216,7 @@ void AudioSoundIo::startProcessing()
|
||||
|
||||
m_outBufFrameIndex = 0;
|
||||
m_outBufFramesTotal = 0;
|
||||
m_outBufSize = mixer()->framesPerPeriod();
|
||||
m_outBufSize = audioEngine()->framesPerPeriod();
|
||||
|
||||
m_outBuf = new surroundSampleFrame[m_outBufSize];
|
||||
|
||||
@@ -283,7 +283,7 @@ void AudioSoundIo::writeCallback(int frameCountMin, int frameCountMax)
|
||||
int bytesPerSample = m_outstream->bytes_per_sample;
|
||||
int err;
|
||||
|
||||
const float gain = mixer()->masterGain();
|
||||
const float gain = audioEngine()->masterGain();
|
||||
|
||||
int framesLeft = frameCountMax;
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <QDebug>
|
||||
#include <QtGlobal>
|
||||
|
||||
#include "AudioEngine.h"
|
||||
#include "AutomatableModel.h"
|
||||
#include "ComboBoxModel.h"
|
||||
#include "Engine.h"
|
||||
@@ -41,7 +42,6 @@
|
||||
#include "Lv2Ports.h"
|
||||
#include "Lv2Evbuf.h"
|
||||
#include "MidiEventToByteSeq.h"
|
||||
#include "Mixer.h"
|
||||
|
||||
|
||||
|
||||
@@ -391,7 +391,7 @@ void Lv2Proc::initPlugin()
|
||||
createPorts();
|
||||
|
||||
m_instance = lilv_plugin_instantiate(m_plugin,
|
||||
Engine::mixer()->processingSampleRate(),
|
||||
Engine::audioEngine()->processingSampleRate(),
|
||||
m_features.featurePointers());
|
||||
|
||||
if (m_instance)
|
||||
@@ -451,8 +451,8 @@ void Lv2Proc::initMOptions()
|
||||
re-initialize, and this code section will be
|
||||
executed again, creating a new option vector.
|
||||
*/
|
||||
float sampleRate = Engine::mixer()->processingSampleRate();
|
||||
int32_t blockLength = Engine::mixer()->framesPerPeriod();
|
||||
float sampleRate = Engine::audioEngine()->processingSampleRate();
|
||||
int32_t blockLength = Engine::audioEngine()->framesPerPeriod();
|
||||
int32_t sequenceSize = defaultEvbufSize();
|
||||
|
||||
using Id = Lv2UridCache::Id;
|
||||
@@ -502,7 +502,7 @@ void Lv2Proc::createPort(std::size_t portNum)
|
||||
{
|
||||
AutoLilvNode node(lilv_port_get_name(m_plugin, lilvPort));
|
||||
QString dispName = lilv_node_as_string(node.get());
|
||||
sample_rate_t sr = Engine::mixer()->processingSampleRate();
|
||||
sample_rate_t sr = Engine::audioEngine()->processingSampleRate();
|
||||
if(meta.def() < meta.min(sr) || meta.def() > meta.max(sr))
|
||||
{
|
||||
qWarning() << "Warning: Plugin"
|
||||
@@ -578,7 +578,7 @@ void Lv2Proc::createPort(std::size_t portNum)
|
||||
Lv2Ports::Audio* audio =
|
||||
new Lv2Ports::Audio(
|
||||
static_cast<std::size_t>(
|
||||
Engine::mixer()->framesPerPeriod()),
|
||||
Engine::audioEngine()->framesPerPeriod()),
|
||||
portIsSideChain(m_plugin, lilvPort)
|
||||
);
|
||||
port = audio;
|
||||
@@ -799,7 +799,7 @@ void Lv2Proc::dumpPort(std::size_t num)
|
||||
qDebug() << " visualization: " << Lv2Ports::toStr(port.m_vis);
|
||||
if (port.m_type == Lv2Ports::Type::Control || port.m_type == Lv2Ports::Type::Cv)
|
||||
{
|
||||
sample_rate_t sr = Engine::mixer()->processingSampleRate();
|
||||
sample_rate_t sr = Engine::audioEngine()->processingSampleRate();
|
||||
qDebug() << " default:" << port.def();
|
||||
qDebug() << " min:" << port.min(sr);
|
||||
qDebug() << " max:" << port.max(sr);
|
||||
|
||||
@@ -362,7 +362,7 @@ int main( int argc, char * * argv )
|
||||
new QCoreApplication( argc, argv ) :
|
||||
new MainApplication( argc, argv );
|
||||
|
||||
Mixer::qualitySettings qs( Mixer::qualitySettings::Mode_HighQuality );
|
||||
AudioEngine::qualitySettings qs( AudioEngine::qualitySettings::Mode_HighQuality );
|
||||
OutputSettings os( 44100, OutputSettings::BitRateSettings(160, false), OutputSettings::Depth_16Bit, OutputSettings::StereoMode_JointStereo );
|
||||
ProjectRenderer::ExportFileFormats eff = ProjectRenderer::WaveFile;
|
||||
|
||||
@@ -628,19 +628,19 @@ int main( int argc, char * * argv )
|
||||
|
||||
if( ip == "linear" )
|
||||
{
|
||||
qs.interpolation = Mixer::qualitySettings::Interpolation_Linear;
|
||||
qs.interpolation = AudioEngine::qualitySettings::Interpolation_Linear;
|
||||
}
|
||||
else if( ip == "sincfastest" )
|
||||
{
|
||||
qs.interpolation = Mixer::qualitySettings::Interpolation_SincFastest;
|
||||
qs.interpolation = AudioEngine::qualitySettings::Interpolation_SincFastest;
|
||||
}
|
||||
else if( ip == "sincmedium" )
|
||||
{
|
||||
qs.interpolation = Mixer::qualitySettings::Interpolation_SincMedium;
|
||||
qs.interpolation = AudioEngine::qualitySettings::Interpolation_SincMedium;
|
||||
}
|
||||
else if( ip == "sincbest" )
|
||||
{
|
||||
qs.interpolation = Mixer::qualitySettings::Interpolation_SincBest;
|
||||
qs.interpolation = AudioEngine::qualitySettings::Interpolation_SincBest;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -662,16 +662,16 @@ int main( int argc, char * * argv )
|
||||
switch( o )
|
||||
{
|
||||
case 1:
|
||||
qs.oversampling = Mixer::qualitySettings::Oversampling_None;
|
||||
qs.oversampling = AudioEngine::qualitySettings::Oversampling_None;
|
||||
break;
|
||||
case 2:
|
||||
qs.oversampling = Mixer::qualitySettings::Oversampling_2x;
|
||||
qs.oversampling = AudioEngine::qualitySettings::Oversampling_2x;
|
||||
break;
|
||||
case 4:
|
||||
qs.oversampling = Mixer::qualitySettings::Oversampling_4x;
|
||||
qs.oversampling = AudioEngine::qualitySettings::Oversampling_4x;
|
||||
break;
|
||||
case 8:
|
||||
qs.oversampling = Mixer::qualitySettings::Oversampling_8x;
|
||||
qs.oversampling = AudioEngine::qualitySettings::Oversampling_8x;
|
||||
break;
|
||||
default:
|
||||
return usageError( QString( "Invalid oversampling %1" ).arg( argv[i] ) );
|
||||
@@ -840,7 +840,7 @@ int main( int argc, char * * argv )
|
||||
|
||||
if( profilerOutputFile.isEmpty() == false )
|
||||
{
|
||||
Engine::mixer()->profiler().setOutputFile( profilerOutputFile );
|
||||
Engine::audioEngine()->profiler().setOutputFile( profilerOutputFile );
|
||||
}
|
||||
|
||||
// start now!
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <QObject>
|
||||
|
||||
#include "Song.h"
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "MidiClient.h"
|
||||
#include "MidiController.h"
|
||||
|
||||
@@ -35,8 +35,7 @@
|
||||
MidiController::MidiController( Model * _parent ) :
|
||||
Controller( Controller::MidiController, _parent, tr( "MIDI Controller" ) ),
|
||||
MidiEventProcessor(),
|
||||
m_midiPort( tr( "unnamed_midi_controller" ),
|
||||
Engine::mixer()->midiClient(), this, this, MidiPort::Input ),
|
||||
m_midiPort( tr( "unnamed_midi_controller" ), Engine::audioEngine()->midiClient(), this, this, MidiPort::Input ),
|
||||
m_lastValue( 0.0f ),
|
||||
m_previousValue( 0.0f )
|
||||
{
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
#include <QCompleter>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "AudioEngine.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "gui_templates.h"
|
||||
#include "GuiApplication.h"
|
||||
#include "Engine.h"
|
||||
#include "Mixer.h"
|
||||
#include "MainWindow.h"
|
||||
|
||||
/* callback functions for jack */
|
||||
@@ -71,7 +71,7 @@ MidiJack::MidiJack() :
|
||||
// and also handles the callback, we pass it our address
|
||||
// so that we can also process during the callback
|
||||
|
||||
m_jackAudio = dynamic_cast<AudioJack*>(Engine::mixer()->audioDev());
|
||||
m_jackAudio = dynamic_cast<AudioJack*>(Engine::audioEngine()->audioDev());
|
||||
if( m_jackAudio )
|
||||
{
|
||||
// if a jack connection has been created for audio we use that
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
#include <QScrollArea>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "AudioEngine.h"
|
||||
#include "ControllerConnectionDialog.h"
|
||||
#include "ControllerConnection.h"
|
||||
#include "MidiController.h"
|
||||
#include "MidiClient.h"
|
||||
#include "MidiPortMenu.h"
|
||||
#include "Mixer.h"
|
||||
#include "LcdSpinBox.h"
|
||||
#include "LedCheckbox.h"
|
||||
#include "ComboBox.h"
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
{
|
||||
m_detectedMidiChannel = event.channel() + 1;
|
||||
m_detectedMidiController = event.controllerNumber() + 1;
|
||||
m_detectedMidiPort = Engine::mixer()->midiClient()->sourcePortName( event );
|
||||
m_detectedMidiPort = Engine::audioEngine()->midiClient()->sourcePortName( event );
|
||||
|
||||
emit valueChanged();
|
||||
}
|
||||
@@ -165,7 +165,7 @@ ControllerConnectionDialog::ControllerConnectionDialog( QWidget * _parent,
|
||||
|
||||
// when using with non-raw-clients we can provide buttons showing
|
||||
// our port-menus when being clicked
|
||||
if( !Engine::mixer()->midiClient()->isRaw() )
|
||||
if( !Engine::audioEngine()->midiClient()->isRaw() )
|
||||
{
|
||||
m_readablePorts = new MidiPortMenu( MidiPort::Input );
|
||||
connect( m_readablePorts, SIGNAL( triggered( QAction * ) ),
|
||||
|
||||
@@ -154,10 +154,10 @@ OutputSettings::StereoMode mapToStereoMode(int index)
|
||||
|
||||
void ExportProjectDialog::startExport()
|
||||
{
|
||||
Mixer::qualitySettings qs =
|
||||
Mixer::qualitySettings(
|
||||
static_cast<Mixer::qualitySettings::Interpolation>(interpolationCB->currentIndex()),
|
||||
static_cast<Mixer::qualitySettings::Oversampling>(oversamplingCB->currentIndex()) );
|
||||
AudioEngine::qualitySettings qs =
|
||||
AudioEngine::qualitySettings(
|
||||
static_cast<AudioEngine::qualitySettings::Interpolation>(interpolationCB->currentIndex()),
|
||||
static_cast<AudioEngine::qualitySettings::Oversampling>(oversamplingCB->currentIndex()) );
|
||||
|
||||
const int samplerates[5] = { 44100, 48000, 88200, 96000, 192000 };
|
||||
const bitrate_t bitrates[6] = { 64, 128, 160, 192, 256, 320 };
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <QStringList>
|
||||
|
||||
#include "FileBrowser.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "BBTrackContainer.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "DataFile.h"
|
||||
@@ -48,7 +49,6 @@
|
||||
#include "Instrument.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Mixer.h"
|
||||
#include "PluginFactory.h"
|
||||
#include "PresetPreviewPlayHandle.h"
|
||||
#include "SamplePlayHandle.h"
|
||||
@@ -650,7 +650,7 @@ void FileBrowserTreeWidget::previewFileItem(FileItem* file)
|
||||
|
||||
if (newPPH != nullptr)
|
||||
{
|
||||
if (Engine::mixer()->addPlayHandle(newPPH))
|
||||
if (Engine::audioEngine()->addPlayHandle(newPPH))
|
||||
{
|
||||
m_previewPlayHandle = newPPH;
|
||||
}
|
||||
@@ -666,7 +666,7 @@ void FileBrowserTreeWidget::stopPreview()
|
||||
QMutexLocker previewLocker(&m_pphMutex);
|
||||
if (m_previewPlayHandle != nullptr)
|
||||
{
|
||||
Engine::mixer()->removePlayHandle(m_previewPlayHandle);
|
||||
Engine::audioEngine()->removePlayHandle(m_previewPlayHandle);
|
||||
m_previewPlayHandle = nullptr;
|
||||
}
|
||||
}
|
||||
@@ -751,7 +751,7 @@ void FileBrowserTreeWidget::mouseReleaseEvent(QMouseEvent * me )
|
||||
|
||||
void FileBrowserTreeWidget::handleFile(FileItem * f, InstrumentTrack * it)
|
||||
{
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
switch( f->handling() )
|
||||
{
|
||||
case FileItem::LoadAsProject:
|
||||
@@ -791,7 +791,7 @@ void FileBrowserTreeWidget::handleFile(FileItem * f, InstrumentTrack * it)
|
||||
break;
|
||||
|
||||
}
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
}
|
||||
|
||||
|
||||
@@ -857,10 +857,10 @@ bool FileBrowserTreeWidget::openInNewSampleTrack(FileItem* item)
|
||||
Track::create(Track::SampleTrack, Engine::getSong()));
|
||||
|
||||
// Add the sample clip to the track
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
SampleTCO* clip = static_cast<SampleTCO*>(sampleTrack->createTCO(0));
|
||||
clip->setSampleFile(item->fullName());
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "FxMixer.h"
|
||||
#include "GuiApplication.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "gui_templates.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "SampleTrack.h"
|
||||
@@ -593,8 +593,8 @@ void FxMixerView::updateFaders()
|
||||
FxMixer * m = Engine::fxMixer();
|
||||
|
||||
// apply master gain
|
||||
m->effectChannel(0)->m_peakLeft *= Engine::mixer()->masterGain();
|
||||
m->effectChannel(0)->m_peakRight *= Engine::mixer()->masterGain();
|
||||
m->effectChannel(0)->m_peakLeft *= Engine::audioEngine()->masterGain();
|
||||
m->effectChannel(0)->m_peakRight *= Engine::audioEngine()->masterGain();
|
||||
|
||||
for( int i = 0; i < m_fxChannelViews.size(); ++i )
|
||||
{
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <lilv/lilv.h>
|
||||
|
||||
#include "AudioEngine.h"
|
||||
#include "Controls.h"
|
||||
#include "Engine.h"
|
||||
#include "GuiApplication.h"
|
||||
@@ -44,7 +45,6 @@
|
||||
#include "Lv2Proc.h"
|
||||
#include "Lv2Ports.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Mixer.h"
|
||||
#include "SubWindow.h"
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ Lv2ViewProc::Lv2ViewProc(QWidget* parent, Lv2Proc* ctrlBase, int colNum) :
|
||||
break;
|
||||
case PortVis::Integer:
|
||||
{
|
||||
sample_rate_t sr = Engine::mixer()->processingSampleRate();
|
||||
sample_rate_t sr = Engine::audioEngine()->processingSampleRate();
|
||||
m_control = new LcdControl((port.max(sr) <= 9.0f) ? 1 : 2,
|
||||
m_par);
|
||||
break;
|
||||
|
||||
@@ -477,7 +477,7 @@ void MainWindow::finalize()
|
||||
this, SLOT( onToggleMetronome() ),
|
||||
m_toolBar );
|
||||
m_metronomeToggle->setCheckable(true);
|
||||
m_metronomeToggle->setChecked(Engine::mixer()->isMetronomeActive());
|
||||
m_metronomeToggle->setChecked(Engine::audioEngine()->isMetronomeActive());
|
||||
|
||||
m_toolBarLayout->setColumnMinimumWidth( 0, 5 );
|
||||
m_toolBarLayout->addWidget( project_new, 0, 1 );
|
||||
@@ -573,10 +573,10 @@ void MainWindow::finalize()
|
||||
SetupDialog sd;
|
||||
sd.exec();
|
||||
}
|
||||
// look whether mixer failed to start the audio device selected by the
|
||||
// look whether the audio engine failed to start the audio device selected by the
|
||||
// user and is using AudioDummy as a fallback
|
||||
// or the audio device is set to invalid one
|
||||
else if( Engine::mixer()->audioDevStartFailed() || !Mixer::isAudioDevNameValid(
|
||||
else if( Engine::audioEngine()->audioDevStartFailed() || !AudioEngine::isAudioDevNameValid(
|
||||
ConfigManager::inst()->value( "mixer", "audiodev" ) ) )
|
||||
{
|
||||
// if so, offer the audio settings section of the setup dialog
|
||||
@@ -1257,9 +1257,7 @@ void MainWindow::updateConfig( QAction * _who )
|
||||
|
||||
void MainWindow::onToggleMetronome()
|
||||
{
|
||||
Mixer * mixer = Engine::mixer();
|
||||
|
||||
mixer->setMetronomeActive( m_metronomeToggle->isChecked() );
|
||||
Engine::audioEngine()->setMetronomeActive( m_metronomeToggle->isChecked() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <QScrollArea>
|
||||
|
||||
#include "AudioDeviceSetupWidget.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "debug.h"
|
||||
#include "embed.h"
|
||||
#include "Engine.h"
|
||||
@@ -39,7 +40,6 @@
|
||||
#include "gui_templates.h"
|
||||
#include "MainWindow.h"
|
||||
#include "MidiSetupWidget.h"
|
||||
#include "Mixer.h"
|
||||
#include "ProjectJournal.h"
|
||||
#include "SetupDialog.h"
|
||||
#include "TabBar.h"
|
||||
@@ -536,7 +536,7 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
|
||||
QString audioDevName = ConfigManager::inst()->value("mixer", "audiodev");
|
||||
if (m_audioInterfaces->findText(audioDevName) < 0)
|
||||
{
|
||||
audioDevName = Engine::mixer()->audioDevName();
|
||||
audioDevName = Engine::audioEngine()->audioDevName();
|
||||
ConfigManager::inst()->setValue("mixer", "audiodev", audioDevName);
|
||||
}
|
||||
m_audioInterfaces->
|
||||
@@ -681,7 +681,7 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
|
||||
QString midiDevName = ConfigManager::inst()->value("mixer", "mididev");
|
||||
if (m_midiInterfaces->findText(midiDevName) < 0)
|
||||
{
|
||||
midiDevName = Engine::mixer()->midiClientName();
|
||||
midiDevName = Engine::audioEngine()->midiClientName();
|
||||
ConfigManager::inst()->setValue("mixer", "mididev", midiDevName);
|
||||
}
|
||||
m_midiInterfaces->setCurrentIndex(m_midiInterfaces->findText(midiDevName));
|
||||
@@ -699,9 +699,9 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
|
||||
m_assignableMidiDevices = new QComboBox(midiAutoAssign_tw);
|
||||
m_assignableMidiDevices->setGeometry(10, 20, 240, 28);
|
||||
m_assignableMidiDevices->addItem("none");
|
||||
if ( !Engine::mixer()->midiClient()->isRaw() )
|
||||
if ( !Engine::audioEngine()->midiClient()->isRaw() )
|
||||
{
|
||||
m_assignableMidiDevices->addItems(Engine::mixer()->midiClient()->readablePorts());
|
||||
m_assignableMidiDevices->addItems(Engine::audioEngine()->midiClient()->readablePorts());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1199,7 +1199,7 @@ void SetupDialog::setBufferSize(int value)
|
||||
|
||||
m_bufferSize = value * BUFFERSIZE_RESOLUTION;
|
||||
m_bufferSizeLbl->setText(tr("Frames: %1\nLatency: %2 ms").arg(m_bufferSize).arg(
|
||||
1000.0f * m_bufferSize / Engine::mixer()->processingSampleRate(), 0, 'f', 1));
|
||||
1000.0f * m_bufferSize / Engine::audioEngine()->processingSampleRate(), 0, 'f', 1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,10 +33,10 @@
|
||||
#include <QWheelEvent>
|
||||
|
||||
#include "TrackContainer.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "BBTrack.h"
|
||||
#include "DataFile.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Mixer.h"
|
||||
#include "FileBrowser.h"
|
||||
#include "ImportFilter.h"
|
||||
#include "Instrument.h"
|
||||
@@ -268,9 +268,9 @@ void TrackContainerView::deleteTrackView( TrackView * _tv )
|
||||
removeTrackView( _tv );
|
||||
delete _tv;
|
||||
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
delete t;
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
#include <QtGlobal>
|
||||
|
||||
|
||||
#include "AudioEngine.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "DataFile.h"
|
||||
#include "Engine.h"
|
||||
#include "FadeButton.h"
|
||||
#include "Mixer.h"
|
||||
#include "PixmapButton.h"
|
||||
#include "StringPairDrag.h"
|
||||
#include "ToolTip.h"
|
||||
@@ -243,9 +243,9 @@ void TrackView::dropEvent( QDropEvent * de )
|
||||
// value contains our XML-data so simply create a
|
||||
// DataFile which does the rest for us...
|
||||
DataFile dataFile( value.toUtf8() );
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
m_track->restoreState( dataFile.content().firstChild().toElement() );
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
de->accept();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <QTimeLine>
|
||||
|
||||
#include "AudioDevice.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "AutomatableSlider.h"
|
||||
#include "ComboBox.h"
|
||||
#include "ConfigManager.h"
|
||||
@@ -45,7 +46,6 @@
|
||||
#include "LcdSpinBox.h"
|
||||
#include "MainWindow.h"
|
||||
#include "MeterDialog.h"
|
||||
#include "Mixer.h"
|
||||
#include "Oscilloscope.h"
|
||||
#include "PianoRoll.h"
|
||||
#include "TextFloat.h"
|
||||
@@ -329,9 +329,9 @@ QString SongEditor::getSnapSizeString() const
|
||||
|
||||
void SongEditor::setHighQuality( bool hq )
|
||||
{
|
||||
Engine::mixer()->changeQuality( Mixer::qualitySettings(
|
||||
hq ? Mixer::qualitySettings::Mode_HighQuality :
|
||||
Mixer::qualitySettings::Mode_Draft ) );
|
||||
Engine::audioEngine()->changeQuality( AudioEngine::qualitySettings(
|
||||
hq ? AudioEngine::qualitySettings::Mode_HighQuality :
|
||||
AudioEngine::qualitySettings::Mode_Draft ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -657,7 +657,7 @@ void SongEditor::setMasterVolume( int new_val )
|
||||
QPoint( m_masterVolumeSlider->width() + 2, -2 ) );
|
||||
m_mvsStatus->setVisibilityTimeOut( 1000 );
|
||||
}
|
||||
Engine::mixer()->setMasterGain( new_val / 100.0f );
|
||||
Engine::audioEngine()->setMasterGain( new_val / 100.0f );
|
||||
}
|
||||
|
||||
|
||||
@@ -910,7 +910,7 @@ ComboBoxModel *SongEditor::snappingModel() const
|
||||
|
||||
|
||||
SongEditorWindow::SongEditorWindow(Song* song) :
|
||||
Editor(Engine::mixer()->audioDev()->supportsCapture(), false),
|
||||
Editor(Engine::audioEngine()->audioDev()->supportsCapture(), false),
|
||||
m_editor(new SongEditor(song)),
|
||||
m_crtlAction( NULL ),
|
||||
m_snapSizeLabel( new QLabel( m_toolBar ) )
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
#include "AudioEngine.h"
|
||||
#include "CPULoadWidget.h"
|
||||
#include "embed.h"
|
||||
#include "Engine.h"
|
||||
#include "Mixer.h"
|
||||
|
||||
|
||||
CPULoadWidget::CPULoadWidget( QWidget * _parent ) :
|
||||
@@ -92,7 +92,7 @@ void CPULoadWidget::paintEvent( QPaintEvent * )
|
||||
void CPULoadWidget::updateCpuLoad()
|
||||
{
|
||||
// smooth load-values a bit
|
||||
int new_load = ( m_currentLoad + Engine::mixer()->cpuLoad() ) / 2;
|
||||
int new_load = ( m_currentLoad + Engine::audioEngine()->cpuLoad() ) / 2;
|
||||
if( new_load != m_currentLoad )
|
||||
{
|
||||
m_currentLoad = new_load;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "gui_templates.h"
|
||||
#include "Knob.h"
|
||||
#include "LedCheckbox.h"
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "DataFile.h"
|
||||
#include "Oscillator.h"
|
||||
#include "PixmapButton.h"
|
||||
@@ -425,7 +425,7 @@ void EnvelopeAndLfoView::paintEvent( QPaintEvent * )
|
||||
int graph_y_base = LFO_GRAPH_Y + 3 + LFO_GRAPH_H / 2;
|
||||
|
||||
const float frames_for_graph = SECS_PER_LFO_OSCILLATION *
|
||||
Engine::mixer()->baseSampleRate() / 10;
|
||||
Engine::audioEngine()->baseSampleRate() / 10;
|
||||
|
||||
const float lfo_gray_amount = 1.0f - fabsf( m_lfoAmountKnob->value<float>() );
|
||||
p.setPen( QPen( QColor( static_cast<int>( 96 * lfo_gray_amount ),
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
|
||||
#include "InstrumentMidiIOView.h"
|
||||
#include "MidiPortMenu.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "Engine.h"
|
||||
#include "embed.h"
|
||||
#include "GroupBox.h"
|
||||
#include "gui_templates.h"
|
||||
#include "LcdSpinBox.h"
|
||||
#include "MidiClient.h"
|
||||
#include "Mixer.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "LedCheckbox.h"
|
||||
|
||||
@@ -127,7 +127,7 @@ InstrumentMidiIOView::InstrumentMidiIOView( QWidget* parent ) :
|
||||
connect( m_midiOutputGroupBox->ledButton(), SIGNAL( toggled( bool ) ),
|
||||
m_fixedOutputNoteSpinBox, SLOT( setEnabled( bool ) ) );
|
||||
|
||||
if( !Engine::mixer()->midiClient()->isRaw() )
|
||||
if( !Engine::audioEngine()->midiClient()->isRaw() )
|
||||
{
|
||||
m_rpBtn = new QToolButton;
|
||||
m_rpBtn->setMinimumSize( 32, 32 );
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "GuiApplication.h"
|
||||
#include "gui_templates.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Mixer.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "Engine.h"
|
||||
#include "ToolTip.h"
|
||||
#include "Song.h"
|
||||
@@ -41,7 +41,7 @@
|
||||
Oscilloscope::Oscilloscope( QWidget * _p ) :
|
||||
QWidget( _p ),
|
||||
m_background( embed::getIconPixmap( "output_graph" ) ),
|
||||
m_points( new QPointF[Engine::mixer()->framesPerPeriod()] ),
|
||||
m_points( new QPointF[Engine::audioEngine()->framesPerPeriod()] ),
|
||||
m_active( false ),
|
||||
m_normalColor(71, 253, 133),
|
||||
m_clippingColor(255, 64, 64)
|
||||
@@ -50,7 +50,7 @@ Oscilloscope::Oscilloscope( QWidget * _p ) :
|
||||
setAttribute( Qt::WA_OpaquePaintEvent, true );
|
||||
setActive( ConfigManager::inst()->value( "ui", "displaywaveform").toInt() );
|
||||
|
||||
const fpp_t frames = Engine::mixer()->framesPerPeriod();
|
||||
const fpp_t frames = Engine::audioEngine()->framesPerPeriod();
|
||||
m_buffer = new sampleFrame[frames];
|
||||
|
||||
BufferManager::clear( m_buffer, frames );
|
||||
@@ -75,7 +75,7 @@ void Oscilloscope::updateAudioBuffer( const surroundSampleFrame * buffer )
|
||||
{
|
||||
if( !Engine::getSong()->isExporting() )
|
||||
{
|
||||
const fpp_t fpp = Engine::mixer()->framesPerPeriod();
|
||||
const fpp_t fpp = Engine::audioEngine()->framesPerPeriod();
|
||||
memcpy( m_buffer, buffer, sizeof( surroundSampleFrame ) * fpp );
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@ void Oscilloscope::setActive( bool _active )
|
||||
connect( gui->mainWindow(),
|
||||
SIGNAL( periodicUpdate() ),
|
||||
this, SLOT( update() ) );
|
||||
connect( Engine::mixer(),
|
||||
connect( Engine::audioEngine(),
|
||||
SIGNAL( nextAudioBuffer( const surroundSampleFrame* ) ),
|
||||
this, SLOT( updateAudioBuffer( const surroundSampleFrame* ) ) );
|
||||
}
|
||||
@@ -100,7 +100,7 @@ void Oscilloscope::setActive( bool _active )
|
||||
disconnect( gui->mainWindow(),
|
||||
SIGNAL( periodicUpdate() ),
|
||||
this, SLOT( update() ) );
|
||||
disconnect( Engine::mixer(),
|
||||
disconnect( Engine::audioEngine(),
|
||||
SIGNAL( nextAudioBuffer( const surroundSampleFrame* ) ),
|
||||
this, SLOT( updateAudioBuffer( const surroundSampleFrame* ) ) );
|
||||
// we have to update (remove last waves),
|
||||
@@ -139,12 +139,12 @@ void Oscilloscope::paintEvent( QPaintEvent * )
|
||||
|
||||
if( m_active && !Engine::getSong()->isExporting() )
|
||||
{
|
||||
Mixer const * mixer = Engine::mixer();
|
||||
AudioEngine const * audioEngine = Engine::audioEngine();
|
||||
|
||||
float master_output = mixer->masterGain();
|
||||
float master_output = audioEngine->masterGain();
|
||||
|
||||
const fpp_t frames = mixer->framesPerPeriod();
|
||||
Mixer::StereoSample peakValues = mixer->getPeakValues(m_buffer, frames);
|
||||
const fpp_t frames = audioEngine->framesPerPeriod();
|
||||
AudioEngine::StereoSample peakValues = audioEngine->getPeakValues(m_buffer, frames);
|
||||
const float max_level = qMax<float>( peakValues.left, peakValues.right );
|
||||
|
||||
// Set the color of the line according to the maximum level
|
||||
@@ -164,7 +164,7 @@ void Oscilloscope::paintEvent( QPaintEvent * )
|
||||
{
|
||||
for( int frame = 0; frame < frames; ++frame )
|
||||
{
|
||||
sample_t const clippedSample = Mixer::clip(m_buffer[frame][ch]);
|
||||
sample_t const clippedSample = AudioEngine::clip(m_buffer[frame][ch]);
|
||||
m_points[frame] = QPointF(
|
||||
x_base + static_cast<qreal>(frame) * xd,
|
||||
y_base + ( static_cast<qreal>(clippedSample) * half_h ) );
|
||||
|
||||
@@ -56,7 +56,7 @@ BBTrack::BBTrack( TrackContainer* tc ) :
|
||||
|
||||
BBTrack::~BBTrack()
|
||||
{
|
||||
Engine::mixer()->removePlayHandlesOfTypes( this,
|
||||
Engine::audioEngine()->removePlayHandlesOfTypes( this,
|
||||
PlayHandle::TypeNotePlayHandle
|
||||
| PlayHandle::TypeInstrumentPlayHandle
|
||||
| PlayHandle::TypeSamplePlayHandle );
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <QPainter>
|
||||
|
||||
#include "FileDialog.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "AutomationPattern.h"
|
||||
#include "BBTrack.h"
|
||||
#include "CaptionMenu.h"
|
||||
@@ -67,7 +68,6 @@
|
||||
#include "MainWindow.h"
|
||||
#include "MidiClient.h"
|
||||
#include "MidiPortMenu.h"
|
||||
#include "Mixer.h"
|
||||
#include "MixHelpers.h"
|
||||
#include "Pattern.h"
|
||||
#include "PluginFactory.h"
|
||||
@@ -89,7 +89,7 @@ const int PIANO_HEIGHT = 80;
|
||||
InstrumentTrack::InstrumentTrack( TrackContainer* tc ) :
|
||||
Track( Track::InstrumentTrack, tc ),
|
||||
MidiEventProcessor(),
|
||||
m_midiPort( tr( "unnamed_track" ), Engine::mixer()->midiClient(),
|
||||
m_midiPort( tr( "unnamed_track" ), Engine::audioEngine()->midiClient(),
|
||||
this, this ),
|
||||
m_notes(),
|
||||
m_sustainPedalPressed( false ),
|
||||
@@ -387,7 +387,7 @@ void InstrumentTrack::processInEvent( const MidiEvent& event, const TimePos& tim
|
||||
NULL, event.channel(),
|
||||
NotePlayHandle::OriginMidiInput );
|
||||
m_notes[event.key()] = nph;
|
||||
if( ! Engine::mixer()->addPlayHandle( nph ) )
|
||||
if( ! Engine::audioEngine()->addPlayHandle( nph ) )
|
||||
{
|
||||
m_notes[event.key()] = NULL;
|
||||
}
|
||||
@@ -401,7 +401,7 @@ void InstrumentTrack::processInEvent( const MidiEvent& event, const TimePos& tim
|
||||
{
|
||||
// do actual note off and remove internal reference to NotePlayHandle (which itself will
|
||||
// be deleted later automatically)
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
m_notes[event.key()]->noteOff( offset );
|
||||
if (isSustainPedalPressed() &&
|
||||
m_notes[event.key()]->origin() ==
|
||||
@@ -410,7 +410,7 @@ void InstrumentTrack::processInEvent( const MidiEvent& event, const TimePos& tim
|
||||
m_sustainedNotes << m_notes[event.key()];
|
||||
}
|
||||
m_notes[event.key()] = NULL;
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
}
|
||||
eventHandled = true;
|
||||
break;
|
||||
@@ -574,7 +574,7 @@ void InstrumentTrack::silenceAllNotes( bool removeIPH )
|
||||
}
|
||||
m_midiNotesMutex.unlock();
|
||||
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
// invalidate all NotePlayHandles and PresetPreviewHandles linked to this track
|
||||
m_processHandles.clear();
|
||||
|
||||
@@ -583,8 +583,8 @@ void InstrumentTrack::silenceAllNotes( bool removeIPH )
|
||||
{
|
||||
flags |= PlayHandle::TypeInstrumentPlayHandle;
|
||||
}
|
||||
Engine::mixer()->removePlayHandlesOfTypes( this, flags );
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->removePlayHandlesOfTypes( this, flags );
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
}
|
||||
|
||||
|
||||
@@ -662,13 +662,13 @@ void InstrumentTrack::setName( const QString & _new_name )
|
||||
|
||||
void InstrumentTrack::updateBaseNote()
|
||||
{
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
Engine::audioEngine()->requestChangeInModel();
|
||||
for( NotePlayHandleList::Iterator it = m_processHandles.begin();
|
||||
it != m_processHandles.end(); ++it )
|
||||
{
|
||||
( *it )->setFrequencyUpdate();
|
||||
}
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::audioEngine()->doneChangeInModel();
|
||||
}
|
||||
|
||||
|
||||
@@ -819,7 +819,7 @@ bool InstrumentTrack::play( const TimePos & _start, const fpp_t _frames,
|
||||
notePlayHandle->setSongGlobalParentOffset( p->startPosition() );
|
||||
}
|
||||
|
||||
Engine::mixer()->addPlayHandle( notePlayHandle );
|
||||
Engine::audioEngine()->addPlayHandle( notePlayHandle );
|
||||
played_a_note = true;
|
||||
++nit;
|
||||
}
|
||||
@@ -1096,14 +1096,14 @@ void InstrumentTrack::autoAssignMidiDevice(bool assign)
|
||||
}
|
||||
|
||||
const QString &device = ConfigManager::inst()->value("midi", "midiautoassign");
|
||||
if ( Engine::mixer()->midiClient()->isRaw() && device != "none" )
|
||||
if ( Engine::audioEngine()->midiClient()->isRaw() && device != "none" )
|
||||
{
|
||||
m_midiPort.setReadable( assign );
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the device exists
|
||||
if ( Engine::mixer()->midiClient()->readablePorts().indexOf(device) >= 0 )
|
||||
if ( Engine::audioEngine()->midiClient()->readablePorts().indexOf(device) >= 0 )
|
||||
{
|
||||
m_midiPort.subscribeReadablePort(device, assign);
|
||||
m_hasAutoMidiDev = assign;
|
||||
@@ -1170,7 +1170,7 @@ InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it, TrackContainerV
|
||||
m_midiMenu = new QMenu( tr( "MIDI" ), this );
|
||||
|
||||
// sequenced MIDI?
|
||||
if( !Engine::mixer()->midiClient()->isRaw() )
|
||||
if( !Engine::audioEngine()->midiClient()->isRaw() )
|
||||
{
|
||||
_it->m_midiPort.m_readablePortsMenu = new MidiPortMenu(
|
||||
MidiPort::Input );
|
||||
|
||||
@@ -54,7 +54,7 @@ SampleTrack::SampleTrack(TrackContainer* tc) :
|
||||
|
||||
SampleTrack::~SampleTrack()
|
||||
{
|
||||
Engine::mixer()->removePlayHandlesOfTypes( this, PlayHandle::TypeSamplePlayHandle );
|
||||
Engine::audioEngine()->removePlayHandlesOfTypes( this, PlayHandle::TypeSamplePlayHandle );
|
||||
}
|
||||
|
||||
|
||||
@@ -147,8 +147,8 @@ bool SampleTrack::play( const TimePos & _start, const fpp_t _frames,
|
||||
handle = smpHandle;
|
||||
}
|
||||
handle->setOffset( _offset );
|
||||
// send it to the mixer
|
||||
Engine::mixer()->addPlayHandle( handle );
|
||||
// send it to the audio engine
|
||||
Engine::audioEngine()->addPlayHandle( handle );
|
||||
played_a_note = true;
|
||||
}
|
||||
}
|
||||
@@ -218,7 +218,7 @@ void SampleTrack::loadTrackSpecificSettings( const QDomElement & _this )
|
||||
|
||||
void SampleTrack::updateTcos()
|
||||
{
|
||||
Engine::mixer()->removePlayHandlesOfTypes( this, PlayHandle::TypeSamplePlayHandle );
|
||||
Engine::audioEngine()->removePlayHandlesOfTypes( this, PlayHandle::TypeSamplePlayHandle );
|
||||
setPlayingTcos( false );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user