Changeset 265

Show
Ignore:
Timestamp:
06/15/06 16:57:46 (16 years ago)
Author:
jwoithe
Message:

Start adding detail in MOTU port infrastructure.
Clean up some "signed/unsigned comparison" compiler warnings.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libfreebob-2.0/src/devicemanager.cpp

    r264 r265  
    3939#define BEBOB_AVCDEVICE_UNIT_VERSION     0x10001 
    4040 
     41// The vendor ID for MOTU devices 
     42#define MOTU_VENDOR_ID                   0x000001f2 
     43 
    4144using namespace std; 
    4245 
     
    196199DeviceManager::probeMotu(Ieee1394Service& service, ConfigRom& configRom, int id, int level) 
    197200{ 
    198     IAvDevice* avDevice = new Motu::MotuDevice( service, id, level ); 
     201    IAvDevice* avDevice; 
     202 
     203    // Do a first-pass test to see if it's likely that this device is a MOTU 
     204    if (configRom.getUnitSpecifierId() != MOTU_VENDOR_ID) { 
     205        debugOutput( DEBUG_LEVEL_VERBOSE, "Not a MOTU device...\n"); 
     206        return NULL; 
     207    }         
     208 
     209    avDevice = new Motu::MotuDevice( service, id, level ); 
    199210    if ( !avDevice ) { 
    200211        return NULL; 
    201212    } 
    202213 
    203     // MOTU's discover() needs to differentiate between different models, 
    204     // so for now keep all probing code in there since it's very intermingled. 
    205     // The code is robust in the event that the device isn't a MOTU, so 
    206     // at this stage there seems no reason to do otherwise. 
     214    // MOTU's discover() needs to differentiate between different models, so 
     215    // for now keep all probing code in there since it's very intermingled.  
     216    // By this point it's fairly certain that we are dealing with a MOTU but 
     217    // in any case the code is robust in the event that the device isn't a 
     218    // MOTU, so at this stage there seems no reason to do otherwise. 
    207219    if ( !avDevice->discover() ) { 
    208220        debugOutput( DEBUG_LEVEL_VERBOSE, "Not a MOTU device...\n"); 
  • branches/libfreebob-2.0/src/libstreaming/AmdtpStreamProcessor.cpp

    r263 r265  
    276276        enum raw1394_iso_disposition retval = RAW1394_ISO_OK; 
    277277 
    278         int read_size=nevents*sizeof(quadlet_t)*m_dimension; 
     278        unsigned int read_size=nevents*sizeof(quadlet_t)*m_dimension; 
    279279 
    280280        if ((freebob_ringbuffer_read(m_event_buffer,(char *)(data+8),read_size)) <  
     
    379379{  
    380380    return true; 
    381     //return (m_framecounter > (int)m_period);  
     381    //return (m_framecounter > m_period);  
    382382} 
    383383  
     
    11941194    // therefore we first check if this is ok 
    11951195     
    1196      if(m_framecounter > (int)m_period) { 
     1196     if(m_framecounter > m_period) { 
    11971197        // we make this signed, because this can be < 0 
    11981198        unsigned int m_last_timestamp_ticks = CYCLE_COUNTER_TO_TICKS(m_last_timestamp); 
     
    12661266     } 
    12671267#else 
    1268     if(m_framecounter > (int)m_period) { 
     1268    if(m_framecounter > m_period) { 
    12691269     return true; 
    12701270    } else return false; 
  • branches/libfreebob-2.0/src/libstreaming/freebob_streaming.cpp

    r250 r265  
    6969 
    7070freebob_device_t *freebob_streaming_init (freebob_device_info_t *device_info, freebob_options_t options) { 
    71         int i=0; 
     71        unsigned int i=0; 
    7272 
    7373        struct _freebob_device *dev = new struct _freebob_device; 
     
    169169 
    170170int freebob_streaming_start(freebob_device_t *dev) { 
    171         int i=0; 
     171        unsigned int i=0; 
    172172        debugOutput(DEBUG_LEVEL_VERBOSE,"------------- Start -------------\n"); 
    173173 
     
    194194 
    195195int freebob_streaming_stop(freebob_device_t *dev) { 
    196         int i; 
     196        unsigned int i; 
    197197        debugOutput(DEBUG_LEVEL_VERBOSE,"------------- Stop -------------\n"); 
    198198 
  • branches/libfreebob-2.0/src/libstreaming/MotuPort.h

    r246 r265  
    5252        MotuAudioPort(std::string name,  
    5353                           enum E_Direction direction, 
    54                            int position) 
     54                           int position, 
     55                           int size) 
    5556        : AudioPort(name, direction), 
    56           MotuPortInfo(name, position) // TODO: add more port information parameters here if nescessary 
     57          MotuPortInfo(name, position, size) // TODO: add more port information parameters here if nescessary 
    5758        {}; 
    5859 
     
    7879                           int position) 
    7980                : MidiPort(name, direction), 
    80                   MotuPortInfo(name, position)  // TODO: add more port information parameters here if nescessary 
     81                  MotuPortInfo(name, position, 16)  // TODO: add more port information parameters here if nescessary 
    8182        {}; 
    8283 
     
    103104                           int position) 
    104105                : ControlPort(name, direction), 
    105                   MotuPortInfo(name, position) // TODO: add more port information parameters here if nescessary  
     106                  MotuPortInfo(name, position, 16) // TODO: add more port information parameters here if nescessary  
    106107        {}; 
    107108 
  • branches/libfreebob-2.0/src/libstreaming/MotuPortInfo.h

    r246 r265  
    5151     * If all channels always have the same format, you won't be needing this 
    5252     */ 
    53      /* 
    54         enum E_Formats { 
    55                 E_MBLA, // Multibit linear audio, is acutally AMDTP. Change if needed 
    56                 E_Midi, 
    57                 E_SPDIF, 
    58         }; 
    59     */ 
     53//      enum E_Formats { 
     54//              E_MBLA,     // Multibit linear audio 
     55//              E_Midi,     // MIDI 
     56//      }; 
    6057     
    6158        /** 
     
    6663         * the name parameter is mandatory 
    6764         * 
    68          * @param name  
    69          * @param position example parameter 
     65         * @param name Port name 
     66         * @param position Start position of port's data in iso event 
     67         * @param format Format of data in iso event 
     68         * @param size Size in bits of port's data in iso event 
    7069         * @return  
    7170         */ 
    72         MotuPortInfo(std::string name, int position
    73           : m_name(name), m_position(position) 
     71        MotuPortInfo(std::string name, int position, int size
     72          : m_name(name), m_position(position), m_size(size) 
    7473        {}; 
    7574        virtual ~MotuPortInfo() {}; 
     
    7877        std::string getName() {return m_name;}; 
    7978        int getPosition()     {return m_position;}; 
     79        int getSize()         {return m_size;}; 
    8080 
    8181protected: 
     
    8383 
    8484    int m_position; 
     85    int m_size; 
    8586 
    8687}; 
  • branches/libfreebob-2.0/src/libstreaming/MotuStreamProcessor.cpp

    r253 r265  
    104104    // note: an 'event' is one sample from all channels + possibly other midi and control data 
    105105    int nevents=0; // TODO: determine 
    106         int read_size=nevents*m_dimension*sizeof(quadlet_t); // assumes each channel takes one quadlet 
     106        unsigned int read_size=nevents*m_dimension*sizeof(quadlet_t); // assumes each channel takes one quadlet 
    107107 
    108108    // we read the packet data from a ringbuffer, because of efficiency 
     
    164164     // this implementation just waits until there is one period of samples 
    165165     // transmitted from the buffer 
    166      return (m_framecounter > (int)m_period);  
     166     return (m_framecounter > m_period);  
    167167} 
    168168  
     
    342342    // we received one period of frames 
    343343    // this is period_size*dimension of events 
    344     int events2write=m_period*m_dimension; 
    345     int bytes2write=events2write*sizeof(quadlet_t); 
     344    unsigned int events2write=m_period*m_dimension; 
     345    unsigned int bytes2write=events2write*sizeof(quadlet_t); 
    346346 
    347347    /* write events2write bytes to the ringbuffer  
     
    353353    *  Make sure that we cannot end up on a non-cluster aligned position! 
    354354    */ 
    355     int cluster_size=m_dimension*sizeof(quadlet_t); 
     355    unsigned int cluster_size=m_dimension*sizeof(quadlet_t); 
    356356 
    357357    while(bytes2write>0) { 
     
    732732     // this implementation just waits until there is one period of samples 
    733733     // received into the buffer 
    734     if(m_framecounter > (int)m_period) { 
     734    if(m_framecounter > m_period) { 
    735735        return true; 
    736736    } 
     
    871871        // this is period_size*dimension of events 
    872872 
    873         int events2read=m_period*m_dimension; 
    874         int bytes2read=events2read*sizeof(quadlet_t); 
     873        unsigned int events2read=m_period*m_dimension; 
     874        unsigned int bytes2read=events2read*sizeof(quadlet_t); 
    875875        /* read events2read bytes from the ringbuffer  
    876876        *  first see if it can be done in one read.  
     
    881881        *  Make sure that we cannot end up on a non-cluster aligned position! 
    882882        */ 
    883         int cluster_size=m_dimension*sizeof(quadlet_t); 
     883        unsigned int cluster_size=m_dimension*sizeof(quadlet_t); 
    884884         
    885885        while(bytes2read>0) { 
  • branches/libfreebob-2.0/src/libstreaming/StreamProcessor.cpp

    r255 r265  
    4242        : IsoStream(type, port) 
    4343        , m_nb_buffers(0) 
    44         , m_manager(0) 
    4544        , m_period(0) 
    4645        , m_xruns(0) 
    4746        , m_framecounter(0) 
    4847        , m_framerate(framerate) 
     48        , m_manager(0) 
    4949        , m_running(false) 
    5050        , m_disabled(true) 
  • branches/libfreebob-2.0/src/libstreaming/StreamProcessor.h

    r263 r265  
    121121 
    122122        unsigned int m_xruns; 
    123         int m_framecounter; 
     123        unsigned int m_framecounter; 
    124124 
    125125        unsigned int m_framerate; 
  • branches/libfreebob-2.0/src/libstreaming/StreamProcessorManager.cpp

    r253 r265  
    497497 
    498498bool StreamProcessorManager::waitForPeriod() { 
    499         int ret; 
     499 
    500500        debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "enter...\n"); 
    501501 
  • branches/libfreebob-2.0/src/motu/motu_avdevice.cpp

    r262 r265  
    226226            buff, 
    227227            FreebobStreaming::Port::E_Capture,  
     228            0, 
    228229            0 // you can add all other port specific stuff you  
    229230              // need to pass by extending MotuXXXPort and MotuPortInfo 
     
    319320            buff, 
    320321            FreebobStreaming::Port::E_Playback,  
     322            0, 
    321323            0 // you can add all other port specific stuff you  
    322324              // need to pass by extending MotuXXXPort and MotuPortInfo