Audacity 3.2.0
Namespaces | Typedefs | Functions | Variables
ClipTimeAndPitchSourceTest.cpp File Reference
#include "ClipTimeAndPitchSource.h"
#include "AudioContainer.h"
#include "FloatVectorClip.h"
#include <catch2/catch.hpp>
Include dependency graph for ClipTimeAndPitchSourceTest.cpp:

Go to the source code of this file.

Namespaces

namespace  anonymous_namespace{ClipTimeAndPitchSourceTest.cpp}
 

Typedefs

using anonymous_namespace{ClipTimeAndPitchSourceTest.cpp}::FloatVectorVector = std::vector< std::vector< float > >
 

Functions

 TEST_CASE ("ClipTimeAndPitchSource")
 

Variables

constexpr auto anonymous_namespace{ClipTimeAndPitchSourceTest.cpp}::sampleRate = 3
 

Function Documentation

◆ TEST_CASE()

TEST_CASE ( "ClipTimeAndPitchSource"  )

Definition at line 23 of file ClipTimeAndPitchSourceTest.cpp.

24{
25 const auto direction =
27
28 SECTION("Pull reads correctly past the end of the clip")
29 {
30 const auto clip = std::make_shared<FloatVectorClip>(
31 sampleRate, FloatVectorVector { { 1.f, 2.f, 3.f, 4.f, 5.f } });
32 ClipTimeAndPitchSource sut { *clip, 0., direction };
33 constexpr auto bufferSize = 3;
34 AudioContainer output(bufferSize, 1u);
35
36 sut.Pull(output.channelPointers.data(), bufferSize);
37 const auto firstExpected = direction == PlaybackDirection::forward ?
38 std::vector<float> { 1.f, 2.f, 3.f } :
39 std::vector<float> { 5.f, 4.f, 3.f };
40 REQUIRE(output.channelVectors[0] == firstExpected);
41
42 sut.Pull(output.channelPointers.data(), bufferSize);
43 const auto secondExpected = direction == PlaybackDirection::forward ?
44 std::vector<float> { 4.f, 5.f, 0.f } :
45 std::vector<float> { 2.f, 1.f, 0.f };
46 REQUIRE(output.channelVectors[0] == secondExpected);
47 }
48}

References backward, AudioContainer::channelPointers, AudioContainer::channelVectors, forward, and anonymous_namespace{ClipTimeAndPitchSourceTest.cpp}::sampleRate.