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

Revision 479, 3.4 kB (checked in by wagi, 14 years ago)

- added all missing 'virtual' to function declared in avdevice implementation
- added getConfigurationId function (used for av/c model caching)

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( ESamplingFrequency 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.