LMMS
Loading...
Searching...
No Matches
ControllerConnection.h
Go to the documentation of this file.
1/*
2 * ControllerConnection.h - declaration of a controller connect, which
3 * provides a definition of the link between a controller and
4 * model, also handles deferred creation of links while
5 * loading project
6 *
7 * Copyright (c) 2008 Paul Giblock <pgllama/at/gmail.com>
8 * Copyright (c) 2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
9 *
10 * This file is part of LMMS - https://lmms.io
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public
23 * License along with this program (see COPYING); if not, write to the
24 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 * Boston, MA 02110-1301 USA.
26 *
27 */
28
29#ifndef LMMS_CONTROLLER_CONNECTION_H
30#define LMMS_CONTROLLER_CONNECTION_H
31
32#include <QObject>
33
34#include "Controller.h"
35#include "JournallingObject.h"
36#include "ValueBuffer.h"
37
38#include <vector>
39
40namespace lmms
41{
42
44
45namespace gui
46{
48}
49
50using ControllerConnectionVector = std::vector<ControllerConnection*>;
51
52class LMMS_EXPORT ControllerConnection : public QObject, public JournallingObject
53{
54 Q_OBJECT
55public:
56
57 ControllerConnection(Controller * _controller);
58 ControllerConnection( int _controllerId );
59
60 ~ControllerConnection() override;
61
63 {
64 return m_controller;
65 }
66
67 void setController( Controller * _controller );
68
69 inline void setController( int _controllerId );
70
71 float currentValue( int _offset )
72 {
73 return m_controller->currentValue( _offset );
74 }
75
77 {
78 return m_controller->valueBuffer();
79 }
80
81 inline void setTargetName( const QString & _name );
82
83 inline QString targetName() const
84 {
85 return m_targetName;
86 }
87
88 inline bool isFinalized()
89 {
90 return m_controllerId < 0;
91 }
92
93 static void finalizeConnections();
94
95 void saveSettings( QDomDocument & _doc, QDomElement & _this ) override;
96 void loadSettings( const QDomElement & _this ) override;
97
98 static inline const QString classNodeName()
99 {
100 return "connection";
101 }
102
103 QString nodeName() const override
104 {
105 return classNodeName();
106 }
107
108public slots:
109 void deleteConnection();
110
111protected:
112 //virtual controllerDialog * createDialog( QWidget * _parent );
116
118
120
121signals:
122 // The value changed while the audio engine isn't running (i.e: MIDI CC)
124
126};
127
128
129} // namespace lmms
130
131#endif // LMMS_CONTROLLER_CONNECTION_H
Definition ControllerConnection.h:53
float currentValue(int _offset)
Definition ControllerConnection.h:71
QString nodeName() const override
Definition ControllerConnection.h:103
static const QString classNodeName()
Definition ControllerConnection.h:98
ValueBuffer * valueBuffer()
Definition ControllerConnection.h:76
int m_controllerId
Definition ControllerConnection.h:115
static ControllerConnectionVector s_connections
Definition ControllerConnection.h:119
bool isFinalized()
Definition ControllerConnection.h:88
bool m_ownsController
Definition ControllerConnection.h:117
ControllerConnection(Controller *_controller)
Definition ControllerConnection.cpp:42
QString m_targetName
Definition ControllerConnection.h:114
QString targetName() const
Definition ControllerConnection.h:83
Controller * m_controller
Definition ControllerConnection.h:113
Controller * getController()
Definition ControllerConnection.h:62
Definition Controller.h:51
JournallingObject()
Definition JournallingObject.cpp:36
Definition ValueBuffer.h:38
Definition ControllerConnectionDialog.h:58
Definition AudioPortAudio.cpp:223
Definition AudioAlsa.cpp:35
std::vector< ControllerConnection * > ControllerConnectionVector
Definition ControllerConnection.h:50