root/branches/echoaudio/src/genericavc/avc_avdevice.h

Revision 524, 3.0 kB (checked in by ppalmers, 17 years ago)

echo discovery works, audio I/O works, still some issues with midi and channel naming

Line 
1 /*
2  * Copyright (C) 2005-2007 by Pieter Palmers
3  * Copyright (C) 2005-2007 by Daniel Wagner
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 #ifndef GENERICAVC_AVDEVICE_H
26 #define GENERICAVC_AVDEVICE_H
27
28 #include "ffadodevice.h"
29
30 #include "debugmodule/debugmodule.h"
31
32 #include "libavc/avc_definitions.h"
33 #include "libavc/general/avc_unit.h"
34 #include "libavc/general/avc_subunit.h"
35 #include "libavc/general/avc_plug.h"
36
37 #include "libstreaming/AmdtpStreamProcessor.h"
38 #include "libstreaming/AmdtpPort.h"
39 #include "libstreaming/AmdtpPortInfo.h"
40
41 class ConfigRom;
42 class Ieee1394Service;
43
44 namespace GenericAVC {
45
46 // struct to define the supported devices
47 struct VendorModelEntry {
48     unsigned int vendor_id;
49     unsigned int model_id;
50     char *vendor_name;
51     char *model_name;
52 };
53
54 class AvDevice : public FFADODevice, public AVC::Unit {
55 public:
56     AvDevice( std::auto_ptr<ConfigRom>( configRom ),
57           Ieee1394Service& ieee1394Service,
58           int nodeId );
59     virtual ~AvDevice();
60
61     static bool probe( ConfigRom& configRom );
62     bool discover();
63
64     void showDevice();
65
66     bool setSamplingFrequency( int );
67     int getSamplingFrequency( );
68
69     int getStreamCount();
70     Streaming::StreamProcessor *getStreamProcessorByIndex(int i);
71
72     bool prepare();
73     bool lock();
74     bool unlock();
75
76     bool startStreamByIndex(int i);
77     bool stopStreamByIndex(int i);
78    
79     // redefinition to resolve ambiguity
80     Ieee1394Service& get1394Service()
81         { return FFADODevice::get1394Service(); };
82     ConfigRom& getConfigRom() const
83         { return FFADODevice::getConfigRom(); };
84        
85 protected:
86     bool addPlugToProcessor( AVC::Plug& plug, Streaming::StreamProcessor *processor,
87                              Streaming::AmdtpAudioPort::E_Direction direction);
88     bool setSamplingFrequencyPlug( AVC::Plug& plug,
89                                    AVC::Plug::EPlugDirection direction,
90                                    AVC::ESamplingFrequency samplingFrequency );
91    
92     struct VendorModelEntry *m_model;
93    
94     // streaming stuff
95     typedef std::vector< Streaming::StreamProcessor * > StreamProcessorVector;
96     StreamProcessorVector m_receiveProcessors;
97     StreamProcessorVector m_transmitProcessors;
98    
99     DECLARE_DEBUG_MODULE;
100 };
101
102 }
103
104 #endif //GENERICAVC_AVDEVICE_H
Note: See TracBrowser for help on using the browser.