root/trunk/libffado/src/ffadodevice.cpp

Revision 554, 2.4 kB (checked in by ppalmers, 16 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  * Copyright (C) 2005-2007 by Pieter Palmers
4  *
5  * This file is part of FFADO
6  * FFADO = Free Firewire (pro-)audio drivers for linux
7  *
8  * FFADO is based upon FreeBoB
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License version 2.1, as published by the Free Software Foundation;
13  *
14  * This library 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 GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22  * MA 02110-1301 USA
23  */
24
25 #include "ffadodevice.h"
26
27 #include "libieee1394/configrom.h"
28 #include "libieee1394/ieee1394service.h"
29
30 #include <iostream>
31 #include <sstream>
32
33 IMPL_DEBUG_MODULE( FFADODevice, FFADODevice, DEBUG_LEVEL_VERBOSE );
34
35 FFADODevice::FFADODevice( std::auto_ptr< ConfigRom >( configRom ),
36                     Ieee1394Service& ieee1394service,
37                     int nodeId )
38     : OscNode()
39     , m_pConfigRom( configRom )
40     , m_p1394Service( &ieee1394service )
41     , m_verboseLevel( DEBUG_LEVEL_NORMAL )
42     , m_nodeId ( nodeId )
43 {
44     addOption(Util::OptionContainer::Option("id",std::string("dev?")));
45
46     std::ostringstream nodestr;
47     nodestr << "node" << nodeId;
48     setOscBase(nodestr.str());
49     ConfigRom& c = getConfigRom();
50
51     addChildOscNode(&c);
52 }
53
54
55 ConfigRom&
56 FFADODevice::getConfigRom() const
57 {
58     return *m_pConfigRom;
59 }
60
61 bool
62 FFADODevice::loadFromCache()
63 {
64     return false;
65 }
66
67 bool
68 FFADODevice::saveCache()
69 {
70     return false;
71 }
72
73 bool
74 FFADODevice::setId( unsigned int id)
75 {
76     bool retval;
77     // FIXME: decent ID system nescessary
78     std::ostringstream idstr;
79     idstr << "dev" << id;
80     debugOutput( DEBUG_LEVEL_VERBOSE, "Set id to %s...\n", idstr.str().c_str());
81
82    
83     retval=setOption("id",idstr.str());
84     if (retval) {
85         setOscBase(idstr.str());
86     }
87     return retval;
88 }
89
90 void
91 FFADODevice::setVerboseLevel(int l)
92 {
93     m_verboseLevel=l;
94     setDebugLevel(l);
95 //     m_pConfigRom->setVerboseLevel(l);
96     m_p1394Service->setVerboseLevel(l);
97 }
98
99 bool
100 FFADODevice::enableStreaming() {
101     return true;
102 }
103
104 bool
105 FFADODevice::disableStreaming() {
106     return true;
107 }
Note: See TracBrowser for help on using the browser.