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 |
#ifndef BEBOB_DEVICE_H |
---|
25 |
#define BEBOB_DEVICE_H |
---|
26 |
|
---|
27 |
#include <stdint.h> |
---|
28 |
|
---|
29 |
#include "debugmodule/debugmodule.h" |
---|
30 |
|
---|
31 |
#include "libieee1394/configrom.h" |
---|
32 |
#include "libieee1394/ieee1394service.h" |
---|
33 |
|
---|
34 |
#include "libavc/avc_definitions.h" |
---|
35 |
#include "libavc/general/avc_extended_cmd_generic.h" |
---|
36 |
#include "libavc/general/avc_unit.h" |
---|
37 |
#include "libavc/general/avc_subunit.h" |
---|
38 |
#include "libavc/general/avc_plug.h" |
---|
39 |
#include "libavc/audiosubunit/avc_function_block.h" |
---|
40 |
|
---|
41 |
#include "bebob/bebob_avplug.h" |
---|
42 |
#include "bebob/bebob_avdevice_subunit.h" |
---|
43 |
#include "bebob/bebob_mixer.h" |
---|
44 |
|
---|
45 |
#include "libstreaming/amdtp/AmdtpReceiveStreamProcessor.h" |
---|
46 |
#include "libstreaming/amdtp/AmdtpTransmitStreamProcessor.h" |
---|
47 |
#include "libstreaming/amdtp/AmdtpPort.h" |
---|
48 |
#include "libstreaming/amdtp/AmdtpPortInfo.h" |
---|
49 |
|
---|
50 |
#include "libutil/serialize.h" |
---|
51 |
|
---|
52 |
#include "genericavc/avc_avdevice.h" |
---|
53 |
|
---|
54 |
#include "ffadodevice.h" |
---|
55 |
|
---|
56 |
#include <sstream> |
---|
57 |
#include <vector> |
---|
58 |
|
---|
59 |
namespace BeBoB { |
---|
60 |
|
---|
61 |
class Device : public GenericAVC::Device { |
---|
62 |
public: |
---|
63 |
Device( DeviceManager& d, ffado_smartptr<ConfigRom>( configRom )); |
---|
64 |
virtual ~Device(); |
---|
65 |
|
---|
66 |
static bool probe( Util::Configuration&, ConfigRom& configRom, bool generic = false ); |
---|
67 |
virtual bool loadFromCache(); |
---|
68 |
virtual bool saveCache(); |
---|
69 |
virtual bool discover(); |
---|
70 |
|
---|
71 |
static FFADODevice * createDevice( DeviceManager& d, ffado_smartptr<ConfigRom>( configRom )); |
---|
72 |
|
---|
73 |
virtual AVC::Subunit* createSubunit(AVC::Unit& unit, |
---|
74 |
AVC::ESubunitType type, |
---|
75 |
AVC::subunit_t id ); |
---|
76 |
virtual AVC::Plug *createPlug( AVC::Unit* unit, |
---|
77 |
AVC::Subunit* subunit, |
---|
78 |
AVC::function_block_type_t functionBlockType, |
---|
79 |
AVC::function_block_type_t functionBlockId, |
---|
80 |
AVC::Plug::EPlugAddressType plugAddressType, |
---|
81 |
AVC::Plug::EPlugDirection plugDirection, |
---|
82 |
AVC::plug_id_t plugId, |
---|
83 |
int globalId = -1 ); |
---|
84 |
|
---|
85 |
virtual int getSelectorFBValue(int id); |
---|
86 |
virtual bool setSelectorFBValue(int id, int v); |
---|
87 |
|
---|
88 |
virtual int getFeatureFBVolumeMinimum(int id, int channel); |
---|
89 |
virtual int getFeatureFBVolumeMaximum(int id, int channel); |
---|
90 |
virtual int getFeatureFBVolumeCurrent(int id, int channel); |
---|
91 |
virtual bool setFeatureFBVolumeCurrent(int id, int channel, int v); |
---|
92 |
|
---|
93 |
virtual int getFeatureFBLRBalanceMinimum(int id, int channel); |
---|
94 |
virtual int getFeatureFBLRBalanceMaximum(int id, int channel); |
---|
95 |
virtual int getFeatureFBLRBalanceCurrent(int id, int channel); |
---|
96 |
virtual bool setFeatureFBLRBalanceCurrent(int id, int channel, int v); |
---|
97 |
|
---|
98 |
virtual bool setProcessingFBMixerSingleCurrent(int id, int iPlugNum, |
---|
99 |
int iAChNum, int oAChNum, |
---|
100 |
int setting); |
---|
101 |
virtual int getProcessingFBMixerSingleCurrent(int id, int iPlugNum, |
---|
102 |
int iAChNum, int oAChNum); |
---|
103 |
|
---|
104 |
virtual void showDevice(); |
---|
105 |
virtual void setVerboseLevel(int l); |
---|
106 |
protected: |
---|
107 |
virtual bool propagatePlugInfo(); |
---|
108 |
|
---|
109 |
virtual bool buildMixer(); |
---|
110 |
virtual bool destroyMixer(); |
---|
111 |
|
---|
112 |
virtual int getFeatureFBVolumeValue(int id, int channel, AVC::FunctionBlockCmd::EControlAttribute controlAttribute); |
---|
113 |
virtual int getFeatureFBLRBalanceValue(int id, int channel, AVC::FunctionBlockCmd::EControlAttribute controlAttribute); |
---|
114 |
|
---|
115 |
public: |
---|
116 |
virtual bool serialize( std::string basePath, Util::IOSerialize& ser ) const; |
---|
117 |
virtual bool deserialize( std::string basePath, Util::IODeserialize& deser ); |
---|
118 |
|
---|
119 |
virtual uint64_t getConfigurationId(); |
---|
120 |
virtual bool needsRediscovery(); |
---|
121 |
|
---|
122 |
std::string getCachePath(); |
---|
123 |
|
---|
124 |
protected: |
---|
125 |
virtual uint8_t getConfigurationIdSampleRate(); |
---|
126 |
virtual uint8_t getConfigurationIdNumberOfChannel( AVC::PlugAddress::EPlugDirection ePlugDirection ); |
---|
127 |
virtual uint16_t getConfigurationIdSyncMode(); |
---|
128 |
|
---|
129 |
std::vector<int> m_supported_frequencies; |
---|
130 |
uint64_t m_last_discovery_config_id; |
---|
131 |
|
---|
132 |
protected: |
---|
133 |
Mixer* m_Mixer; |
---|
134 |
|
---|
135 |
}; |
---|
136 |
|
---|
137 |
} |
---|
138 |
|
---|
139 |
#endif |
---|