Changeset 1520 for branches

Show
Ignore:
Timestamp:
03/22/09 16:21:53 (15 years ago)
Author:
jwoithe
Message:

MOTU: cleanup of mixer code. In particular, we rely on the model ID to customise all aspects of the GUI, rather than a collection of individual feature flags for some things.

Files:

Legend:

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

    r1518 r1520  
    413413}; 
    414414 
     415const MatrixMixBus MixerBuses_896HD[] = { 
     416    {"Mix 1", 0x4000, }, 
     417    {"Mix 2", 0x4100, }, 
     418    {"Mix 3", 0x4200, }, 
     419    {"Mix 4", 0x4300, }, 
     420}; 
     421 
    415422const MatrixMixChannel MixerChannels_896HD[] = { 
    416423    {"Analog 1", MOTU_CTRL_STD_CHANNEL, 0x0000, }, 
     
    455462}; 
    456463 
     464const MatrixMixBus MixerBuses_828Mk2[] = { 
     465    {"Mix 1", 0x4000, }, 
     466    {"Mix 2", 0x4100, }, 
     467    {"Mix 3", 0x4200, }, 
     468    {"Mix 4", 0x4300, }, 
     469}; 
     470 
     471const MatrixMixChannel MixerChannels_828Mk2[] = { 
     472    {"Analog 1", MOTU_CTRL_STD_CHANNEL, 0x0000, }, 
     473    {"Analog 2", MOTU_CTRL_STD_CHANNEL, 0x0004, }, 
     474    {"Analog 3", MOTU_CTRL_STD_CHANNEL, 0x0008, }, 
     475    {"Analog 4", MOTU_CTRL_STD_CHANNEL, 0x000c, }, 
     476    {"Analog 5", MOTU_CTRL_STD_CHANNEL, 0x0010, }, 
     477    {"Analog 6", MOTU_CTRL_STD_CHANNEL, 0x0014, }, 
     478    {"Analog 7", MOTU_CTRL_STD_CHANNEL, 0x0018, }, 
     479    {"Analog 8", MOTU_CTRL_STD_CHANNEL, 0x001c, }, 
     480    {"Mic 1", MOTU_CTRL_STD_CHANNEL, 0x0020, }, 
     481    {"Mic 2", MOTU_CTRL_STD_CHANNEL, 0x0024, }, 
     482    {"SPDIF 1", MOTU_CTRL_STD_CHANNEL, 0x0028, }, 
     483    {"SPDIF 2", MOTU_CTRL_STD_CHANNEL, 0x002c, }, 
     484    {"ADAT 1", MOTU_CTRL_STD_CHANNEL, 0x0030, }, 
     485    {"ADAT 2", MOTU_CTRL_STD_CHANNEL, 0x0034, }, 
     486    {"ADAT 3", MOTU_CTRL_STD_CHANNEL, 0x0038, }, 
     487    {"ADAT 4", MOTU_CTRL_STD_CHANNEL, 0x003c, }, 
     488    {"ADAT 5", MOTU_CTRL_STD_CHANNEL, 0x0040, }, 
     489    {"ADAT 6", MOTU_CTRL_STD_CHANNEL, 0x0044, }, 
     490    {"ADAT 7", MOTU_CTRL_STD_CHANNEL, 0x0048, }, 
     491    {"ADAT 8", MOTU_CTRL_STD_CHANNEL, 0x004c, }, 
     492}; 
     493 
    457494const MixerCtrl MixerCtrls_828Mk2[] = { 
    458495    {"Mix1/Mix_", "Mix 1 ", "", MOTU_CTRL_STD_MIX, 0x0c20, }, 
     
    486523 
    487524const MotuMixer Mixer_828Mk2 = MOTUMIXER( 
    488     MixerCtrls_828Mk2, MixerBuses_Traveler, MixerChannels_Traveler); 
     525    MixerCtrls_828Mk2, MixerBuses_828Mk2, MixerChannels_828Mk2); 
    489526 
    490527const MotuMixer Mixer_896HD = MOTUMIXER( 
    491     MixerCtrls_896HD, MixerBuses_Traveler, MixerChannels_896HD); 
     528    MixerCtrls_896HD, MixerBuses_896HD, MixerChannels_896HD); 
    492529 
    493530/* The order of DevicesProperty entries must match the numeric order of the 
     
    801838    result &= m_MixerContainer->addElement( 
    802839        new InfoElement(*this, MOTU_INFO_SAMPLE_RATE, "Info/SampleRate", "Device sample rate", "")); 
    803     result &= m_MixerContainer->addElement( 
    804         new InfoElement(*this, MOTU_INFO_HAS_MIC_INPUTS, "Info/HasMicInputs", "Device has mic inputs", "")); 
    805     result &= m_MixerContainer->addElement( 
    806         new InfoElement(*this, MOTU_INFO_HAS_AESEBU_INPUTS, "Info/HasAESEBUInputs", "Device has AES/EBU inputs", "")); 
    807     result &= m_MixerContainer->addElement( 
    808         new InfoElement(*this, MOTU_INFO_HAS_SPDIF_INPUTS, "Info/HasSPDIFInputs", "Device has SPDIF inputs", "")); 
    809     result &= m_MixerContainer->addElement( 
    810         new InfoElement(*this, MOTU_INFO_HAS_OPTICAL_SPDIF, "Info/HasOpticalSPDIF", "Device has Optical SPDIF", "")); 
    811840 
    812841    if (!addElement(m_MixerContainer)) { 
  • branches/libffado-2.0/src/motu/motu_controls.cpp

    r1506 r1520  
    11/* 
    22 * Copyright (C) 2005-2008 by Pieter Palmers 
    3  * Copyright (C) 2008 by Jonathan Woithe 
     3 * Copyright (C) 2008-2009 by Jonathan Woithe 
    44 * 
    55 * This file is part of FFADO 
     
    985985            debugOutput(DEBUG_LEVEL_VERBOSE, "SampleRate: %d\n", res); 
    986986            break; 
    987         case MOTU_INFO_HAS_MIC_INPUTS: 
    988             /* Only the 828Mk2 has separate mic inputs.  In time this may be 
    989              * deduced by walking the port info array within the parent. 
    990              */ 
    991             res = m_parent.m_motu_model == MOTU_MODEL_828mkII ? 1:0; 
    992             debugOutput(DEBUG_LEVEL_VERBOSE, "Has mic inputs: %d\n", res); 
    993             break; 
    994         case MOTU_INFO_HAS_AESEBU_INPUTS: 
    995             /* AES/EBU inputs are currently present on the Traveler and 
    996              * 896HD.  In time this may be deduced by walking the port info 
    997              * array within the parent. 
    998              */ 
    999             val = m_parent.m_motu_model; 
    1000             res = (val==MOTU_MODEL_TRAVELER || val==MOTU_MODEL_896HD); 
    1001             debugOutput(DEBUG_LEVEL_VERBOSE, "HasAESEBUInputs: %d\n", res); 
    1002             break; 
    1003         case MOTU_INFO_HAS_SPDIF_INPUTS: 
    1004             /* SPDIF inputs are present on all supported models except the 
    1005              * 896HD and the 8pre.  In time this may be deduced by walking 
    1006              * the port info array within the parent. 
    1007              */ 
    1008             val = m_parent.m_motu_model; 
    1009             res = (val!=MOTU_MODEL_8PRE && val!=MOTU_MODEL_896HD); 
    1010             debugOutput(DEBUG_LEVEL_VERBOSE, "HasSPDIFInputs: %d\n", res); 
    1011             break; 
    1012         case MOTU_INFO_HAS_OPTICAL_SPDIF: 
    1013             /* THe 896HD doesn't have optical SPDIF capability */ 
    1014             val = m_parent.m_motu_model; 
    1015             res = (val != MOTU_MODEL_896HD); 
    1016             debugOutput(DEBUG_LEVEL_VERBOSE, "HasOpticalSPDIF: %d\n", res); 
    1017             break; 
    1018987    } 
    1019988    return res; 
  • branches/libffado-2.0/src/motu/motu_controls.h

    r1508 r1520  
    22 * Copyright (C) 2005-2008 by Daniel Wagner 
    33 * Copyright (C) 2005-2008 by Pieter Palmers 
    4  * Copyright (C) 2008 by Jonathan Woithe 
     4 * Copyright (C) 2008-2009 by Jonathan Woithe 
    55 * 
    66 * This file is part of FFADO 
     
    9595#define MOTU_INFO_IS_STREAMING             0x00000002 
    9696#define MOTU_INFO_SAMPLE_RATE              0x00000003 
    97 #define MOTU_INFO_HAS_MIC_INPUTS           0x00000004 
    98 #define MOTU_INFO_HAS_AESEBU_INPUTS        0x00000005 
    99 #define MOTU_INFO_HAS_SPDIF_INPUTS         0x00000006 
    100 #define MOTU_INFO_HAS_OPTICAL_SPDIF        0x00000007 
    10197 
    10298#define MOTU_CTRL_TRIMGAINPAD_MAX_CHANNEL  3 
  • branches/libffado-2.0/support/mixer-qt4/mixer_motu.py

    r1509 r1520  
    605605        log.debug("device streaming flag: %d" % (self.is_streaming)) 
    606606 
    607         # Retrieve other device settings as needed 
     607        # Retrieve other device settings as needed and customise the UI 
     608        # based on these options. 
    608609        self.model = self.hw.getDiscrete('/Mixer/Info/Model') 
    609610        log.debug("device model identifier: %d" % (self.model)) 
    610611        self.sample_rate = self.hw.getDiscrete('/Mixer/Info/SampleRate') 
    611612        log.debug("device sample rate: %d" % (self.sample_rate)) 
    612         self.has_mic_inputs = self.hw.getDiscrete('/Mixer/Info/HasMicInputs') 
    613         log.debug("device has mic inputs: %d" % (self.has_mic_inputs)) 
    614         self.has_aesebu_inputs = self.hw.getDiscrete('/Mixer/Info/HasAESEBUInputs') 
    615         log.debug("device has AES/EBU inputs: %d" % (self.has_aesebu_inputs)) 
    616         self.has_spdif_inputs = self.hw.getDiscrete('/Mixer/Info/HasSPDIFInputs') 
    617         log.debug("device has SPDIF inputs: %d" % (self.has_spdif_inputs)) 
    618         self.has_optical_spdif = self.hw.getDiscrete('/Mixer/Info/HasOpticalSPDIF') 
    619         log.debug("device has optical SPDIF: %d" % (self.has_optical_spdif)) 
    620  
    621         # Customise the UI based on device options retrieved 
    622         if (self.has_mic_inputs): 
    623             # Mic input controls displace AES/EBU since no current device 
    624             # has both. 
     613 
     614        # The 828Mk2 has separate Mic inputs but no AES/EBU, so use the 
     615        # AES/EBU mixer controls as "Mic" controls.  If a device comes along 
     616        # with both mic and AES inputs this approach will have to be 
     617        # re-thought. 
     618        # Doing this means that on the 828Mk2, the mixer matrix elements 
     619        # used for AES/EBU on other models are used for the Mic channels.  
     620        # So long as the MixerChannels_828Mk2 definition in 
     621        # motu_avdevice.cpp defines the mic channels immediately after the 8 
     622        # analog channels we'll be right.  Note that we don't need to change 
     623        # the matrix lookup tables (self.ChannelFaders etc) because the QT 
     624        # controls are still named *aesebu*. 
     625        if (self.model == MOTU_MODEL_828mkII): 
    625626            self.mix1_tab.setTabText(1, "Mic inputs"); 
    626627            self.mix2_tab.setTabText(1, "Mic inputs"); 
    627628            self.mix3_tab.setTabText(1, "Mic inputs"); 
    628629            self.mix4_tab.setTabText(1, "Mic inputs"); 
    629             # FIXME: when implemented, will mic channels just reuse the AES/EBU 
    630             # dbus path?  If not we'll have to reset the respective values in 
    631             # the control arrays (self.ChannelFaders etc). 
    632630        else: 
    633             if (not(self.has_aesebu_inputs)): 
     631            # Only the Traveler and 896HD have AES/EBU inputs, so disable the AES/EBU 
     632            # tab for all other models. 
     633            if (self.model!=MOTU_MODEL_TRAVELER and self.model!=MOTU_MODEL_896HD): 
    634634                self.mix1_tab.setTabEnabled(1, False) 
    635635                self.mix2_tab.setTabEnabled(1, False) 
    636636                self.mix3_tab.setTabEnabled(1, False) 
    637637                self.mix4_tab.setTabEnabled(1, False) 
    638         if (not(self.has_spdif_inputs)): 
     638 
     639        # All models except the 896HD and 8pre have SPDIF inputs. 
     640        if (self.model==MOTU_MODEL_8PRE or self.model==MOTU_MODEL_896HD): 
    639641            self.mix1_tab.setTabEnabled(2, False); 
    640642            self.mix2_tab.setTabEnabled(2, False); 
     
    642644            self.mix4_tab.setTabEnabled(2, False); 
    643645 
    644         # Devices without AES/EBU inputs/outputs (normally ID 6 in the 
    645         # destination lists) have dedicated "MainOut" outputs instead.  The 
    646         # 896HD is an exception: it uses ID 6 for MainOut and ID 7 
    647         # (nominally SPDIF) for AES/EBU. 
    648         if (not(self.has_aesebu_inputs) or self.model==MOTU_MODEL_896HD): 
     646        # Devices without AES/EBU inputs/outputs (currently all except the 
     647        # Traveler and 896HD) have dedicated "MainOut" outputs instead.  
     648        # AES/EBU is normally ID 6 in the destination lists and "MainOut" 
     649        # displaces it on non-AES/EBU models.  The 896HD has both AES/EBU 
     650        # and MainOut which complicates this; it uses ID 6 for MainOut and 
     651        # ID 7 (nominally SPDIF) for AES/EBU.  Therefore change ID 6 to 
     652        # "MainOut" for everything but the Traveler, and set ID 7 (nominally 
     653        # SPDIF) to AES/EBU for the 896HD. 
     654        if (self.model != MOTU_MODEL_TRAVELER): 
    649655            self.mix1_dest.setItemText(6, "MainOut") 
    650656            self.mix2_dest.setItemText(6, "MainOut") 
     
    652658            self.mix4_dest.setItemText(6, "MainOut") 
    653659            self.phones_src.setItemText(6, "MainOut") 
    654         # Change the SPDIF destination to AES/EBU for the 896HD. 
    655660        if (self.model == MOTU_MODEL_896HD): 
    656661            self.mix1_dest.setItemText(7, "AES/EBU") 
     
    672677        # Some devices don't have the option of selecting an optical SPDIF 
    673678        # mode. 
    674         if (not(self.has_optical_spdif)): 
     679        # The 896HD doesn't have optical SPDIF (aka Toslink) capability 
     680        if (self.model == MOTU_MODEL_896HD): 
    675681            self.optical_in_mode.removeItem(2) 
    676682            self.optical_out_mode.removeItem(2)