Audacity 3.2.0
AnalyzedWaveClip.cpp
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 AnalyzedWaveClip.cpp
7
8 Matthieu Hodgkinson
9
10**********************************************************************/
11#include "AnalyzedWaveClip.h"
12
13#include "ClipMirAudioReader.h"
14#include "WaveClip.h"
15
17 std::shared_ptr<ClipMirAudioReader> reader,
18 std::optional<MIR::ProjectSyncInfo> syncInfo)
19 : mReader { std::move(reader) }
20 , mSyncInfo { syncInfo }
21{
22 assert(mReader);
23}
24
25const std::optional<MIR::ProjectSyncInfo>& AnalyzedWaveClip::GetSyncInfo() const
26{
27 return mSyncInfo;
28}
29
31{
32 if (mReader)
33 mReader->clip->SetRawAudioTempo(tempo);
34}
35
37{
38 if (!mReader || !mSyncInfo)
39 return;
40 auto& clip = *mReader->clip;
41 clip.SetRawAudioTempo(mSyncInfo->rawAudioTempo);
42 clip.TrimQuarternotesFromRight(mSyncInfo->excessDurationInQuarternotes);
43 clip.StretchBy(mSyncInfo->stretchMinimizingPowOfTwo);
44}
AnalyzedWaveClip(std::shared_ptr< ClipMirAudioReader > reader, std::optional< MIR::ProjectSyncInfo > syncInfo)
void Synchronize() override
const std::optional< MIR::ProjectSyncInfo > & GetSyncInfo() const override
const std::shared_ptr< ClipMirAudioReader > mReader
const std::optional< MIR::ProjectSyncInfo > mSyncInfo
void SetRawAudioTempo(double tempo) override
STL namespace.