Audacity  2.2.0
Sequence Class Referencefinal

A WaveTrack contains WaveClip(s). A WaveClip contains a Sequence. A Sequence is primarily an interface to an array of SeqBlock instances, corresponding to the audio BlockFiles on disk. Contrast with RingBuffer. More...

#include <Sequence.h>

Inheritance diagram for Sequence:
XMLTagHandler

Classes

struct  DeleteUpdateMutexLocker
 

Public Member Functions

 Sequence (const std::shared_ptr< DirManager > &projDirManager, sampleFormat format)
 
 Sequence (const Sequence &orig, const std::shared_ptr< DirManager > &projDirManager)
 
 Sequence (const Sequence &) PROHIBITED
 
Sequenceoperator= (const Sequence &) PROHIBITED
 
 ~Sequence ()
 
sampleCount GetNumSamples () const
 
bool Get (samplePtr buffer, sampleFormat format, sampleCount start, size_t len, bool mayThrow) const
 
void SetSamples (samplePtr buffer, sampleFormat format, sampleCount start, sampleCount len)
 
bool GetWaveDisplay (float *min, float *max, float *rms, int *bl, size_t len, const sampleCount *where) const
 
std::unique_ptr< SequenceCopy (sampleCount s0, sampleCount s1) const
 
void Paste (sampleCount s0, const Sequence *src)
 
size_t GetIdealAppendLen () const
 
void Append (samplePtr buffer, sampleFormat format, size_t len, XMLWriter *blockFileLog=NULL)
 
void Delete (sampleCount start, sampleCount len)
 
void AppendAlias (const wxString &fullPath, sampleCount start, size_t len, int channel, bool useOD)
 
void AppendCoded (const wxString &fName, sampleCount start, size_t len, int channel, int decodeType)
 
unsigned int GetODFlags ()
 gets an int with OD flags so that we can determine which ODTasks should be run on this track after save/open, etc. More...
 
void AppendBlockFile (const BlockFilePtr &blockFile)
 
void SetSilence (sampleCount s0, sampleCount len)
 
void InsertSilence (sampleCount s0, sampleCount len)
 
const std::shared_ptr
< DirManager > & 
GetDirManager ()
 
bool HandleXMLTag (const wxChar *tag, const wxChar **attrs) override
 
void HandleXMLEndTag (const wxChar *tag) override
 
XMLTagHandlerHandleXMLChild (const wxChar *tag) override
 
void WriteXML (XMLWriter &xmlFile) const
 
bool GetErrorOpening ()
 
bool Lock ()
 
bool Unlock ()
 
bool CloseLock ()
 
sampleFormat GetSampleFormat () const
 
bool ConvertToSampleFormat (sampleFormat format)
 
std::pair< float, float > GetMinMax (sampleCount start, sampleCount len, bool mayThrow) const
 
float GetRMS (sampleCount start, sampleCount len, bool mayThrow) const
 
sampleCount GetBlockStart (sampleCount position) const
 
size_t GetBestBlockSize (sampleCount start) const
 
size_t GetMaxBlockSize () const
 
size_t GetIdealBlockSize () const
 
BlockArrayGetBlockArray ()
 
void LockDeleteUpdateMutex ()
 
void UnlockDeleteUpdateMutex ()
 
void ConsistencyCheck (const wxChar *whereStr, bool mayThrow=true) const
 
- Public Member Functions inherited from XMLTagHandler
 XMLTagHandler ()
 
virtual ~XMLTagHandler ()
 
virtual void HandleXMLEndTag (const wxChar *WXUNUSED(tag))
 
virtual void HandleXMLContent (const wxString &WXUNUSED(content))
 
bool ReadXMLTag (const char *tag, const char **attrs)
 
void ReadXMLEndTag (const char *tag)
 
void ReadXMLContent (const char *s, int len)
 
XMLTagHandlerReadXMLChild (const char *tag)
 

Static Public Member Functions

static void SetMaxDiskBlockSize (size_t bytes)
 
static size_t GetMaxDiskBlockSize ()
 
