Changeset 277
- Timestamp:
- 06/29/06 16:24:39 (17 years ago)
- Files:
-
- branches/libfreebob-2.0/src/libstreaming/MotuStreamProcessor.cpp (modified) (4 diffs)
- branches/libfreebob-2.0/src/libstreaming/MotuStreamProcessor.h (modified) (2 diffs)
- branches/libfreebob-2.0/src/libutil/DelayLockedLoop.cpp (modified) (1 diff)
- branches/libfreebob-2.0/src/motu/motu_avdevice.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/libfreebob-2.0/src/libstreaming/MotuStreamProcessor.cpp
r274 r277 96 96 // don't process the stream when it is not enabled. 97 97 // however, maybe we do have to generate (semi) valid packets 98 if (m_disabled) {98 if (m_disabled) { 99 99 *length = 0; 100 100 *tag = 1; // TODO: is this correct for MOTU? … … 659 659 MotuReceiveStreamProcessor::MotuReceiveStreamProcessor(int port, int framerate, 660 660 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); 663 676 } 664 677 665 678 MotuReceiveStreamProcessor::~MotuReceiveStreamProcessor() { 666 667 668 679 freebob_ringbuffer_free(m_event_buffer); 680 free(m_tmp_event_buffer); 681 delete m_sph_ofs_dll; 669 682 } 670 683 … … 688 701 689 702 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 706 if (cycle==0) { 707 fprintf(stderr, "sph_ofs_dll=%g\n",m_sph_ofs_dll->get()); 708 } 690 709 691 710 // If the packet length is 8 bytes (ie: just a CIP-like header) there is … … 989 1008 int problem=0; 990 1009 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 991 1031 for ( PortVectorIterator it = m_PeriodPorts.begin(); 992 1032 it != m_PeriodPorts.end(); branches/libfreebob-2.0/src/libstreaming/MotuStreamProcessor.h
r274 r277 32 32 #include "../debugmodule/debugmodule.h" 33 33 #include "StreamProcessor.h" 34 35 #include "../libutil/DelayLockedLoop.h" 34 36 35 37 namespace FreebobStreaming { … … 149 151 unsigned int m_event_size; 150 152 153 FreebobUtil::DelayLockedLoop *m_sph_ofs_dll; 154 signed int m_last_cycle_ofs; 155 151 156 DECLARE_DEBUG_MODULE; 152 157 branches/libfreebob-2.0/src/libutil/DelayLockedLoop.cpp
r253 r277 150 150 DelayLockedLoop::setIntegrator(unsigned int i, float c) { 151 151 152 unsigned int x; 153 if (x<m_order) { 154 m_nodes[x]=c; 152 if (i<m_order) { 153 m_nodes[i]=c; 155 154 } 156 155 } branches/libfreebob-2.0/src/motu/motu_avdevice.cpp
r274 r277 30 30 #include "libstreaming/MotuStreamProcessor.h" 31 31 #include "libstreaming/MotuPort.h" 32 33 #include "libutil/DelayLockedLoop.h" 32 34 33 35 #include <string>