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

Revision 1543, 4.1 kB (checked in by ppalmers, 15 years ago)

- Clean up class names
- Change probe code for all devices (except MOTU) to use the config file based approach

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 #warning M-Audio support is currently useless
25
26 #include "maudio/maudio_avdevice.h"
27
28 #include "libieee1394/configrom.h"
29 #include "libieee1394/ieee1394service.h"
30
31 #include "libavc/avc_definitions.h"
32
33 #include "debugmodule/debugmodule.h"
34
35 #include "devicemanager.h"
36
37 #include <string>
38 #include <stdint.h>
39
40 namespace MAudio {
41
42 Device::Device( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom ))
43     : FFADODevice( d, configRom)
44 {
45     debugOutput( DEBUG_LEVEL_VERBOSE, "Created MAudio::Device (NodeID %d)\n",
46                  getConfigRom().getNodeId() );
47 }
48
49 Device::~Device()
50 {
51 }
52
53 bool
54 Device::probe( Util::Configuration& c, ConfigRom& configRom, bool generic )
55 {
56     if(generic) {
57         return false;
58     } else {
59         // check if device is in supported devices list
60         unsigned int vendorId = configRom.getNodeVendorId();
61         unsigned int modelId = configRom.getModelId();
62
63         Util::Configuration::VendorModelEntry vme = c.findDeviceVME( vendorId, modelId );
64         return c.isValid(vme) && vme.driver == Util::Configuration::eD_MAudio;
65     }
66 }
67
68 FFADODevice *
69 Device::createDevice(DeviceManager& d, std::auto_ptr<ConfigRom>( configRom ))
70 {
71     return new Device( d, configRom );
72 }
73
74 bool
75 Device::discover()
76 {
77     unsigned int vendorId = getConfigRom().getNodeVendorId();
78     unsigned int modelId = getConfigRom().getModelId();
79
80     Util::Configuration &c = getDeviceManager().getConfiguration();
81     Util::Configuration::VendorModelEntry vme = c.findDeviceVME( vendorId, modelId );
82
83     if (c.isValid(vme) && vme.driver == Util::Configuration::eD_MAudio) {
84         debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n",
85                      vme.vendor_name.c_str(),
86                      vme.model_name.c_str());
87     } else {
88         debugWarning("Using generic M-Audio support for unsupported device '%s %s'\n",
89                      getConfigRom().getVendorName().c_str(), getConfigRom().getModelName().c_str());
90     }
91
92     return true;
93 }
94
95
96 int
97 Device::getSamplingFrequency( ) {
98     return 0;
99 }
100
101 std::vector<int>
102 Device::getSupportedSamplingFrequencies()
103 {
104     std::vector<int> frequencies;
105     return frequencies;
106 }
107
108 FFADODevice::ClockSourceVector
109 Device::getSupportedClockSources() {
110     FFADODevice::ClockSourceVector r;
111     return r;
112 }
113
114 bool
115 Device::setActiveClockSource(ClockSource s) {
116     return false;
117 }
118
119 FFADODevice::ClockSource
120 Device::getActiveClockSource() {
121     ClockSource s;
122     return s;
123 }
124
125 bool
126 Device::setSamplingFrequency( int samplingFrequency )
127 {
128
129     return false;
130 }
131
132 bool
133 Device::lock() {
134
135     return true;
136 }
137
138
139 bool
140 Device::unlock() {
141
142     return true;
143 }
144
145 void
146 Device::showDevice()
147 {
148     unsigned int vendorId = getConfigRom().getNodeVendorId();
149     unsigned int modelId = getConfigRom().getModelId();
150
151     Util::Configuration &c = getDeviceManager().getConfiguration();
152     Util::Configuration::VendorModelEntry vme = c.findDeviceVME( vendorId, modelId );
153
154     debugOutput(DEBUG_LEVEL_VERBOSE,
155         "%s %s at node %d\n", vme.vendor_name.c_str(), vme.model_name.c_str(), getNodeId());
156 }
157
158 bool
159 Device::prepare() {
160
161     return true;
162 }
163
164 int
165 Device::getStreamCount() {
166     return 0;
167 }
168
169 Streaming::StreamProcessor *
170 Device::getStreamProcessorByIndex(int i) {
171
172     return NULL;
173 }
174
175 bool
176 Device::startStreamByIndex(int i) {
177     return false;
178 }
179
180 bool
181 Device::stopStreamByIndex(int i) {
182     return false;
183 }
184
185 }
Note: See TracBrowser for help on using the browser.