Changeset 1734

Show
Ignore:
Timestamp:
11/24/09 14:30:28 (13 years ago)
Author:
arnonym
Message:

Controlling the dim-level works now. Controlling the DAC-level works too, but switching the dac-level to control channels is still missing.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/dice/focusrite/focusrite_eap.cpp

    r1730 r1734  
    3030const int msgSet = 0x68; 
    3131 
     32FocusriteEAP::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 
     42int FocusriteEAP::Poti::getValue() { 
     43    return m_value; 
     44} 
     45bool 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 
    3252FocusriteEAP::FocusriteEAP(Dice::Device& dev) : Dice::Device::EAP(dev) { 
    3353} 
     
    3959    bool ret = writeReg(eRT_Application, offset, quadlet); 
    4060    if (!ret) return false; 
     61    debugOutput(DEBUG_LEVEL_VERBOSE, "Will sent command %i.\n", commandToFix(offset)); 
    4162    return writeReg(eRT_Application, msgSet, commandToFix(offset)); 
    4263} 
     
    7495    : Control::Container(eap, name) 
    7596    , m_eap(eap) 
     97    , m_monitorlevel(0) 
     98    , m_dimlevel(0) 
    7699{ 
    77100    m_mute = new Switch(m_eap, "Mute", 0x0C, 1); 
     
    98121        m_mono.push_back(s); 
    99122    } 
     123    m_monitorlevel = m_eap->getMonitorPoti("MonitorLevel"); 
     124    addElement(m_monitorlevel); 
     125    m_dimlevel = m_eap->getDimPoti("DimLevel"); 
     126    addElement(m_dimlevel); 
    100127} 
    101128 
  • trunk/libffado/src/dice/focusrite/focusrite_eap.h

    r1730 r1734  
    5757    }; 
    5858 
     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 
    5979    class MonitorSection : public Control::Container 
    6080    { 
     
    6888        std::vector<Switch*> m_dim_affected; 
    6989        std::vector<Switch*> m_mono; 
     90        Poti* m_monitorlevel; 
     91        Poti* m_dimlevel; 
    7092    }; 
    7193 
     
    79101protected: 
    80102    virtual int commandToFix(unsigned offset) =0; 
     103    virtual Poti* getMonitorPoti(std::string) { return 0; } 
     104    virtual Poti* getDimPoti(std::string) { return 0; } 
    81105}; 
    82106 
  • trunk/libffado/src/dice/focusrite/saffire_pro24.cpp

    r1730 r1734  
    3232    if (offset<0x14) return 2; 
    3333    if (offset<0x3C && offset>=0x14) return 1; 
     34    if (offset<0x58 && offset>=0x50) return 1; 
    3435    if (offset<0x40 && offset>=0x3C) return 3; 
    3536    if (offset<0x60 && offset>=0x58) return 4; 
    3637    return 0; 
     38} 
     39FocusriteEAP::Poti* SaffirePro24::SaffirePro24EAP::getMonitorPoti(std::string name) { 
     40    return new FocusriteEAP::Poti(this, name, 0x50); 
     41} 
     42FocusriteEAP::Poti* SaffirePro24::SaffirePro24EAP::getDimPoti(std::string name) { 
     43    return new FocusriteEAP::Poti(this, name, 0x54); 
    3744} 
    3845 
  • trunk/libffado/src/dice/focusrite/saffire_pro24.h

    r1730 r1734  
    5858 
    5959        int commandToFix(unsigned offset); 
     60 
     61        Poti* getMonitorPoti(std::string); 
     62        Poti* getDimPoti(std::string); 
    6063    }; 
    6164    Dice::Device::EAP* createEAP();