static void DebugPrintf (const BlockArray &block, sampleCount numSamples, wxString *dest)
 

Private Member Functions

int FindBlock (sampleCount pos) const
 
bool Get (int b, samplePtr buffer, sampleFormat format, sampleCount start, size_t len, bool mayThrow) const
 
void CommitChangesIfConsistent (BlockArray &newBlock, sampleCount numSamples, const wxChar *whereStr)
 
void AppendBlocksIfConsistent (BlockArray &additionalBlocks, bool replaceLast, sampleCount numSamples, const wxChar *whereStr)
 

Static Private Member Functions

static void AppendBlock (DirManager &dirManager, BlockArray &blocks, sampleCount &numSamples, const SeqBlock &b)
 
static bool Read (samplePtr buffer, sampleFormat format, const SeqBlock &b, size_t blockRelativeStart, size_t len, bool mayThrow)
 
static void Blockify (DirManager &dirManager, size_t maxSamples, sampleFormat format, BlockArray &list, sampleCount start, samplePtr buffer, size_t len)
 
static void ConsistencyCheck (const BlockArray &block, size_t maxSamples, size_t from, sampleCount numSamples, const wxChar *whereStr, bool mayThrow=true)
 

Private Attributes

std::shared_ptr< DirManagermDirManager
 
BlockArray mBlock
 
sampleFormat mSampleFormat
 
sampleCount mNumSamples { 0 }
 
size_t mMinSamples
 
size_t mMaxSamples
 
bool mErrorOpening { false }
 
ODLock mDeleteUpdateMutex
 To block the Delete() method against the ODCalcSummaryTask::Update() method. More...
 

Static Private Attributes

static size_t sMaxDiskBlockSize = 1048576
 

Detailed Description

A WaveTrack contains WaveClip(s). A WaveClip contains a Sequence. A Sequence is primarily an interface to an array of SeqBlock instances, corresponding to the audio BlockFiles on disk. Contrast with RingBuffer.

Constructor & Destructor Documentation

Sequence::Sequence ( const std::shared_ptr< DirManager > &  projDirManager,
sampleFormat  format 
)
Sequence::Sequence ( const Sequence orig,
const std::shared_ptr< DirManager > &  projDirManager 
)

References Paste().

Sequence::Sequence ( const Sequence )
Sequence::~Sequence ( )

Member Function Documentation

void Sequence::Append ( samplePtr  buffer,
sampleFormat  format,
size_t  len,
XMLWriter blockFileLog = NULL 
)
void Sequence::AppendAlias ( const wxString &  fullPath,
sampleCount  start,
size_t  len,
int  channel,
bool  useOD 
)
void Sequence::AppendBlock ( DirManager dirManager,
BlockArray blocks,
sampleCount &  numSamples,
const SeqBlock b 
)
staticprivate
void Sequence::AppendBlockFile ( const BlockFilePtr blockFile)
void Sequence::AppendBlocksIfConsistent ( BlockArray additionalBlocks,
bool  replaceLast,
sampleCount  numSamples,
const wxChar *  whereStr 
)
private

Referenced by Append().

void Sequence::AppendCoded ( const wxString &  fName,
sampleCount  start,
size_t  len,
int  channel,
int  decodeType 
)
void Sequence::Blockify ( DirManager dirManager,
size_t  maxSamples,
sampleFormat  format,
BlockArray list,
sampleCount  start,
samplePtr  buffer,
size_t  len 
)
staticprivate
bool Sequence::CloseLock ( )

References mBlock.

void Sequence::CommitChangesIfConsistent ( BlockArray newBlock,
sampleCount  numSamples,
const wxChar *  whereStr 
)
private
void Sequence::ConsistencyCheck ( const wxChar *  whereStr,
bool  mayThrow = true 
) const
void Sequence::ConsistencyCheck ( const BlockArray block,
size_t  maxSamples,
size_t  from,
sampleCount  numSamples,
const wxChar *  whereStr,
bool  mayThrow = true 
)
staticprivate
std::unique_ptr< Sequence > Sequence::Copy ( sampleCount  s0,
sampleCount  s1 
) const
void Sequence::DebugPrintf ( const BlockArray block,
sampleCount  numSamples,
wxString *  dest 
)
static

