1 |
/* |
---|
2 |
* Copyright (C) 2005-2007 by Daniel Wagner |
---|
3 |
* |
---|
4 |
* This file is part of FFADO |
---|
5 |
* FFADO = Free Firewire (pro-)audio drivers for linux |
---|
6 |
* |
---|
7 |
* FFADO is based upon FreeBoB. |
---|
8 |
* |
---|
9 |
* This library is free software; you can redistribute it and/or |
---|
10 |
* modify it under the terms of the GNU Lesser General Public |
---|
11 |
* License version 2.1, as published by the Free Software Foundation; |
---|
12 |
* |
---|
13 |
* This library is distributed in the hope that it will be useful, |
---|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 |
* Lesser General Public License for more details. |
---|
17 |
* |
---|
18 |
* You should have received a copy of the GNU Lesser General Public |
---|
19 |
* License along with this library; if not, write to the Free Software |
---|
20 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
---|
21 |
* MA 02110-1301 USA |
---|
22 |
*/ |
---|
23 |
|
---|
24 |
#include "maudio/maudio_avdevice.h" |
---|
25 |
#include "bebob/bebob_avdevice.h" |
---|
26 |
|
---|
27 |
#include "libieee1394/configrom.h" |
---|
28 |
#include "libieee1394/ieee1394service.h" |
---|
29 |
|
---|
30 |
#include "libavc/avc_definitions.h" |
---|
31 |
|
---|
32 |
#include "debugmodule/debugmodule.h" |
---|
33 |
|
---|
34 |
#include <libxml/xmlmemory.h> |
---|
35 |
#include <libxml/parser.h> |
---|
36 |
|
---|
37 |
#include <string> |
---|
38 |
#include <stdint.h> |
---|
39 |
|
---|
40 |
namespace MAudio { |
---|
41 |
|
---|
42 |
AvDevice::AvDevice( Ieee1394Service& ieee1394Service, |
---|
43 |
std::auto_ptr<ConfigRom>( configRom )) |
---|
44 |
: BeBoB::AvDevice( ieee1394Service, configRom) |
---|
45 |
, m_model ( NULL ) |
---|
46 |
{ |
---|
47 |
debugOutput( DEBUG_LEVEL_VERBOSE, "Created MAudio::AvDevice (NodeID %d)\n", |
---|
48 |
getConfigRom().getNodeId() ); |
---|
49 |
} |
---|
50 |
|
---|
51 |
AvDevice::~AvDevice() |
---|
52 |
{ |
---|
53 |
} |
---|
54 |
|
---|
55 |
static VendorModelEntry supportedDeviceList[] = |
---|
56 |
{ |
---|
57 |
//{0x0007f5, 0x00010048, "BridgeCo", "RD Audio1", "refdesign.xml"}, |
---|
58 |
|
---|
59 |
{0x000d6c, 0x00010046, "M-Audio", "FW 410", "fw410.xml"}, |
---|
60 |
{0x000d6c, 0x00010058, "M-Audio", "FW 410", "fw410.xml"}, // Version 5.10.0.5036 |
---|
61 |
{0x000d6c, 0x00010060, "M-Audio", "FW Audiophile", "fwap.xml"}, |
---|
62 |
}; |
---|
63 |
|
---|
64 |
bool |
---|
65 |
AvDevice::probe( ConfigRom& configRom ) |
---|
66 |
{ |
---|
67 |
unsigned int iVendorId = configRom.getNodeVendorId(); |
---|
68 |
unsigned int iModelId = configRom.getModelId(); |
---|
69 |
|
---|
70 |
for ( unsigned int i = 0; |
---|
71 |
i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) ); |
---|
72 |
++i ) |
---|
73 |
{ |
---|
74 |
if ( ( supportedDeviceList[i].vendor_id == iVendorId ) |
---|
75 |
&& ( supportedDeviceList[i].model_id == iModelId ) ) |
---|
76 |
{ |
---|
77 |
return true; |
---|
78 |
} |
---|
79 |
} |
---|
80 |
return false; |
---|
81 |
} |
---|
82 |
|
---|
83 |
FFADODevice * |
---|
84 |
AvDevice::createDevice( Ieee1394Service& ieee1394Service, |
---|
85 |
std::auto_ptr<ConfigRom>( configRom )) |
---|
86 |
{ |
---|
87 |
return new AvDevice(ieee1394Service, configRom ); |
---|
88 |
} |
---|
89 |
|
---|
90 |
bool |
---|
91 |
AvDevice::discover() |
---|
92 |
{ |
---|
93 |
unsigned int vendorId = m_pConfigRom->getNodeVendorId(); |
---|
94 |
unsigned int modelId = m_pConfigRom->getModelId(); |
---|
95 |
|
---|
96 |
for ( unsigned int i = 0; |
---|
97 |
i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) ); |
---|
98 |
++i ) |
---|
99 |
{ |
---|
100 |
if ( ( supportedDeviceList[i].vendor_id == vendorId ) |
---|
101 |
&& ( supportedDeviceList[i].model_id == modelId ) |
---|
102 |
) |
---|
103 |
{ |
---|
104 |
m_model = &(supportedDeviceList[i]); |
---|
105 |
break; |
---|
106 |
} |
---|
107 |
} |
---|
108 |
|
---|
109 |
if (m_model != NULL) { |
---|
110 |
debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", |
---|
111 |
m_model->vendor_name, m_model->model_name); |
---|
112 |
} else return false; |
---|
113 |
|
---|
114 |
return true; |
---|
115 |
} |
---|
116 |
|
---|
117 |
bool |
---|
118 |
AvDevice::setSamplingFrequency( int eSamplingFrequency ) |
---|
119 |
{ |
---|
120 |
// not supported |
---|
121 |
return false; |
---|
122 |
} |
---|
123 |
|
---|
124 |
int AvDevice::getSamplingFrequency( ) { |
---|
125 |
return 44100; |
---|
126 |
} |
---|
127 |
|
---|
128 |
int |
---|
129 |
AvDevice::getConfigurationId() |
---|
130 |
{ |
---|
131 |
return 0; |
---|
132 |
} |
---|
133 |
|
---|
134 |
void |
---|
135 |
AvDevice::showDevice() |
---|
136 |
{ |
---|
137 |
} |
---|
138 |
|
---|
139 |
bool |
---|
140 |
AvDevice::prepare() { |
---|
141 |
|
---|
142 |
return true; |
---|
143 |
} |
---|
144 |
|
---|
145 |
} |
---|