~keithsalisbury/mixxx/mixxx

« back to all changes in this revision

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

  • Committer: Keith Salisbury
  • Date: 2012-05-06 13:44:20 UTC
  • mfrom: (2994.1.100 mixxx-trunk)
  • Revision ID: keithsalisbury@gmail.com-20120506134420-8k1dqq10aqmx0ecq
merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
                           hss1394enumerator.cpp
3
 
                    HSS1394 Device Enumerator Class
4
 
                    --------------------------------
5
 
    begin                : Fri Feb 26 2010
6
 
    copyright            : (C) 2010 Sean M. Pappalardo
7
 
    email                : spappalardo@mixxx.org
8
 
 
9
 
***************************************************************************/
10
 
 
11
 
/***************************************************************************
12
 
*                                                                         *
13
 
*   This program is free software; you can redistribute it and/or modify  *
14
 
*   it under the terms of the GNU General Public License as published by  *
15
 
*   the Free Software Foundation; either version 2 of the License, or     *
16
 
*   (at your option) any later version.                                   *
17
 
*                                                                         *
18
 
***************************************************************************/
19
 
 
20
 
#include <hss1394/HSS1394.h>
21
 
 
22
 
#include "mididevicehss1394.h"
23
 
#include "hss1394enumerator.h"
24
 
 
25
 
 
26
 
Hss1394Enumerator::Hss1394Enumerator() : MidiDeviceEnumerator() {
27
 
}
28
 
 
29
 
Hss1394Enumerator::~Hss1394Enumerator() {
30
 
    qDebug() << "Deleting HSS1394 devices...";
31
 
    QListIterator<MidiDevice*> dev_it(m_devices);
32
 
    while (dev_it.hasNext()) {
33
 
        delete dev_it.next();
34
 
    }
35
 
    using namespace hss1394;
36
 
    Node::Shutdown();
37
 
}
38
 
 
39
 
// Enumerate the HSS1394 MIDI devices
40
 
QList<MidiDevice*> Hss1394Enumerator::queryDevices() {
41
 
    qDebug() << "Scanning HSS1394 devices:";
42
 
    using namespace hss1394;
43
 
 
44
 
    hss1394::uint uNodes = Node::Instance()->GetNodeCount();
45
 
    qDebug() << "   Nodes detected:" << uNodes;
46
 
 
47
 
    for(hss1394::uint i=0; i<40; i++) {
48
 
        TNodeInfo tNodeInfo;
49
 
        bool bInstalled;
50
 
        if (Node::Instance()->GetNodeInfo(tNodeInfo, i, NULL, &bInstalled)) {
51
 
            QString message = QString("Node %1 (%2): Name = <%3>, GUID = %4 %5, FW[%6]")
52
 
                    .arg(QString::number(i),
53
 
                         (bInstalled)?"installed":"not installed",
54
 
                         tNodeInfo.sName.c_str(),
55
 
                         QString("%1").arg(tNodeInfo.uGUID.mu32High, 0, 16),
56
 
                         QString("%1").arg(tNodeInfo.uGUID.mu32Low, 0, 16),
57
 
                         QString("%1").arg(tNodeInfo.uProtocolVersion, 0, 16));
58
 
            qDebug() << " " << message;
59
 
            MidiDeviceHss1394 *currentDevice = new MidiDeviceHss1394(/*new MidiControlProcessor(NULL)*/ NULL,
60
 
                                                                     tNodeInfo,
61
 
                                                                     i);
62
 
            m_devices.push_back((MidiDevice*)currentDevice);
63
 
        }
64
 
    }
65
 
    return m_devices;
66
 
}