1 |
/* |
---|
2 |
* Copyright (C) 2009 by Pieter Palmers |
---|
3 |
* Copyright (C) 2009 by Arnold Krille |
---|
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 program is free software: you can redistribute it and/or modify |
---|
11 |
* it under the terms of the GNU General Public License as published by |
---|
12 |
* the Free Software Foundation, either version 2 of the License, or |
---|
13 |
* (at your option) version 3 of the License. |
---|
14 |
* |
---|
15 |
* This program is distributed in the hope that it will be useful, |
---|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 |
* GNU General Public License for more details. |
---|
19 |
* |
---|
20 |
* You should have received a copy of the GNU General Public License |
---|
21 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
22 |
* |
---|
23 |
*/ |
---|
24 |
|
---|
25 |
#ifndef DICE_FOCUSRITE_FOCUSRITE_EAP_H |
---|
26 |
#define DICE_FOCUSRITE_FOCUSRITE_EAP_H |
---|
27 |
|
---|
28 |
#include "dice/dice_avdevice.h" |
---|
29 |
|
---|
30 |
#include "libieee1394/configrom.h" |
---|
31 |
|
---|
32 |
namespace Dice { |
---|
33 |
namespace Focusrite { |
---|
34 |
|
---|
35 |
class FocusriteEAP : public Dice::Device::EAP |
---|
36 |
{ |
---|
37 |
public: |
---|
38 |
/** |
---|
39 |
* @brief A standard-switch for boolean. |
---|
40 |
* |
---|
41 |
* If you don't like True and False for the labels, subclass and return your own. |
---|
42 |
*/ |
---|
43 |
class Switch : public Control::Boolean |
---|
44 |
{ |
---|
45 |
public: |
---|
46 |
Switch(Dice::Focusrite::FocusriteEAP*, std::string name, size_t offset, int activevalue); |
---|
47 |
|
---|
48 |
bool selected(); |
---|
49 |
bool select(bool); |
---|
50 |
|
---|
51 |
private: |
---|
52 |
Dice::Focusrite::FocusriteEAP* m_eap; |
---|
53 |
bool m_selected; |
---|
54 |
size_t m_offset; |
---|
55 |
int m_activevalue; |
---|
56 |
fb_quadlet_t m_state_tmp; |
---|
57 |
}; |
---|
58 |
|
---|
59 |
class Poti : public Control::Discrete |
---|
60 |
{ |
---|
61 |
public: |
---|
62 |
Poti(Dice::Focusrite::FocusriteEAP*, std::string name, size_t offset); |
---|
63 |
|
---|
64 |
int getValue(int) { return getValue(); } |
---|
65 |
bool setValue(int, int n) { return setValue(n); } |
---|
66 |
|
---|
67 |
int getMinimum() { return -127; } |
---|
68 |
int getMaximum() { return 0; } |
---|
69 |
|
---|
70 |
int getValue(); |
---|
71 |
bool setValue(int n); |
---|
72 |
private: |
---|
73 |
Dice::Focusrite::FocusriteEAP* m_eap; |
---|
74 |
size_t m_offset; |
---|
75 |
int m_value; |
---|
76 |
quadlet_t m_tmp; |
---|
77 |
}; |
---|
78 |
|
---|
79 |
class MonitorSection : public Control::Container |
---|
80 |
{ |
---|
81 |
public: |
---|
82 |
MonitorSection(Dice::Focusrite::FocusriteEAP*, std::string name); |
---|
83 |
|
---|
84 |
private: |
---|
85 |
Dice::Focusrite::FocusriteEAP* m_eap; |
---|
86 |
Switch *m_mute, *m_dim; |
---|
87 |
std::vector<Switch*> m_mute_affected; |
---|
88 |
std::vector<Switch*> m_dim_affected; |
---|
89 |
std::vector<Switch*> m_mono; |
---|
90 |
Poti* m_monitorlevel; |
---|
91 |
Poti* m_dimlevel; |
---|
92 |
}; |
---|
93 |
|
---|
94 |
|
---|
95 |
public: |
---|
96 |
FocusriteEAP(Dice::Device&); |
---|
97 |
|
---|
98 |
bool readApplicationReg(unsigned offset, quadlet_t*); |
---|
99 |
bool writeApplicationReg(unsigned offset, quadlet_t); |
---|
100 |
|
---|
101 |
protected: |
---|
102 |
virtual int commandToFix(unsigned offset) =0; |
---|
103 |
virtual Poti* getMonitorPoti(std::string) { return 0; } |
---|
104 |
virtual Poti* getDimPoti(std::string) { return 0; } |
---|
105 |
}; |
---|
106 |
|
---|
107 |
} |
---|
108 |
} |
---|
109 |
|
---|
110 |
#endif |
---|
111 |
// vim: et |
---|