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

Revision 864, 3.4 kB (checked in by ppalmers, 14 years ago)

update license to GPLv2 or GPLv3 instead of GPLv2 or any later version. Update copyrights to reflect the new year

Line 
1 /*
2  * Copyright (C) 2005-2008 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 program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program 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
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
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( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom ))
43     : BeBoB::AvDevice( d, configRom)
44     , m_model ( NULL )
45 {
46     debugOutput( DEBUG_LEVEL_VERBOSE, "Created MAudio::AvDevice (NodeID %d)\n",
47                  getConfigRom().getNodeId() );
48 }
49
50 AvDevice::~AvDevice()
51 {
52 }
53
54 static VendorModelEntry supportedDeviceList[] =
55 {
56     //{FW_VENDORID_BRIDGECO, 0x00010048, "BridgeCo", "RD Audio1", "refdesign.xml"},
57
58     {FW_VENDORID_MAUDIO, 0x00010046, "M-Audio", "FW 410", "fw410.xml"},
59     {FW_VENDORID_MAUDIO, 0x00010058, "M-Audio", "FW 410", "fw410.xml"},       // Version 5.10.0.5036
60     {FW_VENDORID_MAUDIO, 0x00010060, "M-Audio", "FW Audiophile", "fwap.xml"},
61 };
62
63 bool
64 AvDevice::probe( ConfigRom& configRom )
65 {
66     unsigned int iVendorId = configRom.getNodeVendorId();
67     unsigned int iModelId = configRom.getModelId();
68
69     for ( unsigned int i = 0;
70           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) );
71           ++i )
72     {
73         if ( ( supportedDeviceList[i].vendor_id == iVendorId )
74              && ( supportedDeviceList[i].model_id == iModelId ) )
75         {
76             return true;
77         }
78     }
79     return false;
80 }
81
82 FFADODevice *
83 AvDevice::createDevice(DeviceManager& d, std::auto_ptr<ConfigRom>( configRom ))
84 {
85     return new AvDevice( d, configRom );
86 }
87
88 bool
89 AvDevice::discover()
90 {
91     unsigned int vendorId = getConfigRom().getNodeVendorId();
92     unsigned int modelId = getConfigRom().getModelId();
93
94     for ( unsigned int i = 0;
95           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) );
96           ++i )
97     {
98         if ( ( supportedDeviceList[i].vendor_id == vendorId )
99              && ( supportedDeviceList[i].model_id == modelId )
100            )
101         {
102             m_model = &(supportedDeviceList[i]);
103             break;
104         }
105     }
106
107     if (m_model != NULL) {
108         debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n",
109                 m_model->vendor_name, m_model->model_name);
110     } else return false;
111
112     return true;
113 }
114
115 bool
116 AvDevice::setSamplingFrequency( int eSamplingFrequency )
117 {
118     // not supported
119     return false;
120 }
121
122 int AvDevice::getSamplingFrequency( ) {
123     return 44100;
124 }
125
126 int
127 AvDevice::getConfigurationId()
128 {
129     return 0;
130 }
131
132 void
133 AvDevice::showDevice()
134 {
135 }
136
137 bool
138 AvDevice::prepare() {
139
140     return true;
141 }
142
143 }
Note: See TracBrowser for help on using the browser.