ChangeAudioFile.hpp
1 #pragma once
2 #include <Media/Commands/MediaCommandFactory.hpp>
3 #include <Media/MediaFileHandle.hpp>
4 #include <Media/Sound/SoundModel.hpp>
5 
6 #include <score/command/Command.hpp>
7 #include <score/command/PropertyCommand.hpp>
8 #include <score/model/path/Path.hpp>
9 
10 namespace Media
11 {
12 
13 class SCORE_PLUGIN_MEDIA_EXPORT ChangeAudioFile final : public score::Command
14 {
15  SCORE_COMMAND_DECL(Media::CommandFactoryName(), ChangeAudioFile, "Change audio file")
16 public:
18  const Sound::ProcessModel&, const QString& text,
19  const score::DocumentContext& ctx);
20 
21  ~ChangeAudioFile();
22 
23  void undo(const score::DocumentContext& ctx) const override;
24  void redo(const score::DocumentContext& ctx) const override;
25 
26 protected:
27  void serializeImpl(DataStreamInput& s) const override;
28  void deserializeImpl(DataStreamOutput& s) override;
29 
30 private:
32  QString m_old, m_new;
33  TimeVal m_olddur{};
34  TimeVal m_newdur{};
35  TimeVal m_oldloop{};
36  score::Command* m_resizeInterval{};
37 };
38 
39 class SCORE_PLUGIN_MEDIA_EXPORT LoadProcessedAudioFile final : public score::Command
40 {
41  SCORE_COMMAND_DECL(
42  Media::CommandFactoryName(), LoadProcessedAudioFile, "Load processed audio file")
43 public:
44  LoadProcessedAudioFile(const Sound::ProcessModel&, const QString& text);
45 
46  void undo(const score::DocumentContext& ctx) const override;
47  void redo(const score::DocumentContext& ctx) const override;
48 
49 protected:
50  void serializeImpl(DataStreamInput& s) const override;
51  void deserializeImpl(DataStreamOutput& s) override;
52 
53 private:
55  QString m_old, m_new;
56 };
57 }
58 
59 PROPERTY_COMMAND_T(Media, ChangeStream, Sound::ProcessModel::p_stream, "Change stream")
60 PROPERTY_COMMAND_T(
61  Media, ChangeStart, Sound::ProcessModel::p_startChannel, "Change start channel")
62 PROPERTY_COMMAND_T(
63  Media, ChangeUpmix, Sound::ProcessModel::p_upmixChannels, "Change upmix channels")
64 PROPERTY_COMMAND_T(
65  Media, ChangeStretchMode, Sound::ProcessModel::p_stretchMode, "Change stretch mode")
66 PROPERTY_COMMAND_T(
67  Media, ChangeTempo, Sound::ProcessModel::p_nativeTempo, "Change file tempo")
68 SCORE_COMMAND_DECL_T(Media::ChangeStream)
69 SCORE_COMMAND_DECL_T(Media::ChangeStart)
70 SCORE_COMMAND_DECL_T(Media::ChangeUpmix)
71 SCORE_COMMAND_DECL_T(Media::ChangeTempo)
72 SCORE_COMMAND_DECL_T(Media::ChangeStretchMode)
Definition: ChangeAudioFile.hpp:14
Definition: ChangeAudioFile.hpp:40
Definition: SoundModel.hpp:27
The Path class is a typesafe wrapper around ObjectPath.
Definition: Path.hpp:52
The Command class.
Definition: Command.hpp:34
Definition: DataStreamHelpers.hpp:99
Definition: DataStreamHelpers.hpp:103
Definition: TimeValue.hpp:21
Definition: DocumentContext.hpp:18