Audacity 3.2.0
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]

Public Member Functions

virtual ~SampleBlock ()
 
virtual void CloseLock () noexcept=0
 
virtual SampleBlockID GetBlockID () const =0
 
size_t GetSamples (samplePtr dest, sampleFormat destformat, size_t sampleoffset, size_t numsamples, bool mayThrow=true)
 
virtual BlockSampleView GetFloatSampleView (bool mayThrow)=0
 
virtual sampleFormat GetSampleFormat () const =0
 
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 46 of file SampleBlock.h.

Constructor & Destructor Documentation

◆ ~SampleBlock()

SampleBlock::~SampleBlock ( )
virtualdefault

Member Function Documentation

◆ CloseLock()

virtual void SampleBlock::CloseLock ( )
pure virtualnoexcept

Implemented in SqliteSampleBlock, and MockSampleBlock.

◆ DoGetMinMaxRMS() [1/2]

virtual MinMaxRMS SampleBlock::DoGetMinMaxRMS ( ) const
protectedpure virtual

Implemented in SqliteSampleBlock, and MockSampleBlock.

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, and MockSampleBlock.

◆ DoGetSamples()

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

Implemented in SqliteSampleBlock, and MockSampleBlock.

Referenced by GetSamples().

Here is the caller graph for this function:

◆ GetBlockID()

virtual SampleBlockID SampleBlock::GetBlockID ( ) const
pure virtual

Implemented in SqliteSampleBlock, and MockSampleBlock.

◆ GetFloatSampleView()

virtual BlockSampleView SampleBlock::GetFloatSampleView ( bool  mayThrow)
pure virtual

Implemented in SqliteSampleBlock, and MockSampleBlock.

◆ GetMinMaxRMS() [1/2]

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

Gets extreme values for the entire block.

Definition at line 96 of file SampleBlock.cpp.

97{
98 try{ return DoGetMinMaxRMS(); }
99 catch( ... ) {
100 if( mayThrow )
101 throw;
102 return {};
103 }
104}
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 85 of file SampleBlock.cpp.

87{
88 try{ return DoGetMinMaxRMS(start, len); }
89 catch( ... ) {
90 if( mayThrow )
91 throw;
92 return {};
93 }
94}

References DoGetMinMaxRMS().

Here is the call graph for this function:

◆ GetSampleCount()

virtual size_t SampleBlock::GetSampleCount ( ) const
pure virtual

Implemented in SqliteSampleBlock, and MockSampleBlock.

◆ GetSampleFormat()

virtual sampleFormat SampleBlock::GetSampleFormat ( ) const
pure virtual

Implemented in SqliteSampleBlock, and MockSampleBlock.

◆ GetSamples()

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

Definition at line 71 of file SampleBlock.cpp.

75{
76 try{ return DoGetSamples(dest, destformat, sampleoffset, numsamples); }
77 catch( ... ) {
78 if( mayThrow )
79 throw;
80 ClearSamples( dest, destformat, 0, numsamples );
81 return 0;
82 }
83}
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, and MockSampleBlock.

◆ 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, and MockSampleBlock.

◆ 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, and MockSampleBlock.

◆ SaveXML()

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

Implemented in MockSampleBlock, and SqliteSampleBlock.


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