Add member variable for base sample rate and inline sample rate getter functions (#7552)
Co-authored-by: saker <sakertooth@gmail.com>
This commit is contained in:
@@ -74,6 +74,7 @@ static thread_local bool s_renderingThread = false;
|
||||
AudioEngine::AudioEngine( bool renderOnly ) :
|
||||
m_renderOnly( renderOnly ),
|
||||
m_framesPerPeriod( DEFAULT_BUFFER_SIZE ),
|
||||
m_baseSampleRate(std::max(ConfigManager::inst()->value("audioengine", "samplerate").toInt(), 44100)),
|
||||
m_inputBufferRead( 0 ),
|
||||
m_inputBufferWrite( 1 ),
|
||||
m_outputBufferRead(nullptr),
|
||||
@@ -241,34 +242,6 @@ void AudioEngine::stopProcessing()
|
||||
|
||||
|
||||
|
||||
sample_rate_t AudioEngine::baseSampleRate() const
|
||||
{
|
||||
sample_rate_t sr = ConfigManager::inst()->value( "audioengine", "samplerate" ).toInt();
|
||||
if( sr < 44100 )
|
||||
{
|
||||
sr = 44100;
|
||||
}
|
||||
return sr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
sample_rate_t AudioEngine::outputSampleRate() const
|
||||
{
|
||||
return m_audioDev != nullptr ? m_audioDev->sampleRate() :
|
||||
baseSampleRate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
sample_rate_t AudioEngine::inputSampleRate() const
|
||||
{
|
||||
return m_audioDev != nullptr ? m_audioDev->sampleRate() :
|
||||
baseSampleRate();
|
||||
}
|
||||
|
||||
bool AudioEngine::criticalXRuns() const
|
||||
{
|
||||
return cpuLoad() >= 99 && Engine::getSong()->isExporting() == false;
|
||||
|
||||
Reference in New Issue
Block a user