Changeset 659

Show
Ignore:
Timestamp:
10/18/07 16:45:57 (16 years ago)
Author:
f.ernoult
Message:

MotU: Centralize all device specific parameters in DeviceProperty?

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/motu/motu_avdevice.cpp

    r658 r659  
    177177}; 
    178178 
    179 const DevicePortsEntry DevicesPorts[] = { 
    180     { Ports_828MKII, sizeof( Ports_828MKII ) }, 
    181     { Ports_TRAVELER, sizeof( Ports_TRAVELER ) }, 
    182     { Ports_ULTRALITE, sizeof( Ports_ULTRALITE ) }, 
    183     { Ports_8PRE, sizeof( Ports_8PRE ) }, 
     179const DevicePropertyEntry DevicesProperty[] = { 
     180//  { Ports_map,       sizeof( Ports_map ),        MaxSR }, 
     181    { Ports_828MKII,   sizeof( Ports_828MKII ),    96000 }, 
     182    { Ports_TRAVELER,  sizeof( Ports_TRAVELER ),  192000 }, 
     183    { Ports_ULTRALITE, sizeof( Ports_ULTRALITE ),  96000 }, 
     184    { Ports_8PRE,      sizeof( Ports_8PRE ),       96000 }, 
    184185}; 
    185186 
     
    320321    int i, supported=true, cancel_adat=false; 
    321322 
     323    if ( samplingFrequency > DevicesProperty[m_motu_model-1].MaxSampleRate ) 
     324       return false;  
     325 
    322326    switch ( samplingFrequency ) { 
    323327        case 22050: 
    324             supported=false; 
    325             break; 
    326328        case 24000: 
    327             supported=false; 
    328             break; 
    329329        case 32000: 
    330330            supported=false; 
     
    343343            break; 
    344344        case 176400: 
    345             // Currently only the Traveler supports 4x sample rates 
    346             if (m_motu_model == MOTUFW_MODEL_TRAVELER) { 
    347                 new_rate = MOTUFW_RATE_BASE_44100 | MOTUFW_RATE_MULTIPLIER_4X; 
    348                 cancel_adat = true; 
    349             } else 
    350                 supported=false; 
     345            new_rate = MOTUFW_RATE_BASE_44100 | MOTUFW_RATE_MULTIPLIER_4X; 
     346            cancel_adat = true;  // current ADAT protocol doesn't support sample rate > 96000 
    351347            break; 
    352348        case 192000: 
    353             // Currently only the Traveler supports 4x sample rates 
    354             if (m_motu_model == MOTUFW_MODEL_TRAVELER) { 
    355                 new_rate = MOTUFW_RATE_BASE_48000 | MOTUFW_RATE_MULTIPLIER_4X; 
    356                 cancel_adat = true; 
    357             } else 
    358                 supported=false; 
     349            new_rate = MOTUFW_RATE_BASE_48000 | MOTUFW_RATE_MULTIPLIER_4X; 
     350            cancel_adat = true; 
    359351            break; 
    360352        default: 
     
    845837        flags |= MOTUFW_PA_RATE_1x; 
    846838 
    847     for (i=0; i < ( DevicesPorts[m_motu_model-1].PortsListLength /sizeof( PortEntry ) ); i++) { 
    848         if (( DevicesPorts[m_motu_model-1].PortsList[i].port_dir & dir ) && 
    849            ( DevicesPorts[m_motu_model-1].PortsList[i].port_flags & MOTUFW_PA_RATE_MASK & flags ) && 
    850            ( DevicesPorts[m_motu_model-1].PortsList[i].port_flags & MOTUFW_PA_OPTICAL_MASK & flags )) { 
     839    for (i=0; i < ( DevicesProperty[m_motu_model-1].PortsListLength /sizeof( PortEntry ) ); i++) { 
     840        if (( DevicesProperty[m_motu_model-1].PortsList[i].port_dir & dir ) && 
     841           ( DevicesProperty[m_motu_model-1].PortsList[i].port_flags & MOTUFW_PA_RATE_MASK & flags ) && 
     842           ( DevicesProperty[m_motu_model-1].PortsList[i].port_flags & MOTUFW_PA_OPTICAL_MASK & flags )) { 
    851843            size += 3; 
    852844        } 
     
    925917    } 
    926918 
    927     for (i=0; i < ( DevicesPorts[m_motu_model-1].PortsListLength /sizeof( PortEntry ) ); i++) { 
    928         if (( DevicesPorts[m_motu_model-1].PortsList[i].port_dir & dir ) && 
    929            ( DevicesPorts[m_motu_model-1].PortsList[i].port_flags & MOTUFW_PA_RATE_MASK & flags ) && 
    930            ( DevicesPorts[m_motu_model-1].PortsList[i].port_flags & MOTUFW_PA_OPTICAL_MASK & flags )) { 
     919    for (i=0; i < ( DevicesProperty[m_motu_model-1].PortsListLength /sizeof( PortEntry ) ); i++) { 
     920        if (( DevicesProperty[m_motu_model-1].PortsList[i].port_dir & dir ) && 
     921           ( DevicesProperty[m_motu_model-1].PortsList[i].port_flags & MOTUFW_PA_RATE_MASK & flags ) && 
     922           ( DevicesProperty[m_motu_model-1].PortsList[i].port_flags & MOTUFW_PA_OPTICAL_MASK & flags )) { 
    931923            asprintf(&buff,"%s_%s_%s" , id.c_str(), mode_str, 
    932               DevicesPorts[m_motu_model-1].PortsList[i].port_name); 
    933             if (!addPort(s_processor, buff, direction, DevicesPorts[m_motu_model-1].PortsList[i].port_offset, 0)) 
     924              DevicesProperty[m_motu_model-1].PortsList[i].port_name); 
     925            if (!addPort(s_processor, buff, direction, DevicesProperty[m_motu_model-1].PortsList[i].port_offset, 0)) 
    934926                return false; 
    935927        } 
  • trunk/libffado/src/motu/motu_avdevice.h

    r658 r659  
    114114}; 
    115115 
    116 struct DevicePortsEntry { 
     116struct DevicePropertyEntry { 
    117117    const PortEntry* PortsList; 
    118118    int PortsListLength; 
     119    int MaxSampleRate; 
    119120    // Others features can be added here like MIDI port presence. 
    120121};