root/trunk/libffado/src/maudio/maudio_avdevice.cpp

Revision 554, 3.4 kB (checked in by ppalmers, 17 years ago)

Merge echoaudio branch into trunk.

This adds support for the Echo Audiofire devices to FFADO. Possibly also other devices working with the Apple Class Driver will work with this code. It is not fully complete yet, but the main rework is
done.

First of all the IAvDevice class/interface is renamed to FFADODevice, in order to separate the AV/C code from the FFADO API code. A device supported by FFADO implements a FFADODevice.

The BeBoB device has been split up into three groups:
- libavc/* : all code and commands that are specified by AV/C specs. Note that a lot of the code that used to be in BeBoB::AvDevice? now resides in AVC::Unit
- genericavc/* : a FFADODevice that uses AV/C descriptors & commands for discovery and config
- bebob/* : the bebob FFADODevice that inherits from GenericAVC::AvDevice? but that uses BridgeCo? commands for discovery

Everything has been moved as high as possible in the class hierarchy. If necessary, a subclass that uses device specific commands is introduced (e.g. BeBoB::Plug inherits from AVC::Plug and uses the
BridgeCo? extended plug info command to discover it's properties).

There are some other fixes along the way that have been done too.

Line 
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( std::auto_ptr< ConfigRom >( configRom ),
43                     Ieee1394Service& ieee1394service,
44                     int iNodeId )
45     : BeBoB::AvDevice( configRom,
46                     ieee1394service,
47                     iNodeId )
48     , m_model ( NULL )
49 {
50     debugOutput( DEBUG_LEVEL_VERBOSE, "Created MAudio::AvDevice (NodeID %d)\n",
51                  iNodeId );
52 }
53
54 AvDevice::~AvDevice()
55 {
56 }
57
58 static VendorModelEntry supportedDeviceList[] =
59 {
60     //{0x0007f5, 0x00010048, "BridgeCo", "RD Audio1", "refdesign.xml"},
61
62     {0x000d6c, 0x00010046, "M-Audio", "FW 410", "fw410.xml"},
63     {0x000d6c, 0x00010058, "M-Audio", "FW 410", "fw410.xml"},       // Version 5.10.0.5036
64     {0x000d6c, 0x00010060, "M-Audio", "FW Audiophile", "fwap.xml"},
65 };
66
67 bool
68 AvDevice::probe( ConfigRom& configRom )
69 {
70     unsigned int iVendorId = configRom.getNodeVendorId();
71     unsigned int iModelId = configRom.getModelId();
72
73     for ( unsigned int i = 0;
74           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) );
75           ++i )
76     {
77         if ( ( supportedDeviceList[i].vendor_id == iVendorId )
78              && ( supportedDeviceList[i].model_id == iModelId ) )
79         {
80             return true;
81         }
82     }
83     return false;
84 }
85
86 bool
87 AvDevice::discover()
88 {
89     unsigned int vendorId = m_pConfigRom->getNodeVendorId();
90     unsigned int modelId = m_pConfigRom->getModelId();
91
92     for ( unsigned int i = 0;
93           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) );
94           ++i )
95     {
96         if ( ( supportedDeviceList[i].vendor_id == vendorId )
97              && ( supportedDeviceList[i].model_id == modelId )
98            )
99         {
100             m_model = &(supportedDeviceList[i]);
101             break;
102         }
103     }
104
105     if (m_model != NULL) {
106         debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n",
107                 m_model->vendor_name, m_model->model_name);
108     } else return false;
109
110     return true;
111 }
112
113 bool
114 AvDevice::setSamplingFrequency( int eSamplingFrequency )
115 {
116     // not supported
117     return false;
118 }
119
120 int AvDevice::getSamplingFrequency( ) {
121     return 44100;
122 }
123
124 int
125 AvDevice::getConfigurationId()
126 {
127     return 0;
128 }
129
130 void
131 AvDevice::showDevice()
132 {
133 }
134
135 bool
136 AvDevice::prepare() {
137
138     return true;
139 }
140
141 }
Note: See TracBrowser for help on using the browser.