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

Fix minor sample track playback/export glitches #4666

Merged
merged 1 commit into from Oct 29, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions include/Mixer.h
Expand Up @@ -171,10 +171,11 @@ class EXPORT Mixer : public QObject
return m_audioDevStartFailed;
}

void setAudioDevice( AudioDevice * _dev );
void setAudioDevice( AudioDevice * _dev , bool startNow );
void setAudioDevice( AudioDevice * _dev,
const struct qualitySettings & _qs,
bool _needs_fifo );
bool _needs_fifo,
bool startNow );
void storeAudioDevice();
void restoreAudioDevice();
inline AudioDevice * audioDev()
Expand Down
10 changes: 6 additions & 4 deletions src/core/Mixer.cpp
Expand Up @@ -575,7 +575,8 @@ void Mixer::changeQuality( const struct qualitySettings & _qs )



void Mixer::setAudioDevice( AudioDevice * _dev )
void Mixer::setAudioDevice( AudioDevice * _dev,
bool startNow )
{
stopProcessing();

Expand All @@ -592,15 +593,16 @@ void Mixer::setAudioDevice( AudioDevice * _dev )

emit sampleRateChanged();

startProcessing();
if (startNow) {startProcessing();}
}




void Mixer::setAudioDevice( AudioDevice * _dev,
const struct qualitySettings & _qs,
bool _needs_fifo )
bool _needs_fifo,
bool startNow )
{
// don't delete the audio-device
stopProcessing();
Expand All @@ -621,7 +623,7 @@ void Mixer::setAudioDevice( AudioDevice * _dev,
emit qualitySettingsChanged();
emit sampleRateChanged();

startProcessing( _needs_fifo );
if (startNow) {startProcessing( _needs_fifo );}
}


Expand Down
5 changes: 4 additions & 1 deletion src/core/ProjectRenderer.cpp
Expand Up @@ -146,7 +146,7 @@ void ProjectRenderer::startProcessing()
// make slots connected to sampleRateChanged()-signals being
// called immediately
Engine::mixer()->setAudioDevice( m_fileDev,
m_qualitySettings, false );
m_qualitySettings, false, false );

start(
#ifndef LMMS_BUILD_WIN32
Expand Down Expand Up @@ -185,6 +185,9 @@ void ProjectRenderer::run()
tick_t endTick = exportEndpoints.second.getTicks();
tick_t lengthTicks = endTick - startTick;

// Now start processing
Engine::mixer()->startProcessing(false);

// Continually track and emit progress percentage to listeners
while( exportPos.getTicks() < endTick &&
Engine::getSong()->isExporting() == true
Expand Down
4 changes: 1 addition & 3 deletions src/core/Song.cpp
Expand Up @@ -356,9 +356,7 @@ void Song::processNextBuffer()

m_vstSyncController.setAbsolutePosition( ticks );
m_vstSyncController.setPlaybackJumped( true );
}
else if( m_playPos[m_playMode] == tl->loopEnd() - 1 )
{

emit updateSampleTracks();
}
}
Expand Down
9 changes: 6 additions & 3 deletions src/tracks/SampleTrack.cpp
Expand Up @@ -72,13 +72,16 @@ SampleTCO::SampleTCO( Track * _track ) :
connect( timeLine, SIGNAL( positionMarkerMoved() ), this, SLOT( playbackPositionChanged() ) );
}
//playbutton clicked or space key / on Export Song set isPlaying to false
connect( Engine::getSong(), SIGNAL( playbackStateChanged() ), this, SLOT( playbackPositionChanged() ) );
connect( Engine::getSong(), SIGNAL( playbackStateChanged() ),
this, SLOT( playbackPositionChanged() ), Qt::DirectConnection );
//care about loops
connect( Engine::getSong(), SIGNAL( updateSampleTracks() ), this, SLOT( playbackPositionChanged() ) );
connect( Engine::getSong(), SIGNAL( updateSampleTracks() ),
this, SLOT( playbackPositionChanged() ), Qt::DirectConnection );
//care about mute TCOs
connect( this, SIGNAL( dataChanged() ), this, SLOT( playbackPositionChanged() ) );
//care about mute track
connect( getTrack()->getMutedModel(), SIGNAL( dataChanged() ),this, SLOT( playbackPositionChanged() ) );
connect( getTrack()->getMutedModel(), SIGNAL( dataChanged() ),
this, SLOT( playbackPositionChanged() ), Qt::DirectConnection );
//care about TCO position
connect( this, SIGNAL( positionChanged() ), this, SLOT( updateTrackTcos() ) );

Expand Down