drumstick  1.0.1
netmidiinput.cpp
1 /*
2  Drumstick RT (realtime MIDI In/Out)
3  Copyright (C) 2009-2015 Pedro Lopez-Cabanillas <plcl@users.sf.net>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19 
20 #include <QUdpSocket>
21 #include "netmidiinput.h"
22 #include "netmidiinput_p.h"
23 
24 namespace drumstick {
25 namespace rt {
26 
27 NetMIDIInput::NetMIDIInput(QObject *parent):
28  MIDIInput(parent),
29  d(new NetMIDIInputPrivate(this))
30 { }
31 
32 void NetMIDIInput::initialize(QSettings *settings)
33 {
34  d->initialize(settings);
35 }
36 
37 QString NetMIDIInput::backendName()
38 {
39  return QLatin1String("Network");
40 }
41 
42 QString NetMIDIInput::publicName()
43 {
44  return d->m_publicName;
45 }
46 
47 void NetMIDIInput::setPublicName(QString name)
48 {
49  d->m_publicName = name;
50 }
51 
52 QStringList NetMIDIInput::connections(bool advanced)
53 {
54  Q_UNUSED(advanced)
55  return d->m_inputDevices;
56 }
57 
58 void NetMIDIInput::setExcludedConnections(QStringList conns)
59 {
60  d->m_excludedNames = conns;
61 }
62 
63 void NetMIDIInput::open(QString name)
64 {
65  d->open(name);
66 }
67 
68 void NetMIDIInput::close()
69 {
70  d->close();
71 }
72 
73 QString NetMIDIInput::currentConnection()
74 {
75  return d->m_currentInput;
76 }
77 
78 void NetMIDIInput::setMIDIThruDevice(MIDIOutput *device)
79 {
80  d->setMIDIThruDevice(device);
81 }
82 
83 void NetMIDIInput::enableMIDIThru(bool enable)
84 {
85  d->m_thruEnabled = enable;
86 }
87 
88 bool NetMIDIInput::isEnabledMIDIThru()
89 {
90  return d->m_thruEnabled && (d->m_out != 0);
91 }
92 
93 }}
94 
The QObject class is the base class of all Qt objects.