1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4     Rosegarden
5     A MIDI and audio sequencer and musical notation editor.
6     Copyright 2000-2021 the Rosegarden development team.
7 
8     Other copyrights also apply to some parts of this work.  Please
9     see the AUTHORS file and individual file headers for details.
10 
11     This program is free software; you can redistribute it and/or
12     modify it under the terms of the GNU General Public License as
13     published by the Free Software Foundation; either version 2 of the
14     License, or (at your option) any later version.  See the file
15     COPYING included with this distribution for more information.
16 */
17 
18 #ifndef RG_AUDIOSEGMENTRESCALECOMMAND_H
19 #define RG_AUDIOSEGMENTRESCALECOMMAND_H
20 
21 #include "document/Command.h"
22 #include <QString>
23 #include "base/Event.h"
24 #include <QCoreApplication>
25 
26 #include <QPointer>
27 
28 class QProgressDialog;
29 
30 namespace Rosegarden
31 {
32 
33 class Segment;
34 class AudioFileManager;
35 class AudioFileTimeStretcher;
36 class RosegardenDocument;
37 
38 class AudioSegmentRescaleCommand : public NamedCommand
39 {
40     Q_DECLARE_TR_FUNCTIONS(Rosegarden::AudioSegmentRescaleCommand)
41 
42 public:
43     AudioSegmentRescaleCommand(RosegardenDocument *doc,
44                                Segment *segment, float ratio);
45     AudioSegmentRescaleCommand(RosegardenDocument *doc,
46                                Segment *segment, float ratio,
47                                timeT newStartTime,
48                                timeT newEndMarkerTime);
49     ~AudioSegmentRescaleCommand() override;
50 
51     void execute() override;
52     void unexecute() override;
53 
getStretcher()54     AudioFileTimeStretcher *getStretcher() { return m_stretcher; }
getNewAudioFileId()55     int getNewAudioFileId() const { return m_fid; }
56 
57     /// Used by m_stretcher during execute().
58     void setProgressDialog(QPointer<QProgressDialog> progressDialog);
59 
getGlobalName()60     static QString getGlobalName() { return tr("Stretch or S&quash..."); }
61 
62 private:
63     AudioFileManager *m_afm;
64     AudioFileTimeStretcher *m_stretcher;
65     Segment *m_segment;
66     Segment *m_newSegment;
67     bool m_timesGiven;
68     timeT m_startTime;
69     timeT m_endMarkerTime;
70     int m_fid;
71     float m_ratio;
72     bool m_detached;
73 };
74 
75 
76 
77 }
78 
79 #endif
80