Show
Ignore:
Timestamp:
12/19/09 08:12:53 (13 years ago)
Author:
ppalmers
Message:

Merged revisions 1536,1541,1544-1546,1549,1554-1562,1571,1579-1581,1618,1632,1634-1635,1661,1677-1679,1703-1704,1715,1720-1723,1743-1745,1755 via svnmerge from
svn+ssh://ffadosvn@ffado.org/ffado/branches/libffado-2.0

Also fix remaining format string warnings.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado

    • Property svnmerge-blocked changed from
      /branches/libffado-2.0:1563,1565,1750

      to /branches/libffado-2.0:1563,1565,1750
    • Property svnmerge-integrated changed from
      /branches/libffado-2.0:1-1532,1566-1570,1572-1578,1582-1617,1619-1631,1633,1636-1660,1662-1676,1680-1686

      to /branches/libffado-2.0:1-1562,1564,1566-1749,1751-1762
  • trunk/libffado/src/motu/motu_avdevice.cpp

    r1605 r1763  
    2626 
    2727#include "motu/motu_avdevice.h" 
     28#include "motu/motu_mixerdefs.h" 
     29#include "motu/motu_mark3_mixerdefs.h" 
    2830 
    2931#include "devicemanager.h" 
     
    6769    {FW_VENDORID_MOTU, 0, 0x00000005, 0x000001f2, MOTU_MODEL_896HD, "MOTU", "896HD"}, 
    6870    {FW_VENDORID_MOTU, 0, 0x00000015, 0x000001f2, MOTU_MODEL_828mk3, "MOTU", "828Mk3"}, 
     71    {FW_VENDORID_MOTU, 0, 0x00000019, 0x000001f2, MOTU_MODEL_ULTRALITEmk3, "MOTU", "UltraLineMk3"}, 
    6972}; 
    7073 
     
    202205const PortEntry Ports_ULTRALITE[] = 
    203206{ 
    204     {"Main-L", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 40}, 
    205     {"Main-R", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 43}, 
     207    {"Main-L", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 40}, 
     208    {"Main-R", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 43}, 
    206209    {"Mix-L", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, 
    207210    {"Mix-R", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, 
     
    218221    {"Phones-L", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, 
    219222    {"Phones-R", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, 
     223    {"SPDIF1", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 40}, 
     224    {"SPDIF2", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 43}, 
    220225    {"Padding1", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY|MOTU_PA_PADDING, 46}, 
    221226    {"Padding2", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY|MOTU_PA_PADDING, 49}, 
     
    306311}; 
    307312 
    308 // Mixer registers 
    309 const MatrixMixBus MixerBuses_Traveler[] = { 
    310     {"Mix 1", 0x4000, }, 
    311     {"Mix 2", 0x4100, }, 
    312     {"Mix 3", 0x4200, }, 
    313     {"Mix 4", 0x4300, }, 
     313const PortEntry Ports_ULTRALITEmk3[] = 
     314
     315    {"Main-L", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 40}, 
     316    {"Main-R", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 43}, 
     317    {"Mix-L", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, 
     318    {"Mix-R", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, 
     319    {"Mic1", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 16}, 
     320    {"Mic2", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 19}, 
     321    {"Analog1", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 16}, 
     322    {"Analog2", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 19}, 
     323    {"Analog3", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 22}, 
     324    {"Analog4", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 25}, 
     325    {"Analog5", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 28}, 
     326    {"Analog6", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 31}, 
     327    {"Analog7", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 34}, 
     328    {"Analog8", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 37}, 
     329    {"Phones-L", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, 
     330    {"Phones-R", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, 
     331    {"SPDIF1", MOTU_PA_IN | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 40}, 
     332    {"SPDIF2", MOTU_PA_IN | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 43}, 
     333    {"Padding1", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY|MOTU_PA_PADDING, 46}, 
     334    {"Padding2", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY|MOTU_PA_PADDING, 49}, 
     335    {"SPDIF1", MOTU_PA_OUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 46}, 
     336    {"SPDIF2", MOTU_PA_OUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 49}, 
    314337}; 
    315  
    316 const MatrixMixChannel MixerChannels_Traveler[] = { 
    317     {"Analog 1", MOTU_CTRL_STD_CHANNEL, 0x0000, }, 
    318     {"Analog 2", MOTU_CTRL_STD_CHANNEL, 0x0004, }, 
    319     {"Analog 3", MOTU_CTRL_STD_CHANNEL, 0x0008, }, 
    320     {"Analog 4", MOTU_CTRL_STD_CHANNEL, 0x000c, }, 
    321     {"Analog 5", MOTU_CTRL_STD_CHANNEL, 0x0010, }, 
    322     {"Analog 6", MOTU_CTRL_STD_CHANNEL, 0x0014, }, 
    323     {"Analog 7", MOTU_CTRL_STD_CHANNEL, 0x0018, }, 
    324     {"Analog 8", MOTU_CTRL_STD_CHANNEL, 0x001c, }, 
    325     {"AES/EBU 1", MOTU_CTRL_STD_CHANNEL, 0x0020, }, 
    326     {"AES/EBU 2", MOTU_CTRL_STD_CHANNEL, 0x0024, }, 
    327     {"SPDIF 1", MOTU_CTRL_STD_CHANNEL, 0x0028, }, 
    328     {"SPDIF 2", MOTU_CTRL_STD_CHANNEL, 0x002c, }, 
    329     {"ADAT 1", MOTU_CTRL_STD_CHANNEL, 0x0030, }, 
    330     {"ADAT 2", MOTU_CTRL_STD_CHANNEL, 0x0034, }, 
    331     {"ADAT 3", MOTU_CTRL_STD_CHANNEL, 0x0038, }, 
    332     {"ADAT 4", MOTU_CTRL_STD_CHANNEL, 0x003c, }, 
    333     {"ADAT 5", MOTU_CTRL_STD_CHANNEL, 0x0040, }, 
    334     {"ADAT 6", MOTU_CTRL_STD_CHANNEL, 0x0044, }, 
    335     {"ADAT 7", MOTU_CTRL_STD_CHANNEL, 0x0048, }, 
    336     {"ADAT 8", MOTU_CTRL_STD_CHANNEL, 0x004c, }, 
    337 }; 
    338  
    339 const MixerCtrl MixerCtrls_Traveler[] = { 
    340     {"Mix1/Mix_", "Mix 1 ", "", MOTU_CTRL_STD_MIX, 0x0c20, }, 
    341     {"Mix2/Mix_", "Mix 2 ", "", MOTU_CTRL_STD_MIX, 0x0c24, }, 
    342     {"Mix3/Mix_", "Mix 3 ", "", MOTU_CTRL_STD_MIX, 0x0c28, }, 
    343     {"Mix4/Mix_", "Mix 4 ", "", MOTU_CTRL_STD_MIX, 0x0c2c, }, 
    344     {"Mainout_",  "MainOut ", "", MOTU_CTRL_MIX_FADER, 0x0c0c, }, 
    345     {"Phones_",   "Phones ",  "", MOTU_CTRL_MIX_FADER, 0x0c10, }, 
    346  
    347     /* For mic/line input controls, the "register" is the zero-based channel number */ 
    348     {"Control/Ana1_", "Analog 1 input ", "", MOTU_CTRL_TRAVELER_MIC_INPUT_CTRLS, 0}, 
    349     {"Control/Ana2_", "Analog 2 input ", "", MOTU_CTRL_TRAVELER_MIC_INPUT_CTRLS, 1}, 
    350     {"Control/Ana3_", "Analog 3 input ", "", MOTU_CTRL_TRAVELER_MIC_INPUT_CTRLS, 2}, 
    351     {"Control/Ana4_", "Analog 4 input ", "", MOTU_CTRL_TRAVELER_MIC_INPUT_CTRLS, 3}, 
    352     {"Control/Ana5_", "Analog 5 input ", "", MOTU_CTRL_TRAVELER_LINE_INPUT_CTRLS, 4}, 
    353     {"Control/Ana6_", "Analog 6 input ", "", MOTU_CTRL_TRAVELER_LINE_INPUT_CTRLS, 5}, 
    354     {"Control/Ana7_", "Analog 7 input ", "", MOTU_CTRL_TRAVELER_LINE_INPUT_CTRLS, 6}, 
    355     {"Control/Ana8_", "Analog 8 input ", "", MOTU_CTRL_TRAVELER_LINE_INPUT_CTRLS, 7}, 
    356  
    357     /* For phones source control, "register" is currently unused */ 
    358     {"Control/Phones_", "Phones source", "", MOTU_CTRL_PHONES_SRC, 0}, 
    359  
    360     /* For optical mode controls, the "register" is used to indicate direction */ 
    361     {"Control/OpticalIn_mode", "Optical input mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_IN}, 
    362     {"Control/OpticalOut_mode", "Optical output mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_OUT}, 
    363 }; 
    364  
    365 const MatrixMixBus MixerBuses_Ultralite[] = { 
    366     {"Mix 1", 0x4000, }, 
    367     {"Mix 2", 0x4100, }, 
    368     {"Mix 3", 0x4200, }, 
    369     {"Mix 4", 0x4300, }, 
    370 }; 
    371  
    372 const MatrixMixChannel MixerChannels_Ultralite[] = { 
    373     {"Analog 1", MOTU_CTRL_STD_CHANNEL, 0x0000, }, 
    374     {"Analog 2", MOTU_CTRL_STD_CHANNEL, 0x0004, }, 
    375     {"Analog 3", MOTU_CTRL_STD_CHANNEL, 0x0008, }, 
    376     {"Analog 4", MOTU_CTRL_STD_CHANNEL, 0x000c, }, 
    377     {"Analog 5", MOTU_CTRL_STD_CHANNEL, 0x0010, }, 
    378     {"Analog 6", MOTU_CTRL_STD_CHANNEL, 0x0014, }, 
    379     {"Analog 7", MOTU_CTRL_STD_CHANNEL, 0x0018, }, 
    380     {"Analog 8", MOTU_CTRL_STD_CHANNEL, 0x001c, }, 
    381     {"AES/EBU 1", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 
    382     {"AES/EBU 2", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 
    383     {"SPDIF 1", MOTU_CTRL_STD_CHANNEL, 0x0020, }, 
    384     {"SPDIF 2", MOTU_CTRL_STD_CHANNEL, 0x0024, }, 
    385     {"ADAT 1", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 
    386     {"ADAT 2", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 
    387     {"ADAT 3", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 
    388     {"ADAT 4", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 
    389     {"ADAT 5", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 
    390     {"ADAT 6", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 
    391     {"ADAT 7", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 
    392     {"ADAT 8", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 
    393 }; 
    394  
    395 const MixerCtrl MixerCtrls_Ultralite[] = { 
    396     {"Mix1/Mix_", "Mix 1 ", "", MOTU_CTRL_STD_MIX, 0x0c20, }, 
    397     {"Mix2/Mix_", "Mix 2 ", "", MOTU_CTRL_STD_MIX, 0x0c24, }, 
    398     {"Mix3/Mix_", "Mix 3 ", "", MOTU_CTRL_STD_MIX, 0x0c28, }, 
    399     {"Mix4/Mix_", "Mix 4 ", "", MOTU_CTRL_STD_MIX, 0x0c2c, }, 
    400     {"Mainout_",  "MainOut ", "", MOTU_CTRL_MIX_FADER, 0x0c0c, }, 
    401     {"Phones_",   "Phones ",  "", MOTU_CTRL_MIX_FADER, 0x0c10, }, 
    402  
    403     /* For mic/line input controls, the "register" is the zero-based channel number */ 
    404     {"Control/Ana1_", "Analog 1 input ", "", MOTU_CTRL_ULTRALITE_INPUT_CTRLS, 0}, 
    405     {"Control/Ana2_", "Analog 2 input ", "", MOTU_CTRL_ULTRALITE_INPUT_CTRLS, 1}, 
    406     {"Control/Ana3_", "Analog 3 input ", "", MOTU_CTRL_ULTRALITE_INPUT_CTRLS, 2}, 
    407     {"Control/Ana4_", "Analog 4 input ", "", MOTU_CTRL_ULTRALITE_INPUT_CTRLS, 3}, 
    408     {"Control/Ana5_", "Analog 5 input ", "", MOTU_CTRL_ULTRALITE_INPUT_CTRLS, 4}, 
    409     {"Control/Ana6_", "Analog 6 input ", "", MOTU_CTRL_ULTRALITE_INPUT_CTRLS, 5}, 
    410     {"Control/Ana7_", "Analog 7 input ", "", MOTU_CTRL_ULTRALITE_INPUT_CTRLS, 6}, 
    411     {"Control/Ana8_", "Analog 8 input ", "", MOTU_CTRL_ULTRALITE_INPUT_CTRLS, 7}, 
    412     {"Control/Spdif1_", "SPDIF 1 input ", "", MOTU_CTRL_ULTRALITE_INPUT_CTRLS, 6}, 
    413     {"Control/Spdif2_", "SPDIF 2 input ", "", MOTU_CTRL_ULTRALITE_INPUT_CTRLS, 7}, 
    414  
    415     /* For phones source control, "register" is currently unused */ 
    416     {"Control/Phones_", "Phones source", "", MOTU_CTRL_PHONES_SRC, 0}, 
    417  
    418     /* For optical mode controls, the "register" is used to indicate direction */ 
    419     {"Control/OpticalIn_mode", "Optical input mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_IN}, 
    420     {"Control/OpticalOut_mode", "Optical output mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_OUT}, 
    421 }; 
    422  
    423 const MatrixMixBus MixerBuses_896HD[] = { 
    424     {"Mix 1", 0x4000, }, 
    425     {"Mix 2", 0x4100, }, 
    426     {"Mix 3", 0x4200, }, 
    427     {"Mix 4", 0x4300, }, 
    428 }; 
    429  
    430 const MatrixMixChannel MixerChannels_896HD[] = { 
    431     {"Analog 1", MOTU_CTRL_STD_CHANNEL, 0x0000, }, 
    432     {"Analog 2", MOTU_CTRL_STD_CHANNEL, 0x0004, }, 
    433     {"Analog 3", MOTU_CTRL_STD_CHANNEL, 0x0008, }, 
    434     {"Analog 4", MOTU_CTRL_STD_CHANNEL, 0x000c, }, 
    435     {"Analog 5", MOTU_CTRL_STD_CHANNEL, 0x0010, }, 
    436     {"Analog 6", MOTU_CTRL_STD_CHANNEL, 0x0014, }, 
    437     {"Analog 7", MOTU_CTRL_STD_CHANNEL, 0x0018, }, 
    438     {"Analog 8", MOTU_CTRL_STD_CHANNEL, 0x001c, }, 
    439     {"AES/EBU 1", MOTU_CTRL_STD_CHANNEL, 0x0020, }, 
    440     {"AES/EBU 2", MOTU_CTRL_STD_CHANNEL, 0x0024, }, 
    441     {"SPDIF 1", MOTU_CTRL_STD_CHANNEL, 0x0048, }, 
    442     {"SPDIF 2", MOTU_CTRL_STD_CHANNEL, 0x004c, }, 
    443     {"ADAT 1", MOTU_CTRL_STD_CHANNEL, 0x0028, }, 
    444     {"ADAT 2", MOTU_CTRL_STD_CHANNEL, 0x002c, }, 
    445     {"ADAT 3", MOTU_CTRL_STD_CHANNEL, 0x0030, }, 
    446     {"ADAT 4", MOTU_CTRL_STD_CHANNEL, 0x0034, }, 
    447     {"ADAT 5", MOTU_CTRL_STD_CHANNEL, 0x0038, }, 
    448     {"ADAT 6", MOTU_CTRL_STD_CHANNEL, 0x003c, }, 
    449     {"ADAT 7", MOTU_CTRL_STD_CHANNEL, 0x0040, }, 
    450     {"ADAT 8", MOTU_CTRL_STD_CHANNEL, 0x0044, }, 
    451 }; 
    452  
    453 const MixerCtrl MixerCtrls_896HD[] = { 
    454     {"Mix1/Mix_", "Mix 1 ", "", MOTU_CTRL_STD_MIX, 0x0c20, }, 
    455     {"Mix2/Mix_", "Mix 2 ", "", MOTU_CTRL_STD_MIX, 0x0c24, }, 
    456     {"Mix3/Mix_", "Mix 3 ", "", MOTU_CTRL_STD_MIX, 0x0c28, }, 
    457     {"Mix4/Mix_", "Mix 4 ", "", MOTU_CTRL_STD_MIX, 0x0c2c, }, 
    458     {"Mainout_",  "MainOut ", "", MOTU_CTRL_MIX_FADER, 0x0c0c, }, 
    459     {"Phones_",   "Phones ",  "", MOTU_CTRL_MIX_FADER, 0x0c10, }, 
    460  
    461     /* For phones source control, "register" is currently unused */ 
    462     {"Control/Phones_", "Phones source", "", MOTU_CTRL_PHONES_SRC, 0}, 
    463  
    464     /* For optical mode controls, the "register" is used to indicate direction */ 
    465     {"Control/OpticalIn_mode", "Optical input mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_IN}, 
    466     {"Control/OpticalOut_mode", "Optical output mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_OUT}, 
    467  
    468     /* For meter controls the "register" indicates which meter controls are available */ 
    469     {"Control/Meter_", "Meter ", "", MOTU_CTRL_METER, 
    470       MOTU_CTRL_METER_PEAKHOLD | MOTU_CTRL_METER_CLIPHOLD | MOTU_CTRL_METER_AESEBU_SRC |  
    471       MOTU_CTRL_METER_PROG_SRC}, 
    472 }; 
    473  
    474 const MatrixMixBus MixerBuses_828Mk2[] = { 
    475     {"Mix 1", 0x4000, }, 
    476     {"Mix 2", 0x4100, }, 
    477     {"Mix 3", 0x4200, }, 
    478     {"Mix 4", 0x4300, }, 
    479 }; 
    480  
    481 const MatrixMixChannel MixerChannels_828Mk2[] = { 
    482     {"Analog 1", MOTU_CTRL_STD_CHANNEL, 0x0000, }, 
    483     {"Analog 2", MOTU_CTRL_STD_CHANNEL, 0x0004, }, 
    484     {"Analog 3", MOTU_CTRL_STD_CHANNEL, 0x0008, }, 
    485     {"Analog 4", MOTU_CTRL_STD_CHANNEL, 0x000c, }, 
    486     {"Analog 5", MOTU_CTRL_STD_CHANNEL, 0x0010, }, 
    487     {"Analog 6", MOTU_CTRL_STD_CHANNEL, 0x0014, }, 
    488     {"Analog 7", MOTU_CTRL_STD_CHANNEL, 0x0018, }, 
    489     {"Analog 8", MOTU_CTRL_STD_CHANNEL, 0x001c, }, 
    490     {"Mic 1", MOTU_CTRL_STD_CHANNEL, 0x0020, }, 
    491     {"Mic 2", MOTU_CTRL_STD_CHANNEL, 0x0024, }, 
    492     {"SPDIF 1", MOTU_CTRL_STD_CHANNEL, 0x0028, }, 
    493     {"SPDIF 2", MOTU_CTRL_STD_CHANNEL, 0x002c, }, 
    494     {"ADAT 1", MOTU_CTRL_STD_CHANNEL, 0x0030, }, 
    495     {"ADAT 2", MOTU_CTRL_STD_CHANNEL, 0x0034, }, 
    496     {"ADAT 3", MOTU_CTRL_STD_CHANNEL, 0x0038, }, 
    497     {"ADAT 4", MOTU_CTRL_STD_CHANNEL, 0x003c, }, 
    498     {"ADAT 5", MOTU_CTRL_STD_CHANNEL, 0x0040, }, 
    499     {"ADAT 6", MOTU_CTRL_STD_CHANNEL, 0x0044, }, 
    500     {"ADAT 7", MOTU_CTRL_STD_CHANNEL, 0x0048, }, 
    501     {"ADAT 8", MOTU_CTRL_STD_CHANNEL, 0x004c, }, 
    502 }; 
    503  
    504 const MixerCtrl MixerCtrls_828Mk2[] = { 
    505     {"Mix1/Mix_", "Mix 1 ", "", MOTU_CTRL_STD_MIX, 0x0c20, }, 
    506     {"Mix2/Mix_", "Mix 2 ", "", MOTU_CTRL_STD_MIX, 0x0c24, }, 
    507     {"Mix3/Mix_", "Mix 3 ", "", MOTU_CTRL_STD_MIX, 0x0c28, }, 
    508     {"Mix4/Mix_", "Mix 4 ", "", MOTU_CTRL_STD_MIX, 0x0c2c, }, 
    509     {"Mainout_",  "MainOut ", "", MOTU_CTRL_MIX_FADER, 0x0c0c, }, 
    510     {"Phones_",   "Phones ",  "", MOTU_CTRL_MIX_FADER, 0x0c10, }, 
    511  
    512     /* For mic/line input controls, the "register" is the zero-based channel number */ 
    513     {"Control/Ana1_", "Analog 1 input ", "", MOTU_CTRL_TRAVELER_LINE_INPUT_CTRLS, 0}, 
    514     {"Control/Ana2_", "Analog 2 input ", "", MOTU_CTRL_TRAVELER_LINE_INPUT_CTRLS, 1}, 
    515     {"Control/Ana3_", "Analog 3 input ", "", MOTU_CTRL_TRAVELER_LINE_INPUT_CTRLS, 2}, 
    516     {"Control/Ana4_", "Analog 4 input ", "", MOTU_CTRL_TRAVELER_LINE_INPUT_CTRLS, 3}, 
    517     {"Control/Ana5_", "Analog 5 input ", "", MOTU_CTRL_TRAVELER_LINE_INPUT_CTRLS, 4}, 
    518     {"Control/Ana6_", "Analog 6 input ", "", MOTU_CTRL_TRAVELER_LINE_INPUT_CTRLS, 5}, 
    519     {"Control/Ana7_", "Analog 7 input ", "", MOTU_CTRL_TRAVELER_LINE_INPUT_CTRLS, 6}, 
    520     {"Control/Ana8_", "Analog 8 input ", "", MOTU_CTRL_TRAVELER_LINE_INPUT_CTRLS, 7}, 
    521  
    522     /* For phones source control, "register" is currently unused */ 
    523     {"Control/Phones_", "Phones source", "", MOTU_CTRL_PHONES_SRC, 0}, 
    524  
    525     /* For optical mode controls, the "register" is used to indicate direction */ 
    526     {"Control/OpticalIn_mode", "Optical input mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_IN}, 
    527     {"Control/OpticalOut_mode", "Optical output mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_OUT}, 
    528 }; 
    529  
    530 const MotuMixer Mixer_Traveler = MOTUMIXER( 
    531     MixerCtrls_Traveler, MixerBuses_Traveler, MixerChannels_Traveler); 
    532  
    533 const MotuMixer Mixer_Ultralite = MOTUMIXER( 
    534     MixerCtrls_Ultralite, MixerBuses_Ultralite, MixerChannels_Ultralite); 
    535  
    536 const MotuMixer Mixer_828Mk2 = MOTUMIXER( 
    537     MixerCtrls_828Mk2, MixerBuses_828Mk2, MixerChannels_828Mk2); 
    538  
    539 const MotuMixer Mixer_896HD = MOTUMIXER( 
    540     MixerCtrls_896HD, MixerBuses_896HD, MixerChannels_896HD); 
    541338 
    542339/* The order of DevicesProperty entries must match the numeric order of the 
     
    544341 */ 
    545342const DevicePropertyEntry DevicesProperty[] = { 
    546 //  { Ports_map,       N_ELEMENTS( Ports_map ),        MaxSR, MixerDescrPtr }, 
    547     { Ports_828MKII,   N_ELEMENTS( Ports_828MKII ),    96000, &Mixer_828Mk2, }, 
    548     { Ports_TRAVELER,  N_ELEMENTS( Ports_TRAVELER ),  192000, &Mixer_Traveler, }, 
    549     { Ports_ULTRALITE, N_ELEMENTS( Ports_ULTRALITE ),  96000, &Mixer_Ultralite, }, 
    550     { Ports_8PRE,      N_ELEMENTS( Ports_8PRE ),       96000 }, 
    551     { Ports_828MKI,    N_ELEMENTS( Ports_828MKI ),     48000 }, 
    552     { Ports_896HD,     N_ELEMENTS( Ports_896HD ),     192000, &Mixer_896HD, }, 
    553     { Ports_828mk3,    N_ELEMENTS( Ports_828mk3 ),    192000 }, 
     343//  { Ports_map,          N_ELEMENTS( Ports_map ),        MaxSR, MixerDescrPtr, Mark3MixerDescrPtr }, 
     344    { Ports_828MKII,      N_ELEMENTS( Ports_828MKII ),       96000, &Mixer_828Mk2, NULL, }, 
     345    { Ports_TRAVELER,     N_ELEMENTS( Ports_TRAVELER ),     192000, &Mixer_Traveler, NULL, }, 
     346    { Ports_ULTRALITE,    N_ELEMENTS( Ports_ULTRALITE ),     96000, &Mixer_Ultralite, NULL, }, 
     347    { Ports_8PRE,         N_ELEMENTS( Ports_8PRE ),          96000, &Mixer_8pre, NULL, }, 
     348    { Ports_828MKI,       N_ELEMENTS( Ports_828MKI ),        48000 }, 
     349    { Ports_896HD,        N_ELEMENTS( Ports_896HD ),        192000, &Mixer_896HD, NULL, }, 
     350    { Ports_828mk3,       N_ELEMENTS( Ports_828mk3 ),       192000 }, 
     351    { Ports_ULTRALITEmk3, N_ELEMENTS( Ports_ULTRALITEmk3 ), 192000 }, 
    554352}; 
    555353 
     
    584382 
    585383    destroyMixer(); 
    586 } 
    587  
    588 bool 
    589 MotuDevice::buildMixerAudioControls(void) { 
    590  
    591     bool result = true; 
    592     MotuMatrixMixer *fader_mmixer = NULL; 
    593     MotuMatrixMixer *pan_mmixer = NULL; 
    594     MotuMatrixMixer *solo_mmixer = NULL; 
    595     MotuMatrixMixer *mute_mmixer = NULL; 
    596     const struct MatrixMixBus *buses = NULL; 
    597     const struct MatrixMixChannel *channels = NULL; 
    598     unsigned int bus, ch, i; 
    599  
    600     if (DevicesProperty[m_motu_model-1].mixer == NULL) { 
    601         debugOutput(DEBUG_LEVEL_WARNING, "No mixer controls defined for model %d\n", m_motu_model); 
    602         result = false; 
    603     } else { 
    604         buses = DevicesProperty[m_motu_model-1].mixer->mixer_buses; 
    605         if (buses == NULL) { 
    606             debugOutput(DEBUG_LEVEL_WARNING, "No buses defined for model %d\n", m_motu_model); 
    607             result = false; 
    608         } 
    609         channels = DevicesProperty[m_motu_model-1].mixer->mixer_channels; 
    610         if (channels == NULL) { 
    611             debugOutput(DEBUG_LEVEL_WARNING, "No channels defined for model %d\n", m_motu_model); 
    612             result = false; 
    613         } 
    614     } 
    615     if (result == false) { 
    616         return true; 
    617     } 
    618  
    619     /* Create the top-level matrix mixers */ 
    620     fader_mmixer = new ChannelFaderMatrixMixer(*this, "fader"); 
    621     result &= m_MixerContainer->addElement(fader_mmixer); 
    622     pan_mmixer = new ChannelPanMatrixMixer(*this, "pan"); 
    623     result &= m_MixerContainer->addElement(pan_mmixer); 
    624     solo_mmixer = new ChannelBinSwMatrixMixer(*this, "solo",  
    625         MOTU_CTRL_MASK_SOLO_VALUE, MOTU_CTRL_MASK_SOLO_SETENABLE); 
    626     result &= m_MixerContainer->addElement(solo_mmixer); 
    627     mute_mmixer = new ChannelBinSwMatrixMixer(*this, "mute", 
    628         MOTU_CTRL_MASK_MUTE_VALUE, MOTU_CTRL_MASK_MUTE_SETENABLE); 
    629     result &= m_MixerContainer->addElement(mute_mmixer); 
    630  
    631     for (bus=0; bus<DevicesProperty[m_motu_model-1].mixer->n_mixer_buses; bus++) { 
    632         fader_mmixer->addRowInfo(buses[bus].name, 0, buses[bus].address); 
    633         pan_mmixer->addRowInfo(buses[bus].name, 0, buses[bus].address); 
    634         solo_mmixer->addRowInfo(buses[bus].name, 0, buses[bus].address); 
    635         mute_mmixer->addRowInfo(buses[bus].name, 0, buses[bus].address); 
    636     } 
    637  
    638     for (ch=0; ch<DevicesProperty[m_motu_model-1].mixer->n_mixer_channels; ch++) { 
    639         uint32_t flags = channels[ch].flags; 
    640         if (flags & MOTU_CTRL_CHANNEL_FADER) 
    641             fader_mmixer->addColInfo(channels[ch].name, 0, channels[ch].addr_ofs); 
    642         if (flags & MOTU_CTRL_CHANNEL_PAN) 
    643             pan_mmixer->addColInfo(channels[ch].name, 0, channels[ch].addr_ofs); 
    644         if (flags & MOTU_CTRL_CHANNEL_SOLO) 
    645             solo_mmixer->addColInfo(channels[ch].name, 0, channels[ch].addr_ofs); 
    646         if (flags & MOTU_CTRL_CHANNEL_MUTE) 
    647             mute_mmixer->addColInfo(channels[ch].name, 0, channels[ch].addr_ofs); 
    648         flags &= ~(MOTU_CTRL_CHANNEL_FADER|MOTU_CTRL_CHANNEL_PAN|MOTU_CTRL_CHANNEL_SOLO|MOTU_CTRL_CHANNEL_MUTE); 
    649         if (flags) { 
    650             debugOutput(DEBUG_LEVEL_WARNING, "Control %s: unknown flag bits 0x%08x\n", channels[ch].name, flags); 
    651         } 
    652     } 
    653  
    654     // Single non-matrixed mixer controls get added here.  Channel controls are supported 
    655     // here, but usually these will be a part of a matrix mixer. 
    656     for (i=0; i<DevicesProperty[m_motu_model-1].mixer->n_mixer_ctrls; i++) { 
    657         const struct MixerCtrl *ctrl = &DevicesProperty[m_motu_model-1].mixer->mixer_ctrl[i]; 
    658         unsigned int type; 
    659         char name[100]; 
    660         char label[100]; 
    661  
    662         if (ctrl == NULL) { 
    663             debugOutput(DEBUG_LEVEL_WARNING, "NULL control at index %d for model %d\n", i, m_motu_model); 
    664             continue; 
    665         } 
    666         type = ctrl->type; 
    667         if (type & MOTU_CTRL_CHANNEL_FADER) { 
    668             snprintf(name, 100, "%s%s", ctrl->name, "fader"); 
    669             snprintf(label,100, "%s%s", ctrl->label,"fader"); 
    670             result &= m_MixerContainer->addElement( 
    671                 new ChannelFader(*this, ctrl->dev_register, name, label, ctrl->desc)); 
    672             type &= ~MOTU_CTRL_CHANNEL_FADER; 
    673         } 
    674         if (type & MOTU_CTRL_CHANNEL_PAN) { 
    675             snprintf(name, 100, "%s%s", ctrl->name, "pan"); 
    676             snprintf(label,100, "%s%s", ctrl->label,"pan"); 
    677             result &= m_MixerContainer->addElement( 
    678                 new ChannelPan(*this,  
    679                     ctrl->dev_register, 
    680                     name, label, 
    681                     ctrl->desc)); 
    682             type &= ~MOTU_CTRL_CHANNEL_PAN; 
    683         } 
    684         if (type & MOTU_CTRL_CHANNEL_MUTE) { 
    685             snprintf(name, 100, "%s%s", ctrl->name, "mute"); 
    686             snprintf(label,100, "%s%s", ctrl->label,"mute"); 
    687             result &= m_MixerContainer->addElement( 
    688                 new MotuBinarySwitch(*this, ctrl->dev_register, 
    689                     MOTU_CTRL_MASK_MUTE_VALUE, MOTU_CTRL_MASK_MUTE_SETENABLE, 
    690                     name, label, ctrl->desc)); 
    691             type &= ~MOTU_CTRL_CHANNEL_MUTE; 
    692         } 
    693         if (type & MOTU_CTRL_CHANNEL_SOLO) { 
    694             snprintf(name, 100, "%s%s", ctrl->name, "solo"); 
    695             snprintf(label,100, "%s%s", ctrl->label,"solo"); 
    696             result &= m_MixerContainer->addElement( 
    697                 new MotuBinarySwitch(*this, ctrl->dev_register, 
    698                     MOTU_CTRL_MASK_SOLO_VALUE, MOTU_CTRL_MASK_SOLO_SETENABLE, 
    699                     name, label, ctrl->desc)); 
    700             type &= ~MOTU_CTRL_CHANNEL_SOLO; 
    701         } 
    702  
    703         if (type & MOTU_CTRL_MIX_FADER) { 
    704             snprintf(name, 100, "%s%s", ctrl->name, "fader"); 
    705             snprintf(label,100, "%s%s", ctrl->label,"fader"); 
    706             result &= m_MixerContainer->addElement( 
    707                 new MixFader(*this, ctrl->dev_register, name, label, ctrl->desc)); 
    708             type &= ~MOTU_CTRL_MIX_FADER; 
    709         } 
    710         if (type & MOTU_CTRL_MIX_MUTE) { 
    711             snprintf(name, 100, "%s%s", ctrl->name, "mute"); 
    712             snprintf(label,100, "%s%s", ctrl->label,"mute"); 
    713             result &= m_MixerContainer->addElement( 
    714                 new MixMute(*this, ctrl->dev_register, name, label, ctrl->desc)); 
    715             type &= ~MOTU_CTRL_MIX_MUTE; 
    716         } 
    717         if (type & MOTU_CTRL_MIX_DEST) { 
    718             snprintf(name, 100, "%s%s", ctrl->name, "dest"); 
    719             snprintf(label,100, "%s%s", ctrl->label,"dest"); 
    720             result &= m_MixerContainer->addElement( 
    721                 new MixDest(*this, ctrl->dev_register, name, label, ctrl->desc)); 
    722             type &= ~MOTU_CTRL_MIX_DEST; 
    723         } 
    724  
    725         if (type & MOTU_CTRL_INPUT_UL_GAIN) { 
    726             snprintf(name, 100, "%s%s", ctrl->name, "trimgain"); 
    727             snprintf(label,100, "%s%s", ctrl->label,"trimgain"); 
    728             result &= m_MixerContainer->addElement( 
    729                 new InputGainPadInv(*this, ctrl->dev_register, MOTU_CTRL_MODE_UL_GAIN, 
    730                     name, label, ctrl->desc)); 
    731             type &= ~MOTU_CTRL_INPUT_UL_GAIN; 
    732         } 
    733         if (type & MOTU_CTRL_INPUT_PHASE_INV) { 
    734             snprintf(name, 100, "%s%s", ctrl->name, "invert"); 
    735             snprintf(label,100, "%s%s", ctrl->label,"invert"); 
    736             result &= m_MixerContainer->addElement( 
    737                 new InputGainPadInv(*this, ctrl->dev_register, MOTU_CTRL_MODE_PHASE_INV, 
    738                     name, label, ctrl->desc)); 
    739             type &= ~MOTU_CTRL_INPUT_PHASE_INV; 
    740         } 
    741         if (type & MOTU_CTRL_INPUT_TRIMGAIN) { 
    742             snprintf(name, 100, "%s%s", ctrl->name, "trimgain"); 
    743             snprintf(label,100, "%s%s", ctrl->label,"trimgain"); 
    744             result &= m_MixerContainer->addElement( 
    745                 new InputGainPadInv(*this, ctrl->dev_register, MOTU_CTRL_MODE_TRIMGAIN, 
    746                     name, label, ctrl->desc)); 
    747             type &= ~MOTU_CTRL_INPUT_TRIMGAIN; 
    748         } 
    749         if (type & MOTU_CTRL_INPUT_PAD) { 
    750             snprintf(name, 100, "%s%s", ctrl->name, "pad"); 
    751             snprintf(label,100, "%s%s", ctrl->label,"pad"); 
    752             result &= m_MixerContainer->addElement( 
    753                 new InputGainPadInv(*this, ctrl->dev_register, MOTU_CTRL_MODE_PAD, 
    754                     name, label, ctrl->desc)); 
    755             type &= ~MOTU_CTRL_INPUT_PAD; 
    756         } 
    757  
    758         if (type & MOTU_CTRL_INPUT_LEVEL) { 
    759             snprintf(name, 100, "%s%s", ctrl->name, "level"); 
    760             snprintf(label,100, "%s%s", ctrl->label,"level"); 
    761             result &= m_MixerContainer->addElement( 
    762                 new MotuBinarySwitch(*this, MOTU_REG_INPUT_LEVEL, 
    763                     1<<ctrl->dev_register, 0, name, label, ctrl->desc)); 
    764             type &= ~MOTU_CTRL_INPUT_LEVEL; 
    765         } 
    766         if (type & MOTU_CTRL_INPUT_BOOST) { 
    767             snprintf(name, 100, "%s%s", ctrl->name, "boost"); 
    768             snprintf(label,100, "%s%s", ctrl->label,"boost"); 
    769             result &= m_MixerContainer->addElement( 
    770                 new MotuBinarySwitch(*this, MOTU_REG_INPUT_BOOST, 
    771                     1<<ctrl->dev_register, 0, name, label, ctrl->desc)); 
    772             type &= ~MOTU_CTRL_INPUT_BOOST; 
    773         } 
    774         if (type & MOTU_CTRL_PHONES_SRC) { 
    775             snprintf(name, 100, "%s%s", ctrl->name, "src"); 
    776             snprintf(label,100, "%s%s", ctrl->label,"src"); 
    777             result &= m_MixerContainer->addElement( 
    778                 new PhonesSrc(*this, name, label, ctrl->desc)); 
    779             type &= ~MOTU_CTRL_PHONES_SRC; 
    780         } 
    781         if (type & MOTU_CTRL_OPTICAL_MODE) { 
    782             result &= m_MixerContainer->addElement( 
    783                 new OpticalMode(*this, ctrl->dev_register, 
    784                     ctrl->name, ctrl->label, ctrl->desc)); 
    785             type &= ~MOTU_CTRL_OPTICAL_MODE; 
    786         } 
    787         if (type & MOTU_CTRL_METER) { 
    788             if (ctrl->dev_register & MOTU_CTRL_METER_PEAKHOLD) { 
    789                 snprintf(name, 100, "%s%s", ctrl->name, "peakhold_time"); 
    790                 snprintf(label,100, "%s%s", ctrl->label,"peakhold time"); 
    791                 result &= m_MixerContainer->addElement( 
    792                     new MeterControl(*this, MOTU_METER_PEAKHOLD_MASK, 
    793                         MOTU_METER_PEAKHOLD_SHIFT, name, label, ctrl->desc)); 
    794             } 
    795             if (ctrl->dev_register & MOTU_CTRL_METER_CLIPHOLD) { 
    796                 snprintf(name, 100, "%s%s", ctrl->name, "cliphold_time"); 
    797                 snprintf(label,100, "%s%s", ctrl->label,"cliphold time"); 
    798                 result &= m_MixerContainer->addElement( 
    799                     new MeterControl(*this, MOTU_METER_CLIPHOLD_MASK, 
    800                         MOTU_METER_CLIPHOLD_SHIFT, name, label, ctrl->desc)); 
    801             } 
    802             if (ctrl->dev_register & MOTU_CTRL_METER_AESEBU_SRC) { 
    803                 snprintf(name, 100, "%s%s", ctrl->name, "aesebu_src"); 
    804                 snprintf(label,100, "%s%s", ctrl->label,"AESEBU source"); 
    805                 result &= m_MixerContainer->addElement( 
    806                     new MeterControl(*this, MOTU_METER_AESEBU_SRC_MASK, 
    807                         MOTU_METER_AESEBU_SRC_SHIFT, name, label, ctrl->desc)); 
    808             } 
    809             if (ctrl->dev_register & MOTU_CTRL_METER_PROG_SRC) { 
    810                 snprintf(name, 100, "%s%s", ctrl->name, "src"); 
    811                 snprintf(label,100, "%s%s", ctrl->label,"source"); 
    812                 result &= m_MixerContainer->addElement( 
    813                     new MeterControl(*this, MOTU_METER_PROG_SRC_MASK, 
    814                         MOTU_METER_PROG_SRC_SHIFT, name, label, ctrl->desc)); 
    815             } 
    816             type &= ~MOTU_CTRL_METER; 
    817         } 
    818  
    819         if (type) { 
    820             debugOutput(DEBUG_LEVEL_WARNING, "Unknown mixer control type flag bits 0x%08x\n", ctrl->type); 
    821         } 
    822     } 
    823     return result; 
    824 } 
    825  
    826 bool 
    827 MotuDevice::buildMixer() { 
    828     bool result = true; 
    829  
    830     destroyMixer(); 
    831     debugOutput(DEBUG_LEVEL_VERBOSE, "Building a MOTU mixer...\n"); 
    832  
    833     // create the mixer object container 
    834     m_MixerContainer = new Control::Container(this, "Mixer"); 
    835     if (!m_MixerContainer) { 
    836         debugError("Could not create mixer container...\n"); 
    837         return false; 
    838     } 
    839  
    840     // Create and populate the top-level matrix mixers 
    841     result = buildMixerAudioControls(); 
    842  
    843     /* Now add some general device information controls.  These may yet 
    844      * become device-specific if it turns out to be easier that way. 
    845      */ 
    846     result &= m_MixerContainer->addElement( 
    847         new InfoElement(*this, MOTU_INFO_MODEL, "Info/Model", "Model identifier", "")); 
    848     result &= m_MixerContainer->addElement( 
    849         new InfoElement(*this, MOTU_INFO_IS_STREAMING, "Info/IsStreaming", "Is device streaming", "")); 
    850     result &= m_MixerContainer->addElement( 
    851         new InfoElement(*this, MOTU_INFO_SAMPLE_RATE, "Info/SampleRate", "Device sample rate", "")); 
    852  
    853     if (!addElement(m_MixerContainer)) { 
    854         debugWarning("Could not register mixer to device\n"); 
    855         // clean up 
    856         destroyMixer(); 
    857         return false; 
    858     } 
    859  
    860     // Special controls 
    861     m_ControlContainer = new Control::Container(this, "Control"); 
    862     if (!m_ControlContainer) { 
    863         debugError("Could not create control container...\n"); 
    864         destroyMixer(); 
    865         return false; 
    866     } 
    867  
    868     // Special controls get added here 
    869  
    870     if (!result) { 
    871         debugWarning("One or more device control elements could not be created\n"); 
    872         // clean up those that couldn't be created 
    873         destroyMixer(); 
    874         return false; 
    875     } 
    876     if (!addElement(m_ControlContainer)) { 
    877         debugWarning("Could not register controls to device\n"); 
    878         // clean up 
    879         destroyMixer(); 
    880         return false; 
    881     } 
    882  
    883     return true; 
    884 } 
    885  
    886  
    887 bool 
    888 MotuDevice::destroyMixer() { 
    889     bool ret = true; 
    890     debugOutput(DEBUG_LEVEL_VERBOSE, "destroy mixer...\n"); 
    891  
    892     if (m_MixerContainer == NULL) { 
    893         debugOutput(DEBUG_LEVEL_VERBOSE, "no mixer to destroy...\n"); 
    894     } else 
    895     if (!deleteElement(m_MixerContainer)) { 
    896         debugError("Mixer present but not registered to the avdevice\n"); 
    897         ret = false; 
    898     } else { 
    899         // remove and delete (as in free) child control elements 
    900         m_MixerContainer->clearElements(true); 
    901         delete m_MixerContainer; 
    902         m_MixerContainer = NULL; 
    903     } 
    904  
    905     // remove control container 
    906     if (m_ControlContainer == NULL) { 
    907         debugOutput(DEBUG_LEVEL_VERBOSE, "no controls to destroy...\n"); 
    908     } else 
    909     if (!deleteElement(m_ControlContainer)) { 
    910         debugError("Controls present but not registered to the avdevice\n"); 
    911         ret = false; 
    912     } else { 
    913         // remove and delete (as in free) child control elements 
    914         m_ControlContainer->clearElements(true); 
    915         delete m_ControlContainer; 
    916         m_ControlContainer = NULL; 
    917     } 
    918     return ret; 
    919384} 
    920385 
     
    1010475 * Retrieve the current sample rate from the MOTU device. 
    1011476 */ 
    1012     quadlet_t q = ReadRegister(MOTU_REG_CLK_CTRL)
     477    quadlet_t q = 0
    1013478    int rate = 0; 
    1014479 
     480    if (m_motu_model == MOTU_MODEL_828MkI) { 
     481        /* The original MOTU interfaces did things rather differently */ 
     482        q = ReadRegister(MOTU_G1_REG_CONFIG); 
     483        if ((q & MOTU_G1_RATE_MASK) == MOTU_G1_RATE_44100) 
     484            rate = 44100; 
     485        else 
     486            rate = 48000; 
     487        return rate; 
     488    } 
     489 
     490    q = ReadRegister(MOTU_REG_CLK_CTRL); 
    1015491    switch (q & MOTU_RATE_BASE_MASK) { 
    1016492        case MOTU_RATE_BASE_44100: 
     
    1057533    if ( samplingFrequency > DevicesProperty[m_motu_model-1].MaxSampleRate ) 
    1058534       return false;  
     535 
     536    /* The original MOTU devices do things differently; they are much 
     537     * simpler than the later interfaces. 
     538     */ 
     539    if (m_motu_model == MOTU_MODEL_828MkI) { 
     540        reg = ReadRegister(MOTU_G1_REG_CONFIG); 
     541        if (samplingFrequency > 0) { 
     542            reg &= ~MOTU_G1_RATE_MASK; 
     543            switch (samplingFrequency) { 
     544                case 44100: 
     545                    reg |= MOTU_G1_RATE_44100; 
     546                    break; 
     547                case 48000: 
     548                    reg |= MOTU_G1_RATE_48000; 
     549                default: 
     550                    // Unsupported rate 
     551                    return false; 
     552            } 
     553        } 
     554        if (clock_source != MOTU_CLKSRC_UNCHANGED) { 
     555            switch (clock_source) { 
     556                case MOTU_CLKSRC_INTERNAL: 
     557                    clock_source = MOTU_G1_CLKSRC_INTERNAL; break; 
     558                case MOTU_CLKSRC_SPDIF_TOSLINK: 
     559                    clock_source = MOTU_G1_CLKSRC_SPDIF; break; 
     560                case MOTU_CLKSRC_ADAT_9PIN: 
     561                    clock_source = MOTU_G1_CLKSRC_ADAT_9PIN; break; 
     562                default: 
     563                    // Unsupported clock source 
     564                    return false; 
     565            } 
     566            reg &= ~MOTU_G1_CLKSRC_MASK; 
     567            reg |= clock_source; 
     568        } 
     569        if (WriteRegister(MOTU_G1_REG_CONFIG, reg) != 0) 
     570            return false; 
     571        return true; 
     572    } 
     573 
     574    /* The rest of this function deals with later generation devices */ 
    1059575 
    1060576    reg = ReadRegister(MOTU_REG_CLK_CTRL); 
     
    1220736MotuDevice::clockIdToClockSource(unsigned int id) { 
    1221737    ClockSource s; 
     738    bool g1_model = (m_motu_model == MOTU_MODEL_828MkI); 
    1222739    s.id = id; 
    1223740 
     
    1235752            s.type = eCT_ADAT; 
    1236753            s.description = "ADAT optical"; 
     754            s.valid = s.active = s.locked = !g1_model; 
    1237755            break; 
    1238756        case MOTU_CLKSRC_SPDIF_TOSLINK: 
     
    1252770            s.type = eCT_WordClock; 
    1253771            s.description = "Wordclock"; 
     772            s.valid = s.active = s.locked = !g1_model; 
    1254773            break; 
    1255774        case MOTU_CLKSRC_ADAT_9PIN: 
     
    1260779            s.type = eCT_AES; 
    1261780            s.description = "AES/EBU"; 
     781            s.valid = s.active = s.locked = !g1_model; 
    1262782            break; 
    1263783        default: 
     
    15631083quadlet_t isoctrl = ReadRegister(MOTU_REG_ISOCTRL); 
    15641084 
     1085    if (m_motu_model == MOTU_MODEL_828MkI) { 
     1086        // The 828MkI device does this differently. 
     1087        // To be implemented 
     1088        return false; 
     1089    } 
     1090 
    15651091    // NOTE: this assumes that you have two streams 
    15661092    switch (i) { 
     
    16141140    // TODO: connection management: break connection 
    16151141    // cfr the start function 
     1142 
     1143    if (m_motu_model == MOTU_MODEL_828MkI) { 
     1144        // The 828MkI device does this differently. 
     1145        // To be implemented 
     1146        return false; 
     1147    } 
    16161148 
    16171149    // NOTE: this assumes that you have two streams 
     
    16501182 
    16511183unsigned int MotuDevice::getOpticalMode(unsigned int dir) { 
    1652     unsigned int reg = ReadRegister(MOTU_REG_ROUTE_PORT_CONF); 
    1653  
    1654 debugOutput(DEBUG_LEVEL_VERBOSE, "optical mode: %x %x %x %x\n",dir, reg, reg & MOTU_OPTICAL_IN_MODE_MASK, 
    1655 reg & MOTU_OPTICAL_OUT_MODE_MASK); 
     1184    unsigned int reg; 
     1185 
     1186    if (m_motu_model == MOTU_MODEL_828MkI) { 
     1187        // The early devices used a different register layout.   
     1188        unsigned int mask, shift; 
     1189        reg = ReadRegister(MOTU_G1_REG_CONFIG); 
     1190        mask = (dir==MOTU_DIR_IN)?MOTU_G1_OPT_IN_MODE_MASK:MOTU_G1_OPT_OUT_MODE_MASK; 
     1191        shift = (dir==MOTU_DIR_IN)?MOTU_G1_OPT_IN_MODE_BIT0:MOTU_G1_OPT_OUT_MODE_BIT0; 
     1192        switch (reg & mask) { 
     1193            case MOTU_G1_OPTICAL_OFF: return MOTU_OPTICAL_MODE_OFF; 
     1194            case MOTU_G1_OPTICAL_TOSLINK: return MOTU_OPTICAL_MODE_TOSLINK; 
     1195            // MOTU_G1_OPTICAL_OFF and MOTU_G1_OPTICAL_ADAT seem to be 
     1196            // identical, so currently we don't know how to differentiate 
     1197            // these two modes. 
     1198            // case MOTU_G1_OPTICAL_ADAT: return MOTU_OPTICAL_MODE_ADAT; 
     1199        } 
     1200        return 0; 
     1201    } 
     1202 
     1203    reg = ReadRegister(MOTU_REG_ROUTE_PORT_CONF); 
    16561204 
    16571205    if (dir == MOTU_DIR_IN) 
     
    16621210 
    16631211signed int MotuDevice::setOpticalMode(unsigned int dir, unsigned int mode) { 
    1664     unsigned int reg = ReadRegister(MOTU_REG_ROUTE_PORT_CONF)
     1212    unsigned int reg
    16651213    unsigned int opt_ctrl = 0x0000002; 
    16661214 
     
    16701218    if (m_motu_model==MOTU_MODEL_896HD && mode==MOTU_OPTICAL_MODE_TOSLINK) 
    16711219        return -1; 
     1220 
     1221    if (m_motu_model == MOTU_MODEL_828MkI) { 
     1222        // The earlier MOTUs handle this differently. 
     1223        unsigned int mask, shift, g1mode = 0; 
     1224        reg = ReadRegister(MOTU_G1_REG_CONFIG); 
     1225        mask = (dir==MOTU_DIR_IN)?MOTU_G1_OPT_IN_MODE_MASK:MOTU_G1_OPT_OUT_MODE_MASK; 
     1226        shift = (dir==MOTU_DIR_IN)?MOTU_G1_OPT_IN_MODE_BIT0:MOTU_G1_OPT_OUT_MODE_BIT0; 
     1227        switch (mode) { 
     1228            case MOTU_OPTICAL_MODE_OFF: g1mode = MOTU_G1_OPTICAL_OFF; break; 
     1229            case MOTU_OPTICAL_MODE_ADAT: g1mode = MOTU_G1_OPTICAL_ADAT; break; 
     1230            // See comment in getOpticalMode() about mode ambiguity 
     1231            // case MOTU_OPTICAL_MODE_TOSLINK: g1mode = MOTU_G1_OPTICAL_TOSLINK; break; 
     1232        } 
     1233        reg = (reg & ~mask) | (g1mode << shift); 
     1234        return WriteRegister(MOTU_G1_REG_CONFIG, reg); 
     1235    } 
     1236 
     1237    reg = ReadRegister(MOTU_REG_ROUTE_PORT_CONF); 
    16721238 
    16731239    // Set up the optical control register value according to the current 
  • trunk/libffado/src/motu/motu_avdevice.h

    r1531 r1763  
    3535 
    3636#include "motu_controls.h" 
     37#include "motu_mark3_controls.h" 
    3738 
    3839#define MOTU_BASE_ADDR               0xfffff0000000ULL 
     
    8889#define MOTU_REG_INPUT_GAIN_PHINV1 0x0c74 
    8990#define MOTU_REG_INPUT_GAIN_PHINV2 0x0c78 
     91 
     92/* Device register definitions for the earliest generation devices */ 
     93#define MOTU_G1_REG_CONFIG         0x0b00 
     94#define MOTU_G1_REG_ISOCTRL        0x0b10 
     95 
     96/* There's an unknown subtlety regarding the optical mode of the "generation 
     97 * 1" devices such as the 828Mk1.  It seems that the same configuration 
     98 * register setting is used for "off" and "adat" modes.  There must be more 
     99 * to this though because the number of audio channels sent presumedly 
     100 * changes when adat mode is selected; there must be some way that the 
     101 * device deduces the mode. 
     102 */ 
     103#define MOTU_G1_OPT_IN_MODE_MASK   0x8000 
     104#define MOTU_G1_OPT_IN_MODE_BIT0       15 
     105#define MOTU_G1_OPT_OUT_MODE_MASK  0x4000 
     106#define MOTU_G1_OPT_OUT_MODE_BIT0      14 
     107#define MOTU_G1_OPTICAL_OFF        0x0000 
     108#define MOTU_G1_OPTICAL_TOSLINK    0x0001 
     109#define MOTU_G1_OPTICAL_ADAT       0x0000 
     110 
     111#define MOTU_G1_RATE_MASK          0x0004 
     112#define MOTU_G1_RATE_44100         0x0000 
     113#define MOTU_G1_RATE_48000         0x0004 
     114 
     115#define MOTU_G1_CLKSRC_MASK        0x0003 
     116#define MOTU_G1_CLKSRC_INTERNAL    0x0000 
     117#define MOTU_G1_CLKSRC_ADAT_9PIN   0x0001 
     118#define MOTU_G1_CLKSRC_SPDIF       0x0002 
     119#define MOTU_G1_CLKSRC_UNCHANGED   MOTU_CLKSRC_UNCHANGED 
     120 
     121#define MOTU_G1_MONIN_MASK         0x3f00 
     122#define MOTU_G1_MONIN_L_SRC_MASK   0x0600 
     123#define MOTU_G1_MONIN_R_SRC_MASK   0x3000 
     124#define MOTU_G1_MONIN_L_MUTE_MASK  0x0100  // Yes, the sense of these 2 bits 
     125#define MOTU_G1_MONIN_R_EN_MASK    0x0800  //   really are reversed 
     126#define MOTU_G1_MONIN_L_MUTE       0x0100 
     127#define MOTU_G1_MONIN_L_ENABLE     0x0000 
     128#define MOTU_G1_MONIN_R_MUTE       0x0000 
     129#define MOTU_G1_MONIN_R_ENABLE     0x0800 
     130#define MOTU_G1_MONIN_L_CH1        0x0000 
     131#define MOTU_G1_MONIN_L_CH3        0x0020 
     132#define MOTU_G1_MONIN_L_CH5        0x0040 
     133#define MOTU_G1_MONIN_L_CH7        0x0060 
     134#define MOTU_G1_MONIN_R_CH2        0x0000 
     135#define MOTU_G1_MONIN_R_CH4        0x1000 
     136#define MOTU_G1_MONIN_R_CH6        0x2000 
     137#define MOTU_G1_MONIN_R_CH8        0x3000 
     138 
     139/* Mark3 device registers - these don't have MOTU_BASE_ADDR as the base 
     140 * address so for now we'll define them as absolute addresses. 
     141 */ 
     142#define MOTU_MARK3_REG_MIXER     0xffff00010000LL 
    90143 
    91144/* Port Active Flags (ports declaration) */ 
     
    122175 
    123176enum EMotuModel { 
    124     MOTU_MODEL_NONE     = 0x0000, 
    125     MOTU_MODEL_828mkII  = 0x0001, 
    126     MOTU_MODEL_TRAVELER = 0x0002, 
    127     MOTU_MODEL_ULTRALITE= 0x0003, 
    128     MOTU_MODEL_8PRE     = 0x0004, 
    129     MOTU_MODEL_828MkI   = 0x0005, 
    130     MOTU_MODEL_896HD    = 0x0006, 
    131     MOTU_MODEL_828mk3   = 0x0007, 
     177    MOTU_MODEL_NONE         = 0x0000, 
     178    MOTU_MODEL_828mkII      = 0x0001, 
     179    MOTU_MODEL_TRAVELER     = 0x0002, 
     180    MOTU_MODEL_ULTRALITE    = 0x0003, 
     181    MOTU_MODEL_8PRE         = 0x0004, 
     182    MOTU_MODEL_828MkI       = 0x0005, 
     183    MOTU_MODEL_896HD        = 0x0006, 
     184    MOTU_MODEL_828mk3       = 0x0007, 
     185    MOTU_MODEL_ULTRALITEmk3 = 0x0008, 
    132186}; 
    133187 
     
    148202}; 
    149203 
     204// Structures used for pre-Mark3 device mixer definitions 
    150205struct MixerCtrl { 
    151206    const char *name, *label, *desc; 
     
    153208    unsigned int dev_register; 
    154209}; 
    155  
    156210struct MatrixMixBus { 
    157211    const char *name; 
    158212    unsigned int address; 
    159213}; 
    160  
    161214struct MatrixMixChannel { 
    162215    const char *name; 
     
    164217    unsigned int addr_ofs; 
    165218}; 
    166  
    167219struct MotuMixer { 
    168220    const MixerCtrl *mixer_ctrl; 
     
    174226}; 
    175227 
     228// Structures used for devices which use the "Mark3" mixer protocol 
     229struct MotuMark3Mixer { 
     230}; 
     231 
    176232struct DevicePropertyEntry { 
    177233    const PortEntry* port_entry; 
    178234    unsigned int n_port_entries; 
    179235    signed int MaxSampleRate; 
     236    // A device will set at most one of the *mixer fields 
    180237    const struct MotuMixer *mixer; 
     238    const struct MotuMark3Mixer *m3mixer; 
    181239    // Others features can be added here like MIDI port presence. 
    182240}; 
     241 
     242extern const DevicePropertyEntry DevicesProperty[]; 
    183243 
    184244/* Macro to calculate the size of an array */ 
     
    244304private: 
    245305    bool buildMixerAudioControls(void); 
     306    bool buildMark3MixerAudioControls(void); 
    246307    bool addPort(Streaming::StreamProcessor *s_processor, 
    247308        char *name, 
  • trunk/libffado/src/motu/motu_controls.cpp

    r1531 r1763  
    301301    if (v > 0x80) 
    302302      v = 0x80; 
    303     debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelFader setValue for row %d col %d to %lf (%ld)\n", 
     303    debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelFader setValue for row %d col %d to %lf (%d)\n", 
    304304      row, col, val, v); 
    305305    reg = getCellRegister(row,col); 
     
    331331    val = m_parent.ReadRegister(reg) & 0xff; 
    332332 
    333     debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelFader getValue for row %d col %d = %lu\n", 
     333    debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelFader getValue for row %d col %d = %u\n", 
    334334      row, col, val); 
    335335    return val; 
     
    353353      v = 0x80; 
    354354 
    355     debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelPan setValue for row %d col %d to %lf (%ld)\n", 
     355    debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelPan setValue for row %d col %d to %lf (%d)\n", 
    356356      row, col, val, v); 
    357357    reg = getCellRegister(row,col); 
     
    387387    val = ((val >> 8) & 0xff) - 0x40; 
    388388 
    389     debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelPan getValue for row %d col %d = %lu\n", 
     389    debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelPan getValue for row %d col %d = %u\n", 
    390390      row, col, val); 
    391391    return val; 
     
    414414    uint32_t v, reg; 
    415415 
    416     debugOutput(DEBUG_LEVEL_VERBOSE, "BinSw setValue for row %d col %d to %lf (%ld)\n", 
     416    debugOutput(DEBUG_LEVEL_VERBOSE, "BinSw setValue for row %d col %d to %lf (%d)\n", 
    417417      row, col, val, val==0?0:1); 
    418418    reg = getCellRegister(row,col); 
     
    460460    val = (val & m_value_mask) != 0; 
    461461 
    462     debugOutput(DEBUG_LEVEL_VERBOSE, "BinSw getValue for row %d col %d = %lu\n", 
     462    debugOutput(DEBUG_LEVEL_VERBOSE, "BinSw getValue for row %d col %d = %u\n", 
    463463      row, col, val); 
    464464    return val; 
  • trunk/libffado/src/motu/motu_controls.h

    r1742 r1763  
    2323 * 
    2424 */ 
     25 
     26/* DBus controls used with devices which utilise a pre-Mark3 mixer interface */ 
    2527 
    2628#include "debugmodule/debugmodule.h" 
  • trunk/libffado/src/motu/motu_mixerdefs.cpp

    r1579 r1763  
    254254}; 
    255255 
     256const MatrixMixBus MixerBuses_8pre[] = { 
     257    {"Mix 1", 0x4000, }, 
     258    {"Mix 2", 0x4100, }, 
     259    {"Mix 3", 0x4200, }, 
     260    {"Mix 4", 0x4300, }, 
     261}; 
     262 
     263const MatrixMixChannel MixerChannels_8pre[] = { 
     264    {"Analog 1", MOTU_CTRL_STD_CHANNEL, 0x0000, }, 
     265    {"Analog 2", MOTU_CTRL_STD_CHANNEL, 0x0004, }, 
     266    {"Analog 3", MOTU_CTRL_STD_CHANNEL, 0x0008, }, 
     267    {"Analog 4", MOTU_CTRL_STD_CHANNEL, 0x000c, }, 
     268    {"Analog 5", MOTU_CTRL_STD_CHANNEL, 0x0010, }, 
     269    {"Analog 6", MOTU_CTRL_STD_CHANNEL, 0x0014, }, 
     270    {"Analog 7", MOTU_CTRL_STD_CHANNEL, 0x0018, }, 
     271    {"Analog 8", MOTU_CTRL_STD_CHANNEL, 0x001c, }, 
     272    {"ADAT 1", MOTU_CTRL_STD_CHANNEL, 0x0020, }, 
     273    {"ADAT 2", MOTU_CTRL_STD_CHANNEL, 0x0024, }, 
     274    {"ADAT 3", MOTU_CTRL_STD_CHANNEL, 0x0028, }, 
     275    {"ADAT 4", MOTU_CTRL_STD_CHANNEL, 0x002c, }, 
     276    {"ADAT 5", MOTU_CTRL_STD_CHANNEL, 0x0030, }, 
     277    {"ADAT 6", MOTU_CTRL_STD_CHANNEL, 0x0034, }, 
     278    {"ADAT 7", MOTU_CTRL_STD_CHANNEL, 0x0038, }, 
     279    {"ADAT 8", MOTU_CTRL_STD_CHANNEL, 0x003c, }, 
     280}; 
     281 
     282const MixerCtrl MixerCtrls_8pre[] = { 
     283    {"Mix1/Mix_", "Mix 1 ", "", MOTU_CTRL_STD_MIX, 0x0c20, }, 
     284    {"Mix2/Mix_", "Mix 2 ", "", MOTU_CTRL_STD_MIX, 0x0c24, }, 
     285    {"Mix3/Mix_", "Mix 3 ", "", MOTU_CTRL_STD_MIX, 0x0c28, }, 
     286    {"Mix4/Mix_", "Mix 4 ", "", MOTU_CTRL_STD_MIX, 0x0c2c, }, 
     287 
     288    /* For phones source control, "register" is currently unused */ 
     289    {"Control/Phones_", "Phones source", "", MOTU_CTRL_PHONES_SRC, 0}, 
     290 
     291    /* For optical mode controls, the "register" is used to indicate direction */ 
     292    {"Control/OpticalIn_mode", "Optical input mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_IN}, 
     293    {"Control/OpticalOut_mode", "Optical output mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_OUT}, 
     294}; 
     295 
    256296const MotuMixer Mixer_Traveler = MOTUMIXER( 
    257297    MixerCtrls_Traveler, MixerBuses_Traveler, MixerChannels_Traveler); 
     
    266306    MixerCtrls_896HD, MixerBuses_896HD, MixerChannels_896HD); 
    267307 
     308const MotuMixer Mixer_8pre = MOTUMIXER( 
     309    MixerCtrls_8pre, MixerBuses_8pre, MixerChannels_8pre); 
     310 
    268311} 
  • trunk/libffado/src/motu/motu_mixerdefs.h

    r1579 r1763  
    3838extern const MotuMixer Mixer_828Mk2; 
    3939extern const MotuMixer Mixer_896HD; 
     40extern const MotuMixer Mixer_8pre; 
    4041 
    4142}