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 124 of file SampleFormat.h.

Constructor & Destructor Documentation

◆ SampleBuffer() [1/3]

SampleBuffer::SampleBuffer ( )
inline

Definition at line 127 of file SampleFormat.h.

128 : mPtr(0)
129 {}
samplePtr mPtr
Definition: SampleFormat.h:169

◆ SampleBuffer() [2/3]

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

Definition at line 130 of file SampleFormat.h.

131 : mPtr((samplePtr)malloc(count * SAMPLE_SIZE(format)))
132 {}
char * samplePtr
Definition: SampleFormat.h:57
#define SAMPLE_SIZE(SampleFormat)
Definition: SampleFormat.h:52

◆ ~SampleBuffer()

SampleBuffer::~SampleBuffer ( )
inline

Definition at line 133 of file SampleFormat.h.

134 {
135 Free();
136 }

References Free().

Here is the call graph for this function:

◆ SampleBuffer() [3/3]

SampleBuffer::SampleBuffer ( SampleBuffer &&  other)
inline

Definition at line 137 of file SampleFormat.h.

138 {
139 mPtr = other.mPtr;
140 other.mPtr = nullptr;
141 }

References mPtr.

Member Function Documentation

◆ Allocate()

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

Definition at line 151 of file SampleFormat.h.

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

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 159 of file SampleFormat.h.

160 {
161 free(mPtr);
162 mPtr = 0;
163 }
void free(void *ptr)
Definition: VectorOps.h:34

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 142 of file SampleFormat.h.

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

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 169 of file SampleFormat.h.

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


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