~mixxxdevelopers/mixxx/trunk

« back to all changes in this revision

Viewing changes to mixxx/src/controllers/midi/hss1394enumerator.cpp

Merging features_controllerAbstraction. Migration of mappings from .mixxx/midi/ to controllers/ only works on a version upgrade (end-users.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
* @file hss1394enumerator.cpp
 
3
* @author Sean Pappalardo spappalardo@mixxx.org
 
4
* @date Thu 15 Mar 2012
 
5
*/
 
6
 
 
7
#include <hss1394/HSS1394.h>
 
8
 
 
9
#include "controllers/midi/hss1394controller.h"
 
10
#include "controllers/midi/hss1394enumerator.h"
 
11
 
 
12
Hss1394Enumerator::Hss1394Enumerator() : MidiEnumerator() {
 
13
}
 
14
 
 
15
Hss1394Enumerator::~Hss1394Enumerator() {
 
16
    qDebug() << "Deleting HSS1394 devices...";
 
17
    QListIterator<Controller*> dev_it(m_devices);
 
18
    while (dev_it.hasNext()) {
 
19
        delete dev_it.next();
 
20
    }
 
21
    using namespace hss1394;
 
22
    Node::Shutdown();
 
23
}
 
24
 
 
25
// Enumerate the HSS1394 MIDI devices
 
26
QList<Controller*> Hss1394Enumerator::queryDevices() {
 
27
    qDebug() << "Scanning HSS1394 devices:";
 
28
    using namespace hss1394;
 
29
 
 
30
    hss1394::uint uNodes = Node::Instance()->GetNodeCount();
 
31
    qDebug() << "   Nodes detected:" << uNodes;
 
32
 
 
33
    for(hss1394::uint i=0; i<40; i++) {
 
34
        TNodeInfo tNodeInfo;
 
35
        bool bInstalled;
 
36
        if (Node::Instance()->GetNodeInfo(tNodeInfo, i, NULL, &bInstalled)) {
 
37
            QString message = QString("Node %1 (%2): Name = <%3>, GUID = %4 %5, FW[%6]")
 
38
                    .arg(QString::number(i),
 
39
                         (bInstalled)?"installed":"not installed",
 
40
                         tNodeInfo.sName.c_str(),
 
41
                         QString("%1").arg(tNodeInfo.uGUID.mu32High, 0, 16),
 
42
                         QString("%1").arg(tNodeInfo.uGUID.mu32Low, 0, 16),
 
43
                         QString("%1").arg(tNodeInfo.uProtocolVersion, 0, 16));
 
44
            qDebug() << " " << message;
 
45
            Hss1394Controller *currentDevice = new Hss1394Controller(
 
46
                tNodeInfo, i);
 
47
            m_devices.push_back(currentDevice);
 
48
        }
 
49
    }
 
50
    return m_devices;
 
51
}