mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-23 17:30:17 +01:00
AUP3: Better space usage calculations
Several improvements in determining how much actual disk space a sampleblock uses. This allows us to provide how much space will be recovered when using File -> Compact Project. In addition, the History window now provides better space estimates.
This commit is contained in:
@@ -12,6 +12,7 @@ Paul Licameli -- split from SampleBlock.cpp and SampleBlock.h
|
||||
#include <sqlite3.h>
|
||||
|
||||
#include "DBConnection.h"
|
||||
#include "ProjectFileIO.h"
|
||||
#include "SampleFormat.h"
|
||||
#include "xml/XMLTagHandler.h"
|
||||
|
||||
@@ -454,8 +455,7 @@ MinMaxRMS SqliteSampleBlock::DoGetMinMaxRMS() const
|
||||
|
||||
size_t SqliteSampleBlock::GetSpaceUsage() const
|
||||
{
|
||||
// Not an exact number, but close enough
|
||||
return mSummary256Bytes + mSummary64kBytes + mSampleBytes;
|
||||
return ProjectFileIO::GetDiskUsage(Conn(), mBlockID);
|
||||
}
|
||||
|
||||
size_t SqliteSampleBlock::GetBlob(void *dest,
|
||||
@@ -868,10 +868,16 @@ void SqliteSampleBlock::CalcSummary()
|
||||
}
|
||||
|
||||
// Inject our database implementation at startup
|
||||
static struct Injector { Injector() {
|
||||
// Do this some time before the first project is created
|
||||
(void) SampleBlockFactory::RegisterFactoryFactory(
|
||||
[]( AudacityProject &project ){
|
||||
return std::make_shared<SqliteSampleBlockFactory>( project ); }
|
||||
);
|
||||
} } injector;
|
||||
static struct Injector
|
||||
{
|
||||
Injector()
|
||||
{
|
||||
// Do this some time before the first project is created
|
||||
(void) SampleBlockFactory::RegisterFactoryFactory(
|
||||
[]( AudacityProject &project )
|
||||
{
|
||||
return std::make_shared<SqliteSampleBlockFactory>( project );
|
||||
}
|
||||
);
|
||||
}
|
||||
} injector;
|
||||
|
||||
Reference in New Issue
Block a user