Changeset 277

Show
Ignore:
Timestamp:
06/29/06 16:24:39 (17 years ago)
Author:
jwoithe
Message:

Start of work leading to MOTU iso transmission.
Fix use of uninitialised local variable in DelayLockedLoop::setIntegrator().

Files:

Legend:

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

    r274 r277  
    9696        // don't process the stream when it is not enabled. 
    9797        // however, maybe we do have to generate (semi) valid packets 
    98         if(m_disabled) { 
     98        if (m_disabled) { 
    9999                *length = 0;  
    100100                *tag = 1; // TODO: is this correct for MOTU? 
     
    659659MotuReceiveStreamProcessor::MotuReceiveStreamProcessor(int port, int framerate,  
    660660        unsigned int event_size) 
    661     : ReceiveStreamProcessor(port, framerate), m_event_size(event_size) { 
    662  
     661    : ReceiveStreamProcessor(port, framerate), m_event_size(event_size), 
     662        m_last_cycle_ofs(-1) { 
     663 
     664        // Set up the Delay-locked-loop to track audio frequency relative 
     665        // to the cycle timer.  The seed value is just the difference one 
     666        // would see if the audio clock was locked to the ieee1394 cycle 
     667        // timer. 
     668        // FIXME: the value for omega and coeff[0] are more or less copied 
     669        // from the test-dll.cpp code.  They need to be understood and 
     670        // optimised for this process. 
     671        float omega=6.28*0.001; 
     672        float coeffs[1]; 
     673        coeffs[0]=1.41*omega; 
     674        m_sph_ofs_dll = new FreebobUtil::DelayLockedLoop(1, coeffs); 
     675        m_sph_ofs_dll->setIntegrator(0, 24576000.0/framerate); 
    663676} 
    664677 
    665678MotuReceiveStreamProcessor::~MotuReceiveStreamProcessor() { 
    666     freebob_ringbuffer_free(m_event_buffer); 
    667     free(m_tmp_event_buffer); 
    668  
     679       freebob_ringbuffer_free(m_event_buffer); 
     680       free(m_tmp_event_buffer); 
     681        delete m_sph_ofs_dll; 
    669682} 
    670683 
     
    688701     
    689702    enum raw1394_iso_disposition retval=RAW1394_ISO_OK; 
     703 
     704// FIXME: just for debugging, print out the sph ofs DLL value 
     705// once a second 
     706if (cycle==0) { 
     707  fprintf(stderr, "sph_ofs_dll=%g\n",m_sph_ofs_dll->get()); 
     708} 
    690709 
    691710    // If the packet length is 8 bytes (ie: just a CIP-like header) there is 
     
    9891008        int problem=0; 
    9901009 
     1010        /* Push cycle offset differences from each event's SPH into the DLL. 
     1011         * If this is the very first block received, use the first event to 
     1012         * initialise the last cycle offset. 
     1013         * FIXME: it might be best to use differences only within the given 
     1014         * block rather than keeping a store of the last cycle offset. 
     1015         * Otherwise in the event of a lost incoming packet the DLL will 
     1016         * have an abnormally large value sent to it.  Perhaps this doesn't 
     1017         * matter? 
     1018         */ 
     1019        unsigned int ev; 
     1020        signed int sph_ofs = ntohl(*(quadlet_t *)data) & 0xfff; 
     1021        if (m_last_cycle_ofs < 0) { 
     1022                m_last_cycle_ofs = sph_ofs-m_sph_ofs_dll->get(); 
     1023        } 
     1024        for (ev=0; ev<nevents; ev++) { 
     1025                sph_ofs = ntohl(*(quadlet_t *)(data+ev*m_event_size)) & 0xfff; 
     1026                m_sph_ofs_dll->put((m_last_cycle_ofs<sph_ofs)? 
     1027                        sph_ofs-m_last_cycle_ofs:sph_ofs+3072-m_last_cycle_ofs); 
     1028                m_last_cycle_ofs = sph_ofs; 
     1029        } 
     1030 
    9911031        for ( PortVectorIterator it = m_PeriodPorts.begin(); 
    9921032          it != m_PeriodPorts.end(); 
  • branches/libfreebob-2.0/src/libstreaming/MotuStreamProcessor.h

    r274 r277  
    3232#include "../debugmodule/debugmodule.h" 
    3333#include "StreamProcessor.h" 
     34 
     35#include "../libutil/DelayLockedLoop.h" 
    3436 
    3537namespace FreebobStreaming { 
     
    149151        unsigned int m_event_size; 
    150152 
     153        FreebobUtil::DelayLockedLoop *m_sph_ofs_dll; 
     154        signed int m_last_cycle_ofs; 
     155 
    151156    DECLARE_DEBUG_MODULE; 
    152157 
  • branches/libfreebob-2.0/src/libutil/DelayLockedLoop.cpp

    r253 r277  
    150150DelayLockedLoop::setIntegrator(unsigned int i, float c) { 
    151151     
    152     unsigned int x; 
    153     if (x<m_order) { 
    154         m_nodes[x]=c; 
     152    if (i<m_order) { 
     153        m_nodes[i]=c; 
    155154    } 
    156155} 
  • branches/libfreebob-2.0/src/motu/motu_avdevice.cpp

    r274 r277  
    3030#include "libstreaming/MotuStreamProcessor.h" 
    3131#include "libstreaming/MotuPort.h" 
     32 
     33#include "libutil/DelayLockedLoop.h" 
    3234 
    3335#include <string>