1 |
/* |
---|
2 |
* Copyright (C) 2005-2007 by Daniel Wagner |
---|
3 |
* Copyright (C) 2005-2007 by Pieter Palmers |
---|
4 |
* |
---|
5 |
* This file is part of FFADO |
---|
6 |
* FFADO = Free Firewire (pro-)audio drivers for linux |
---|
7 |
* |
---|
8 |
* FFADO is based upon FreeBoB |
---|
9 |
* |
---|
10 |
* This library is free software; you can redistribute it and/or |
---|
11 |
* modify it under the terms of the GNU Lesser General Public |
---|
12 |
* License version 2.1, as published by the Free Software Foundation; |
---|
13 |
* |
---|
14 |
* This library is distributed in the hope that it will be useful, |
---|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
17 |
* Lesser General Public License for more details. |
---|
18 |
* |
---|
19 |
* You should have received a copy of the GNU Lesser General Public |
---|
20 |
* License along with this library; if not, write to the Free Software |
---|
21 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
---|
22 |
* MA 02110-1301 USA |
---|
23 |
*/ |
---|
24 |
|
---|
25 |
#include "ffadodevice.h" |
---|
26 |
|
---|
27 |
#include "libieee1394/configrom.h" |
---|
28 |
#include "libieee1394/ieee1394service.h" |
---|
29 |
|
---|
30 |
#include <iostream> |
---|
31 |
#include <sstream> |
---|
32 |
|
---|
33 |
#include <assert.h> |
---|
34 |
|
---|
35 |
IMPL_DEBUG_MODULE( FFADODevice, FFADODevice, DEBUG_LEVEL_NORMAL ); |
---|
36 |
|
---|
37 |
FFADODevice::FFADODevice( Ieee1394Service& ieee1394Service, |
---|
38 |
std::auto_ptr<ConfigRom>( configRom )) |
---|
39 |
: Control::Container() |
---|
40 |
, m_pConfigRom( configRom ) |
---|
41 |
, m_p1394Service( &ieee1394Service ) |
---|
42 |
{ |
---|
43 |
addOption(Util::OptionContainer::Option("id",std::string("dev?"))); |
---|
44 |
|
---|
45 |
std::ostringstream nodestr; |
---|
46 |
nodestr << "node" << m_pConfigRom->getNodeId(); |
---|
47 |
|
---|
48 |
// setOscBase(nodestr.str()); |
---|
49 |
// ConfigRom& c = getConfigRom(); |
---|
50 |
// addChildOscNode(&c); |
---|
51 |
} |
---|
52 |
|
---|
53 |
FFADODevice * |
---|
54 |
FFADODevice::createDevice( Ieee1394Service& , |
---|
55 |
std::auto_ptr<ConfigRom>( x )) |
---|
56 |
{ |
---|
57 |
// re-implement this!! |
---|
58 |
assert(0); |
---|
59 |
return NULL; |
---|
60 |
} |
---|
61 |
|
---|
62 |
std::string |
---|
63 |
FFADODevice::getName() |
---|
64 |
{ |
---|
65 |
return getConfigRom().getGuidString(); |
---|
66 |
} |
---|
67 |
|
---|
68 |
int |
---|
69 |
FFADODevice::getNodeId() |
---|
70 |
{ |
---|
71 |
return getConfigRom().getNodeId(); |
---|
72 |
} |
---|
73 |
|
---|
74 |
bool FFADODevice::compareGUID( FFADODevice *a, FFADODevice *b ) { |
---|
75 |
assert(a); |
---|
76 |
assert(b); |
---|
77 |
return ConfigRom::compareGUID(a->getConfigRom(), b->getConfigRom()); |
---|
78 |
} |
---|
79 |
|
---|
80 |
ConfigRom& |
---|
81 |
FFADODevice::getConfigRom() const |
---|
82 |
{ |
---|
83 |
return *m_pConfigRom; |
---|
84 |
} |
---|
85 |
|
---|
86 |
bool |
---|
87 |
FFADODevice::loadFromCache() |
---|
88 |
{ |
---|
89 |
return false; |
---|
90 |
} |
---|
91 |
|
---|
92 |
bool |
---|
93 |
FFADODevice::saveCache() |
---|
94 |
{ |
---|
95 |
return false; |
---|
96 |
} |
---|
97 |
|
---|
98 |
bool |
---|
99 |
FFADODevice::setId( unsigned int id) |
---|
100 |
{ |
---|
101 |
bool retval; |
---|
102 |
// FIXME: decent ID system nescessary |
---|
103 |
std::ostringstream idstr; |
---|
104 |
idstr << "dev" << id; |
---|
105 |
debugOutput( DEBUG_LEVEL_VERBOSE, "Set id to %s...\n", idstr.str().c_str()); |
---|
106 |
|
---|
107 |
retval=setOption("id",idstr.str()); |
---|
108 |
/* if (retval) { |
---|
109 |
setOscBase(idstr.str()); |
---|
110 |
}*/ |
---|
111 |
return retval; |
---|
112 |
} |
---|
113 |
|
---|
114 |
void |
---|
115 |
FFADODevice::setVerboseLevel(int l) |
---|
116 |
{ |
---|
117 |
debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l ); |
---|
118 |
setDebugLevel(l); |
---|
119 |
} |
---|
120 |
|
---|
121 |
void |
---|
122 |
FFADODevice::showDevice() |
---|
123 |
{ |
---|
124 |
debugOutput(DEBUG_LEVEL_NORMAL, "Node...........: %d\n", getNodeId()); |
---|
125 |
debugOutput(DEBUG_LEVEL_NORMAL, "GUID...........: %s\n", getConfigRom().getGuidString().c_str()); |
---|
126 |
|
---|
127 |
std::string id=std::string("dev? [none]"); |
---|
128 |
getOption("id", id); |
---|
129 |
|
---|
130 |
debugOutput(DEBUG_LEVEL_NORMAL, "Assigned ID....: %s\n", id.c_str()); |
---|
131 |
|
---|
132 |
flushDebugOutput(); |
---|
133 |
} |
---|
134 |
|
---|
135 |
|
---|
136 |
bool |
---|
137 |
FFADODevice::enableStreaming() { |
---|
138 |
return true; |
---|
139 |
} |
---|
140 |
|
---|
141 |
bool |
---|
142 |
FFADODevice::disableStreaming() { |
---|
143 |
return true; |
---|
144 |
} |
---|