24 : mClips {
std::move(clips) }
26 , mNumChannels { numChannels }
30std::vector<std::shared_ptr<AudioSegment>>
39std::vector<std::shared_ptr<AudioSegment>>
44 sortedClips.begin(), sortedClips.end(),
45 [](
const std::shared_ptr<const ClipInterface>& a,
46 const std::shared_ptr<const ClipInterface>& b) {
47 return a->GetPlayStartTime() < b->GetPlayStartTime();
49 std::vector<std::shared_ptr<AudioSegment>> segments;
50 for (
const auto& clip : sortedClips)
52 if (clip->GetPlayStartTime() > t0)
54 const auto numSamples =
57 std::make_shared<SilenceSegment>(
mNumChannels, numSamples));
58 t0 = clip->GetPlayStartTime();
60 else if (clip->GetPlayEndTime() <= t0)
62 segments.push_back(std::make_shared<ClipSegment>(
64 t0 = clip->GetPlayEndTime();
69std::vector<std::shared_ptr<AudioSegment>>
74 sortedClips.begin(), sortedClips.end(),
76 const std::shared_ptr<const ClipInterface>& a,
77 const std::shared_ptr<const ClipInterface>& b) {
78 return a->GetPlayEndTime() > b->GetPlayEndTime();
80 std::vector<std::shared_ptr<AudioSegment>> segments;
81 for (
const auto& clip : sortedClips)
83 if (clip->GetPlayEndTime() < t0)
85 const auto numSamples =
88 std::make_shared<SilenceSegment>(
mNumChannels, numSamples));
89 t0 = clip->GetPlayEndTime();
91 else if (clip->GetPlayStartTime() >= t0)
93 segments.push_back(std::make_shared<ClipSegment>(
95 t0 = clip->GetPlayStartTime();
std::shared_ptr< const ClipInterface > ClipConstHolder
std::vector< std::shared_ptr< const ClipInterface > > ClipConstHolders
AudioSegmentFactory(int sampleRate, int numChannels, ClipConstHolders clips)
const ClipConstHolders mClips
std::vector< std::shared_ptr< AudioSegment > > CreateAudioSegmentSequenceBackward(double playbackStartTime)
std::vector< std::shared_ptr< AudioSegment > > CreateAudioSegmentSequenceForward(double playbackStartTime)
std::vector< std::shared_ptr< AudioSegment > > CreateAudioSegmentSequence(double playbackStartTime, PlaybackDirection) override
Positions or offsets within audio files need a wide type.
constexpr auto sampleRate