Changeset 1382

Show
Ignore:
Timestamp:
10/26/08 15:58:20 (12 years ago)
Author:
jwoithe
Message:

MOTU: Allow dbus matrix elements to be flagged as non-existent "pad" controls so other controls remain at their respective places within the matrix.
MOTU: Use pad controls in Ultralite mixer so SPDIF controls remain at their usual index within the dbus matrix mixer elements.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libffado-2.0/src/motu/motu_avdevice.cpp

    r1355 r1382  
    320320    {"Analog 7", MOTU_CTRL_STD_CHANNEL, 0x0018, }, 
    321321    {"Analog 8", MOTU_CTRL_STD_CHANNEL, 0x001c, }, 
     322    {"AES/EBU 1", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 
     323    {"AES/EBU 2", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 
    322324    {"SPDIF 1", MOTU_CTRL_STD_CHANNEL, 0x0020, }, 
    323325    {"SPDIF 2", MOTU_CTRL_STD_CHANNEL, 0x0024, }, 
  • branches/libffado-2.0/src/motu/motu_controls.cpp

    r1315 r1382  
    7676      getName().c_str(), m_register, v); 
    7777 
     78    if (m_register == MOTU_CTRL_NONE) { 
     79        debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 
     80        return true; 
     81    } 
     82 
    7883    // Set the value 
    7984    if (m_setenable_mask) { 
     
    103108      getName().c_str(), m_register); 
    104109 
     110    if (m_register == MOTU_CTRL_NONE) { 
     111        debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 
     112        return 0; 
     113    } 
     114 
    105115    // FIXME: we could just read the appropriate mixer status field from the 
    106116    // receive stream processor once we work out an efficient way to do this. 
     
    125135    unsigned int val; 
    126136    debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for channel fader 0x%04x to %d\n", m_register, v); 
     137 
     138    if (m_register == MOTU_CTRL_NONE) { 
     139        debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 
     140        return true; 
     141    } 
    127142 
    128143    val = v<0?0:v; 
     
    142157    debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for channel fader 0x%04x\n", m_register); 
    143158 
     159    // Silently swallow attempts to read non-existent controls for now 
     160    if (m_register == MOTU_CTRL_NONE) { 
     161        debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 
     162        return 0; 
     163    } 
     164 
    144165    // FIXME: we could just read the appropriate mixer status field from the 
    145166    // receive stream processor once we work out an efficient way to do this. 
     
    164185    unsigned int val; 
    165186    debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for channel pan 0x%04x to %d\n", m_register, v); 
     187 
     188    if (m_register == MOTU_CTRL_NONE) { 
     189        debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 
     190        return true; 
     191    } 
    166192 
    167193    val = ((v<-64?-64:v)+64) & 0xff; 
     
    181207    debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for channel pan 0x%04x\n", m_register); 
    182208 
     209    // Silently swallow attempts to read non-existent controls for now 
     210    if (m_register == MOTU_CTRL_NONE) { 
     211        debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 
     212        return 0; 
     213    } 
     214 
    183215    // FIXME: we could just read the appropriate mixer status field from the 
    184216    // receive stream processor once we work out an efficient way to do this. 
     
    222254uint32_t MotuMatrixMixer::getCellRegister(const unsigned int row, const unsigned int col) 
    223255{ 
     256    if (m_RowInfo.at(row).address==MOTU_CTRL_NONE || 
     257        m_ColInfo.at(col).address==MOTU_CTRL_NONE) 
     258        return MOTU_CTRL_NONE; 
    224259    return m_RowInfo.at(row).address + m_ColInfo.at(col).address; 
    225260} 
     
    262297double ChannelFaderMatrixMixer::setValue(const int row, const int col, const double val) 
    263298{ 
    264     uint32_t v
     299    uint32_t v, reg
    265300    v = val<0?0:(uint32_t)val; 
    266301    if (v > 0x80) 
     
    268303    debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelFader setValue for row %d col %d to %lf (%ld)\n", 
    269304      row, col, val, v); 
    270  
     305    reg = getCellRegister(row,col); 
     306 
     307    // Silently swallow attempts to set non-existent controls for now 
     308    if (reg == MOTU_CTRL_NONE) { 
     309        debugOutput(DEBUG_LEVEL_VERBOSE, "ignoring control marked as non-existent\n"); 
     310        return true; 
     311    } 
    271312    // Bit 30 indicates that the channel fader is being set 
    272313    v |= 0x40000000; 
    273     m_parent.WriteRegister(getCellRegister(row,col), v); 
     314    m_parent.WriteRegister(reg, v); 
    274315 
    275316    return true; 
     
    278319double ChannelFaderMatrixMixer::getValue(const int row, const int col) 
    279320{ 
    280     uint32_t val; 
     321    uint32_t val, reg; 
     322    reg = getCellRegister(row,col); 
     323 
     324    // Silently swallow attempts to read non-existent controls for now 
     325    if (reg == MOTU_CTRL_NONE) { 
     326        debugOutput(DEBUG_LEVEL_VERBOSE, "ignoring control marked as non-existent\n"); 
     327        return 0; 
     328    } 
    281329    // FIXME: we could just read the appropriate mixer status field from the 
    282330    // receive stream processor once we work out an efficient way to do this. 
    283     val = m_parent.ReadRegister(getCellRegister(row,col)) & 0xff; 
     331    val = m_parent.ReadRegister(reg) & 0xff; 
    284332 
    285333    debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelFader getValue for row %d col %d = %lu\n", 
     
    300348double ChannelPanMatrixMixer::setValue(const int row, const int col, const double val) 
    301349{ 
    302     uint32_t v
     350    uint32_t v, reg
    303351    v = ((val<-64?-64:(int32_t)val)+64) & 0xff; 
    304352    if (v > 0x80) 
     
    307355    debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelPan setValue for row %d col %d to %lf (%ld)\n", 
    308356      row, col, val, v); 
     357    reg = getCellRegister(row,col); 
     358 
     359    // Silently swallow attempts to set non-existent controls for now 
     360    if (reg == MOTU_CTRL_NONE) { 
     361        debugOutput(DEBUG_LEVEL_VERBOSE, "ignoring control marked as non-existent\n"); 
     362        return true; 
     363    } 
    309364 
    310365    // Bit 31 indicates that pan is being set 
    311366    v = (v << 8) | 0x80000000; 
    312     m_parent.WriteRegister(getCellRegister(row,col), v); 
     367    m_parent.WriteRegister(reg, v); 
    313368 
    314369    return true; 
     
    318373{ 
    319374    int32_t val; 
     375    uint32_t reg; 
     376    reg = getCellRegister(row,col); 
     377 
     378    // Silently swallow attempts to read non-existent controls for now 
     379    if (reg == MOTU_CTRL_NONE) { 
     380        debugOutput(DEBUG_LEVEL_VERBOSE, "ignoring control marked as non-existent\n"); 
     381        return 0; 
     382    } 
     383 
    320384    // FIXME: we could just read the appropriate mixer status field from the 
    321385    // receive stream processor once we work out an efficient way to do this. 
    322     val = m_parent.ReadRegister(getCellRegister(row,col)); 
     386    val = m_parent.ReadRegister(reg); 
    323387    val = ((val >> 8) & 0xff) - 0x40; 
    324388 
     
    348412double ChannelBinSwMatrixMixer::setValue(const int row, const int col, const double val) 
    349413{ 
    350     uint32_t v
     414    uint32_t v, reg
    351415 
    352416    debugOutput(DEBUG_LEVEL_VERBOSE, "BinSw setValue for row %d col %d to %lf (%ld)\n", 
    353417      row, col, val, val==0?0:1); 
     418    reg = getCellRegister(row,col); 
     419 
     420    // Silently swallow attempts to set non-existent controls for now 
     421    if (reg == MOTU_CTRL_NONE) { 
     422        debugOutput(DEBUG_LEVEL_VERBOSE, "ignoring control marked as non-existent\n"); 
     423        return true; 
     424    } 
    354425 
    355426    // Set the value 
     
    362433      // processor (if running) later on.  For now we'll just fetch the 
    363434      // current register value directly when needed. 
    364       v = m_parent.ReadRegister(getCellRegister(row,col)); 
     435      v = m_parent.ReadRegister(reg); 
    365436      if (v==0) 
    366437        v &= ~m_value_mask; 
     
    368439        v |= m_value_mask; 
    369440    } 
    370     m_parent.WriteRegister(getCellRegister(row,col), v); 
     441    m_parent.WriteRegister(reg, v); 
    371442 
    372443    return true; 
     
    375446double ChannelBinSwMatrixMixer::getValue(const int row, const int col) 
    376447{ 
    377     uint32_t val; 
     448    uint32_t val, reg; 
     449    reg = getCellRegister(row,col); 
     450 
     451    // Silently swallow attempts to read non-existent controls for now 
     452    if (reg == MOTU_CTRL_NONE) { 
     453        debugOutput(DEBUG_LEVEL_VERBOSE, "ignoring control marked as non-existent\n"); 
     454        return 0; 
     455    } 
    378456 
    379457    // FIXME: we could just read the appropriate mixer status field from the  
    380458    // receive stream processor once we work out an efficient way to do this. 
    381     val = m_parent.ReadRegister(getCellRegister(row,col)); 
     459    val = m_parent.ReadRegister(reg); 
    382460    val = (val & m_value_mask) != 0; 
    383461 
     
    405483    debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for mix fader 0x%04x to %d\n", m_register, v); 
    406484 
     485    // Silently swallow attempts to set non-existent controls for now 
     486    if (m_register == MOTU_CTRL_NONE) { 
     487        debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 
     488        return true; 
     489    } 
    407490    val = v<0?0:v; 
    408491    if (val > 0x80) 
     
    421504    debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for mix fader 0x%04x\n", m_register); 
    422505 
     506    // Silently swallow attempts to read non-existent controls for now 
     507    if (m_register == MOTU_CTRL_NONE) { 
     508        debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 
     509        return 0; 
     510    } 
     511 
    423512    // FIXME: we could just read the appropriate mixer status field from the 
    424513    // receive stream processor once we work out an efficient way to do this. 
     
    443532    unsigned int val, dest; 
    444533    debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for mix mute 0x%04x to %d\n", m_register, v); 
     534 
     535    // Silently swallow attempts to set non-existent controls for now 
     536    if (m_register == MOTU_CTRL_NONE) { 
     537        debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 
     538        return true; 
     539    } 
    445540 
    446541    // Need to read current destination so we can preserve that when setting 
     
    463558    debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for mix mute 0x%04x\n", m_register); 
    464559 
     560    // Silently swallow attempts to read non-existent controls for now 
     561    if (m_register == MOTU_CTRL_NONE) { 
     562        debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 
     563        return 0; 
     564    } 
     565 
    465566    // FIXME: we could just read the appropriate mixer status field from the 
    466567    // receive stream processor once we work out an efficient way to do this. 
     
    486587    debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for mix destination 0x%04x to %d\n", m_register, v); 
    487588 
     589    // Silently swallow attempts to set non-existent controls for now 
     590    if (m_register == MOTU_CTRL_NONE) { 
     591        debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 
     592        return true; 
     593    } 
    488594    // Need to get current mute status so we can preserve it 
    489595    mute = m_parent.ReadRegister(m_register) & 0x00001000; 
     
    511617    debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for mix destination 0x%04x\n", m_register); 
    512618 
     619    // Silently swallow attempts to read non-existent controls for now 
     620    if (m_register == MOTU_CTRL_NONE) { 
     621        debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 
     622        return true; 
     623    } 
    513624    // FIXME: we could just read the appropriate mixer status field from the 
    514625    // receive stream processor once we work out an efficient way to do this. 
     
    656767    debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for mode %d input pad/trim %d to %d\n", m_mode, m_register, v); 
    657768 
     769    if (m_register == MOTU_CTRL_NONE) { 
     770        debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 
     771        return true; 
     772    } 
     773 
    658774    reg = dev_register(); 
    659775    if (reg == 0) 
     
    703819    debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for mode %d input pad/trim %d\n", m_mode, m_register); 
    704820 
     821    if (m_register == MOTU_CTRL_NONE) { 
     822        debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 
     823        return 0; 
     824    } 
     825 
    705826    reg = dev_register(); 
    706827    if (reg == 0) 
  • branches/libffado-2.0/src/motu/motu_controls.h

    r1359 r1382  
    9191#define MOTU_CTRL_TRIMGAINPAD_MAX_CHANNEL  3 
    9292 
     93/* A "register" value used to signify that a particular control in a matrix 
     94 * mixer is not available on the current interface. 
     95 */ 
     96#define MOTU_CTRL_NONE                     0xffffffff 
     97 
    9398class MotuDiscreteCtrl 
    9499    : public Control::Discrete