References SeqBlock::f, and SeqBlock::start.

int Sequence::FindBlock ( sampleCount  pos) const
private
bool Sequence::Get ( samplePtr  buffer,
sampleFormat  format,
sampleCount  start,
size_t  len,
bool  mayThrow 
) const
bool Sequence::Get ( int  b,
samplePtr  buffer,
sampleFormat  format,
sampleCount  start,
size_t  len,
bool  mayThrow 
) const
private
size_t Sequence::GetBestBlockSize ( sampleCount  start) const
BlockArray& Sequence::GetBlockArray ( )
inline
sampleCount Sequence::GetBlockStart ( sampleCount  position) const

References FindBlock().

Referenced by WaveTrack::GetBlockStart().

const std::shared_ptr<DirManager>& Sequence::GetDirManager ( )
inline
bool Sequence::GetErrorOpening ( )
inline
size_t Sequence::GetIdealAppendLen ( ) const

References GetMaxBlockSize().

size_t Sequence::GetIdealBlockSize ( ) const
size_t Sequence::GetMaxBlockSize ( ) const
size_t Sequence::GetMaxDiskBlockSize ( )
static

References sMaxDiskBlockSize.

Referenced by BenchmarkDialog::OnRun().

std::pair< float, float > Sequence::GetMinMax ( sampleCount  start,
sampleCount  len,
bool  mayThrow 
) const
sampleCount Sequence::GetNumSamples ( ) const
inline
unsigned int Sequence::GetODFlags ( )

gets an int with OD flags so that we can determine which ODTasks should be run on this track after save/open, etc.

References ODTask::eODPCMSummary.

Referenced by WaveTrack::GetODFlags().

float Sequence::GetRMS ( sampleCount  start,
sampleCount  len,
bool  mayThrow 
) const
sampleFormat Sequence::GetSampleFormat ( ) const
bool Sequence::GetWaveDisplay ( float *  min,
float *  max,
float *  rms,
int *  bl,
size_t  len,
const sampleCount *  where 
) const
XMLTagHandler * Sequence::HandleXMLChild ( const wxChar *  tag)
overridevirtual
void Sequence::HandleXMLEndTag ( const wxChar *  tag)
override
void Sequence::InsertSilence ( sampleCount  s0,
sampleCount  len 
)
bool Sequence::Lock ( )

References mBlock.

void Sequence::LockDeleteUpdateMutex ( )
inline

Referenced by ODDecodeTask::Update().

Sequence& Sequence::operator= ( const Sequence )
bool Sequence::Read ( samplePtr  buffer,
sampleFormat  format,
const SeqBlock b,
size_t  blockRelativeStart,
size_t  len,
bool  mayThrow 
)
staticprivate
void Sequence::SetMaxDiskBlockSize ( size_t  bytes)
static
void Sequence::SetSamples ( samplePtr  buffer,
sampleFormat  format,
sampleCount  start,
sampleCount  len 
)
void Sequence::SetSilence ( sampleCount  s0,
sampleCount  len 
)

References mSampleFormat, and SetSamples().

Referenced by WaveTrack::Silence().

bool Sequence::Unlock ( )

References mBlock.

void Sequence::UnlockDeleteUpdateMutex ( )
inline

Referenced by ODDecodeTask::Update().

void Sequence::WriteXML ( XMLWriter xmlFile) const

Member Data Documentation

ODLock Sequence::mDeleteUpdateMutex
private

To block the Delete() method against the ODCalcSummaryTask::Update() method.

std::shared_ptr<DirManager> Sequence::mDirManager
private
bool Sequence::mErrorOpening { false }
private

Referenced by HandleXMLEndTag(), and HandleXMLTag().

size_t Sequence::mMinSamples
private
sampleCount Sequence::mNumSamples { 0 }
private
size_t Sequence::sMaxDiskBlockSize = 1048576
staticprivate

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