mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-01-20 21:00:46 +01:00
Replace QTimeLine::CurveShape with QEasingCurve
This commit is contained in:
parent
6e2ec89a05
commit
638998a861
@ -43,6 +43,7 @@
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
#include <QTimeLine>
|
||||
#include <QEasingCurve>
|
||||
#include <QMetaObject>
|
||||
#include <QFlags>
|
||||
#include <QTimerEvent>
|
||||
@ -233,7 +234,7 @@ void GstEngine::Pause() {
|
||||
// Check if we started a fade out. If it isn't finished yet and the user pressed play, we inverse the fader and resume the playback.
|
||||
if (is_fading_out_to_pause_) {
|
||||
disconnect(current_pipeline_.get(), SIGNAL(FaderFinished()), nullptr, nullptr);
|
||||
current_pipeline_->StartFader(fadeout_pause_duration_nanosec_, QTimeLine::Forward, QTimeLine::EaseInOutCurve, false);
|
||||
current_pipeline_->StartFader(fadeout_pause_duration_nanosec_, QTimeLine::Forward, QEasingCurve::InOutQuad, false);
|
||||
is_fading_out_to_pause_ = false;
|
||||
has_faded_out_ = false;
|
||||
emit StateChanged(Engine::Playing);
|
||||
@ -264,7 +265,7 @@ void GstEngine::Unpause() {
|
||||
// If we pause with fadeout, deactivate fadeout and resume playback, the player would be muted if not faded in.
|
||||
if (has_faded_out_) {
|
||||
disconnect(current_pipeline_.get(), SIGNAL(FaderFinished()), nullptr, nullptr);
|
||||
current_pipeline_->StartFader(fadeout_pause_duration_nanosec_, QTimeLine::Forward, QTimeLine::EaseInOutCurve, false);
|
||||
current_pipeline_->StartFader(fadeout_pause_duration_nanosec_, QTimeLine::Forward, QEasingCurve::InOutQuad, false);
|
||||
has_faded_out_ = false;
|
||||
}
|
||||
|
||||
@ -725,9 +726,9 @@ void GstEngine::StartFadeoutPause() {
|
||||
fadeout_pause_pipeline_ = current_pipeline_;
|
||||
disconnect(fadeout_pause_pipeline_.get(), SIGNAL(FaderFinished()), nullptr, nullptr);
|
||||
|
||||
fadeout_pause_pipeline_->StartFader(fadeout_pause_duration_nanosec_, QTimeLine::Backward, QTimeLine::EaseInOutCurve, false);
|
||||
fadeout_pause_pipeline_->StartFader(fadeout_pause_duration_nanosec_, QTimeLine::Backward, QEasingCurve::InOutQuad, false);
|
||||
if (fadeout_pipeline_ && fadeout_pipeline_->state() == GST_STATE_PLAYING) {
|
||||
fadeout_pipeline_->StartFader(fadeout_pause_duration_nanosec_, QTimeLine::Backward, QTimeLine::LinearCurve, false);
|
||||
fadeout_pipeline_->StartFader(fadeout_pause_duration_nanosec_, QTimeLine::Backward, QEasingCurve::Linear, false);
|
||||
}
|
||||
connect(fadeout_pause_pipeline_.get(), SIGNAL(FaderFinished()), SLOT(FadeoutPauseFinished()));
|
||||
is_fading_out_to_pause_ = true;
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QTimeLine>
|
||||
#include <QEasingCurve>
|
||||
#include <QMetaObject>
|
||||
#include <QUuid>
|
||||
#include <QtDebug>
|
||||
@ -1136,7 +1137,7 @@ void GstEnginePipeline::UpdateEqualizer() {
|
||||
|
||||
}
|
||||
|
||||
void GstEnginePipeline::StartFader(const qint64 duration_nanosec, const QTimeLine::Direction direction, const QTimeLine::CurveShape shape, const bool use_fudge_timer) {
|
||||
void GstEnginePipeline::StartFader(const qint64 duration_nanosec, const QTimeLine::Direction direction, const QEasingCurve::Type shape, const bool use_fudge_timer) {
|
||||
|
||||
const int duration_msec = duration_nanosec / kNsecPerMsec;
|
||||
|
||||
@ -1157,7 +1158,7 @@ void GstEnginePipeline::StartFader(const qint64 duration_nanosec, const QTimeLin
|
||||
connect(fader_.get(), SIGNAL(valueChanged(qreal)), SLOT(SetVolumeModifier(qreal)));
|
||||
connect(fader_.get(), SIGNAL(finished()), SLOT(FaderTimelineFinished()));
|
||||
fader_->setDirection(direction);
|
||||
fader_->setCurveShape(shape);
|
||||
fader_->setEasingCurve(shape);
|
||||
fader_->setCurrentTime(start_time);
|
||||
fader_->resume();
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <QThreadPool>
|
||||
#include <QFuture>
|
||||
#include <QTimeLine>
|
||||
#include <QEasingCurve>
|
||||
#include <QBasicTimer>
|
||||
#include <QList>
|
||||
#include <QByteArray>
|
||||
@ -88,7 +89,7 @@ class GstEnginePipeline : public QObject {
|
||||
void SetStereoBalance(const float value);
|
||||
void SetEqualizerParams(const int preamp, const QList<int> &band_gains);
|
||||
|
||||
void StartFader(const qint64 duration_nanosec, const QTimeLine::Direction direction = QTimeLine::Forward, const QTimeLine::CurveShape shape = QTimeLine::LinearCurve, const bool use_fudge_timer = true);
|
||||
void StartFader(const qint64 duration_nanosec, const QTimeLine::Direction direction = QTimeLine::Forward, const QEasingCurve::Type shape = QEasingCurve::Linear, const bool use_fudge_timer = true);
|
||||
|
||||
// If this is set then it will be loaded automatically when playback finishes for gapless playback
|
||||
void SetNextUrl(const QByteArray &stream_url, const QUrl &original_url, qint64 beginning_nanosec, qint64 end_nanosec);
|
||||
|
Loading…
Reference in New Issue
Block a user