1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-04-02 04:24:51 +02:00

Prevent system sleep at a different point

Instead of only when recording (it broke monitoring), now Audacity
will prevent the system from sleeping while any audio I/O is active.

This might be a little strong-handed though and maybe should be a
preference option.
This commit is contained in:
Leland Lucius
2019-12-24 00:33:54 -06:00
parent 57350ff104
commit 036efda65e
2 changed files with 16 additions and 14 deletions

View File

@@ -16,10 +16,6 @@ Paul Licameli split from ProjectManager.cpp
#include <wx/frame.h>
#include <wx/statusbr.h>
#if defined(__WXMAC__) || defined(__WXMSW__)
#include <wx/power.h>
#endif
#include "AudioIO.h"
#include "AutoRecovery.h"
#include "CommonCommandFlags.h"
@@ -811,11 +807,6 @@ void ProjectAudioManager::OnAudioIORate(int rate)
void ProjectAudioManager::OnAudioIOStartRecording()
{
#if defined(__WXMAC__) || defined(__WXMSW__)
// Don't want the system to sleep while recording
wxPowerResource::Acquire(wxPOWER_RESOURCE_SCREEN, _("Audacity recording"));
#endif
auto &projectFileIO = ProjectFileIO::Get( mProject );
// Before recording is started, auto-save the file. The file will have
// empty tracks at the bottom where the recording will be put into
@@ -825,11 +816,6 @@ void ProjectAudioManager::OnAudioIOStartRecording()
// This is called after recording has stopped and all tracks have flushed.
void ProjectAudioManager::OnAudioIOStopRecording()
{
#if defined(__WXMAC__) || defined(__WXMSW__)
// Done recording, so allow sleeping again
wxPowerResource::Release(wxPOWER_RESOURCE_SCREEN);
#endif
auto &project = mProject;
auto &dirManager = DirManager::Get( project );
auto &projectAudioIO = ProjectAudioIO::Get( project );