Audacity 3.2.0
MockAudioSegmentFactory.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 MockAudioSegmentFactory.h
7
8 Matthieu Hodgkinson
9
10**********************************************************************/
11#pragma once
12
13#include "AudioSegment.h"
15
16class NiceAudioSegment final : public AudioSegment
17{
18public:
19 size_t GetFloats(float* const*, size_t numSamples) override
20 {
21 return numSamples;
22 }
23
24 size_t NChannels() const override
25 {
26 return 1u;
27 }
28
29 bool Empty() const override
30 {
31 return false;
32 }
33};
34
36{
37public:
38 std::vector<std::shared_ptr<AudioSegment>>
40 {
41 ++const_cast<size_t&>(callCount);
42 return { std::make_shared<NiceAudioSegment>() };
43 }
44
45 size_t callCount = 0u;
46};
PlaybackDirection
A generalization for audio segments, whether clips or silence between clips.
Definition: AudioSegment.h:23
std::vector< std::shared_ptr< AudioSegment > > CreateAudioSegmentSequence(double, PlaybackDirection) override
size_t GetFloats(float *const *, size_t numSamples) override
Fills buffers with as many as numSamples or the number of remaining samples, whichever is smaller.
bool Empty() const override
Whether the segment has no more samples to provide.
size_t NChannels() const override
The number of channels in the segment.