Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
SampleBuffer Class Reference

#include <SampleFormat.h>

Inheritance diagram for SampleBuffer:
[legend]

Public Member Functions

 SampleBuffer ()
 
 SampleBuffer (size_t count, sampleFormat format)
 
 ~SampleBuffer ()
 
 SampleBuffer (SampleBuffer &&other)
 
SampleBufferoperator= (SampleBuffer &&other)
 
SampleBufferAllocate (size_t count, sampleFormat format)
 
void Free ()
 
samplePtr ptr () const
 

Private Attributes

samplePtr mPtr
 

Detailed Description

Definition at line 122 of file SampleFormat.h.

Constructor & Destructor Documentation

◆ SampleBuffer() [1/3]

SampleBuffer::SampleBuffer ( )
inline

Definition at line 125 of file SampleFormat.h.

126 : mPtr(0)
127 {}
samplePtr mPtr
Definition: SampleFormat.h:167

◆ SampleBuffer() [2/3]

SampleBuffer::SampleBuffer ( size_t  count,
sampleFormat  format 
)
inline

Definition at line 128 of file SampleFormat.h.

129 : mPtr((samplePtr)malloc(count * SAMPLE_SIZE(format)))
130 {}
char * samplePtr
Definition: SampleFormat.h:55
#define SAMPLE_SIZE(SampleFormat)
Definition: SampleFormat.h:50

◆ ~SampleBuffer()

SampleBuffer::~SampleBuffer ( )
inline

Definition at line 131 of file SampleFormat.h.

132 {
133 Free();
134 }

References Free().

Here is the call graph for this function:

◆ SampleBuffer() [3/3]

SampleBuffer::SampleBuffer ( SampleBuffer &&  other)
inline

Definition at line 135 of file SampleFormat.h.

136 {
137 mPtr = other.mPtr;
138 other.mPtr = nullptr;
139 }

References mPtr.

Member Function Documentation

◆ Allocate()

SampleBuffer & SampleBuffer::Allocate ( size_t  count,
sampleFormat  format 
)
inline

Definition at line 149 of file SampleFormat.h.

150 {
151 Free();
152 mPtr = (samplePtr)malloc(count * SAMPLE_SIZE(format));
153 return *this;
154 }

References anonymous_namespace{ExportPCM.cpp}::format, Free(), mPtr, and SAMPLE_SIZE.

Referenced by Sequence::Append(), Sequence::Delete(), AudioIO::DrainRecordBuffers(), anonymous_namespace{Sequence.cpp}::ensureSampleBufferSize(), PCMImportFileHandle::Import(), GrowableSampleBuffer::Resize(), and Sequence::SetSamples().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Free()

void SampleBuffer::Free ( )
inline

Definition at line 157 of file SampleFormat.h.

158 {
159 free(mPtr);
160 mPtr = 0;
161 }
void free(void *ptr)
Definition: VectorOps.h:25

References staffpad::vo::free(), and mPtr.

Referenced by Allocate(), Sequence::Flush(), GrowableSampleBuffer::Free(), and ~SampleBuffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

SampleBuffer & SampleBuffer::operator= ( SampleBuffer &&  other)
inline

Definition at line 140 of file SampleFormat.h.

141 {
142 auto ptr = other.mPtr;
143 other.mPtr = nullptr;
144 mPtr = ptr;
145 return *this;
146 }
samplePtr ptr() const
Definition: SampleFormat.h:163

References mPtr, and ptr().

Here is the call graph for this function:

◆ ptr()

samplePtr SampleBuffer::ptr ( ) const
inline

Member Data Documentation

◆ mPtr

samplePtr SampleBuffer::mPtr
private

Definition at line 167 of file SampleFormat.h.

Referenced by Allocate(), Free(), operator=(), ptr(), and SampleBuffer().


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