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

Revision 739, 3.4 kB (checked in by ppalmers, 15 years ago)

- Adapt the ffado external API (upgrade to v3)

NEEDS NEW JACK BACKEND

- simplify FFADODevice constructor even more
- implement first framework support for supporting multiple adapters.

currently all firewire adapters are scanned for supported devices unless specified otherwise
however attaching devices to separate adapters is not supported. using multiple adapters at
that are connected together might work.

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     : BeBoB::AvDevice( 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(std::auto_ptr<ConfigRom>( configRom ))
84 {
85     return new AvDevice(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.