From 03ffd3717c46bc57660b9b60552cc776e62ffa69 Mon Sep 17 00:00:00 2001
From: Per Lindgren <per.lindgren@ltu.se>
Date: Sat, 23 May 2020 20:41:59 +0200
Subject: [PATCH] DBG instead of logger

---
 Source/PluginEditor.cpp    | 12 +++---------
 Source/PluginEditor.h      | 10 +++++-----
 Source/PluginProcessor.cpp | 22 ++++++++--------------
 Source/PluginProcessor.h   |  5 -----
 4 files changed, 16 insertions(+), 33 deletions(-)

diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp
index 584a0f8..2273d9e 100644
--- a/Source/PluginEditor.cpp
+++ b/Source/PluginEditor.cpp
@@ -34,11 +34,8 @@ Test2AudioProcessorEditor::Test2AudioProcessorEditor(Test2AudioProcessor &p)
   setResizable(true, true);
   setResizeLimits(400, 300, 1024, 1024);
   setSize(400, 300);
-  if (processor.m_flogger)
-  {
 
-    processor.m_flogger->logMessage("Editor initialized");
-  }
+  DBG("Editor initialized");
 }
 
 Test2AudioProcessorEditor::~Test2AudioProcessorEditor()
@@ -69,9 +66,6 @@ void Test2AudioProcessorEditor::resized()
   timecodeDisplayLabel.setBounds(bounds.removeFromTop(26));
   posSlider.setBounds(100, 30, getWidth() - 120, 20);
 
-  if (processor.m_flogger)
-  {
-    processor.m_flogger->logMessage(bounds.toString());
-    processor.m_flogger->logMessage(std::to_string(processor.buf_size));
-  }
+  DBG("bounds " + bounds.toString());
+  DBG("buf_size" + std::to_string(processor.buf_size));
 }
diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h
index a08697d..1dc0d68 100644
--- a/Source/PluginEditor.h
+++ b/Source/PluginEditor.h
@@ -32,11 +32,11 @@ private:
 
   void sliderValueChanged(juce::Slider *slider) override
   {
-    if (slider == &posSlider)
-    {
-      if (processor.m_flogger)
-        processor.m_flogger->logMessage("slider changed");
-    }
+    DBG("slider changed");
+    // if (slider == &posSlider)
+    //   durationSlider.setValue(1.0 / frequencySlider.getValue(), dontSendNotification);
+    // else if (slider == &durationSlider)
+    //   frequencySlider.setValue(1.0 / durationSlider.getValue(), dontSendNotification);
   }
 
   // is this the way
diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp
index fe2af35..fcf1bfa 100644
--- a/Source/PluginProcessor.cpp
+++ b/Source/PluginProcessor.cpp
@@ -15,7 +15,6 @@ Test2AudioProcessor::Test2AudioProcessor()
                          .withInput("Input", juce::AudioChannelSet::stereo(), true)
                          .withOutput("Output", juce::AudioChannelSet::stereo(), true))
 {
-    m_flogger = std::unique_ptr<juce::FileLogger>(juce::FileLogger::createDateStampedLogger("foo", "mylog", ".txt", "Welcome to plugin"));
 
     position = 0;
     lastPosInfo.resetToDefault();
@@ -26,8 +25,7 @@ Test2AudioProcessor::Test2AudioProcessor()
                                                       1.0f,      // maximum value
                                                       0.5f));    // default value
 
-    if (m_flogger)
-        m_flogger->logMessage("PluginProcessor");
+    DBG("PluginProcessor");
 }
 
 Test2AudioProcessor::~Test2AudioProcessor()
@@ -47,7 +45,6 @@ bool Test2AudioProcessor::acceptsMidi() const
 
 bool Test2AudioProcessor::producesMidi() const
 {
-    // Should that be true for automation parameters?
     return true;
 }
 
@@ -171,16 +168,13 @@ void Test2AudioProcessor::processBlock(juce::AudioBuffer<float> &buffer, juce::M
                     break;
                 }
             };
-            if (m_flogger)
-            {
-                m_flogger->logMessage(msg.getDescription());
-                m_flogger->logMessage("pos " + std::to_string(position));
-                //for (int i = 0; i < msg.getRawDataSize(); i++)
-                //{
-                //    juce::uint8 val = msg.getRawData()[i];
-                //    m_flogger->logMessage(std::to_string(val));
-                //};
-            };
+            DBG("Desc" + msg.getDescription());
+            DBG("pos " + std::to_string(position));
+            //for (int i = 0; i < msg.getRawDataSize(); i++)
+            //{
+            //    juce::uint8 val = msg.getRawData()[i];
+            //    m_flogger->logMessage(std::to_string(val));
+            //};
         };
     };
 
diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h
index 8734c2c..3e5545a 100644
--- a/Source/PluginProcessor.h
+++ b/Source/PluginProcessor.h
@@ -23,11 +23,7 @@ public:
   //==============================================================================
   void prepareToPlay(double sampleRate, int samplesPerBlock) override;
   void releaseResources() override;
-
-#ifndef JucePlugin_PreferredChannelConfigurations
   bool isBusesLayoutSupported(const BusesLayout &layouts) const override;
-#endif
-
   void processBlock(juce::AudioBuffer<float> &, juce::MidiBuffer &) override;
 
   //==============================================================================
@@ -53,7 +49,6 @@ public:
   void getStateInformation(juce::MemoryBlock &destData) override;
   void setStateInformation(const void *data, int sizeInBytes) override;
 
-  std::unique_ptr<juce::FileLogger> m_flogger;
   int position;
   // this keeps a copy of the last set of time info that was acquired during an audio
   // callback - the UI component will read this and display it.
-- 
GitLab