root/trunk/libffado/src/dice/focusrite/focusrite_eap.h

Revision 1730, 2.2 kB (checked in by arnonym, 14 years ago)

Save code by creating another class. Next step is unified monitoring and switches for both the pro40 and the pro24.

Line 
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 MonitorSection : public Control::Container
60     {
61     public:
62         MonitorSection(Dice::Focusrite::FocusriteEAP*, std::string name);
63
64     private:
65         Dice::Focusrite::FocusriteEAP* m_eap;
66         Switch *m_mute, *m_dim;
67         std::vector<Switch*> m_mute_affected;
68         std::vector<Switch*> m_dim_affected;
69         std::vector<Switch*> m_mono;
70     };
71
72
73 public:
74     FocusriteEAP(Dice::Device&);
75
76     bool readApplicationReg(unsigned offset, quadlet_t*);
77     bool writeApplicationReg(unsigned offset, quadlet_t);
78
79 protected:
80     virtual int commandToFix(unsigned offset) =0;
81 };
82
83 }
84 }
85
86 #endif
87 // vim: et
Note: See TracBrowser for help on using the browser.