Commits

Aleksey Kunitskiy committed c996989

Added verbose mode switch

Comments (0)

Files changed (1)

   T _signalNormFactor;
   bool _rms;
 
+  bool _verbose;
+  std::ostream& _vOutput;
+
   unsigned _popSkip;
 
   float _obSizeParam;
         if (popBufferStatus == JackPipe::JackLoopBufferManager<T>::ib_end)
           std::fill_n(outBufs[0], nframes, 0.0f);
         float rms = JackPipe::rmsPower<float>(inBufs[0], nframes);
-        std::cerr << "rms " << rms << std::endl;
+        if (_verbose)
+          _vOutput << "rms " << rms << std::endl;
         if (rms > _obSizeParam)
         {
-          std::cerr << "push ok" <<  std::endl;
+          if (_verbose)
+            _vOutput << "push ok" <<  std::endl;
           pushBufferStatus = _jlbm->push(inBufs[0], nframes);
           if (pushBufferStatus == JackPipe::JackLoopBufferManager<T>::ob_full)
           {
-            std::cerr << "ob_end" << std::endl;
+            if (_verbose)
+              _vOutput << "ob_end" << std::endl;
             return 1;
           }
           return 0;
       float obSizeParam,
       unsigned jackPhysicalInPort = 0,
       unsigned jackPhysicalOutPort = 0,
-      bool rms = true ) :
+      bool rms = true,
+      bool verbose = false,
+      std::ostream& vOutput = std::cerr ) :
     JackCpp::AudioIO("AAT frequency response loop", 1, 1, false),
     _wF(window.c_str()),
     _rms(rms),
+    _verbose(verbose),
+    _vOutput(vOutput),
     _popSkip(5),
     _obSizeParam(obSizeParam),
     _jackPhysicalInPort(jackPhysicalInPort),
     JackPipe::Vector<T>::scaleVecMul(_fr, _signalNormFactor / _wF.getDensityFactor());
 
     // debug stuff
-    std::cerr << "buffer size " << _lFftG->getBufferSize() << std::endl;
-    std::cerr << "pushed size " << _jlbm->getPushedSize() << std::endl;
-    JackPipe::Vector<T>::saveAscii("b.dat", _b, _lFftG->getBufferSize());
-    JackPipe::Vector<T>::saveAscii("ob.dat", _ob, _jlbm->getPushedSize());
-    
+    if (_verbose)
+    {
+      _vOutput << "buffer size " << _lFftG->getBufferSize() << std::endl;
+      _vOutput << "pushed size " << _jlbm->getPushedSize() << std::endl;
+    }
+    //JackPipe::Vector<T>::saveAscii("b.dat", _b, _lFftG->getBufferSize());
+    //JackPipe::Vector<T>::saveAscii("ob.dat", _ob, _jlbm->getPushedSize());
   }
 
 };
     ( "p", "base2approx", "Make signal/input buffers sizes power-of-2", false );
   TP::SwitchArg rmsStartStop
     ( "r", "rmsstartstop", "Signal start/stop markers calculated by maximum noise RMS value", false );
+  TP::SwitchArg bVerbose
+    ( "v", "verbose", "Verbose mode", false );
   TP::ValueArg<float> outBufferSize
     ( "b", "outbuffer", "Output buffer size in case if --rmsstartstop not set, otherwise time in seconds to measure noise RMS",
       false, 1.0f, "number" );
     cmd.add(jackOutPortPhysical);
     cmd.add(recalibrationFilePath);
     cmd.add(frOutputFilePath);
+    cmd.add(bVerbose);
 
     cmd.parse(argc, argv);
 
           rms,
           jackInPortPhysical.getValue(),
           jackOutPortPhysical.getValue(),
-          true
+          true,
+          bVerbose.getValue()
          );
 
       aatfrl.run();
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.