Skip to content

Commit

Permalink
[Mod] After seeking, inform plugins about the new playback position i…
Browse files Browse the repository at this point in the history
…mmediately if playback is stopped (https://bugs.openmpt.org/view.php?id=1731).

git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22309 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Nov 25, 2024
1 parent 88314c0 commit cc4f997
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions soundlib/Snd_fx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,8 @@ std::vector<GetLengthType> CSoundFile::GetLength(enmGetLengthResetMode adjustMod
{
m_MixPlugins[plug].fDryRatio = dryWetRatio;
}

UpdatePluginPositions();
#endif // NO_PLUGINS
} else if(adjustMode != eAdjustOnSuccess)
{
Expand Down
19 changes: 19 additions & 0 deletions soundlib/Sndfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,25 @@ void CSoundFile::ResumePlugins()
}


void CSoundFile::UpdatePluginPositions()
{
#ifndef NO_PLUGINS
float out = 0.0f;
for(auto &plugin : m_MixPlugins)
{
IMixPlugin *pPlugin = plugin.pMixPlugin;
if(pPlugin != nullptr && !pPlugin->IsResumed())
{
pPlugin->PositionChanged();
pPlugin->Resume();
pPlugin->Process(&out, &out, 0);
pPlugin->Suspend();
}
}
#endif // NO_PLUGINS
}


void CSoundFile::StopAllVsti()
{
#ifndef NO_PLUGINS
Expand Down
1 change: 1 addition & 0 deletions soundlib/Sndfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,7 @@ class CSoundFile
// Real-time sound functions
void SuspendPlugins();
void ResumePlugins();
void UpdatePluginPositions();
void StopAllVsti();
void RecalculateGainForAllPlugs();
void ResetChannels();
Expand Down

0 comments on commit cc4f997

Please sign in to comment.