drumstick  1.0.2
netmidiinput.cpp
00001 /*
00002     Drumstick RT (realtime MIDI In/Out)
00003     Copyright (C) 2009-2015 Pedro Lopez-Cabanillas <plcl@users.sf.net>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License along
00016     with this program; if not, write to the Free Software Foundation, Inc.,
00017     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018 */
00019 
00020 #include <QUdpSocket>
00021 #include "netmidiinput.h"
00022 #include "netmidiinput_p.h"
00023 
00024 namespace drumstick {
00025 namespace rt {
00026 
00027 NetMIDIInput::NetMIDIInput(QObject *parent):
00028     MIDIInput(parent),
00029     d(new NetMIDIInputPrivate(this))
00030 { }
00031 
00032 void NetMIDIInput::initialize(QSettings *settings)
00033 {
00034     d->initialize(settings);
00035 }
00036 
00037 QString NetMIDIInput::backendName()
00038 {
00039     return QLatin1String("Network");
00040 }
00041 
00042 QString NetMIDIInput::publicName()
00043 {
00044     return d->m_publicName;
00045 }
00046 
00047 void NetMIDIInput::setPublicName(QString name)
00048 {
00049     d->m_publicName = name;
00050 }
00051 
00052 QStringList NetMIDIInput::connections(bool advanced)
00053 {
00054     Q_UNUSED(advanced)
00055     return d->m_inputDevices;
00056 }
00057 
00058 void NetMIDIInput::setExcludedConnections(QStringList conns)
00059 {
00060     d->m_excludedNames = conns;
00061 }
00062 
00063 void NetMIDIInput::open(QString name)
00064 {
00065     d->open(name);
00066 }
00067 
00068 void NetMIDIInput::close()
00069 {
00070     d->close();
00071 }
00072 
00073 QString NetMIDIInput::currentConnection()
00074 {
00075     return d->m_currentInput;
00076 }
00077 
00078 void NetMIDIInput::setMIDIThruDevice(MIDIOutput *device)
00079 {
00080     d->setMIDIThruDevice(device);
00081 }
00082 
00083 void NetMIDIInput::enableMIDIThru(bool enable)
00084 {
00085     d->m_thruEnabled = enable;
00086 }
00087 
00088 bool NetMIDIInput::isEnabledMIDIThru()
00089 {
00090     return d->m_thruEnabled && (d->m_out != 0);
00091 }
00092 
00093 }}
00094