- Timestamp:
- 10/26/08 15:58:20 (15 years ago)
- Files:
-
- branches/libffado-2.0/src/motu/motu_avdevice.cpp (modified) (1 diff)
- branches/libffado-2.0/src/motu/motu_controls.cpp (modified) (25 diffs)
- branches/libffado-2.0/src/motu/motu_controls.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/libffado-2.0/src/motu/motu_avdevice.cpp
r1355 r1382 320 320 {"Analog 7", MOTU_CTRL_STD_CHANNEL, 0x0018, }, 321 321 {"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, }, 322 324 {"SPDIF 1", MOTU_CTRL_STD_CHANNEL, 0x0020, }, 323 325 {"SPDIF 2", MOTU_CTRL_STD_CHANNEL, 0x0024, }, branches/libffado-2.0/src/motu/motu_controls.cpp
r1315 r1382 76 76 getName().c_str(), m_register, v); 77 77 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 78 83 // Set the value 79 84 if (m_setenable_mask) { … … 103 108 getName().c_str(), m_register); 104 109 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 105 115 // FIXME: we could just read the appropriate mixer status field from the 106 116 // receive stream processor once we work out an efficient way to do this. … … 125 135 unsigned int val; 126 136 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 } 127 142 128 143 val = v<0?0:v; … … 142 157 debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for channel fader 0x%04x\n", m_register); 143 158 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 144 165 // FIXME: we could just read the appropriate mixer status field from the 145 166 // receive stream processor once we work out an efficient way to do this. … … 164 185 unsigned int val; 165 186 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 } 166 192 167 193 val = ((v<-64?-64:v)+64) & 0xff; … … 181 207 debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for channel pan 0x%04x\n", m_register); 182 208 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 183 215 // FIXME: we could just read the appropriate mixer status field from the 184 216 // receive stream processor once we work out an efficient way to do this. … … 222 254 uint32_t MotuMatrixMixer::getCellRegister(const unsigned int row, const unsigned int col) 223 255 { 256 if (m_RowInfo.at(row).address==MOTU_CTRL_NONE || 257 m_ColInfo.at(col).address==MOTU_CTRL_NONE) 258 return MOTU_CTRL_NONE; 224 259 return m_RowInfo.at(row).address + m_ColInfo.at(col).address; 225 260 } … … 262 297 double ChannelFaderMatrixMixer::setValue(const int row, const int col, const double val) 263 298 { 264 uint32_t v ;299 uint32_t v, reg; 265 300 v = val<0?0:(uint32_t)val; 266 301 if (v > 0x80) … … 268 303 debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelFader setValue for row %d col %d to %lf (%ld)\n", 269 304 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 } 271 312 // Bit 30 indicates that the channel fader is being set 272 313 v |= 0x40000000; 273 m_parent.WriteRegister( getCellRegister(row,col), v);314 m_parent.WriteRegister(reg, v); 274 315 275 316 return true; … … 278 319 double ChannelFaderMatrixMixer::getValue(const int row, const int col) 279 320 { 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 } 281 329 // FIXME: we could just read the appropriate mixer status field from the 282 330 // 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; 284 332 285 333 debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelFader getValue for row %d col %d = %lu\n", … … 300 348 double ChannelPanMatrixMixer::setValue(const int row, const int col, const double val) 301 349 { 302 uint32_t v ;350 uint32_t v, reg; 303 351 v = ((val<-64?-64:(int32_t)val)+64) & 0xff; 304 352 if (v > 0x80) … … 307 355 debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelPan setValue for row %d col %d to %lf (%ld)\n", 308 356 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 } 309 364 310 365 // Bit 31 indicates that pan is being set 311 366 v = (v << 8) | 0x80000000; 312 m_parent.WriteRegister( getCellRegister(row,col), v);367 m_parent.WriteRegister(reg, v); 313 368 314 369 return true; … … 318 373 { 319 374 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 320 384 // FIXME: we could just read the appropriate mixer status field from the 321 385 // 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); 323 387 val = ((val >> 8) & 0xff) - 0x40; 324 388 … … 348 412 double ChannelBinSwMatrixMixer::setValue(const int row, const int col, const double val) 349 413 { 350 uint32_t v ;414 uint32_t v, reg; 351 415 352 416 debugOutput(DEBUG_LEVEL_VERBOSE, "BinSw setValue for row %d col %d to %lf (%ld)\n", 353 417 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 } 354 425 355 426 // Set the value … … 362 433 // processor (if running) later on. For now we'll just fetch the 363 434 // current register value directly when needed. 364 v = m_parent.ReadRegister( getCellRegister(row,col));435 v = m_parent.ReadRegister(reg); 365 436 if (v==0) 366 437 v &= ~m_value_mask; … … 368 439 v |= m_value_mask; 369 440 } 370 m_parent.WriteRegister( getCellRegister(row,col), v);441 m_parent.WriteRegister(reg, v); 371 442 372 443 return true; … … 375 446 double ChannelBinSwMatrixMixer::getValue(const int row, const int col) 376 447 { 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 } 378 456 379 457 // FIXME: we could just read the appropriate mixer status field from the 380 458 // 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); 382 460 val = (val & m_value_mask) != 0; 383 461 … … 405 483 debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for mix fader 0x%04x to %d\n", m_register, v); 406 484 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 } 407 490 val = v<0?0:v; 408 491 if (val > 0x80) … … 421 504 debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for mix fader 0x%04x\n", m_register); 422 505 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 423 512 // FIXME: we could just read the appropriate mixer status field from the 424 513 // receive stream processor once we work out an efficient way to do this. … … 443 532 unsigned int val, dest; 444 533 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 } 445 540 446 541 // Need to read current destination so we can preserve that when setting … … 463 558 debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for mix mute 0x%04x\n", m_register); 464 559 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 465 566 // FIXME: we could just read the appropriate mixer status field from the 466 567 // receive stream processor once we work out an efficient way to do this. … … 486 587 debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for mix destination 0x%04x to %d\n", m_register, v); 487 588 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 } 488 594 // Need to get current mute status so we can preserve it 489 595 mute = m_parent.ReadRegister(m_register) & 0x00001000; … … 511 617 debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for mix destination 0x%04x\n", m_register); 512 618 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 } 513 624 // FIXME: we could just read the appropriate mixer status field from the 514 625 // receive stream processor once we work out an efficient way to do this. … … 656 767 debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for mode %d input pad/trim %d to %d\n", m_mode, m_register, v); 657 768 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 658 774 reg = dev_register(); 659 775 if (reg == 0) … … 703 819 debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for mode %d input pad/trim %d\n", m_mode, m_register); 704 820 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 705 826 reg = dev_register(); 706 827 if (reg == 0) branches/libffado-2.0/src/motu/motu_controls.h
r1359 r1382 91 91 #define MOTU_CTRL_TRIMGAINPAD_MAX_CHANNEL 3 92 92 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 93 98 class MotuDiscreteCtrl 94 99 : public Control::Discrete