Audacity 3.2.0
Classes | Public Member Functions | Protected Member Functions | List of all members
SampleBlock Class Referenceabstract

Abstract class allows access to contents of a block of sound samples, serialization as XML, and reference count management that can suppress reclamation of its storage. More...

#include <SampleBlock.h>

Inheritance diagram for SampleBlock:
[legend]

Classes

struct  DeletionCallback
 Type of function that is informed when a block is about to be deleted. More...
 

Public Member Functions

virtual ~SampleBlock ()
 
virtual void CloseLock ()=0
 
virtual SampleBlockID GetBlockID () const =0
 
size_t GetSamples (samplePtr dest, sampleFormat destformat, size_t sampleoffset, size_t numsamples, bool mayThrow=true)
 
virtual size_t GetSampleCount () const =0
 
virtual bool GetSummary256 (float *dest, size_t frameoffset, size_t numframes)=0
 Non-throwing, should fill with zeroes on failure. More...
 
virtual bool GetSummary64k (float *dest, size_t frameoffset, size_t numframes)=0
 Non-throwing, should fill with zeroes on failure. More...
 
MinMaxRMS GetMinMaxRMS (size_t start, size_t len, bool mayThrow=true)
 Gets extreme values for the specified region. More...
 
MinMaxRMS GetMinMaxRMS (bool mayThrow=true) const
 Gets extreme values for the entire block. More...
 
virtual size_t GetSpaceUsage () const =0
 
virtual void SaveXML (XMLWriter &xmlFile)=0
 

Protected Member Functions

virtual size_t DoGetSamples (samplePtr dest, sampleFormat destformat, size_t sampleoffset, size_t numsamples)=0
 
virtual MinMaxRMS DoGetMinMaxRMS (size_t start, size_t len)=0
 
virtual MinMaxRMS DoGetMinMaxRMS () const =0
 

Detailed Description

Abstract class allows access to contents of a block of sound samples, serialization as XML, and reference count management that can suppress reclamation of its storage.

Definition at line 43 of file SampleBlock.h.

Constructor & Destructor Documentation

◆ ~SampleBlock()

SampleBlock::~SampleBlock ( )
virtualdefault

Member Function Documentation

◆ CloseLock()

virtual void SampleBlock::CloseLock ( )
pure virtual

Implemented in SqliteSampleBlock.

◆ DoGetMinMaxRMS() [1/2]

virtual MinMaxRMS SampleBlock::DoGetMinMaxRMS ( ) const
protectedpure virtual

Implemented in SqliteSampleBlock.

Referenced by GetMinMaxRMS().

Here is the caller graph for this function:

◆ DoGetMinMaxRMS() [2/2]

virtual MinMaxRMS SampleBlock::DoGetMinMaxRMS ( size_t  start,
size_t  len 
)
protectedpure virtual

Implemented in SqliteSampleBlock.

◆ DoGetSamples()

virtual size_t SampleBlock::DoGetSamples ( samplePtr  dest,
sampleFormat  destformat,
size_t  sampleoffset,
size_t  numsamples 
)
protectedpure virtual

Implemented in SqliteSampleBlock.

Referenced by GetSamples().

Here is the caller graph for this function:

◆ GetBlockID()

virtual SampleBlockID SampleBlock::GetBlockID ( ) const
pure virtual

Implemented in SqliteSampleBlock.

Referenced by EstimateRemovedBlocks().

Here is the caller graph for this function:

◆ GetMinMaxRMS() [1/2]

MinMaxRMS SampleBlock::GetMinMaxRMS ( bool  mayThrow = true) const

Gets extreme values for the entire block.

Definition at line 83 of file SampleBlock.cpp.

84{
85 try{ return DoGetMinMaxRMS(); }
86 catch( ... ) {
87 if( mayThrow )
88 throw;
89 return {};
90 }
91}
virtual MinMaxRMS DoGetMinMaxRMS() const =0

References DoGetMinMaxRMS().

Here is the call graph for this function:

◆ GetMinMaxRMS() [2/2]

MinMaxRMS SampleBlock::GetMinMaxRMS ( size_t  start,
size_t  len,
bool  mayThrow = true 
)

Gets extreme values for the specified region.

Definition at line 72 of file SampleBlock.cpp.

74{
75 try{ return DoGetMinMaxRMS(start, len); }
76 catch( ... ) {
77 if( mayThrow )
78 throw;
79 return {};
80 }
81}

References DoGetMinMaxRMS().

Here is the call graph for this function:

◆ GetSampleCount()

virtual size_t SampleBlock::GetSampleCount ( ) const
pure virtual

Implemented in SqliteSampleBlock.

◆ GetSamples()

size_t SampleBlock::GetSamples ( samplePtr  dest,
sampleFormat  destformat,
size_t  sampleoffset,
size_t  numsamples,
bool  mayThrow = true 
)

Definition at line 58 of file SampleBlock.cpp.

62{
63 try{ return DoGetSamples(dest, destformat, sampleoffset, numsamples); }
64 catch( ... ) {
65 if( mayThrow )
66 throw;
67 ClearSamples( dest, destformat, 0, numsamples );
68 return 0;
69 }
70}
void ClearSamples(samplePtr dst, sampleFormat format, size_t start, size_t len)
virtual size_t DoGetSamples(samplePtr dest, sampleFormat destformat, size_t sampleoffset, size_t numsamples)=0

References ClearSamples(), and DoGetSamples().

Here is the call graph for this function:

◆ GetSpaceUsage()

virtual size_t SampleBlock::GetSpaceUsage ( ) const
pure virtual

Implemented in SqliteSampleBlock.

◆ GetSummary256()

virtual bool SampleBlock::GetSummary256 ( float *  dest,
size_t  frameoffset,
size_t  numframes 
)
pure virtual

Non-throwing, should fill with zeroes on failure.

Implemented in SqliteSampleBlock.

◆ GetSummary64k()

virtual bool SampleBlock::GetSummary64k ( float *  dest,
size_t  frameoffset,
size_t  numframes 
)
pure virtual

Non-throwing, should fill with zeroes on failure.

Implemented in SqliteSampleBlock.

◆ SaveXML()

virtual void SampleBlock::SaveXML ( XMLWriter xmlFile)
pure virtual

Implemented in SqliteSampleBlock.


The documentation for this class was generated from the following files: