Audacity 3.2.0
Public Types | Public Member Functions | Private Attributes | Static Private Attributes | List of all members
TestWaveClipMaker Class Referencefinal

#include <TestWaveClipMaker.h>

Collaboration diagram for TestWaveClipMaker:
[legend]

Public Types

using Operations = std::function< void(WaveClip &)>
 

Public Member Functions

 TestWaveClipMaker (int sampleRate, SampleBlockFactoryPtr)
 
WaveClipHolder ClipFilledWith (const std::vector< std::vector< float > > &values, Operations operations=[](WaveClip &) {}) const
 
WaveClipHolder ClipFilledWith (const std::vector< float > &values, size_t numChannels, Operations operations=[](WaveClip &) {}) const
 
WaveClipHolder ClipFilledWith (float value, size_t numValues, size_t numChannels, Operations operations=[](WaveClip &) {}) const
 

Private Attributes

const int mSampleRate
 
const SampleBlockFactoryPtr mFactory
 

Static Private Attributes

static constexpr bool copyCutLines = false
 

Detailed Description

Definition at line 20 of file TestWaveClipMaker.h.

Member Typedef Documentation

◆ Operations

using TestWaveClipMaker::Operations = std::function<void(WaveClip&)>

Definition at line 25 of file TestWaveClipMaker.h.

Constructor & Destructor Documentation

◆ TestWaveClipMaker()

TestWaveClipMaker::TestWaveClipMaker ( int  sampleRate,
SampleBlockFactoryPtr  factory 
)

Audacity: A Digital Audio Editor

TestWaveClipMaker.cpp

Matthieu Hodgkinson

Definition at line 15 of file TestWaveClipMaker.cpp.

18 , mFactory { factory }
19{
20}
static RegisteredToolbarFactory factory
const SampleBlockFactoryPtr mFactory

Member Function Documentation

◆ ClipFilledWith() [1/3]

WaveClipHolder TestWaveClipMaker::ClipFilledWith ( const std::vector< float > &  values,
size_t  numChannels,
Operations  operations = [](WaveClip&) {} 
) const

Definition at line 42 of file TestWaveClipMaker.cpp.

45{
46 return ClipFilledWith(
47 std::vector<std::vector<float>> { values }, operations);
48}
const wxChar * values
WaveClipHolder ClipFilledWith(const std::vector< std::vector< float > > &values, Operations operations=[](WaveClip &) {}) const

References ClipFilledWith(), and values.

Here is the call graph for this function:

◆ ClipFilledWith() [2/3]

WaveClipHolder TestWaveClipMaker::ClipFilledWith ( const std::vector< std::vector< float > > &  values,
Operations  operations = [](WaveClip&) {} 
) const

Definition at line 22 of file TestWaveClipMaker.cpp.

24{
25 const auto numSamples = values[0].size();
26 const auto clip = std::make_shared<WaveClip>(
28 // Is there any more convenient way of doing this ?
29 clip->InsertSilence(0, 1. * numSamples / mSampleRate);
30 for (auto i = 0u; i < values.size(); ++i)
31 {
32 AudioContainer audio(numSamples, 1u);
33 std::copy(values[i].begin(), values[i].end(), audio.Get()[0u]);
34 clip->SetSamples(
35 i, AudioContainerHelper::GetData<char>(audio)[0u], floatSample, 0,
36 numSamples, floatSample);
37 }
38 operations(*clip);
39 return clip;
40}
MockedAudio audio
const char * end(const char *str) noexcept
Definition: StringUtils.h:106
const char * begin(const char *str) noexcept
Definition: StringUtils.h:101
void copy(const T *src, T *dst, int32_t n)
Definition: VectorOps.h:40

References audio, details::begin(), staffpad::vo::copy(), details::end(), floatSample, mFactory, mSampleRate, and values.

Referenced by ClipFilledWith(), and TEST_CASE().

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

◆ ClipFilledWith() [3/3]

WaveClipHolder TestWaveClipMaker::ClipFilledWith ( float  value,
size_t  numValues,
size_t  numChannels,
Operations  operations = [](WaveClip&) {} 
) const

Definition at line 50 of file TestWaveClipMaker.cpp.

53{
54 std::vector<float> values(numValues);
55 std::fill(values.begin(), values.end(), value);
56 return ClipFilledWith(values, numChannels, operations);
57}

References ClipFilledWith(), and values.

Here is the call graph for this function:

Member Data Documentation

◆ copyCutLines

constexpr bool TestWaveClipMaker::copyCutLines = false
staticconstexprprivate

Definition at line 40 of file TestWaveClipMaker.h.

◆ mFactory

const SampleBlockFactoryPtr TestWaveClipMaker::mFactory
private

Definition at line 43 of file TestWaveClipMaker.h.

Referenced by ClipFilledWith().

◆ mSampleRate

const int TestWaveClipMaker::mSampleRate
private

Definition at line 42 of file TestWaveClipMaker.h.

Referenced by ClipFilledWith().


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