Loading...
Searching...
No Matches
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
10namespace Media
11{
12
13class SCORE_PLUGIN_MEDIA_EXPORT ChangeAudioFile final : public score::Command
14{
15 SCORE_COMMAND_DECL(Media::CommandFactoryName(), ChangeAudioFile, "Change audio file")
16public:
18 const Sound::ProcessModel&, const QString& text,
19 const score::DocumentContext& ctx);
20
22
23 void undo(const score::DocumentContext& ctx) const override;
24 void redo(const score::DocumentContext& ctx) const override;
25
26protected:
27 void serializeImpl(DataStreamInput& s) const override;
28 void deserializeImpl(DataStreamOutput& s) override;
29
30private:
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
46class SCORE_PLUGIN_MEDIA_EXPORT RelocateAudioFile final : public score::Command
47{
48 SCORE_COMMAND_DECL(
49 Media::CommandFactoryName(), RelocateAudioFile, "Relocate audio file")
50public:
51 RelocateAudioFile(const Sound::ProcessModel&, QString newPath);
52
53 void undo(const score::DocumentContext& ctx) const override;
54 void redo(const score::DocumentContext& ctx) const override;
55
56protected:
57 void serializeImpl(DataStreamInput& s) const override;
58 void deserializeImpl(DataStreamOutput& s) override;
59
60private:
62 QString m_old, m_new;
63 int m_stream{-1};
64};
65
66class SCORE_PLUGIN_MEDIA_EXPORT LoadProcessedAudioFile final : public score::Command
67{
68 SCORE_COMMAND_DECL(
69 Media::CommandFactoryName(), LoadProcessedAudioFile, "Load processed audio file")
70public:
71 LoadProcessedAudioFile(const Sound::ProcessModel&, const QString& text);
72
73 void undo(const score::DocumentContext& ctx) const override;
74 void redo(const score::DocumentContext& ctx) const override;
75
76protected:
77 void serializeImpl(DataStreamInput& s) const override;
78 void deserializeImpl(DataStreamOutput& s) override;
79
80private:
82 QString m_old, m_new;
83};
84}
85
86PROPERTY_COMMAND_T(Media, ChangeStream, Sound::ProcessModel::p_stream, "Change stream")
87PROPERTY_COMMAND_T(
88 Media, ChangeStart, Sound::ProcessModel::p_startChannel, "Change start channel")
89PROPERTY_COMMAND_T(
90 Media, ChangeUpmix, Sound::ProcessModel::p_upmixChannels, "Change upmix channels")
91PROPERTY_COMMAND_T(
92 Media, ChangeStretchMode, Sound::ProcessModel::p_stretchMode, "Change stretch mode")
93PROPERTY_COMMAND_T(
94 Media, ChangeTempo, Sound::ProcessModel::p_nativeTempo, "Change file tempo")
95SCORE_COMMAND_DECL_T(Media::ChangeStream)
96SCORE_COMMAND_DECL_T(Media::ChangeStart)
97SCORE_COMMAND_DECL_T(Media::ChangeUpmix)
98SCORE_COMMAND_DECL_T(Media::ChangeTempo)
99SCORE_COMMAND_DECL_T(Media::ChangeStretchMode)
Definition ChangeAudioFile.hpp:14
Definition ChangeAudioFile.hpp:67
Points a sound process at the same audio, in another place.
Definition ChangeAudioFile.hpp:47
Definition SoundModel.hpp:28
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