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 44 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 86 of file SampleBlock.cpp.

87{
88 try{ return DoGetMinMaxRMS(); }
89 catch( ... ) {
90 if( mayThrow )
91 throw;
92 return {};
93 }
94}
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 75 of file SampleBlock.cpp.

77{
78 try{ return DoGetMinMaxRMS(start, len); }
79 catch( ... ) {
80 if( mayThrow )
81 throw;
82 return {};
83 }
84}

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 61 of file SampleBlock.cpp.

65{
66 try{ return DoGetSamples(dest, destformat, sampleoffset, numsamples); }
67 catch( ... ) {
68 if( mayThrow )
69 throw;
70 ClearSamples( dest, destformat, 0, numsamples );
71 return 0;
72 }
73}
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: