Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Don't restore audio device during exporting #4083

Merged
merged 2 commits into from
Mar 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/Mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class EXPORT Mixer : public QObject
void setAudioDevice( AudioDevice * _dev,
const struct qualitySettings & _qs,
bool _needs_fifo );
void storeAudioDevice();
void restoreAudioDevice();
inline AudioDevice * audioDev()
{
Expand Down
1 change: 0 additions & 1 deletion include/ProjectRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public slots:

AudioFileDevice * m_fileDev;
Mixer::qualitySettings m_qualitySettings;
Mixer::qualitySettings m_oldQualitySettings;

volatile int m_progress;
volatile bool m_abort;
Expand Down
1 change: 1 addition & 0 deletions include/RenderManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ private slots:
void restoreMutedState();

const Mixer::qualitySettings m_qualitySettings;
const Mixer::qualitySettings m_oldQualitySettings;
const OutputSettings m_outputSettings;
ProjectRenderer::ExportFileFormats m_format;
QString m_outputPath;
Expand Down
14 changes: 11 additions & 3 deletions src/core/Mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,6 @@ void Mixer::setAudioDevice( AudioDevice * _dev )
{
stopProcessing();

m_oldAudioDev = m_audioDev;

if( _dev == NULL )
{
printf( "param _dev == NULL in Mixer::setAudioDevice(...). "
Expand Down Expand Up @@ -608,7 +606,6 @@ void Mixer::setAudioDevice( AudioDevice * _dev,
stopProcessing();

m_qualitySettings = _qs;
m_oldAudioDev = m_audioDev;

if( _dev == NULL )
{
Expand All @@ -630,6 +627,17 @@ void Mixer::setAudioDevice( AudioDevice * _dev,



void Mixer::storeAudioDevice()
{
if( !m_oldAudioDev )
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've included this check, but looks redundant. Maybe removing is better?

{
m_oldAudioDev = m_audioDev;
}
}




void Mixer::restoreAudioDevice()
{
if( m_oldAudioDev != NULL )
Expand Down
3 changes: 0 additions & 3 deletions src/core/ProjectRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ ProjectRenderer::ProjectRenderer( const Mixer::qualitySettings & qualitySettings
QThread( Engine::mixer() ),
m_fileDev( NULL ),
m_qualitySettings( qualitySettings ),
m_oldQualitySettings( Engine::mixer()->currentQualitySettings() ),
m_progress( 0 ),
m_abort( false )
{
Expand All @@ -103,8 +102,6 @@ ProjectRenderer::ProjectRenderer( const Mixer::qualitySettings & qualitySettings

ProjectRenderer::~ProjectRenderer()
{
Engine::mixer()->restoreAudioDevice(); // also deletes audio-dev
Engine::mixer()->changeQuality( m_oldQualitySettings );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure #3680 still works. If these test projects renders, as instructed, it's a 'go' from me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zonkmachine I'm pretty sure #3680 will still work because RenderManager destructor is called after ProjectRenderer destructor. However, testing is always good. I'll double-check it!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zonkmachine Tested. It still works!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I think you should merge.

}


Expand Down
6 changes: 6 additions & 0 deletions src/core/RenderManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,22 @@ RenderManager::RenderManager(
ProjectRenderer::ExportFileFormats fmt,
QString outputPath) :
m_qualitySettings(qualitySettings),
m_oldQualitySettings( Engine::mixer()->currentQualitySettings() ),
m_outputSettings(outputSettings),
m_format(fmt),
m_outputPath(outputPath),
m_activeRenderer(NULL)
{
Engine::mixer()->storeAudioDevice();
}

RenderManager::~RenderManager()
{
delete m_activeRenderer;
m_activeRenderer = NULL;

Engine::mixer()->restoreAudioDevice(); // Also deletes audio dev.
Engine::mixer()->changeQuality( m_oldQualitySettings );
}

void RenderManager::abortProcessing()
Expand Down