21#include <QMediaPlayer>
23#include "soundplayer.h"
31 mOriginalSoundClipName = s2.mOriginalSoundClipName;
34SoundClip::~SoundClip()
46 KeyFrame::operator=(a);
47 mOriginalSoundClipName = a.mOriginalSoundClipName;
64 setFileName(strSoundFile);
68bool SoundClip::isValid()
const
70 if (fileName().isEmpty())
85 Q_ASSERT( player !=
nullptr );
86 mPlayer.reset(player);
89void SoundClip::detachPlayer()
102void SoundClip::playFromPosition(
int frameNumber,
int fps)
104 int framesIntoSound = frameNumber;
107 framesIntoSound = frameNumber - pos();
109 qreal msPerFrame = 1000.0 / fps;
110 qint64 msIntoSound = qRound(framesIntoSound * msPerFrame);
113 mPlayer->setMediaPlayerPosition(msIntoSound);
118void SoundClip::pause()
126void SoundClip::stop()
134int64_t SoundClip::duration()
const
139void SoundClip::setDuration(
const int64_t& duration)
141 mDuration = duration;
144void SoundClip::updateLength(
int fps)
146 setLength(qCeil(mDuration * fps / 1000.0));
bool isEmpty() const const