Changeset 830

Show
Ignore:
Timestamp:
01/10/08 13:11:59 (14 years ago)
Author:
ppalmers
Message:

add some extra control elements

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/api-cleanup/src/bebob/focusrite/focusrite_saffirepro.cpp

    r783 r830  
    231231            "UseHighVoltageRail", "Use High Supply", "Prefer the high voltage power supply rail")); 
    232232 
     233    result &= m_ControlContainer->addElement( 
     234        new SaffireProMultiControl(*this, SaffireProMultiControl::eTCT_ExitStandalone, 
     235            "ExitStandalone", "Exit Standalone mode", "Try to leave standalonbe mode")); 
     236 
     237    result &= m_ControlContainer->addElement( 
     238        new SaffireProMultiControl(*this, SaffireProMultiControl::eTCT_PllLockRange, 
     239            "PllLockRange", "PLL Lock Range", "Get/Set PLL Lock range")); 
     240 
    233241    if (!result) { 
    234242        debugWarning("One or more device control elements could not be created."); 
     
    484492 
    485493void 
     494SaffireProDevice::exitStandalone() { 
     495    debugOutput( DEBUG_LEVEL_VERBOSE, "exit standalone mode...\n" ); 
     496    if ( !setSpecificValue(FR_SAFFIREPRO_CMD_ID_EXIT_STANDALONE,  
     497                           FR_SAFFIREPRO_CMD_EXIT_STANDALONE_CODE ) ) { 
     498        debugError( "setSpecificValue failed\n" ); 
     499    } 
     500} 
     501 
     502void 
    486503SaffireProDevice::flashLed() { 
    487504    int ledFlashDuration=2; 
     
    570587} 
    571588 
     589void 
     590SaffireProDevice::setPllLockRange(unsigned int i) { 
     591    uint32_t reg=i; 
     592    debugOutput( DEBUG_LEVEL_VERBOSE, "set PLL lock range: %d ...\n", i ); 
     593 
     594    if ( !setSpecificValue(FR_SAFFIREPRO_CMD_ID_PLL_LOCK_RANGE,  
     595                           reg ) ) { 
     596        debugError( "setSpecificValue failed\n" ); 
     597    } 
     598} 
     599 
     600unsigned int 
     601SaffireProDevice::getPllLockRange() { 
     602    uint32_t retval; 
     603    if ( !getSpecificValue(FR_SAFFIREPRO_CMD_ID_PLL_LOCK_RANGE, &retval ) ) { 
     604        debugError( "getSpecificValue failed\n" ); 
     605        return false; 
     606    } 
     607 
     608    debugOutput( DEBUG_LEVEL_VERBOSE, 
     609                     "PLL lock range: %d\n", retval ); 
     610    return retval; 
     611} 
     612 
    572613// swiss army knife control element 
    573 SaffireProMultiControl::SaffireProMultiControl(SaffireProDevice& parent, enum eTriggerControlType t) 
     614SaffireProMultiControl::SaffireProMultiControl(SaffireProDevice& parent, enum eMultiControlType t) 
    574615: Control::Discrete() 
    575616, m_Parent(parent) 
    576617, m_type ( t ) 
    577618{} 
    578 SaffireProMultiControl::SaffireProMultiControl(SaffireProDevice& parent, enum eTriggerControlType t, 
     619SaffireProMultiControl::SaffireProMultiControl(SaffireProDevice& parent, enum eMultiControlType t, 
    579620                std::string name, std::string label, std::string descr) 
    580621: Control::Discrete() 
     
    594635        case eTCT_FlashLed: m_Parent.flashLed(); return true; 
    595636        case eTCT_UseHighVoltageRail: m_Parent.useHighVoltageRail(v); return true; 
     637        case eTCT_ExitStandalone: m_Parent.exitStandalone(); return true; 
     638        case eTCT_PllLockRange: m_Parent.setPllLockRange(v); return true; 
    596639    } 
    597640    return false; 
     
    605648        case eTCT_FlashLed: return 0; 
    606649        case eTCT_UseHighVoltageRail: return m_Parent.usingHighVoltageRail(); 
     650        case eTCT_ExitStandalone: return 0; 
     651        case eTCT_PllLockRange: return m_Parent.getPllLockRange(); 
    607652    } 
    608653    return -1; 
  • branches/api-cleanup/src/bebob/focusrite/focusrite_saffirepro.h

    r750 r830  
    254254{ 
    255255public: 
    256     enum eTriggerControlType { 
     256    enum eMultiControlType { 
    257257        eTCT_Reboot, 
    258258        eTCT_FlashLed, 
    259259        eTCT_UseHighVoltageRail, 
     260        eTCT_ExitStandalone, 
     261        eTCT_PllLockRange, 
    260262    }; 
    261263 
    262264public: 
    263     SaffireProMultiControl(SaffireProDevice& parent, enum eTriggerControlType); 
    264     SaffireProMultiControl(SaffireProDevice& parent, enum eTriggerControlType, 
     265    SaffireProMultiControl(SaffireProDevice& parent, enum eMultiControlType); 
     266    SaffireProMultiControl(SaffireProDevice& parent, enum eMultiControlType, 
    265267                  std::string name, std::string label, std::string descr); 
    266268 
     
    270272private: 
    271273    SaffireProDevice&          m_Parent; 
    272     enum eTriggerControlType  m_type; 
     274    enum eMultiControlType  m_type; 
    273275}; 
    274276 
     
    320322    bool isExtClockLocked(); 
    321323    uint32_t getCount32(); 
     324    void exitStandalone(); 
    322325 
    323326    void useHighVoltageRail(bool useIt); 
    324327    bool usingHighVoltageRail(); 
     328    unsigned int getPllLockRange(); 
     329    void setPllLockRange(unsigned int); 
     330 
    325331private: 
    326332    virtual bool setSamplingFrequencyDo( uint32_t );