3232bool HarpDecoder::decodeBarcode (HarpBarcode& barcode, double expectedSampleRate)
3333{
3434
35- LOGD (" Decoding barcode..." );
35+ // LOGD ("Decoding barcode...");
3636
3737 // Convert events to bit sequence
3838 std::array<bool , TOTAL_BITS> bits;
@@ -62,7 +62,7 @@ bool HarpDecoder::decodeBarcode(HarpBarcode& barcode, double expectedSampleRate)
6262 // std::cout << bit ? 1 : 0;
6363 // std::cout << std::endl;
6464
65- LOGD (" Bits decoded: " , bitIndex);
65+ // LOGD ("Bits decoded: ", bitIndex);
6666
6767 if (bitIndex < TOTAL_BITS) return false ;
6868
@@ -80,7 +80,7 @@ bool HarpDecoder::decodeBarcode(HarpBarcode& barcode, double expectedSampleRate)
8080 barcode.isComplete = true ;
8181 barcode.isValid = true ;
8282
83- LOGD (" Found Harp barcode: " , barcode.encodedTime , " at sample " , barcode.localStartSample );
83+ // LOGD ("Found Harp barcode: ", barcode.encodedTime, " at sample ", barcode.localStartSample);
8484
8585 return true ;
8686}
@@ -114,11 +114,11 @@ uint32_t HarpDecoder::extractTimestamp(const std::array<bool, TOTAL_BITS>& bits)
114114
115115bool HarpDecoder::validateBitTiming (const HarpBarcode& barcode)
116116{
117- LOGD (" Validating bit timing." );
117+ // LOGD ("Validating bit timing.");
118118 // Check overall duration
119119 if (std::abs (barcode.actualDuration - EXPECTED_BARCODE_DURATION_MS) > 5.0 )
120120 {
121- LOGD (" Overall duration more than 5 ms off." );
121+ // LOGD ("Overall duration more than 5 ms off.");
122122 return false ;
123123 }
124124
@@ -128,20 +128,20 @@ bool HarpDecoder::validateBitTiming(const HarpBarcode& barcode)
128128 {
129129 if (std::abs (barcode.bitDurations [i] - EXPECTED_BIT_DURATION_MS) > BIT_TOLERANCE_MS)
130130 {
131- LOGD (" Failed tolerance for bit " , i);
131+ // LOGD ("Failed tolerance for bit ", i);
132132 return false ;
133133 }
134134
135135 }
136136
137- LOGD (" OK." );
137+ // LOGD ("OK.");
138138
139139 return true ;
140140}
141141
142142bool HarpDecoder::validateBarcodeStructure (const std::array<bool , TOTAL_BITS>& bits)
143143{
144- LOGD (" Validating barcode structure." );
144+ // LOGD ("Validating barcode structure.");
145145 // Check start bit (should be LOW)
146146 if (bits[0 ] != false ) return false ;
147147
@@ -155,7 +155,7 @@ bool HarpDecoder::validateBarcodeStructure(const std::array<bool, TOTAL_BITS>& b
155155 return false ;
156156 }
157157
158- LOGD (" OK." );
158+ // LOGD ("OK.");
159159
160160 return true ;
161161}
@@ -284,20 +284,20 @@ double SyncStream::getSyncAccuracy()
284284 if (pulses.size () > 0 )
285285 {
286286
287- LOGD (" Sync accuracy for stream " , streamKey);
287+ // LOGD ("Sync accuracy for stream ", streamKey);
288288
289- LOGD (" latestSyncSampleNumber: " , latestSyncSampleNumber);
290- LOGD (" latestGlobalSyncTime: " , latestGlobalSyncTime);
291- LOGD (" globalStartTime: " , globalStartTime);
292- LOGD (" actualSampleRate: " , actualSampleRate);
293- LOGD (" baselineMatchingPulse.globalTimestamp: " , baselineMatchingPulse.globalTimestamp );
289+ // LOGD ("latestSyncSampleNumber: ", latestSyncSampleNumber);
290+ // LOGD ("latestGlobalSyncTime: ", latestGlobalSyncTime);
291+ // LOGD ("globalStartTime: ", globalStartTime);
292+ // LOGD ("actualSampleRate: ", actualSampleRate);
293+ // LOGD ("baselineMatchingPulse.globalTimestamp: ", baselineMatchingPulse.globalTimestamp);
294294
295295 // NEW CALCULATION:
296296 double estimatedGlobalTime = double (latestSyncSampleNumber - baselineMatchingPulse.localSampleNumber )
297297 / actualSampleRate
298298 + (baselineMatchingPulse.globalTimestamp );
299- LOGD (" estimatedGlobalTime: " , estimatedGlobalTime);
300- LOGD (" difference: " , latestGlobalSyncTime - estimatedGlobalTime);
299+ // LOGD ("estimatedGlobalTime: ", estimatedGlobalTime);
300+ // LOGD ("difference: ", latestGlobalSyncTime - estimatedGlobalTime);
301301
302302 return (estimatedGlobalTime - latestGlobalSyncTime) * 1000 ;
303303 }
@@ -309,8 +309,8 @@ double SyncStream::getSyncAccuracy()
309309
310310void SyncStream::syncWith (const SyncStream* mainStream)
311311{
312- LOGD (" Synchronizing " , streamKey, " with " , mainStream->streamKey , " ..." );
313- LOGD (" Expected sample rate: " , expectedSampleRate);
312+ // LOGD ("Synchronizing ", streamKey, " with ", mainStream->streamKey, "...");
313+ // LOGD ("Expected sample rate: ", expectedSampleRate);
314314
315315 if (mainStream->pulses .size () < 2 || pulses.size () < 2 )
316316 {
@@ -511,7 +511,7 @@ void SyncStream::processHarpEvent(int64 sampleNumber, bool state)
511511
512512 if (timeSinceLastEvent > 0.5 )
513513 {
514- LOGD (" COMPLETED BARCODE." );
514+ // LOGD ("COMPLETED BARCODE.");
515515 completedBarcodes.push_back (currentBarcode);
516516 currentBarcode = {};
517517 }
@@ -521,7 +521,7 @@ void SyncStream::processHarpEvent(int64 sampleNumber, bool state)
521521
522522 if (currentBarcode.localStartSample == 0 )
523523 {
524- LOGD (" STARTING NEW BARCODE COLLECTION." );
524+ // LOGD ("STARTING NEW BARCODE COLLECTION.");
525525 currentBarcode.localStartSample = sampleNumber;
526526 currentBarcode.localStartTimestamp = double (sampleNumber) / expectedSampleRate;
527527 currentBarcode.computerTimeMillis = Time::currentTimeMillis ();
@@ -567,12 +567,12 @@ bool SyncStream::validateBarcodeTimestamp(const HarpBarcode& barcode)
567567 auto & lastBarcode = completedBarcodes[completedBarcodes.size () - 2 ];
568568 if (barcode.encodedTime != lastBarcode.encodedTime + 1 )
569569 {
570- LOGD (" Non-monotonic increase" );
570+ // LOGD ("Non-monotonic increase");
571571 return false ; // Should increment by 1 second
572572 }
573573 else
574574 {
575- LOGD (" Expected barcode found!" );
575+ // LOGD ("Expected barcode found!");
576576 }
577577 }
578578
@@ -587,46 +587,46 @@ void SyncStream::predictNextBarcodeStart(const HarpBarcode& barcode)
587587
588588void SyncStream::attemptBarcodeDecoding ()
589589{
590- LOGD (" Attempting Harp barcode decoding for stream " , streamKey);
590+ // LOGD ("Attempting Harp barcode decoding for stream ", streamKey);
591591
592592 if (completedBarcodes.size () == 0 )
593593 {
594- LOGD (" No completed barcodes yet." );
594+ // LOGD (" No completed barcodes yet.");
595595 numDecodingAttempts += 1 ;
596596 return ;
597597 }
598598 else
599599 {
600- LOGD (" Completed barcodes: " , completedBarcodes.size ());
600+ // LOGD (" Completed barcodes: ", completedBarcodes.size());
601601 }
602602
603603 // decode last barcode
604604 if (harpDecoder.decodeBarcode (completedBarcodes.back (), expectedSampleRate))
605605 {
606- LOGD (" Successful decoding...setting isHarpStream to true." );
606+ // LOGD ("Successful decoding...setting isHarpStream to true.");
607607 isHarpStream = true ;
608608 isSynchronized = true ;
609609
610610
611611 // Validate timing
612612 if (!validateBarcodeTimestamp (completedBarcodes.back ()))
613613 {
614- LOGD (" Non-consecutive barcodes, clearing completed barcodes" );
614+ // LOGD ("Non-consecutive barcodes, clearing completed barcodes");
615615 completedBarcodes.clear ();
616616 }
617617 }
618618 else
619619 {
620- LOGD (" Unsuccessful decoding" );
620+ // LOGD ("Unsuccessful decoding");
621621
622622 if (completedBarcodes.size () == 0 )
623623 {
624- LOGD (" No completed barcodes, setting Harp detection to false" );
624+ // LOGD ("No completed barcodes, setting Harp detection to false");
625625 harpDetectionActive = false ;
626626 }
627627 else
628628 {
629- LOGD (" Previous completed barcodes, keeping Harp detection active" );
629+ // LOGD ("Previous completed barcodes, keeping Harp detection active");
630630 }
631631
632632 }
@@ -648,11 +648,11 @@ void SyncStream::syncWithHarp()
648648
649649 if (std::abs (estimatedSampleRate - expectedSampleRate) / expectedSampleRate < 0.05 )
650650 {
651- LOGD (" Estimated sample rate from Harp barcodes: " , estimatedSampleRate);
651+ // LOGD ("Estimated sample rate from Harp barcodes: ", estimatedSampleRate);
652652 actualSampleRate = estimatedSampleRate;
653653
654654 // Calculate global start time
655- LOGD (" Estimated global start time: " , double (firstBarcode.encodedTime ) - firstBarcode.localStartTimestamp );
655+ // LOGD ("Estimated global start time: ", double (firstBarcode.encodedTime) - firstBarcode.localStartTimestamp);
656656 globalStartTime = (double (firstBarcode.encodedTime ) - firstBarcode.localStartTimestamp ) / 1000 ;
657657 baselineMatchingPulse.globalTimestamp = double (firstBarcode.encodedTime );
658658 baselineMatchingPulse.localSampleNumber = firstBarcode.localStartSample ;
@@ -661,7 +661,7 @@ void SyncStream::syncWithHarp()
661661
662662 isSynchronized = true ;
663663
664- LOGD (" Harp stream " , streamKey, " synchronized. Sample rate: " , actualSampleRate, " , start time: " , globalStartTime);
664+ // LOGD ("Harp stream ", streamKey, " synchronized. Sample rate: ", actualSampleRate, ", start time: ", globalStartTime);
665665 }
666666
667667}
0 commit comments