Changeset 1734
- Timestamp:
- 11/24/09 14:30:28 (13 years ago)
- Files:
-
- trunk/libffado/src/dice/focusrite/focusrite_eap.cpp (modified) (4 diffs)
- trunk/libffado/src/dice/focusrite/focusrite_eap.h (modified) (3 diffs)
- trunk/libffado/src/dice/focusrite/saffire_pro24.cpp (modified) (1 diff)
- trunk/libffado/src/dice/focusrite/saffire_pro24.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/dice/focusrite/focusrite_eap.cpp
r1730 r1734 30 30 const int msgSet = 0x68; 31 31 32 FocusriteEAP::Poti::Poti(Dice::Focusrite::FocusriteEAP* eap, std::string name, size_t offset) 33 : Control::Discrete(eap, name) 34 , m_eap(eap) 35 , m_offset(offset) 36 { 37 m_eap->readApplicationReg(m_offset, &m_tmp); 38 printf("%s: Value: %i\n", name.c_str(), m_tmp); 39 m_value = /*127*/-m_tmp; 40 } 41 42 int FocusriteEAP::Poti::getValue() { 43 return m_value; 44 } 45 bool FocusriteEAP::Poti::setValue(int n) { 46 if ( n == m_value ) 47 return true; 48 return m_eap->writeApplicationReg(m_offset, -n); 49 //return false; 50 } 51 32 52 FocusriteEAP::FocusriteEAP(Dice::Device& dev) : Dice::Device::EAP(dev) { 33 53 } … … 39 59 bool ret = writeReg(eRT_Application, offset, quadlet); 40 60 if (!ret) return false; 61 debugOutput(DEBUG_LEVEL_VERBOSE, "Will sent command %i.\n", commandToFix(offset)); 41 62 return writeReg(eRT_Application, msgSet, commandToFix(offset)); 42 63 } … … 74 95 : Control::Container(eap, name) 75 96 , m_eap(eap) 97 , m_monitorlevel(0) 98 , m_dimlevel(0) 76 99 { 77 100 m_mute = new Switch(m_eap, "Mute", 0x0C, 1); … … 98 121 m_mono.push_back(s); 99 122 } 123 m_monitorlevel = m_eap->getMonitorPoti("MonitorLevel"); 124 addElement(m_monitorlevel); 125 m_dimlevel = m_eap->getDimPoti("DimLevel"); 126 addElement(m_dimlevel); 100 127 } 101 128 trunk/libffado/src/dice/focusrite/focusrite_eap.h
r1730 r1734 57 57 }; 58 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 59 79 class MonitorSection : public Control::Container 60 80 { … … 68 88 std::vector<Switch*> m_dim_affected; 69 89 std::vector<Switch*> m_mono; 90 Poti* m_monitorlevel; 91 Poti* m_dimlevel; 70 92 }; 71 93 … … 79 101 protected: 80 102 virtual int commandToFix(unsigned offset) =0; 103 virtual Poti* getMonitorPoti(std::string) { return 0; } 104 virtual Poti* getDimPoti(std::string) { return 0; } 81 105 }; 82 106 trunk/libffado/src/dice/focusrite/saffire_pro24.cpp
r1730 r1734 32 32 if (offset<0x14) return 2; 33 33 if (offset<0x3C && offset>=0x14) return 1; 34 if (offset<0x58 && offset>=0x50) return 1; 34 35 if (offset<0x40 && offset>=0x3C) return 3; 35 36 if (offset<0x60 && offset>=0x58) return 4; 36 37 return 0; 38 } 39 FocusriteEAP::Poti* SaffirePro24::SaffirePro24EAP::getMonitorPoti(std::string name) { 40 return new FocusriteEAP::Poti(this, name, 0x50); 41 } 42 FocusriteEAP::Poti* SaffirePro24::SaffirePro24EAP::getDimPoti(std::string name) { 43 return new FocusriteEAP::Poti(this, name, 0x54); 37 44 } 38 45 trunk/libffado/src/dice/focusrite/saffire_pro24.h
r1730 r1734 58 58 59 59 int commandToFix(unsigned offset); 60 61 Poti* getMonitorPoti(std::string); 62 Poti* getDimPoti(std::string); 60 63 }; 61 64 Dice::Device::EAP* createEAP();