Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
TimeAndPitchRealSource Class Referencefinal

#include <TimeAndPitchRealSource.h>

Inheritance diagram for TimeAndPitchRealSource:
[legend]
Collaboration diagram for TimeAndPitchRealSource:
[legend]

Public Member Functions

 TimeAndPitchRealSource (const std::vector< std::vector< float > > &input)
 
void Pull (float *const *buffer, size_t samplesPerChannel) override
 
- Public Member Functions inherited from TimeAndPitchSource
virtual ~TimeAndPitchSource ()
 
virtual void Pull (float *const *, size_t samplesPerChannel)=0
 

Private Attributes

const std::vector< std::vector< float > > & mInput
 
unsigned long long mNumPulledFrames = 0u
 

Detailed Description


Audacity: A Digital Audio Editor

TimeAndPitchRealSource.cpp

Matthieu Hodgkinson

Definition at line 17 of file TimeAndPitchRealSource.h.

Constructor & Destructor Documentation

◆ TimeAndPitchRealSource()

TimeAndPitchRealSource::TimeAndPitchRealSource ( const std::vector< std::vector< float > > &  input)
inline

Definition at line 20 of file TimeAndPitchRealSource.h.

21 : mInput(input)
22 {
23 }
const std::vector< std::vector< float > > & mInput

Member Function Documentation

◆ Pull()

void TimeAndPitchRealSource::Pull ( float *const *  buffer,
size_t  samplesPerChannel 
)
inlineoverridevirtual

Implements TimeAndPitchSource.

Definition at line 25 of file TimeAndPitchRealSource.h.

26 {
27 const auto numFrames = mInput[0].size();
28 const auto remainingSamples =
29 numFrames > mNumPulledFrames ? numFrames - mNumPulledFrames : 0u;
30 const size_t framesToRead = std::min(
31 remainingSamples,
32 static_cast<decltype(remainingSamples)>(samplesPerChannel));
33 const auto numZerosToPad = samplesPerChannel - framesToRead;
34 for (auto i = 0u; i < mInput.size(); ++i)
35 {
36 const auto in = mInput[i].data() + mNumPulledFrames;
37 std::copy(in, in + framesToRead, buffer[i]);
38 std::fill(
39 buffer[i] + framesToRead, buffer[i] + framesToRead + numZerosToPad,
40 0.f);
41 }
42 mNumPulledFrames += framesToRead;
43 }
int min(int a, int b)
unsigned long long mNumPulledFrames
void copy(const T *src, T *dst, int32_t n)
Definition: VectorOps.h:40

References staffpad::vo::copy(), min(), mInput, and mNumPulledFrames.

Here is the call graph for this function:

Member Data Documentation

◆ mInput

const std::vector<std::vector<float> >& TimeAndPitchRealSource::mInput
private

Definition at line 46 of file TimeAndPitchRealSource.h.

Referenced by Pull().

◆ mNumPulledFrames

unsigned long long TimeAndPitchRealSource::mNumPulledFrames = 0u
private

Definition at line 47 of file TimeAndPitchRealSource.h.

Referenced by Pull().


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