MCPcopy Create free account
hub / github.com/audacity/audacity / OnPause

Method OnPause

src/ProjectAudioManager.cpp:1010–1046  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1008}
1009
1010void ProjectAudioManager::OnPause()
1011{
1012 auto &projectAudioManager = *this;
1013 bool canStop = projectAudioManager.CanStopAudioStream();
1014
1015 if ( !canStop ) {
1016 return;
1017 }
1018
1019 bool paused = !projectAudioManager.Paused();
1020 TogglePaused();
1021
1022 auto gAudioIO = AudioIO::Get();
1023
1024 auto project = &mProject;
1025 auto &scrubber = Scrubber::Get( *project );
1026
1027 // Bug 1494 - Pausing a seek or scrub should just STOP as
1028 // it is confusing to be in a paused scrub state.
1029 bool bStopInstead = paused &&
1030 ScrubState::IsScrubbing() &&
1031 !scrubber.IsSpeedPlaying() &&
1032 !scrubber.IsKeyboardScrubbing();
1033
1034 if (bStopInstead) {
1035 Stop();
1036 return;
1037 }
1038
1039 if (ScrubState::IsScrubbing())
1040 scrubber.Pause(paused);
1041 else
1042 {
1043 constexpr auto publish = true;
1044 gAudioIO->SetPaused(paused, publish);
1045 }
1046}
1047
1048
1049void ProjectAudioManager::TogglePaused()

Callers 1

ClickMethod · 0.45

Calls 6

GetFunction · 0.85
CanStopAudioStreamMethod · 0.80
PausedMethod · 0.80
SetPausedMethod · 0.80
StopClass · 0.70
PauseMethod · 0.45

Tested by

no test coverage detected