2 * automation_pattern.h - declaration of class automationPattern, which contains
3 * all information about an automation pattern
5 * Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
6 * Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
8 * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public
21 * License along with this program (see COPYING); if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301 USA.
28 #ifndef _AUTOMATION_PATTERN_H
29 #define _AUTOMATION_PATTERN_H
31 #include <QtCore/QPointer>
36 class automationTrack
;
41 class EXPORT automationPattern
: public trackContentObject
45 typedef QMap
<int, float> timeMap
;
46 typedef QVector
<QPointer
<AutomatableModel
> > objectVector
;
48 automationPattern( automationTrack
* _auto_track
);
49 automationPattern( const automationPattern
& _pat_to_copy
);
50 virtual ~automationPattern();
52 void addObject( AutomatableModel
* _obj
, bool _search_dup
= true );
54 const AutomatableModel
* firstObject() const;
56 virtual midiTime
length() const;
58 midiTime
putValue( const midiTime
& _time
, const float _value
,
59 const bool _quant_pos
= true );
61 void removeValue( const midiTime
& _time
);
63 inline const timeMap
& getTimeMap() const
68 inline timeMap
& getTimeMap()
73 inline bool hasAutomation() const
75 return m_hasAutomation
;
78 float valueAt( const midiTime
& _time
) const;
80 const QString
name() const;
82 // settings-management
83 virtual void saveSettings( QDomDocument
& _doc
, QDomElement
& _parent
);
84 virtual void loadSettings( const QDomElement
& _this
);
86 static inline const QString
classNodeName()
88 return "automationpattern";
91 inline virtual QString
nodeName() const
93 return classNodeName();
96 void processMidiTime( const midiTime
& _time
);
98 virtual trackContentObjectView
* createView( trackView
* _tv
);
101 static bool isAutomated( const AutomatableModel
* _m
);
102 static automationPattern
* globalAutomationPattern(
103 AutomatableModel
* _m
);
104 static void resolveAllIDs();
109 void openInAutomationEditor();
110 void objectDestroyed( jo_id_t
);
114 automationTrack
* m_autoTrack
;
115 QVector
<jo_id_t
> m_idsToResolve
;
116 objectVector m_objects
;
117 timeMap m_timeMap
; // actual values
118 bool m_hasAutomation
;
121 friend class automationPatternView
;