From ff1d75be86417239ca29f78a287b5c6895522e1a Mon Sep 17 00:00:00 2001 From: Johannes Lorenz Date: Tue, 4 Jun 2019 23:20:17 +0200 Subject: [PATCH 1/2] Fix metadata when exporting multiple tracks (#4996) --- include/Mixer.h | 4 ++++ src/core/Mixer.cpp | 46 +++++++++++++++++++++++++--------------------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/include/Mixer.h b/include/Mixer.h index 757a08d4991..79fbf7db392 100644 --- a/include/Mixer.h +++ b/include/Mixer.h @@ -171,7 +171,10 @@ class EXPORT Mixer : public QObject return m_audioDevStartFailed; } + //! Set new audio device. Old device will be deleted, + //! unless it's stored using storeAudioDevice void setAudioDevice( AudioDevice * _dev , bool startNow ); + //! See overloaded function void setAudioDevice( AudioDevice * _dev, const struct qualitySettings & _qs, bool _needs_fifo, @@ -396,6 +399,7 @@ class EXPORT Mixer : public QObject bool m_isProcessing; // audio device stuff + void doSetAudioDevice( AudioDevice *_dev ); AudioDevice * m_audioDev; AudioDevice * m_oldAudioDev; QString m_audioDevName; diff --git a/src/core/Mixer.cpp b/src/core/Mixer.cpp index c873056419a..b3fbb464cb8 100644 --- a/src/core/Mixer.cpp +++ b/src/core/Mixer.cpp @@ -575,21 +575,35 @@ void Mixer::changeQuality( const struct qualitySettings & _qs ) -void Mixer::setAudioDevice( AudioDevice * _dev, - bool startNow ) +void Mixer::doSetAudioDevice( AudioDevice * _dev ) { - stopProcessing(); + // TODO: Use shared_ptr here in the future. + // Currently, this is save, because this is only called by + // ProjectRenderer, and after ProjectRenderer calls this function, + // it does not access the old device anymore. + if( m_audioDev != m_oldAudioDev ) {delete m_audioDev;} - if( _dev == NULL ) + if( _dev ) { - printf( "param _dev == NULL in Mixer::setAudioDevice(...). " - "Trying any working audio-device\n" ); - m_audioDev = tryAudioDevices(); + m_audioDev = _dev; } else { - m_audioDev = _dev; + printf( "param _dev == NULL in Mixer::setAudioDevice(...). " + "Trying any working audio-device\n" ); + m_audioDev = tryAudioDevices(); } +} + + + + +void Mixer::setAudioDevice( AudioDevice * _dev, + bool startNow ) +{ + stopProcessing(); + + doSetAudioDevice( _dev ); emit sampleRateChanged(); @@ -599,26 +613,16 @@ void Mixer::setAudioDevice( AudioDevice * _dev, -void Mixer::setAudioDevice( AudioDevice * _dev, +void Mixer::setAudioDevice(AudioDevice * _dev, const struct qualitySettings & _qs, bool _needs_fifo, - bool startNow ) + bool startNow) { - // don't delete the audio-device stopProcessing(); m_qualitySettings = _qs; - if( _dev == NULL ) - { - printf( "param _dev == NULL in Mixer::setAudioDevice(...). " - "Trying any working audio-device\n" ); - m_audioDev = tryAudioDevices(); - } - else - { - m_audioDev = _dev; - } + doSetAudioDevice( _dev ); emit qualitySettingsChanged(); emit sampleRateChanged(); From 8e5b7a603a1a35c50ebc912932447b7aa4e09fa7 Mon Sep 17 00:00:00 2001 From: Johannes Lorenz <1042576+JohannesLorenz@users.noreply.github.com> Date: Wed, 5 Jun 2019 18:48:03 +0200 Subject: [PATCH 2/2] Mixer.cpp: Fix spelling mistake Co-Authored-By: Hyunjin Song --- src/core/Mixer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/Mixer.cpp b/src/core/Mixer.cpp index b3fbb464cb8..ac1aa256455 100644 --- a/src/core/Mixer.cpp +++ b/src/core/Mixer.cpp @@ -578,7 +578,7 @@ void Mixer::changeQuality( const struct qualitySettings & _qs ) void Mixer::doSetAudioDevice( AudioDevice * _dev ) { // TODO: Use shared_ptr here in the future. - // Currently, this is save, because this is only called by + // Currently, this is safe, because this is only called by // ProjectRenderer, and after ProjectRenderer calls this function, // it does not access the old device anymore. if( m_audioDev != m_oldAudioDev ) {delete m_audioDev;}