From bdc29f10116235f4e679dc4ad86fc747b33dca7b Mon Sep 17 00:00:00 2001
From: jsiegle <jsiegle@mit.edu>
Date: Tue, 18 Jun 2013 21:32:03 -0400
Subject: [PATCH] Run astyle to clean up formatting

---
 Source/Processors/ChannelMappingNode.cpp      |  79 ++--
 Source/Processors/DataThreads/DataThread.cpp  |   4 +-
 Source/Processors/DataThreads/FPGAThread.cpp  |   2 +-
 .../DataThreads/FileReaderThread.cpp          |   2 +-
 .../Processors/DataThreads/RHD2000Thread.cpp  | 406 +++++++++---------
 Source/Processors/DataThreads/RHD2000Thread.h |   4 +-
 .../Editors/ChannelMappingEditor.cpp          |  92 ++--
 .../Processors/Editors/ChannelMappingEditor.h |  10 +-
 Source/Processors/Editors/ChannelSelector.cpp |  14 +-
 Source/Processors/Editors/ChannelSelector.h   |  14 +-
 .../Processors/Editors/FileReaderEditor.cpp   |  92 ++--
 Source/Processors/Editors/FileReaderEditor.h  |  12 +-
 Source/Processors/Editors/FilterEditor.cpp    |  24 +-
 Source/Processors/Editors/FilterEditor.h      |   4 +-
 Source/Processors/Editors/GenericEditor.cpp   |  25 +-
 Source/Processors/Editors/ParameterEditor.cpp |  16 +-
 .../Editors/PhaseDetectorEditor.cpp           |  14 +-
 .../Processors/Editors/PhaseDetectorEditor.h  |   2 +-
 .../Editors/PulsePalOutputEditor.cpp          |   7 +-
 Source/Processors/Editors/RHD2000Editor.cpp   |  48 ++-
 .../Editors/ReferenceNodeEditor.cpp           |  14 +-
 .../Processors/Editors/ReferenceNodeEditor.h  |   2 +-
 .../Processors/Editors/ResamplingNodeEditor.h |   2 +-
 .../Editors/SpikeDetectorEditor.cpp           |  14 +-
 .../Processors/Editors/SpikeDetectorEditor.h  |   2 +-
 .../Processors/Editors/VisualizerEditor.cpp   |  28 +-
 Source/Processors/Editors/WiFiOutputEditor.h  |   2 +-
 Source/Processors/FileReader.cpp              |  54 +--
 Source/Processors/FileReader.h                |   6 +-
 Source/Processors/FilterNode.cpp              |  22 +-
 Source/Processors/FilterNode.h                |   2 +-
 Source/Processors/GenericProcessor.cpp        |  60 +--
 Source/Processors/GenericProcessor.h          |   7 +-
 Source/Processors/LfpDisplayNode.cpp          |  19 +-
 Source/Processors/PhaseDetector.cpp           |  50 +--
 Source/Processors/PhaseDetector.h             |   6 +-
 Source/Processors/ProcessorGraph.cpp          |   6 +-
 Source/Processors/ProcessorGraph.h            |   2 +-
 Source/Processors/PulsePalOutput.cpp          |  10 +-
 Source/Processors/PulsePalOutput.h            |   2 +-
 Source/Processors/RecordNode.cpp              |  38 +-
 Source/Processors/RecordNode.h                |   9 +-
 Source/Processors/ReferenceNode.cpp           |   6 +-
 Source/Processors/Serial/PulsePal.cpp         | 170 ++++----
 Source/Processors/Serial/PulsePal.h           |  42 +-
 Source/Processors/SourceNode.cpp              |  25 +-
 Source/Processors/SourceNode.h                |   4 +-
 Source/Processors/SpikeDetector.cpp           |  35 +-
 .../Visualization/LfpDisplayCanvas.cpp        | 222 ++++++----
 .../Visualization/LfpDisplayCanvas.h          |  14 +-
 .../Visualization/SpikeDisplayCanvas.cpp      | 150 ++++---
 .../Visualization/SpikeDisplayCanvas.h        |   9 +-
 .../Processors/Visualization/SpikeObject.cpp  |  10 +-
 Source/UI/ControlPanel.cpp                    |  12 +-
 Source/UI/EditorViewport.cpp                  |  27 +-
 Source/UI/ProcessorList.cpp                   |   2 +-
 Source/UI/UIComponent.cpp                     |  22 +-
 57 files changed, 1041 insertions(+), 937 deletions(-)

diff --git a/Source/Processors/ChannelMappingNode.cpp b/Source/Processors/ChannelMappingNode.cpp
index 536d47bde..61fa6c81b 100644
--- a/Source/Processors/ChannelMappingNode.cpp
+++ b/Source/Processors/ChannelMappingNode.cpp
@@ -30,14 +30,14 @@
 ChannelMappingNode::ChannelMappingNode()
     : GenericProcessor("Channel Mapping"), channelBuffer(1,10000)
 {
-	referenceArray.resize(1024); // make room for 1024 channels
-	channelArray.resize(1024);
+    referenceArray.resize(1024); // make room for 1024 channels
+    channelArray.resize(1024);
 
-	for (int i = 0; i < referenceArray.size(); i++)
-	{
-		referenceArray.set(i, -1);
-		channelArray.set(i, i);
-	}
+    for (int i = 0; i < referenceArray.size(); i++)
+    {
+        referenceArray.set(i, -1);
+        channelArray.set(i, i);
+    }
 
 }
 
@@ -59,67 +59,68 @@ AudioProcessorEditor* ChannelMappingNode::createEditor()
 
 void ChannelMappingNode::updateSettings()
 {
-	if (getNumInputs() > 0)
-		channelBuffer.setSize(getNumInputs(), 10000);
+    if (getNumInputs() > 0)
+        channelBuffer.setSize(getNumInputs(), 10000);
 
 }
 
 
 void ChannelMappingNode::setParameter(int parameterIndex, float newValue)
 {
-    
+
     if (parameterIndex == 1)
     {
-    	referenceArray.set(currentChannel, (int) newValue);
-    } else
+        referenceArray.set(currentChannel, (int) newValue);
+    }
+    else
     {
-    	channelArray.set(currentChannel, (int) newValue);
+        channelArray.set(currentChannel, (int) newValue);
     }
 
 }
 
 void ChannelMappingNode::process(AudioSampleBuffer& buffer,
-                            MidiBuffer& midiMessages,
-                            int& nSamples)
+                                 MidiBuffer& midiMessages,
+                                 int& nSamples)
 {
 
-	// use copy constructor to set the data to refer to
-	channelBuffer = buffer;
+    // use copy constructor to set the data to refer to
+    channelBuffer = buffer;
 
-	// copy it back into the buffer according to the channel mapping
-	buffer.clear();
+    // copy it back into the buffer according to the channel mapping
+    buffer.clear();
 
-	for (int i = 0; i < buffer.getNumChannels(); i++)
-	{
-		buffer.addFrom(i, // destChannel
+    for (int i = 0; i < buffer.getNumChannels(); i++)
+    {
+        buffer.addFrom(i, // destChannel
                        0, // destStartSample
                        channelBuffer, // source
                        channelArray[i], // sourceChannel
                        0, // sourceStartSample
                        nSamples, // numSamples
                        1.0f // gain to apply to source (positive for original signal)
-                       );
+                      );
 
-	}
+    }
 
-	// now do the referencing
-	for (int i = 0; i < buffer.getNumChannels(); i++)
-	{
+    // now do the referencing
+    for (int i = 0; i < buffer.getNumChannels(); i++)
+    {
 
-		if (referenceArray[i] > -1)
-		{
+        if (referenceArray[i] > -1)
+        {
 
-			buffer.addFrom(i, // destChannel
-                       0, // destStartSample
-                       channelBuffer, // source
-                       referenceArray[i], // sourceChannel
-                       0, // sourceStartSample
-                       nSamples, // numSamples
-                       -1.0f // gain to apply to source (negative for reference)
-                       );
-		}
+            buffer.addFrom(i, // destChannel
+                           0, // destStartSample
+                           channelBuffer, // source
+                           referenceArray[i], // sourceChannel
+                           0, // sourceStartSample
+                           nSamples, // numSamples
+                           -1.0f // gain to apply to source (negative for reference)
+                          );
+        }
 
-	}
+    }
 
 }
 
diff --git a/Source/Processors/DataThreads/DataThread.cpp b/Source/Processors/DataThreads/DataThread.cpp
index 450e27b93..aeebad2b5 100755
--- a/Source/Processors/DataThreads/DataThread.cpp
+++ b/Source/Processors/DataThreads/DataThread.cpp
@@ -31,8 +31,8 @@ DataThread::DataThread(SourceNode* s) : Thread("Data Thread"), dataBuffer(0)
     setPriority(10);
 
     timestamp = 0; // set default to zero, so that sources that
-                   // do not generate their own timestamps can simply increment
-                   // this value
+    // do not generate their own timestamps can simply increment
+    // this value
 
 }
 
diff --git a/Source/Processors/DataThreads/FPGAThread.cpp b/Source/Processors/DataThreads/FPGAThread.cpp
index 280ea4c2a..9f61020e9 100644
--- a/Source/Processors/DataThreads/FPGAThread.cpp
+++ b/Source/Processors/DataThreads/FPGAThread.cpp
@@ -316,7 +316,7 @@ bool FPGAThread::updateBuffer()
                 //             "     Bytes read: " << bytesToRead << std::endl;
             }
 
-            unsigned char timecode[6]; 
+            unsigned char timecode[6];
             timecode[0] = (pBuffer[j] >> 1) | ((pBuffer[j+1] >> 1) << 7); // 1st byte throw out last bit of each byte and just concatenate the other bytes in ascending order
             timecode[1] = (pBuffer[j+1] >> 2) | ((pBuffer[j+2] >> 1) << 6); // 2nd byte
             timecode[2] = (pBuffer[j+2] >> 3) | ((pBuffer[j+3] >> 1) << 5); // 3rd byte
diff --git a/Source/Processors/DataThreads/FileReaderThread.cpp b/Source/Processors/DataThreads/FileReaderThread.cpp
index 64fb0928f..8461db153 100755
--- a/Source/Processors/DataThreads/FileReaderThread.cpp
+++ b/Source/Processors/DataThreads/FileReaderThread.cpp
@@ -143,7 +143,7 @@ bool FileReaderThread::updateBuffer()
             {
 
                 timestamp++; // = (0 << 0) + (0 << 8) + (0 << 16) + (0 << 24); // +
-                            //(4 << 32); // + (3 << 40) + (2 << 48) + (1 << 56);
+                //(4 << 32); // + (3 << 40) + (2 << 48) + (1 << 56);
 
                 //timestamp++; // = timer.getHighResolutionTicks();
                 dataBuffer->addToBuffer(thisSample, &timestamp, &eventCode, 1);
diff --git a/Source/Processors/DataThreads/RHD2000Thread.cpp b/Source/Processors/DataThreads/RHD2000Thread.cpp
index 66cbc03ef..da972f5da 100644
--- a/Source/Processors/DataThreads/RHD2000Thread.cpp
+++ b/Source/Processors/DataThreads/RHD2000Thread.cpp
@@ -236,13 +236,13 @@ void RHD2000Thread::scanPorts()
         // Record delay settings that yield good communication with the chip.
         for (stream = 0; stream < MAX_NUM_DATA_STREAMS; ++stream)//MAX_NUM_DATA_STREAMS; ++stream)
         {
-           // std::cout << "Stream number " << stream << ", delay = " << delay << std::endl;
+            // std::cout << "Stream number " << stream << ", delay = " << delay << std::endl;
 
             id = deviceId(dataBlock, stream);
-            
+
             if (id > 0) // 1 = RHD2132, 2 = RHD2216
             {
-              //  std::cout << "Device ID found: " << id << std::endl;
+                //  std::cout << "Device ID found: " << id << std::endl;
 
                 sumGoodDelays.set(stream,sumGoodDelays[stream] + 1);
 
@@ -374,32 +374,32 @@ int RHD2000Thread::getNumChannels()
 
     for (int i = 0; i < MAX_NUM_DATA_STREAMS; i++)
     {
-    
+
         if (numChannelsPerDataStream[i] > 0)
         {
             numChannels += numChannelsPerDataStream[i];
             numChannels += 3; // to account for aux inputs
         }
 
-		
-		/*
-		if (chipRegisters->adcAux1En){ // no public function to read these? fix this in some way
-			numChannels += 1;
-		}
-		if (chipRegisters->adcAux2En){
-			numChannels += 1;
-		}
-		if (chipRegisters->adcAux3En){
-			numChannels += 1;
-		}
-		*/
-	}
+
+        /*
+        if (chipRegisters->adcAux1En){ // no public function to read these? fix this in some way
+        	numChannels += 1;
+        }
+        if (chipRegisters->adcAux2En){
+        	numChannels += 1;
+        }
+        if (chipRegisters->adcAux3En){
+        	numChannels += 1;
+        }
+        */
+    }
 
 
     if (acquireAdcChannels)
     {
         numChannels += 8; // add 8 channels for the ADCs
-    }        
+    }
 
     if (numChannels > 0)
         return numChannels;
@@ -414,7 +414,7 @@ void RHD2000Thread::updateChannelNames()
 
     for (int i = 0; i < MAX_NUM_DATA_STREAMS; i++)
     {
-    
+
         for (int j = 0; j < numChannelsPerDataStream[i]; j++)
         {
             chNum++;
@@ -427,17 +427,17 @@ void RHD2000Thread::updateChannelNames()
     {
         for (int i = 0; i < MAX_NUM_DATA_STREAMS; i++)
         {
-        
+
             for (int j = 0; j < 3; j++)
             {
-                
+
                 chNum++;
 
                 String chName = "AUX";
                 chName += (j+1);
 
-              // this is causing a seg fault for some reason:
-              //  sn->channels[chNum]->setName(chName);
+                // this is causing a seg fault for some reason:
+                //  sn->channels[chNum]->setName(chName);
             }
         }
     }
@@ -452,9 +452,9 @@ void RHD2000Thread::updateChannelNames()
             String chName = "ADC";
             chName += (j+1);
 
-          //  sn->channels[chNum]->setName(chName);
+            //  sn->channels[chNum]->setName(chName);
         }
-    }        
+    }
 
 }
 
@@ -471,7 +471,7 @@ float RHD2000Thread::getSampleRate()
 
 float RHD2000Thread::getBitVolts()
 {
-	return 0.195f;
+    return 0.195f;
 }
 
 double RHD2000Thread::setUpperBandwidth(double upper)
@@ -519,7 +519,7 @@ bool RHD2000Thread::enableHeadstage(int hsNum, bool enabled)
     for (int i = 0; i < MAX_NUM_DATA_STREAMS; i++)
     {
         std::cout << numChannelsPerDataStream[i] << " ";
-    } 
+    }
 
     std:: cout << std::endl;
 
@@ -549,15 +549,16 @@ void RHD2000Thread::assignAudioOut(int dacChannel, int dataChannel)
         audioOutputR = dataChannel;
 
 
-    } else if (dacChannel == 1)
+    }
+    else if (dacChannel == 1)
     {
         audioOutputL = dataChannel;
 
     }
 
     dacOutputShouldChange = true; // set a flag and take care of setting wires
-                                  // during the updateBuffer() method
-                                  // to avoid problems
+    // during the updateBuffer() method
+    // to avoid problems
 
 }
 
@@ -577,101 +578,102 @@ void RHD2000Thread::setSampleRate(int sampleRateIndex, bool isTemporary)
     {
         savedSampleRateIndex = sampleRateIndex;
     }
- 
+
     int numUsbBlocksToRead = 0; // placeholder - make this change the number of blocks that are read in RHD2000Thread::updateBuffer()
 
     Rhd2000EvalBoard::AmplifierSampleRate sampleRate; // just for local use
 
-    switch (sampleRateIndex) {
-    case 0:
-        sampleRate = Rhd2000EvalBoard::SampleRate1000Hz;
-        numUsbBlocksToRead = 1;
-        boardSampleRate = 1000.0f;
-        break;
-    case 1:
-        sampleRate = Rhd2000EvalBoard::SampleRate1250Hz;
-        numUsbBlocksToRead = 1;
-        boardSampleRate = 1250.0f;
-        break;
-    case 2:
-        sampleRate = Rhd2000EvalBoard::SampleRate1500Hz;
-        numUsbBlocksToRead = 1;
-        boardSampleRate = 1500.0f;
-        break;
-    case 3:
-        sampleRate = Rhd2000EvalBoard::SampleRate2000Hz;
-        numUsbBlocksToRead = 1;
-        boardSampleRate = 2000.0f;
-        break;
-    case 4:
-        sampleRate = Rhd2000EvalBoard::SampleRate2500Hz;
-        numUsbBlocksToRead = 1;
-        boardSampleRate = 2500.0f;
-        break;
-    case 5:
-        sampleRate = Rhd2000EvalBoard::SampleRate3000Hz;
-        numUsbBlocksToRead = 2;
-        boardSampleRate = 3000.0f;
-        break;
-    case 6:
-        sampleRate = Rhd2000EvalBoard::SampleRate3333Hz;
-        numUsbBlocksToRead = 2;
-        boardSampleRate = 3333.0f;
-        break;
-    case 7:
-        sampleRate = Rhd2000EvalBoard::SampleRate4000Hz;
-        numUsbBlocksToRead = 2;
-        boardSampleRate = 4000.0f;
-        break;
-    case 8:
-        sampleRate = Rhd2000EvalBoard::SampleRate5000Hz;
-        numUsbBlocksToRead = 3;
-        boardSampleRate = 5000.0f;
-        break;
-    case 9:
-        sampleRate = Rhd2000EvalBoard::SampleRate6250Hz;
-        numUsbBlocksToRead = 3;
-        boardSampleRate = 6250.0f;
-        break;
-    case 10:
-        sampleRate = Rhd2000EvalBoard::SampleRate8000Hz;
-        numUsbBlocksToRead = 4;
-        boardSampleRate = 8000.0f;
-        break;
-    case 11:
-        sampleRate = Rhd2000EvalBoard::SampleRate10000Hz;
-        numUsbBlocksToRead = 6;
-        boardSampleRate = 10000.0f;
-        break;
-    case 12:
-        sampleRate = Rhd2000EvalBoard::SampleRate12500Hz;
-        numUsbBlocksToRead = 7;
-        boardSampleRate = 12500.0f;
-        break;
-    case 13:
-        sampleRate = Rhd2000EvalBoard::SampleRate15000Hz;
-        numUsbBlocksToRead = 8;
-        boardSampleRate = 15000.0f;
-        break;
-    case 14:
-        sampleRate = Rhd2000EvalBoard::SampleRate20000Hz;
-        numUsbBlocksToRead = 12;
-        boardSampleRate = 20000.0f;
-        break;
-    case 15:
-        sampleRate = Rhd2000EvalBoard::SampleRate25000Hz;
-        numUsbBlocksToRead = 14;
-        boardSampleRate = 25000.0f;
-        break;
-    case 16:
-        sampleRate = Rhd2000EvalBoard::SampleRate30000Hz;
-        numUsbBlocksToRead = 16;
-        boardSampleRate = 30000.0f;
-        break;
-    default:
-        sampleRate = Rhd2000EvalBoard::SampleRate10000Hz;
-        numUsbBlocksToRead = 6;
-        boardSampleRate = 10000.0f;
+    switch (sampleRateIndex)
+    {
+        case 0:
+            sampleRate = Rhd2000EvalBoard::SampleRate1000Hz;
+            numUsbBlocksToRead = 1;
+            boardSampleRate = 1000.0f;
+            break;
+        case 1:
+            sampleRate = Rhd2000EvalBoard::SampleRate1250Hz;
+            numUsbBlocksToRead = 1;
+            boardSampleRate = 1250.0f;
+            break;
+        case 2:
+            sampleRate = Rhd2000EvalBoard::SampleRate1500Hz;
+            numUsbBlocksToRead = 1;
+            boardSampleRate = 1500.0f;
+            break;
+        case 3:
+            sampleRate = Rhd2000EvalBoard::SampleRate2000Hz;
+            numUsbBlocksToRead = 1;
+            boardSampleRate = 2000.0f;
+            break;
+        case 4:
+            sampleRate = Rhd2000EvalBoard::SampleRate2500Hz;
+            numUsbBlocksToRead = 1;
+            boardSampleRate = 2500.0f;
+            break;
+        case 5:
+            sampleRate = Rhd2000EvalBoard::SampleRate3000Hz;
+            numUsbBlocksToRead = 2;
+            boardSampleRate = 3000.0f;
+            break;
+        case 6:
+            sampleRate = Rhd2000EvalBoard::SampleRate3333Hz;
+            numUsbBlocksToRead = 2;
+            boardSampleRate = 3333.0f;
+            break;
+        case 7:
+            sampleRate = Rhd2000EvalBoard::SampleRate4000Hz;
+            numUsbBlocksToRead = 2;
+            boardSampleRate = 4000.0f;
+            break;
+        case 8:
+            sampleRate = Rhd2000EvalBoard::SampleRate5000Hz;
+            numUsbBlocksToRead = 3;
+            boardSampleRate = 5000.0f;
+            break;
+        case 9:
+            sampleRate = Rhd2000EvalBoard::SampleRate6250Hz;
+            numUsbBlocksToRead = 3;
+            boardSampleRate = 6250.0f;
+            break;
+        case 10:
+            sampleRate = Rhd2000EvalBoard::SampleRate8000Hz;
+            numUsbBlocksToRead = 4;
+            boardSampleRate = 8000.0f;
+            break;
+        case 11:
+            sampleRate = Rhd2000EvalBoard::SampleRate10000Hz;
+            numUsbBlocksToRead = 6;
+            boardSampleRate = 10000.0f;
+            break;
+        case 12:
+            sampleRate = Rhd2000EvalBoard::SampleRate12500Hz;
+            numUsbBlocksToRead = 7;
+            boardSampleRate = 12500.0f;
+            break;
+        case 13:
+            sampleRate = Rhd2000EvalBoard::SampleRate15000Hz;
+            numUsbBlocksToRead = 8;
+            boardSampleRate = 15000.0f;
+            break;
+        case 14:
+            sampleRate = Rhd2000EvalBoard::SampleRate20000Hz;
+            numUsbBlocksToRead = 12;
+            boardSampleRate = 20000.0f;
+            break;
+        case 15:
+            sampleRate = Rhd2000EvalBoard::SampleRate25000Hz;
+            numUsbBlocksToRead = 14;
+            boardSampleRate = 25000.0f;
+            break;
+        case 16:
+            sampleRate = Rhd2000EvalBoard::SampleRate30000Hz;
+            numUsbBlocksToRead = 16;
+            boardSampleRate = 30000.0f;
+            break;
+        default:
+            sampleRate = Rhd2000EvalBoard::SampleRate10000Hz;
+            numUsbBlocksToRead = 6;
+            boardSampleRate = 10000.0f;
     }
 
 
@@ -680,7 +682,7 @@ void RHD2000Thread::setSampleRate(int sampleRateIndex, bool isTemporary)
 
     std::cout << "Sample rate set to " << evalBoard->getSampleRate() << std::endl;
 
-     // Now that we have set our sampling rate, we can set the MISO sampling delay
+    // Now that we have set our sampling rate, we can set the MISO sampling delay
     // which is dependent on the sample rate.
     evalBoard->setCableLengthMeters(Rhd2000EvalBoard::PortA, cableLengthPortA);
     evalBoard->setCableLengthMeters(Rhd2000EvalBoard::PortB, cableLengthPortB);
@@ -691,7 +693,7 @@ void RHD2000Thread::setSampleRate(int sampleRateIndex, bool isTemporary)
 
 void RHD2000Thread::updateRegisters()
 {
-       // Set up an RHD2000 register object using this sample rate to
+    // Set up an RHD2000 register object using this sample rate to
     // optimize MUX-related register settings.
     chipRegisters.defineSampleRate(boardSampleRate);
 
@@ -722,18 +724,18 @@ void RHD2000Thread::updateRegisters()
 
     // Before generating register configuration command sequences, set amplifier
     // bandwidth paramters.
-     actualDspCutoffFreq = chipRegisters.setDspCutoffFreq(desiredDspCutoffFreq);
-     actualLowerBandwidth = chipRegisters.setLowerBandwidth(desiredLowerBandwidth);
-     actualUpperBandwidth = chipRegisters.setUpperBandwidth(desiredUpperBandwidth);
-     chipRegisters.enableDsp(dspEnabled);
+    actualDspCutoffFreq = chipRegisters.setDspCutoffFreq(desiredDspCutoffFreq);
+    actualLowerBandwidth = chipRegisters.setLowerBandwidth(desiredLowerBandwidth);
+    actualUpperBandwidth = chipRegisters.setUpperBandwidth(desiredUpperBandwidth);
+    chipRegisters.enableDsp(dspEnabled);
 
-     // turn on aux inputs
+    // turn on aux inputs
     chipRegisters.enableAux1(true);
     chipRegisters.enableAux2(true);
     chipRegisters.enableAux3(true);
 
-     chipRegisters.createCommandListRegisterConfig(commandList, true);
-        // Upload version with ADC calibration to AuxCmd3 RAM Bank 0.
+    chipRegisters.createCommandListRegisterConfig(commandList, true);
+    // Upload version with ADC calibration to AuxCmd3 RAM Bank 0.
     evalBoard->uploadCommandList(commandList, Rhd2000EvalBoard::AuxCmd3, 0);
     evalBoard->selectAuxCommandLength(Rhd2000EvalBoard::AuxCmd3, 0,
                                       commandSequenceLength - 1);
@@ -752,7 +754,7 @@ void RHD2000Thread::updateRegisters()
                                       commandSequenceLength - 1);
     chipRegisters.setFastSettle(false);
 
-    
+
 
     evalBoard->selectAuxCommandBank(Rhd2000EvalBoard::PortA, Rhd2000EvalBoard::AuxCmd3,
                                     fastSettleEnabled ? 2 : 1);
@@ -867,104 +869,108 @@ bool RHD2000Thread::updateBuffer()
     //cout << "Block size: " << blockSize << endl;
 
     bool return_code;
-	
 
-        if (evalBoard->numWordsInFifo() >= blockSize)
+
+    if (evalBoard->numWordsInFifo() >= blockSize)
+    {
+        return_code = evalBoard->readDataBlock(dataBlock);
+
+        for (int samp = 0; samp < dataBlock->getSamplesPerDataBlock(); samp++)
         {
-            return_code = evalBoard->readDataBlock(dataBlock);
+            int streamNumber = -1;
+            int channel = -1;
 
-            for (int samp = 0; samp < dataBlock->getSamplesPerDataBlock(); samp++)
+            // do the neural data channels first
+            for (int dataStream = 0; dataStream < MAX_NUM_DATA_STREAMS; dataStream++)
             {
-                int streamNumber = -1;
-                int channel = -1;
-
-                // do the neural data channels first
-                for (int dataStream = 0; dataStream < MAX_NUM_DATA_STREAMS; dataStream++)
+                if (numChannelsPerDataStream[dataStream] > 0)
                 {
-                    if (numChannelsPerDataStream[dataStream] > 0)
+                    streamNumber++;
+
+                    for (int chan = 0; chan < numChannelsPerDataStream[dataStream]; chan++)
                     {
-                        streamNumber++;
+                        //   std::cout << "reading sample stream" << streamNumber << " chan " << chan << " sample "<< samp << std::endl;
+                        channel++;
 
-                        for (int chan = 0; chan < numChannelsPerDataStream[dataStream]; chan++)
-                        {
-                         //   std::cout << "reading sample stream" << streamNumber << " chan " << chan << " sample "<< samp << std::endl;
-							channel++;
+                        int value = dataBlock->amplifierData[streamNumber][chan][samp];
 
-                            int value = dataBlock->amplifierData[streamNumber][chan][samp];
+                        thisSample[channel] = float(value-32768)*0.195f;
+                    }
 
-                            thisSample[channel] = float(value-32768)*0.195f;
-                        }
-					
-					}
+                }
 
-				}
+            }
 
-                streamNumber = -1;
+            streamNumber = -1;
 
-                // then do the ADC channels
-                for (int dataStream = 0; dataStream < MAX_NUM_DATA_STREAMS; dataStream++)
+            // then do the ADC channels
+            for (int dataStream = 0; dataStream < MAX_NUM_DATA_STREAMS; dataStream++)
+            {
+                if (numChannelsPerDataStream[dataStream] > 0)
                 {
-                    if (numChannelsPerDataStream[dataStream] > 0)
+                    streamNumber++;
+
+                    if (samp % 4 == 1)   // every 4th sample should have auxiliary input data
                     {
-                        streamNumber++;
 
-                        if (samp % 4 == 1) { // every 4th sample should have auxiliary input data
-                        
-                            channel++;
-                            thisSample[channel] = 0.0374 *
-                                 float(dataBlock->auxiliaryData[dataStream][1][samp+0]);
+                        channel++;
+                        thisSample[channel] = 0.0374 *
+                                              float(dataBlock->auxiliaryData[dataStream][1][samp+0]);
 
-                            auxBuffer[channel]=thisSample[channel];
+                        auxBuffer[channel]=thisSample[channel];
 
-                            channel++;
-                            thisSample[channel] = 0.0374 *
-                                 float(dataBlock->auxiliaryData[dataStream][1][samp+1]);
+                        channel++;
+                        thisSample[channel] = 0.0374 *
+                                              float(dataBlock->auxiliaryData[dataStream][1][samp+1]);
 
-                            auxBuffer[channel]=thisSample[channel];
+                        auxBuffer[channel]=thisSample[channel];
 
-                        
-                            channel++;
-                            thisSample[channel] = 0.0374 *
-                                 float(dataBlock->auxiliaryData[dataStream][1][samp+2]);
 
-                            auxBuffer[channel]=thisSample[channel];
+                        channel++;
+                        thisSample[channel] = 0.0374 *
+                                              float(dataBlock->auxiliaryData[dataStream][1][samp+2]);
 
-                        } else{ // repeat last values from buffer
+                        auxBuffer[channel]=thisSample[channel];
 
-                            channel++;
-                            thisSample[channel] = auxBuffer[channel];
-                            channel++;
-                            thisSample[channel] = auxBuffer[channel];
-                            channel++;
-                            thisSample[channel] = auxBuffer[channel];
-                        }
                     }
+                    else    // repeat last values from buffer
+                    {
 
+                        channel++;
+                        thisSample[channel] = auxBuffer[channel];
+                        channel++;
+                        thisSample[channel] = auxBuffer[channel];
+                        channel++;
+                        thisSample[channel] = auxBuffer[channel];
+                    }
                 }
 
-                // finally, loop through ADC channels if necessary
-                if (acquireAdcChannels)
+            }
+
+            // finally, loop through ADC channels if necessary
+            if (acquireAdcChannels)
+            {
+                for (int adcChan = 0; adcChan < 8; ++adcChan)
                 {
-                    for (int adcChan = 0; adcChan < 8; ++adcChan) {
-                    
+
                     channel++;
                     // ADC waveform units = volts
-                     thisSample[channel] = 
-                       0.000050354 * float(dataBlock->boardAdcData[adcChan][samp]);
-                    }
+                    thisSample[channel] =
+                        0.000050354 * float(dataBlock->boardAdcData[adcChan][samp]);
                 }
-				// std::cout << channel << std::endl;
+            }
+            // std::cout << channel << std::endl;
 
-				timestamp = dataBlock->timeStamp[samp];
-				timestamp = timestamp;
-				eventCode = dataBlock->ttlIn[samp];
+            timestamp = dataBlock->timeStamp[samp];
+            timestamp = timestamp;
+            eventCode = dataBlock->ttlIn[samp];
 
-				dataBuffer->addToBuffer(thisSample, &timestamp, &eventCode, 1);
-				 
-            }
+            dataBuffer->addToBuffer(thisSample, &timestamp, &eventCode, 1);
 
         }
-    
+
+    }
+
 
     if (dacOutputShouldChange)
     {
@@ -972,15 +978,19 @@ bool RHD2000Thread::updateBuffer()
         {
             evalBoard->enableDac(0, true);
             evalBoard->selectDacDataChannel(0, audioOutputR);
-        } else {
+        }
+        else
+        {
             evalBoard->enableDac(0, false);
         }
-            
+
         if (audioOutputL >= 0)
         {
             evalBoard->enableDac(1, true);
             evalBoard->selectDacDataChannel(1, audioOutputR);
-        } else {
+        }
+        else
+        {
             evalBoard->enableDac(1, false);
         }
 
diff --git a/Source/Processors/DataThreads/RHD2000Thread.h b/Source/Processors/DataThreads/RHD2000Thread.h
index 47faa406f..144e254d5 100644
--- a/Source/Processors/DataThreads/RHD2000Thread.h
+++ b/Source/Processors/DataThreads/RHD2000Thread.h
@@ -98,7 +98,7 @@ private:
     bool deviceFound;
 
     float thisSample[256];
-	float auxBuffer[256]; // aux inputs are only sampled every 4th sample, so use this to buffer the samples so they can be handles just like the regular neural channels later
+    float auxBuffer[256]; // aux inputs are only sampled every 4th sample, so use this to buffer the samples so they can be handles just like the regular neural channels later
 
     int blockSize;
 
@@ -123,7 +123,7 @@ private:
     void initializeBoard();
 
     void updateRegisters();
-    
+
     int deviceId(Rhd2000DataBlock* dataBlock, int stream);
 
     bool updateBuffer();
diff --git a/Source/Processors/Editors/ChannelMappingEditor.cpp b/Source/Processors/Editors/ChannelMappingEditor.cpp
index 4f7faf243..d93aff3d0 100644
--- a/Source/Processors/Editors/ChannelMappingEditor.cpp
+++ b/Source/Processors/Editors/ChannelMappingEditor.cpp
@@ -60,7 +60,7 @@ void ChannelMappingEditor::updateSettings()
 
     if (getProcessor()->getNumInputs() != previousChannelCount)
     {
-        
+
         createElectrodeButtons(getProcessor()->getNumInputs());
 
         previousChannelCount = getProcessor()->getNumInputs();
@@ -72,10 +72,10 @@ void ChannelMappingEditor::updateSettings()
 void ChannelMappingEditor::createElectrodeButtons(int numNeeded)
 {
 
-	electrodeButtons.clear();
+    electrodeButtons.clear();
 
-	referenceArray.clear();
-	channelArray.clear();
+    referenceArray.clear();
+    channelArray.clear();
 
     int width = 20;
     int height = 15;
@@ -83,7 +83,7 @@ void ChannelMappingEditor::createElectrodeButtons(int numNeeded)
     int row = 0;
     int column = 0;
 
-	for (int i = 0; i < numNeeded; i++)
+    for (int i = 0; i < numNeeded; i++)
     {
         ElectrodeButton* button = new ElectrodeButton(i+1);
         electrodeButtons.add(button);
@@ -118,53 +118,53 @@ void ChannelMappingEditor::createElectrodeButtons(int numNeeded)
 void ChannelMappingEditor::buttonEvent(Button* button)
 {
 
-	if (button == mappingButton) // mapping
-	{
+    if (button == mappingButton) // mapping
+    {
         std::cout << "Mapping button clicked." << std::endl;
 
-		referenceButton->setToggleState(false, false);
+        referenceButton->setToggleState(false, false);
         mappingButton->setToggleState(true, false);
 
-		for (int i = 0; i < electrodeButtons.size(); i++)
-		{
-			electrodeButtons[i]->setRadioGroupId(999);
-			electrodeButtons[i]->setChannelNum(channelArray[i]);
-			electrodeButtons[i]->repaint();
-		}
+        for (int i = 0; i < electrodeButtons.size(); i++)
+        {
+            electrodeButtons[i]->setRadioGroupId(999);
+            electrodeButtons[i]->setChannelNum(channelArray[i]);
+            electrodeButtons[i]->repaint();
+        }
 
-	}
-	 else if (button == referenceButton) // reference
-	{
+    }
+    else if (button == referenceButton) // reference
+    {
 
         std::cout << "Reference button clicked." << std::endl;
 
-		mappingButton->setToggleState(false, false);
+        mappingButton->setToggleState(false, false);
         referenceButton->setToggleState(true, false);
 
-		for (int i = 0; i < electrodeButtons.size(); i++)
-		{
-			electrodeButtons[i]->setRadioGroupId(0);
-			electrodeButtons[i]->setChannelNum(referenceArray[i]);
-			electrodeButtons[i]->repaint();
-		}
+        for (int i = 0; i < electrodeButtons.size(); i++)
+        {
+            electrodeButtons[i]->setRadioGroupId(0);
+            electrodeButtons[i]->setChannelNum(referenceArray[i]);
+            electrodeButtons[i]->repaint();
+        }
 
 
-	} 
-	else if (electrodeButtons.contains((ElectrodeButton*) button))
-	{
+    }
+    else if (electrodeButtons.contains((ElectrodeButton*) button))
+    {
 
-		ElectrodeButton* eb = (ElectrodeButton*) button;
+        ElectrodeButton* eb = (ElectrodeButton*) button;
         int electrodeNum = eb->getChannelNum()-1;
 
         std::cout << "Channel number: " << electrodeNum << std::endl;
         Array<int> a;
 
         if (electrodeNum >= 0)
-        	a.add(electrodeNum);
+            a.add(electrodeNum);
 
         channelSelector->setActiveChannels(a);
 
-	}
+    }
 
     std::cout << "Reference button state: " << referenceButton->getToggleState() << std::endl;
     std::cout << "Mapping button state: " << mappingButton->getToggleState() << std::endl;
@@ -173,7 +173,7 @@ void ChannelMappingEditor::buttonEvent(Button* button)
 
 void ChannelMappingEditor::channelChanged(int chan)
 {
-	for (int i = 0; i < electrodeButtons.size(); i++)
+    for (int i = 0; i < electrodeButtons.size(); i++)
     {
         if (electrodeButtons[i]->getToggleState())
         {
@@ -184,14 +184,16 @@ void ChannelMappingEditor::channelChanged(int chan)
 
             if (referenceButton->getToggleState()) // reference
             {
-            	referenceArray.set(i,chan);
+                referenceArray.set(i,chan);
 
-        		getProcessor()->setParameter(1,chan-1); // set reference
+                getProcessor()->setParameter(1,chan-1); // set reference
 
-            } else {
-            	channelArray.set(i,chan);
+            }
+            else
+            {
+                channelArray.set(i,chan);
 
-            	getProcessor()->setParameter(0,chan-1); // set mapping
+                getProcessor()->setParameter(0,chan-1); // set mapping
             }
 
         }
@@ -203,24 +205,24 @@ void ChannelMappingEditor::saveEditorParameters(XmlElement* xml)
 
     xml->setAttribute("Type", "ChannelMappingEditor");
 
-  //  XmlElement* selectedChannel = xml->createNewChildElement("SELECTEDID");
+    //  XmlElement* selectedChannel = xml->createNewChildElement("SELECTEDID");
 
-   // selectedChannel->setAttribute("ID",referenceSelector->getSelectedId());
+    // selectedChannel->setAttribute("ID",referenceSelector->getSelectedId());
 
 }
 
 void ChannelMappingEditor::loadEditorParameters(XmlElement* xml)
 {
 
-     forEachXmlChildElement(*xml, xmlNode)
-     {
+    forEachXmlChildElement(*xml, xmlNode)
+    {
         // if (xmlNode->hasTagName("SELECTEDID"))
-      //   {
-//
-           // int id = xmlNode->getIntAttribute("ID");
+        //   {
+        //
+        // int id = xmlNode->getIntAttribute("ID");
 
-          //  referenceSelector->setSelectedId(id);
+        //  referenceSelector->setSelectedId(id);
 
-      //  }
+        //  }
     }
 }
\ No newline at end of file
diff --git a/Source/Processors/Editors/ChannelMappingEditor.h b/Source/Processors/Editors/ChannelMappingEditor.h
index 46b7a499d..bd9851fe3 100644
--- a/Source/Processors/Editors/ChannelMappingEditor.h
+++ b/Source/Processors/Editors/ChannelMappingEditor.h
@@ -59,12 +59,12 @@ public:
 
 private:
 
- 	OwnedArray<ElectrodeButton> electrodeButtons;
- 	ScopedPointer<ElectrodeEditorButton> referenceButton;
- 	ScopedPointer<ElectrodeEditorButton> mappingButton;
+    OwnedArray<ElectrodeButton> electrodeButtons;
+    ScopedPointer<ElectrodeEditorButton> referenceButton;
+    ScopedPointer<ElectrodeEditorButton> mappingButton;
 
- 	Array<int> channelArray;
- 	Array<int> referenceArray;
+    Array<int> channelArray;
+    Array<int> referenceArray;
 
     int previousChannelCount;
 
diff --git a/Source/Processors/Editors/ChannelSelector.cpp b/Source/Processors/Editors/ChannelSelector.cpp
index 6e3b4bb3e..a627e4335 100755
--- a/Source/Processors/Editors/ChannelSelector.cpp
+++ b/Source/Processors/Editors/ChannelSelector.cpp
@@ -373,7 +373,7 @@ void ChannelSelector::setRadioStatus(bool radioOn)
 
     }
 
-  
+
 
 }
 
@@ -534,11 +534,11 @@ void ChannelSelector::buttonClicked(Button* button)
         }
 
         if (radioStatus) // if radio buttons are active
-            {
-                // send a message to parent
-                GenericEditor* editor = (GenericEditor*) getParentComponent();
-                editor->channelChanged(-1);
-            }
+        {
+            // send a message to parent
+            GenericEditor* editor = (GenericEditor*) getParentComponent();
+            editor->channelChanged(-1);
+        }
     }
     else
     {
@@ -836,5 +836,5 @@ void ChannelSelectorRegion::mouseWheelMove(const MouseEvent& event,
 
 void ChannelSelectorRegion::paint(Graphics& g)
 {
-   // g.fillAll(Colours::white);
+    // g.fillAll(Colours::white);
 }
\ No newline at end of file
diff --git a/Source/Processors/Editors/ChannelSelector.h b/Source/Processors/Editors/ChannelSelector.h
index dd8d45c55..466fc6196 100755
--- a/Source/Processors/Editors/ChannelSelector.h
+++ b/Source/Processors/Editors/ChannelSelector.h
@@ -74,7 +74,10 @@ public:
     void setNumChannels(int);
 
     /** get the total number of channels. */
-    int getNumChannels(){return parameterButtons.size();}
+    int getNumChannels()
+    {
+        return parameterButtons.size();
+    }
 
     /** Return whether a particular channel should be recording. */
     bool getRecordStatus(int chan);
@@ -110,8 +113,11 @@ public:
     void activateButtons();
 
     /** Refreshes Parameter Colors on change*/
-    void refreshParameterColors(){GenericEditor* p=dynamic_cast<GenericEditor*>(getParentComponent());
-        p->updateParameterButtons(-1);}
+    void refreshParameterColors()
+    {
+        GenericEditor* p=dynamic_cast<GenericEditor*>(getParentComponent());
+        p->updateParameterButtons(-1);
+    }
 
     /** Controls the behavior of ChannelSelectorButtons; they can either behave
     like radio buttons (only one selected at a time) or like toggle buttons (an
@@ -255,7 +261,7 @@ public:
     ~ChannelSelectorRegion();
 
     /** Allows the user to scroll the channels if they are not all visible.*/
-    void mouseWheelMove(const MouseEvent& event, const MouseWheelDetails &wheel);
+    void mouseWheelMove(const MouseEvent& event, const MouseWheelDetails& wheel);
     void paint(Graphics& g);
 
 private:
diff --git a/Source/Processors/Editors/FileReaderEditor.cpp b/Source/Processors/Editors/FileReaderEditor.cpp
index 64a855c35..b77a609c2 100644
--- a/Source/Processors/Editors/FileReaderEditor.cpp
+++ b/Source/Processors/Editors/FileReaderEditor.cpp
@@ -28,22 +28,22 @@
 #include <stdio.h>
 
 FileReaderEditor::FileReaderEditor(GenericProcessor* parentNode, bool useDefaultParameterEditors=true)
-   : GenericEditor(parentNode, useDefaultParameterEditors)
+    : GenericEditor(parentNode, useDefaultParameterEditors)
 
 {
 
-	fileReader = (FileReader*) parentNode;
+    fileReader = (FileReader*) parentNode;
 
-	lastFilePath = File::getCurrentWorkingDirectory();
+    lastFilePath = File::getCurrentWorkingDirectory();
 
-	fileButton = new UtilityButton("Select file",Font("Small Text", 13, Font::plain));
-	fileButton->addListener(this);
-	fileButton->setBounds(30,50,120,25);
-	addAndMakeVisible(fileButton);
+    fileButton = new UtilityButton("Select file",Font("Small Text", 13, Font::plain));
+    fileButton->addListener(this);
+    fileButton->setBounds(30,50,120,25);
+    addAndMakeVisible(fileButton);
 
- 	fileNameLabel = new Label("FileNameLabel", "No file selected.");
-	fileNameLabel->setBounds(20,80,140,25);
-	addAndMakeVisible(fileNameLabel);
+    fileNameLabel = new Label("FileNameLabel", "No file selected.");
+    fileNameLabel->setBounds(20,80,140,25);
+    addAndMakeVisible(fileNameLabel);
 
     desiredWidth = 180;
 
@@ -59,65 +59,65 @@ FileReaderEditor::~FileReaderEditor()
 void FileReaderEditor::setFile(String file)
 {
 
-	File fileToRead(file);
-	lastFilePath = fileToRead.getParentDirectory();
-	fileReader->setFile(fileToRead.getFullPathName());
-	fileNameLabel->setText(fileToRead.getFileName(),false);
+    File fileToRead(file);
+    lastFilePath = fileToRead.getParentDirectory();
+    fileReader->setFile(fileToRead.getFullPathName());
+    fileNameLabel->setText(fileToRead.getFileName(),false);
 
-	setEnabledState(true);
+    setEnabledState(true);
 
-	repaint();
+    repaint();
 }
 
 void FileReaderEditor::buttonEvent(Button* button)
 {
 
-	if (!acquisitionIsActive)
-	{
+    if (!acquisitionIsActive)
+    {
 
-		if (button == fileButton)
-		{
-			//std::cout << "Button clicked." << std::endl;
-			FileChooser chooseFileReaderFile("Please select the file you want to load...",
-                                          lastFilePath,
-                                          "*");
+        if (button == fileButton)
+        {
+            //std::cout << "Button clicked." << std::endl;
+            FileChooser chooseFileReaderFile("Please select the file you want to load...",
+                                             lastFilePath,
+                                             "*");
 
-	         if (chooseFileReaderFile.browseForFileToOpen())
-	         {
-	             // Use the selected file
-	             setFile(chooseFileReaderFile.getResult().getFullPathName());
+            if (chooseFileReaderFile.browseForFileToOpen())
+            {
+                // Use the selected file
+                setFile(chooseFileReaderFile.getResult().getFullPathName());
 
-	             // lastFilePath = fileToRead.getParentDirectory();
+                // lastFilePath = fileToRead.getParentDirectory();
 
-	             // thread->setFile(fileToRead.getFullPathName());
+                // thread->setFile(fileToRead.getFullPathName());
 
-	             // fileNameLabel->setText(fileToRead.getFileName(),false);
-			}
-		}
+                // fileNameLabel->setText(fileToRead.getFileName(),false);
+            }
+        }
 
-	}
+    }
 }
 
 void FileReaderEditor::saveEditorParameters(XmlElement* xml)
 {
 
-	// XmlElement* fileName = xml->createNewChildElement("FILENAME");
-	// fileName->addTextElement(lastFilePath.getFullPathName());
+    // XmlElement* fileName = xml->createNewChildElement("FILENAME");
+    // fileName->addTextElement(lastFilePath.getFullPathName());
 
 }
 
 void FileReaderEditor::loadEditorParameters(XmlElement* xml)
 {
 
-	 // forEachXmlChildElement(*xml, xmlNode)
-  //    {
-  //       if (xmlNode->hasTagName("FILENAME"))
-  //       {
-            
-  //           lastFilePath = File(xmlNode->getText());
-  //           thread->setFile(lastFilePath.getFullPathName());
-  //           fileNameLabel->setText(lastFilePath.getFullPathName(),false);
-  //       }
-  //   }
+    // forEachXmlChildElement(*xml, xmlNode)
+    //    {
+    //       if (xmlNode->hasTagName("FILENAME"))
+    //       {
+
+    //           lastFilePath = File(xmlNode->getText());
+    //           thread->setFile(lastFilePath.getFullPathName());
+    //           fileNameLabel->setText(lastFilePath.getFullPathName(),false);
+    //       }
+    //   }
 
 }
\ No newline at end of file
diff --git a/Source/Processors/Editors/FileReaderEditor.h b/Source/Processors/Editors/FileReaderEditor.h
index fb82c4b6a..1e789d5ff 100644
--- a/Source/Processors/Editors/FileReaderEditor.h
+++ b/Source/Processors/Editors/FileReaderEditor.h
@@ -39,7 +39,7 @@ class FileReader;
 
 */
 
-  class FileReaderEditor : public GenericEditor
+class FileReaderEditor : public GenericEditor
 
 {
 public:
@@ -51,17 +51,17 @@ public:
     void setFile(String file);
 
     void saveEditorParameters(XmlElement*);
-    
+
     void loadEditorParameters(XmlElement*);
 
 private:
 
-	ScopedPointer<UtilityButton> fileButton;
-	ScopedPointer<Label> fileNameLabel;
+    ScopedPointer<UtilityButton> fileButton;
+    ScopedPointer<Label> fileNameLabel;
 
-	FileReader* fileReader;
+    FileReader* fileReader;
 
-	File lastFilePath;
+    File lastFilePath;
 
     JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FileReaderEditor);
 
diff --git a/Source/Processors/Editors/FilterEditor.cpp b/Source/Processors/Editors/FilterEditor.cpp
index fd7ee0808..ae074a8d5 100755
--- a/Source/Processors/Editors/FilterEditor.cpp
+++ b/Source/Processors/Editors/FilterEditor.cpp
@@ -83,7 +83,7 @@ FilterEditor::FilterEditor(GenericProcessor* parentNode, bool useDefaultParamete
 
 FilterEditor::~FilterEditor()
 {
-   // deleteAllChildren();
+    // deleteAllChildren();
 }
 
 // void FilterEditor::sliderValueChanged (Slider* slider)
@@ -110,7 +110,9 @@ void FilterEditor::labelTextChanged(Label* label)
         if (label == highCutValue)
         {
             label->setText(lastHighCutString, dontSendNotification);
-        } else {
+        }
+        else
+        {
             label->setText(lastLowCutString, dontSendNotification);
         }
 
@@ -133,11 +135,13 @@ void FilterEditor::labelTextChanged(Label* label)
             {
                 fn->setCurrentChannel(n);
                 fn->setParameter(1, requestedValue);
-            } 
+            }
 
             lastHighCutString = label->getText();
 
-        } else {
+        }
+        else
+        {
             double maxVal = fn->getHighCutValueForChannel(n);
 
             if (requestedValue < maxVal)
@@ -198,12 +202,12 @@ void FilterEditor::saveEditorParameters(XmlElement* xml)
 void FilterEditor::loadEditorParameters(XmlElement* xml)
 {
 
-     forEachXmlChildElement(*xml, xmlNode)
-     {
-         if (xmlNode->hasTagName("VALUES"))
-         {
+    forEachXmlChildElement(*xml, xmlNode)
+    {
+        if (xmlNode->hasTagName("VALUES"))
+        {
             highCutValue->setText(xmlNode->getStringAttribute("HighCut"),dontSendNotification);
             lowCutValue->setText(xmlNode->getStringAttribute("LowCut"),dontSendNotification);
-         }   
-     }
+        }
+    }
 }
diff --git a/Source/Processors/Editors/FilterEditor.h b/Source/Processors/Editors/FilterEditor.h
index 4925e92b2..0e727a090 100755
--- a/Source/Processors/Editors/FilterEditor.h
+++ b/Source/Processors/Editors/FilterEditor.h
@@ -38,8 +38,8 @@ class FilterViewport;
 
 */
 
-class FilterEditor : public GenericEditor, 
-                     public Label::Listener
+class FilterEditor : public GenericEditor,
+    public Label::Listener
 {
 public:
     FilterEditor(GenericProcessor* parentNode, bool useDefaultParameterEditors);
diff --git a/Source/Processors/Editors/GenericEditor.cpp b/Source/Processors/Editors/GenericEditor.cpp
index 6c41a3a48..428473577 100755
--- a/Source/Processors/Editors/GenericEditor.cpp
+++ b/Source/Processors/Editors/GenericEditor.cpp
@@ -36,7 +36,7 @@
 GenericEditor::GenericEditor(GenericProcessor* owner, bool useDefaultParameterEditors=true)
     : AudioProcessorEditor(owner),
       desiredWidth(150), isFading(false), accumulator(0.0), acquisitionIsActive(false),
-      drawerButton(0), channelSelector(0), 
+      drawerButton(0), channelSelector(0),
       isSelected(false),  isEnabled(true), tNum(-1)
 {
     constructorInitialize(owner, useDefaultParameterEditors);
@@ -92,7 +92,8 @@ void GenericEditor::constructorInitialize(GenericProcessor* owner, bool useDefau
 
         isSplitOrMerge=false;
     }
-    else{
+    else
+    {
         isSplitOrMerge=true;
     }
 
@@ -464,10 +465,11 @@ Array<int> GenericEditor::getActiveChannels()
 {
     if (!isSplitOrMerge)
     {
-    Array<int> a = channelSelector->getActiveChannels();
-    return a;
+        Array<int> a = channelSelector->getActiveChannels();
+        return a;
     }
-    else{
+    else
+    {
         Array<int> a;
         return a;
     }
@@ -477,9 +479,10 @@ bool GenericEditor::getRecordStatus(int chan)
 {
     if (!isSplitOrMerge)
     {
-    return channelSelector->getRecordStatus(chan);
+        return channelSelector->getRecordStatus(chan);
     }
-    else{
+    else
+    {
         return false;
     }
 }
@@ -490,7 +493,8 @@ bool GenericEditor::getAudioStatus(int chan)
     {
         return channelSelector->getAudioStatus(chan);
     }
-    else{
+    else
+    {
         return false;
     }
 }
@@ -503,7 +507,8 @@ void GenericEditor::getChannelSelectionState(int chan, bool* p, bool* r, bool* a
         *r = channelSelector->getRecordStatus(chan);
         *a = channelSelector->getAudioStatus(chan);
     }
-    else{
+    else
+    {
         *p = false;
         *r = false;
         *a = false;
@@ -827,6 +832,6 @@ void GenericEditor::updateParameterButtons(int parameterIndex)
         {
             parameterEditors[parameterIndex]->channelSelectionUI();
         }
-    //std::cout << "updateParameterButtons" << std::endl;
+        //std::cout << "updateParameterButtons" << std::endl;
     }
 }
diff --git a/Source/Processors/Editors/ParameterEditor.cpp b/Source/Processors/Editors/ParameterEditor.cpp
index b81d70cbc..d818c82c3 100755
--- a/Source/Processors/Editors/ParameterEditor.cpp
+++ b/Source/Processors/Editors/ParameterEditor.cpp
@@ -268,11 +268,11 @@ ParameterButton::ParameterButton(var value, int buttonType, Font labelFont) :
                                       Colour(190,150,25),0.0, 0.0f,
                                       false);
     usedByNonActiveGrad = ColourGradient(Colour(200,100,0),0.0,0.0,
-                                  Colour(158,95,32),0.0, 20.0f,
-                                  false);
+                                         Colour(158,95,32),0.0, 20.0f,
+                                         false);
     usedByNonActiveOverGrad = ColourGradient(Colour(158,95,32),0.0, 5.0f,
-                                      Colour(128,70,13),0.0, 0.0f,
-                                      false);
+                                             Colour(128,70,13),0.0, 0.0f,
+                                             false);
     neutralGrad = ColourGradient(Colour(220,220,220),0.0,0.0,
                                  Colour(170,170,170),0.0, 20.0f,
                                  false);
@@ -526,13 +526,13 @@ void ParameterEditor::channelSelectionUI()
         for (int i = 0; i < buttonArray.size(); i++)
         {
             buttonArray[i]->colorState=0;
-            
+
             for (int j = 0; j < numChannels; j++)
             {
 
                 if (possibleValues[i]==parameter->getValue(j))
                 {
-                    
+
                     if (channelSelector->getParamStatus(j))
                     {
                         /* Set button as usedbyactive */
@@ -543,9 +543,9 @@ void ParameterEditor::channelSelectionUI()
                     {
                         // Set button as used by non-selected
                         buttonArray[i]->colorState=2;
-                    }   
+                    }
 
-                } 
+                }
             }
             buttonArray[i]->repaint();
 
diff --git a/Source/Processors/Editors/PhaseDetectorEditor.cpp b/Source/Processors/Editors/PhaseDetectorEditor.cpp
index 47e0e4582..f24e1ac7e 100644
--- a/Source/Processors/Editors/PhaseDetectorEditor.cpp
+++ b/Source/Processors/Editors/PhaseDetectorEditor.cpp
@@ -79,8 +79,10 @@ void PhaseDetectorEditor::comboBoxChanged(ComboBox* c)
 
     if (id == 1)
     {
-        channel = -1.0f; 
-    } else {
+        channel = -1.0f;
+    }
+    else
+    {
         channel = float(id) - 2.0f;
     }
 
@@ -108,10 +110,10 @@ void PhaseDetectorEditor::saveEditorParameters(XmlElement* xml)
 void PhaseDetectorEditor::loadEditorParameters(XmlElement* xml)
 {
 
-     forEachXmlChildElement(*xml, xmlNode)
-     {
-         if (xmlNode->hasTagName("SELECTEDID"))
-         {
+    forEachXmlChildElement(*xml, xmlNode)
+    {
+        if (xmlNode->hasTagName("SELECTEDID"))
+        {
 
             int id = xmlNode->getIntAttribute("ID");
 
diff --git a/Source/Processors/Editors/PhaseDetectorEditor.h b/Source/Processors/Editors/PhaseDetectorEditor.h
index fff420cea..eb6311bc2 100644
--- a/Source/Processors/Editors/PhaseDetectorEditor.h
+++ b/Source/Processors/Editors/PhaseDetectorEditor.h
@@ -37,7 +37,7 @@
 */
 
 class PhaseDetectorEditor : public GenericEditor,
-                            public ComboBox::Listener
+    public ComboBox::Listener
 {
 public:
     PhaseDetectorEditor(GenericProcessor* parentNode, bool useDefaultParameterEditors);
diff --git a/Source/Processors/Editors/PulsePalOutputEditor.cpp b/Source/Processors/Editors/PulsePalOutputEditor.cpp
index d11b54512..c0cfa5a4d 100644
--- a/Source/Processors/Editors/PulsePalOutputEditor.cpp
+++ b/Source/Processors/Editors/PulsePalOutputEditor.cpp
@@ -120,16 +120,17 @@ void ChannelTriggerInterface::buttonClicked(Button* button)
 void ChannelTriggerInterface::comboBoxChanged(ComboBox* comboBoxThatHasChanged)
 {
     //std::cout << "Combo box changed to " << comboBoxThatHasChanged->getSelectedId() << std::endl;
-   
+
     if (comboBoxThatHasChanged == triggerSelector)
     {
         processor->setParameter(0, channelNumber);
         processor->setParameter(1, (float) comboBoxThatHasChanged->getSelectedId() - 2);
-    } else if (comboBoxThatHasChanged == gateSelector)
+    }
+    else if (comboBoxThatHasChanged == gateSelector)
     {
         processor->setParameter(0, channelNumber);
         processor->setParameter(2, (float) comboBoxThatHasChanged->getSelectedId() - 2);
     }
 
-    
+
 }
diff --git a/Source/Processors/Editors/RHD2000Editor.cpp b/Source/Processors/Editors/RHD2000Editor.cpp
index 65a84dc7a..f8426a6f1 100644
--- a/Source/Processors/Editors/RHD2000Editor.cpp
+++ b/Source/Processors/Editors/RHD2000Editor.cpp
@@ -88,7 +88,7 @@ RHD2000Editor::RHD2000Editor(GenericProcessor* parentNode,
     adcButton->addListener(this);
     adcButton->setClickingTogglesState(true);
     addAndMakeVisible(adcButton);
-    
+
 
 }
 
@@ -114,13 +114,16 @@ void RHD2000Editor::buttonEvent(Button* button)
             headstageOptionsInterfaces[i]->checkEnabledState();
         }
 
-    } else if (button == electrodeButtons[0])
+    }
+    else if (button == electrodeButtons[0])
     {
-        channelSelector->setRadioStatus(true);   
-    } else if (button == electrodeButtons[1])
+        channelSelector->setRadioStatus(true);
+    }
+    else if (button == electrodeButtons[1])
     {
-        channelSelector->setRadioStatus(true);   
-    } else if (button == adcButton)
+        channelSelector->setRadioStatus(true);
+    }
+    else if (button == adcButton)
     {
         board->enableAdcs(button->getToggleState());
         getEditorViewport()->makeEditorVisible(this, false, true);
@@ -169,7 +172,7 @@ void RHD2000Editor::stopAcquisition()
 // Bandwidth Options --------------------------------------------------------------------
 
 BandwidthInterface::BandwidthInterface(RHD2000Thread* board_,
-                                                     RHD2000Editor* editor_) :
+                                       RHD2000Editor* editor_) :
     board(board_), editor(editor_)
 {
 
@@ -206,7 +209,7 @@ BandwidthInterface::~BandwidthInterface()
 
 void BandwidthInterface::labelTextChanged(Label* label)
 {
-    
+
     if (!(editor->acquisitionIsActive) && board->foundInputSource())
     {
         if (label == UpperBandwidthSelection)
@@ -230,7 +233,9 @@ void BandwidthInterface::labelTextChanged(Label* label)
             std::cout << "Actual Upper Bandwidth:  " <<  actualUpperBandwidth  << std::endl;
             label->setText(String((roundFloatToInt)(actualUpperBandwidth)), false);
 
-        } else {
+        }
+        else
+        {
 
             Value val = label->getTextValue();
             double requestedValue = double(val.getValue());
@@ -239,7 +244,7 @@ void BandwidthInterface::labelTextChanged(Label* label)
             {
                 editor->sendActionMessage("Value out of range.");
 
-                 label->setText(lastLowCutString, dontSendNotification);
+                label->setText(lastLowCutString, dontSendNotification);
 
                 return;
             }
@@ -259,7 +264,7 @@ void BandwidthInterface::labelTextChanged(Label* label)
 void BandwidthInterface::paint(Graphics& g)
 {
 
-     g.setColour(Colours::darkgrey);
+    g.setColour(Colours::darkgrey);
 
     g.setFont(Font("Small Text",10,Font::plain));
 
@@ -274,7 +279,7 @@ void BandwidthInterface::paint(Graphics& g)
 // Sample rate Options --------------------------------------------------------------------
 
 SampleRateInterface::SampleRateInterface(RHD2000Thread* board_,
-                                                     RHD2000Editor* editor_) :
+                                         RHD2000Editor* editor_) :
     board(board_), editor(editor_)
 {
 
@@ -317,7 +322,7 @@ SampleRateInterface::~SampleRateInterface()
 
 void SampleRateInterface::comboBoxChanged(ComboBox* cb)
 {
-	if (!(editor->acquisitionIsActive) && board->foundInputSource())
+    if (!(editor->acquisitionIsActive) && board->foundInputSource())
     {
         if (cb == rateSelection)
         {
@@ -336,7 +341,7 @@ void SampleRateInterface::comboBoxChanged(ComboBox* cb)
 void SampleRateInterface::paint(Graphics& g)
 {
 
-     g.setColour(Colours::darkgrey);
+    g.setColour(Colours::darkgrey);
 
     g.setFont(Font("Small Text",10,Font::plain));
 
@@ -377,7 +382,7 @@ HeadstageOptionsInterface::HeadstageOptionsInterface(RHD2000Thread* board_,
     channelsOnHs1 = 0;
     channelsOnHs2 = 0;
 
-    
+
 
     hsButton1 = new UtilityButton(" ", Font("Small Text", 13, Font::plain));
     hsButton1->setRadius(3.0f);
@@ -405,7 +410,7 @@ HeadstageOptionsInterface::~HeadstageOptionsInterface()
 
 void HeadstageOptionsInterface::checkEnabledState()
 {
-    isEnabled = (board->isHeadstageEnabled(hsNumber1) || 
+    isEnabled = (board->isHeadstageEnabled(hsNumber1) ||
                  board->isHeadstageEnabled(hsNumber2));
 
     if (board->isHeadstageEnabled(hsNumber1))
@@ -413,7 +418,9 @@ void HeadstageOptionsInterface::checkEnabledState()
         channelsOnHs1 = 32;
         hsButton1->setLabel(String(channelsOnHs1));
         hsButton1->setEnabledState(true);
-    } else {
+    }
+    else
+    {
         channelsOnHs1 = 0;
         hsButton1->setLabel(" ");
         hsButton1->setEnabledState(false);
@@ -424,7 +431,9 @@ void HeadstageOptionsInterface::checkEnabledState()
         channelsOnHs2 = 32;
         hsButton2->setLabel(String(channelsOnHs2));
         hsButton2->setEnabledState(true);
-    } else {
+    }
+    else
+    {
         channelsOnHs2 = 0;
         hsButton2->setLabel(" ");
         hsButton2->setEnabledState(false);
@@ -453,7 +462,8 @@ void HeadstageOptionsInterface::buttonClicked(Button* button)
             hsButton1->setLabel(String(channelsOnHs1));
             board->setNumChannels(hsNumber1, channelsOnHs1);
 
-        } else if (button == hsButton2)
+        }
+        else if (button == hsButton2)
         {
             if (channelsOnHs2 == 32)
                 channelsOnHs2 = 16;
diff --git a/Source/Processors/Editors/ReferenceNodeEditor.cpp b/Source/Processors/Editors/ReferenceNodeEditor.cpp
index 91bea3e29..700f42647 100644
--- a/Source/Processors/Editors/ReferenceNodeEditor.cpp
+++ b/Source/Processors/Editors/ReferenceNodeEditor.cpp
@@ -79,8 +79,10 @@ void ReferenceNodeEditor::comboBoxChanged(ComboBox* c)
 
     if (id == 1)
     {
-        channel = -1.0f; 
-    } else {
+        channel = -1.0f;
+    }
+    else
+    {
         channel = float(id) - 2.0f;
     }
 
@@ -108,10 +110,10 @@ void ReferenceNodeEditor::saveEditorParameters(XmlElement* xml)
 void ReferenceNodeEditor::loadEditorParameters(XmlElement* xml)
 {
 
-     forEachXmlChildElement(*xml, xmlNode)
-     {
-         if (xmlNode->hasTagName("SELECTEDID"))
-         {
+    forEachXmlChildElement(*xml, xmlNode)
+    {
+        if (xmlNode->hasTagName("SELECTEDID"))
+        {
 
             int id = xmlNode->getIntAttribute("ID");
 
diff --git a/Source/Processors/Editors/ReferenceNodeEditor.h b/Source/Processors/Editors/ReferenceNodeEditor.h
index defe11c75..7ae0f9a5d 100644
--- a/Source/Processors/Editors/ReferenceNodeEditor.h
+++ b/Source/Processors/Editors/ReferenceNodeEditor.h
@@ -36,7 +36,7 @@
 */
 
 class ReferenceNodeEditor : public GenericEditor,
-                            public ComboBox::Listener
+    public ComboBox::Listener
 {
 public:
     ReferenceNodeEditor(GenericProcessor* parentNode, bool useDefaultParameterEditors);
diff --git a/Source/Processors/Editors/ResamplingNodeEditor.h b/Source/Processors/Editors/ResamplingNodeEditor.h
index ee3fce9c7..9e347e62b 100644
--- a/Source/Processors/Editors/ResamplingNodeEditor.h
+++ b/Source/Processors/Editors/ResamplingNodeEditor.h
@@ -42,7 +42,7 @@ public:
     ResamplingNodeEditor(GenericProcessor* parentNode, bool useDefaultParameterEditors);
     virtual ~ResamplingNodeEditor();
 
-   // void startAcquisition();
+    // void startAcquisition();
     //void stopAcquisition();
 
 private:
diff --git a/Source/Processors/Editors/SpikeDetectorEditor.cpp b/Source/Processors/Editors/SpikeDetectorEditor.cpp
index 92ba61003..5a8a063a3 100755
--- a/Source/Processors/Editors/SpikeDetectorEditor.cpp
+++ b/Source/Processors/Editors/SpikeDetectorEditor.cpp
@@ -194,7 +194,9 @@ void SpikeDetectorEditor::buttonEvent(Button* button)
             thresholdSlider->setActive(true);
             thresholdSlider->setValue(processor->getChannelThreshold(electrodeList->getSelectedItemIndex(),
                                                                      electrodeButtons.indexOf((ElectrodeButton*) button)));
-        } else {
+        }
+        else
+        {
 
             SpikeDetector* processor = (SpikeDetector*) getProcessor();
 
@@ -207,10 +209,10 @@ void SpikeDetectorEditor::buttonEvent(Button* button)
                                         button->getToggleState());
 
             std::cout << "Disabling channel " << channelNum <<
-                         " of electrode " << electrodeNum << std::endl;
+                      " of electrode " << electrodeNum << std::endl;
 
         }
-    
+
 
     }
 
@@ -264,7 +266,7 @@ void SpikeDetectorEditor::buttonEvent(Button* button)
             }
         }
 
-        
+
         getEditorViewport()->makeEditorVisible(this, true, true);
         return;
 
@@ -385,7 +387,9 @@ bool SpikeDetectorEditor::addElectrode(int nChans)
     {
         refreshElectrodeList();
         return true;
-    } else {
+    }
+    else
+    {
         return false;
     }
 
diff --git a/Source/Processors/Editors/SpikeDetectorEditor.h b/Source/Processors/Editors/SpikeDetectorEditor.h
index 2fae5e948..2bbf5d90f 100755
--- a/Source/Processors/Editors/SpikeDetectorEditor.h
+++ b/Source/Processors/Editors/SpikeDetectorEditor.h
@@ -173,7 +173,7 @@ private:
     OwnedArray<ElectrodeButton> electrodeButtons;
     Array<ElectrodeEditorButton*> electrodeEditorButtons;
 
-    
+
     void removeElectrode(int index);
     void editElectrode(int index, int chan, int newChan);
 
diff --git a/Source/Processors/Editors/VisualizerEditor.cpp b/Source/Processors/Editors/VisualizerEditor.cpp
index ff432a7bf..73ffa3337 100755
--- a/Source/Processors/Editors/VisualizerEditor.cpp
+++ b/Source/Processors/Editors/VisualizerEditor.cpp
@@ -281,10 +281,10 @@ void VisualizerEditor::saveEditorParameters(XmlElement* xml)
 void VisualizerEditor::loadEditorParameters(XmlElement* xml)
 {
 
-     forEachXmlChildElement(*xml, xmlNode)
-     {
-         if (xmlNode->hasTagName("TAB"))
-         {
+    forEachXmlChildElement(*xml, xmlNode)
+    {
+        if (xmlNode->hasTagName("TAB"))
+        {
 
             bool tabState = xmlNode->getBoolAttribute("Active");
 
@@ -292,21 +292,23 @@ void VisualizerEditor::loadEditorParameters(XmlElement* xml)
                 tabSelector->setToggleState(true,true);
 
 
-         } else if (xmlNode->hasTagName("WINDOW")) {
+        }
+        else if (xmlNode->hasTagName("WINDOW"))
+        {
 
-             bool windowState = xmlNode->getBoolAttribute("Active");
+            bool windowState = xmlNode->getBoolAttribute("Active");
 
-             if (windowState)
+            if (windowState)
             {
                 windowSelector->setToggleState(true,true);
                 dataWindow->setBounds(xmlNode->getIntAttribute("x"),
-                                          xmlNode->getIntAttribute("y"),
-                                          xmlNode->getIntAttribute("width"),
-                                          xmlNode->getIntAttribute("height"));
+                                      xmlNode->getIntAttribute("y"),
+                                      xmlNode->getIntAttribute("width"),
+                                      xmlNode->getIntAttribute("height"));
 
             }
-            
-         }
+
+        }
     }
 
     if (canvas != nullptr)
@@ -323,5 +325,5 @@ void VisualizerEditor::saveVisualizerParameters(XmlElement* xml)
 
 void VisualizerEditor::loadVisualizerParameters(XmlElement* xml)
 {
-    
+
 }
\ No newline at end of file
diff --git a/Source/Processors/Editors/WiFiOutputEditor.h b/Source/Processors/Editors/WiFiOutputEditor.h
index 23b6b1811..d31e613ac 100755
--- a/Source/Processors/Editors/WiFiOutputEditor.h
+++ b/Source/Processors/Editors/WiFiOutputEditor.h
@@ -20,7 +20,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 */
-    
+
 #ifndef __WIFIOUTPUTEDITOR_H_7161DB44__
 #define __WIFIOUTPUTEDITOR_H_7161DB44__
 
diff --git a/Source/Processors/FileReader.cpp b/Source/Processors/FileReader.cpp
index f8c2929e8..08bcddb4c 100644
--- a/Source/Processors/FileReader.cpp
+++ b/Source/Processors/FileReader.cpp
@@ -29,36 +29,38 @@ FileReader::FileReader()
     : GenericProcessor("File Reader")
 {
 
-	input = 0;
-	timestamp = 0; 
+    input = 0;
+    timestamp = 0;
 
-	enabledState(false);
+    enabledState(false);
 
 }
 
 FileReader::~FileReader()
 {
-	if (input)
+    if (input)
         fclose(input);
 }
 
 AudioProcessorEditor* FileReader::createEditor()
 {
-	editor = new FileReaderEditor(this, true);
+    editor = new FileReaderEditor(this, true);
 
-	return editor;
+    return editor;
 
 }
 
 bool FileReader::isReady()
 {
-	if (input == 0)
-	{
-		sendActionMessage("No file selected in File Reader.");
-		return false;
-	} else {
-		return true;
-	}
+    if (input == 0)
+    {
+        sendActionMessage("No file selected in File Reader.");
+        return false;
+    }
+    else
+    {
+        return true;
+    }
 }
 
 
@@ -80,7 +82,7 @@ float FileReader::getDefaultBitVolts()
 void FileReader::enabledState(bool t)
 {
 
-	isEnabled = t;
+    isEnabled = t;
 
 }
 
@@ -128,7 +130,7 @@ void FileReader::updateSettings()
 void FileReader::process(AudioSampleBuffer& buffer, MidiBuffer& events, int& nSamples)
 {
 
-	uint8 data[8];
+    uint8 data[8];
     memcpy(data, &timestamp, 8);
 
     // generate timestamp
@@ -143,24 +145,24 @@ void FileReader::process(AudioSampleBuffer& buffer, MidiBuffer& events, int& nSa
 
     // FIXME: needs to account for the fact that the ratio might not be an exact
     //        integer value
-	int samplesNeeded = (int) float(buffer.getNumSamples()) * (getDefaultSampleRate()/44100.0f); 
+    int samplesNeeded = (int) float(buffer.getNumSamples()) * (getDefaultSampleRate()/44100.0f);
 
-	 if (ftell(input) >= lengthOfInputFile - samplesNeeded)
-     {
+    if (ftell(input) >= lengthOfInputFile - samplesNeeded)
+    {
         rewind(input);
-     }
+    }
 
-     size_t numRead = fread(readBuffer, 2, samplesNeeded*buffer.getNumChannels(), input);
+    size_t numRead = fread(readBuffer, 2, samplesNeeded*buffer.getNumChannels(), input);
 
     int chan = 0;
     int samp = 0;
 
     for (size_t n = 0; n < numRead; n++)
     {
-        
+
         if (chan == buffer.getNumChannels())
         {
-        	samp++;
+            samp++;
             timestamp++;
             chan = 0;
         }
@@ -194,18 +196,18 @@ void FileReader::loadCustomParametersFromXml()
 
     if (parametersAsXml != nullptr)
     {
-        // use parametersAsXml to restore state 
+        // use parametersAsXml to restore state
 
         forEachXmlChildElement(*parametersAsXml, xmlNode)
         {
-           if (xmlNode->hasTagName("FILENAME"))
+            if (xmlNode->hasTagName("FILENAME"))
             {
                 String filepath = xmlNode->getStringAttribute("path");
-               FileReaderEditor* fre = (FileReaderEditor*) getEditor();
+                FileReaderEditor* fre = (FileReaderEditor*) getEditor();
                 fre->setFile(filepath);
 
             }
-        }   
+        }
     }
 
 }
\ No newline at end of file
diff --git a/Source/Processors/FileReader.h b/Source/Processors/FileReader.h
index d688cba44..87eff3f20 100644
--- a/Source/Processors/FileReader.h
+++ b/Source/Processors/FileReader.h
@@ -64,7 +64,7 @@ public:
 
     bool isSource()
     {
-    	return true;
+        return true;
     }
 
     void enabledState(bool t);
@@ -81,9 +81,9 @@ public:
 
 private:
 
-	uint64 timestamp;
+    uint64 timestamp;
 
-	int lengthOfInputFile;
+    int lengthOfInputFile;
     FILE* input;
 
     int16 readBuffer[BUFFER_SIZE];
diff --git a/Source/Processors/FilterNode.cpp b/Source/Processors/FilterNode.cpp
index ac453c109..fac605e31 100755
--- a/Source/Processors/FilterNode.cpp
+++ b/Source/Processors/FilterNode.cpp
@@ -142,7 +142,7 @@ void FilterNode::updateSettings()
                         Dsp::DirectFormII>						// realization
                         (1));
 
-            
+
             //Parameter& p1 =  parameters.getReference(0);
             //p1.setValue(600.0f, n);
             //Parameter& p2 =  parameters.getReference(1);
@@ -221,7 +221,7 @@ void FilterNode::setParameter(int parameterIndex, float newValue)
 
     // std::cout << float(p1[currentChannel]) << " ";
     // std::cout << float(p2[currentChannel]) << std::endl;
-    
+
     // if (parameterIndex == 0) {
     // 	parameters[0].setValue(newValue, currentChannel);
     // 	setFilterParameters(newValue, parameters[0][currentChannel], currentChannel);
@@ -255,19 +255,19 @@ void FilterNode::saveCustomChannelParametersToXml(XmlElement* channelInfo, int c
     {
         //std::cout << "Saving custom parameters for filter node." << std::endl;
 
-         XmlElement* channelParams = channelInfo->createNewChildElement("PARAMETERS");
-         channelParams->setAttribute("highcut",highCuts[channelNumber]);
-         channelParams->setAttribute("lowcut",lowCuts[channelNumber]);
+        XmlElement* channelParams = channelInfo->createNewChildElement("PARAMETERS");
+        channelParams->setAttribute("highcut",highCuts[channelNumber]);
+        channelParams->setAttribute("lowcut",lowCuts[channelNumber]);
     }
 
 }
-    
+
 void FilterNode::loadCustomChannelParametersFromXml(XmlElement* channelInfo, bool isEventChannel)
 {
 
-     int channelNum = channelInfo->getIntAttribute("number");
+    int channelNum = channelInfo->getIntAttribute("number");
 
-     if (!isEventChannel)
+    if (!isEventChannel)
     {
         forEachXmlChildElement(*channelInfo, subNode)
         {
@@ -277,11 +277,11 @@ void FilterNode::loadCustomChannelParametersFromXml(XmlElement* channelInfo, boo
                 lowCuts.set(channelNum, subNode->getDoubleAttribute("lowcut",600.0f));
 
                 setFilterParameters(lowCuts[channelNum],
-                        highCuts[channelNum],
-                        channelNum);
+                                    highCuts[channelNum],
+                                    channelNum);
 
             }
-        } 
+        }
     }
 
 
diff --git a/Source/Processors/FilterNode.h b/Source/Processors/FilterNode.h
index 5e4f7f425..87851c9b5 100755
--- a/Source/Processors/FilterNode.h
+++ b/Source/Processors/FilterNode.h
@@ -62,7 +62,7 @@ public:
     void updateSettings();
 
     void saveCustomChannelParametersToXml(XmlElement* channelInfo, int channelNumber, bool isEventChannel);
-    
+
     void loadCustomChannelParametersFromXml(XmlElement* channelInfo, bool isEventChannel);
 
 private:
diff --git a/Source/Processors/GenericProcessor.cpp b/Source/Processors/GenericProcessor.cpp
index e935833ec..6bfa53c46 100755
--- a/Source/Processors/GenericProcessor.cpp
+++ b/Source/Processors/GenericProcessor.cpp
@@ -532,10 +532,10 @@ void GenericProcessor::saveToXml(XmlElement* parentElement)
     {
         saveChannelParametersToXml(parentElement, i, true);
 
-         // channelName=/**String("EventCh:")+*/String(i);
-         // channelChildNode = parentElement->createNewChildElement("EVENTCHANNEL");
-         // channelChildNode->setAttribute("name", channelName);
-         // saveParametersToChannelsXml(channelChildNode, i);
+        // channelName=/**String("EventCh:")+*/String(i);
+        // channelChildNode = parentElement->createNewChildElement("EVENTCHANNEL");
+        // channelChildNode->setAttribute("name", channelName);
+        // saveParametersToChannelsXml(channelChildNode, i);
     }
 
     // Save editor parameters:
@@ -569,12 +569,14 @@ void GenericProcessor::saveChannelParametersToXml(XmlElement* parentElement, int
 
         saveCustomChannelParametersToXml(channelInfo, channelNumber);
 
-    } else {
+    }
+    else
+    {
 
         XmlElement* channelInfo = parentElement->createNewChildElement("EVENTCHANNEL");
         channelInfo->setAttribute("name", String(channelNumber));
         channelInfo->setAttribute("number", channelNumber);
-    
+
         saveCustomChannelParametersToXml(channelInfo, channelNumber, true);
 
     }
@@ -598,7 +600,7 @@ void GenericProcessor::saveChannelParametersToXml(XmlElement* parentElement, int
     //     parameterValue = parameterVar.toString();
     //     parameterChildNode->addTextElement(parameterValue);
     // }
-    
+
 }
 
 void GenericProcessor::saveCustomChannelParametersToXml(XmlElement* channelInfo, int channelNum, bool isEventChannel)
@@ -616,34 +618,36 @@ void GenericProcessor::loadFromXml()
     if (!paramsWereLoaded)
     {
 
-    if (parametersAsXml != nullptr)
-    {
-        // use parametersAsXml to restore state 
-        loadCustomParametersFromXml();
-
-        forEachXmlChildElement(*parametersAsXml, xmlNode)
+        if (parametersAsXml != nullptr)
         {
-           if (xmlNode->hasTagName("CHANNEL"))
-            {
+            // use parametersAsXml to restore state
+            loadCustomParametersFromXml();
 
-                loadChannelParametersFromXml(xmlNode);
-            } else if (xmlNode->hasTagName("EVENTCHANNEL"))
+            forEachXmlChildElement(*parametersAsXml, xmlNode)
             {
+                if (xmlNode->hasTagName("CHANNEL"))
+                {
 
-                loadChannelParametersFromXml(xmlNode, true);
-                 
-            } else if (xmlNode->hasTagName("EDITOR"))
-            {
-                getEditor()->loadEditorParameters(xmlNode);
-            }
+                    loadChannelParametersFromXml(xmlNode);
+                }
+                else if (xmlNode->hasTagName("EVENTCHANNEL"))
+                {
 
-        }   
-    }
+                    loadChannelParametersFromXml(xmlNode, true);
+
+                }
+                else if (xmlNode->hasTagName("EDITOR"))
+                {
+                    getEditor()->loadEditorParameters(xmlNode);
+                }
+
+            }
+        }
 
     }
 
     paramsWereLoaded = true;
-    
+
 }
 
 void GenericProcessor::loadChannelParametersFromXml(XmlElement* channelInfo, bool isEventChannel)
@@ -664,7 +668,7 @@ void GenericProcessor::loadChannelParametersFromXml(XmlElement* channelInfo, boo
                                                       subNode->getBoolAttribute("record"),
                                                       subNode->getBoolAttribute("audio"));
             }
-        } 
+        }
     }
 
     loadCustomChannelParametersFromXml(channelInfo, isEventChannel);
@@ -675,7 +679,7 @@ void GenericProcessor::loadChannelParametersFromXml(XmlElement* channelInfo, boo
 
 void GenericProcessor::loadCustomParametersFromXml()
 {
-    
+
 }
 
 void GenericProcessor::loadCustomChannelParametersFromXml(XmlElement* channelInfo, bool isEventChannel)
diff --git a/Source/Processors/GenericProcessor.h b/Source/Processors/GenericProcessor.h
index 29c4dd708..2179dc26a 100755
--- a/Source/Processors/GenericProcessor.h
+++ b/Source/Processors/GenericProcessor.h
@@ -496,7 +496,10 @@ public:
     OwnedArray<Channel> eventChannels;
 
     /** Returns total number of channels */
-    int totalNumberOfChannels(){return channels.size()+eventChannels.size();}
+    int totalNumberOfChannels()
+    {
+        return channels.size()+eventChannels.size();
+    }
 
     /** Settings used by most processors. */
     struct ProcessorSettings
@@ -561,7 +564,7 @@ public:
     /** Load custom parameters for each channel. */
     virtual void loadCustomChannelParametersFromXml(XmlElement* channelElement, bool isEventChannel=false);
 
-     /** Holds loaded parameters */
+    /** Holds loaded parameters */
     XmlElement* parametersAsXml;
 
 private:
diff --git a/Source/Processors/LfpDisplayNode.cpp b/Source/Processors/LfpDisplayNode.cpp
index 16d017aa3..4b5a3a122 100755
--- a/Source/Processors/LfpDisplayNode.cpp
+++ b/Source/Processors/LfpDisplayNode.cpp
@@ -34,22 +34,6 @@ LfpDisplayNode::LfpDisplayNode()
     displayBuffer = new AudioSampleBuffer(8, 100);
     eventBuffer = new MidiBuffer();
 
-    // Array<var> timeBaseValues;
-    // timeBaseValues.add(1);
-    // timeBaseValues.add(2);
-    // timeBaseValues.add(5);
-    // timeBaseValues.add(10);
-
-    // parameters.add(Parameter("timebase",timeBaseValues, 1, 0));//true);//a,0);
-
-    // Array<var> displayGainValues;
-    // displayGainValues.add(1);
-    // displayGainValues.add(2);
-    // displayGainValues.add(4);
-    // displayGainValues.add(8);
-
-    // parameters.add(Parameter("display gain",displayGainValues, 1, 1));//true);//a,0);
-
     arrayOfOnes = new float[5000];
 
     for (int n = 0; n < 5000; n++)
@@ -61,8 +45,7 @@ LfpDisplayNode::LfpDisplayNode()
 
 LfpDisplayNode::~LfpDisplayNode()
 {
-    //deleteAndZero(displayBuffer);
-    //deleteAndZero(eventBuffer);
+
 }
 
 AudioProcessorEditor* LfpDisplayNode::createEditor()
diff --git a/Source/Processors/PhaseDetector.cpp b/Source/Processors/PhaseDetector.cpp
index 2a2e149b0..84e86258b 100644
--- a/Source/Processors/PhaseDetector.cpp
+++ b/Source/Processors/PhaseDetector.cpp
@@ -91,29 +91,29 @@ void PhaseDetector::handleEvent(int eventType, MidiMessage& event, int sampleNum
 
     //std::cout << "GOT EVENT." << std::endl;
 
-     if (eventType == TTL)
-     {
-         const uint8* dataptr = event.getRawData();
+    if (eventType == TTL)
+    {
+        const uint8* dataptr = event.getRawData();
 
-         // int eventNodeId = *(dataptr+1);
-         int eventId = *(dataptr+2);
-         int eventChannel = *(dataptr+3);
-         //int eventTime = event.getTimeStamp();
+        // int eventNodeId = *(dataptr+1);
+        int eventId = *(dataptr+2);
+        int eventChannel = *(dataptr+3);
+        //int eventTime = event.getTimeStamp();
 
-    //     //	std::cout << "Received event from " << eventNodeId << ", channel "
-    //     //          << eventChannel << ", with ID " << eventId << std::endl;
+        //     //	std::cout << "Received event from " << eventNodeId << ", channel "
+        //     //          << eventChannel << ", with ID " << eventId << std::endl;
 
-    //     if (eventId == 1 && eventChannel == 5)
-    //     {
-    //         canBeTriggered = true;
-    //     }
-         if (eventId == 0 && eventChannel == 5)
-         {
-             triggerOnPeak = randomNumberGenerator.nextBool();
+        //     if (eventId == 1 && eventChannel == 5)
+        //     {
+        //         canBeTriggered = true;
+        //     }
+        if (eventId == 0 && eventChannel == 5)
+        {
+            triggerOnPeak = randomNumberGenerator.nextBool();
 
-         }
+        }
 
-     }
+    }
 
 }
 
@@ -134,7 +134,7 @@ void PhaseDetector::process(AudioSampleBuffer& buffer,
 
             if (!triggerOnPeak)
                 sample = -sample; // invert
-               
+
 
             if (sample > lastSample && !isIncreasing)
             {
@@ -151,11 +151,11 @@ void PhaseDetector::process(AudioSampleBuffer& buffer,
 
 
                 //std::cout << "GOT EVENT." << std::endl;
-                
+
                 // entering falling phase (just reached peak or trough)
                 //if (true)
                 addEvent(events, TTL, i, 1, 3);
-                
+
 
                 peakIntervals[numPeakIntervals % NUM_INTERVALS] = nSamplesSinceLastPeak;
 
@@ -172,10 +172,10 @@ void PhaseDetector::process(AudioSampleBuffer& buffer,
                 // either rising or falling
                 nSamplesSinceLastPeak++;
 
-                 if (nSamplesSinceLastPeak == 500)
-                 {
-                     addEvent(events, TTL, i, 0, 3);
-                 }
+                if (nSamplesSinceLastPeak == 500)
+                {
+                    addEvent(events, TTL, i, 0, 3);
+                }
 
             }
 
diff --git a/Source/Processors/PhaseDetector.h b/Source/Processors/PhaseDetector.h
index fcb29bbd4..9942881b2 100644
--- a/Source/Processors/PhaseDetector.h
+++ b/Source/Processors/PhaseDetector.h
@@ -48,7 +48,7 @@ public:
 
     void process(AudioSampleBuffer& buffer, MidiBuffer& midiMessages, int& nSamples);
     void setParameter(int parameterIndex, float newValue);
-    
+
     AudioProcessorEditor* createEditor();
 
     bool hasEditor() const
@@ -68,9 +68,9 @@ private:
 
     bool isIncreasing;
 
-	bool triggerOnPeak;
+    bool triggerOnPeak;
 
-	bool canBeTriggered;
+    bool canBeTriggered;
 
     void handleEvent(int eventType, MidiMessage& event, int sampleNum);
 
diff --git a/Source/Processors/ProcessorGraph.cpp b/Source/Processors/ProcessorGraph.cpp
index fa997e55d..1af9de78f 100644
--- a/Source/Processors/ProcessorGraph.cpp
+++ b/Source/Processors/ProcessorGraph.cpp
@@ -79,12 +79,12 @@ void ProcessorGraph::createDefaultNodes()
     // add record node -- sends output to disk
     RecordNode* recn = new RecordNode();
     recn->setNodeId(RECORD_NODE_ID);
-   
+
 
     // add audio node -- takes all inputs and selects those to be used for audio monitoring
     AudioNode* an = new AudioNode();
     an->setNodeId(AUDIO_NODE_ID);
-    
+
 
     // add audio resampling node -- resamples continuous signals to 44.1kHz
     AudioResamplingNode* arn = new AudioResamplingNode();
@@ -431,7 +431,7 @@ GenericProcessor* ProcessorGraph::createProcessorFromDescription(String& descrip
     {
 
         if (subProcessorType.equalsIgnoreCase("RHA2000-EVAL") ||
-           // subProcessorType.equalsIgnoreCase("File Reader") ||
+            // subProcessorType.equalsIgnoreCase("File Reader") ||
             subProcessorType.equalsIgnoreCase("Custom FPGA") ||
             subProcessorType.equalsIgnoreCase("Rhythm FPGA"))
         {
diff --git a/Source/Processors/ProcessorGraph.h b/Source/Processors/ProcessorGraph.h
index bd232b923..44775bf8f 100755
--- a/Source/Processors/ProcessorGraph.h
+++ b/Source/Processors/ProcessorGraph.h
@@ -94,7 +94,7 @@ private:
     };
 
     void createDefaultNodes();
-    
+
     void clearConnections();
 
 };
diff --git a/Source/Processors/PulsePalOutput.cpp b/Source/Processors/PulsePalOutput.cpp
index 9f51da752..6cbfe51dc 100644
--- a/Source/Processors/PulsePalOutput.cpp
+++ b/Source/Processors/PulsePalOutput.cpp
@@ -60,7 +60,7 @@ void PulsePalOutput::handleEvent(int eventType, MidiMessage& event, int sampleNu
 {
     if (eventType == TTL)
     {
-      //  std::cout << "Received an event!" << std::endl;
+        //  std::cout << "Received an event!" << std::endl;
 
         const uint8* dataptr = event.getRawData();
 
@@ -107,7 +107,9 @@ void PulsePalOutput::setParameter(int parameterIndex, float newValue)
             if (newValue < 0)
             {
                 channelState.set(channelToChange, true);
-            } else {
+            }
+            else
+            {
                 channelState.set(channelToChange, false);
             }
 
@@ -119,8 +121,8 @@ void PulsePalOutput::setParameter(int parameterIndex, float newValue)
 }
 
 void PulsePalOutput::process(AudioSampleBuffer& buffer,
-                         MidiBuffer& events,
-                         int& nSamples)
+                             MidiBuffer& events,
+                             int& nSamples)
 {
 
     checkForEvents(events);
diff --git a/Source/Processors/PulsePalOutput.h b/Source/Processors/PulsePalOutput.h
index ed84b0524..85f192cca 100644
--- a/Source/Processors/PulsePalOutput.h
+++ b/Source/Processors/PulsePalOutput.h
@@ -31,7 +31,7 @@
 
 /**
 
-  Allows the signal chain to send outputs to the Pulse Pal 
+  Allows the signal chain to send outputs to the Pulse Pal
   from Lucid Biosystems (www.lucidbiosystems.com)
 
   @see GenericProcessor, PulsePalOutputEditor, PulsePal
diff --git a/Source/Processors/RecordNode.cpp b/Source/Processors/RecordNode.cpp
index 8115f6ac0..447d78054 100755
--- a/Source/Processors/RecordNode.cpp
+++ b/Source/Processors/RecordNode.cpp
@@ -312,7 +312,7 @@ void RecordNode::setParameter(int parameterIndex, float newValue)
 
         openFile(eventChannel);
 
-         sampleCount = 0; // reset sample count
+        sampleCount = 0; // reset sample count
 
         // create / open necessary files
         for (int i = 0; i < channelPointers.size(); i++)
@@ -418,7 +418,7 @@ void RecordNode::openFile(Channel* ch)
         std::cout << "File already exists, just opening." << std::endl;
     }
 
-    
+
 
     //To avoid a race condition resulting on data written before the header,
     //do not assign the channel pointer until the header has been written
@@ -476,8 +476,8 @@ String RecordNode::generateHeader(Channel* ch)
 
     header += "header.sampleRate = ";
     header += String(channelPointers[0]->sampleRate); // all channels need to have the
-                                                      // same sample rate under the current
-                                                      // scheme
+    // same sample rate under the current
+    // scheme
     header += ";\n";
     header += "header.blockLength = ";
     header += BLOCK_LENGTH;
@@ -543,7 +543,7 @@ float RecordNode::getFreeSpace()
 
 void RecordNode::writeContinuousBuffer(float* data, int nSamples, int channel)
 {
-    
+
     // check to see if the file exists
     if (channelPointers[channel]->file == NULL)
         return;
@@ -556,7 +556,7 @@ void RecordNode::writeContinuousBuffer(float* data, int nSamples, int channel)
     }
     AudioDataConverters::convertFloatToInt16BE(continuousDataFloatBuffer, continuousDataIntegerBuffer, nSamples);
 
-    // 
+    //
     //int16 samps = (int16) nSamples;
 
     if (sampleCount == 0)
@@ -584,14 +584,14 @@ void RecordNode::writeTimestampAndSampleCount(FILE* file)
     int16 samps = BLOCK_LENGTH;
 
     fwrite(&timestamp,                       // ptr
-            8,                               // size of each element
-            1,                               // count
-            file); // ptr to FILE object
+           8,                               // size of each element
+           1,                               // count
+           file); // ptr to FILE object
 
     fwrite(&samps,                           // ptr
-            2,                               // size of each element
-            1,                               // count
-            file); // ptr to FILE object
+           2,                               // size of each element
+           1,                               // count
+           file); // ptr to FILE object
 
 }
 
@@ -637,10 +637,10 @@ void RecordNode::handleEvent(int eventType, MidiMessage& event, int samplePositi
     if (eventType == TTL)
     {
         writeEventBuffer(event, samplePosition);
-    } 
+    }
     else if (eventType == TIMESTAMP)
     {
-    	const uint8* dataptr = event.getRawData();
+        const uint8* dataptr = event.getRawData();
 
         // std::cout << (int) *(dataptr + 11) << " " <<
         //             (int) *(dataptr + 10) << " " <<
@@ -652,7 +652,7 @@ void RecordNode::handleEvent(int eventType, MidiMessage& event, int samplePositi
         //             (int) *(dataptr + 4) << std::endl;
 
 
-    	memcpy(&timestamp, dataptr + 4, 8); // remember to skip first four bytes
+        memcpy(&timestamp, dataptr + 4, 8); // remember to skip first four bytes
     }
 
 }
@@ -685,7 +685,7 @@ void RecordNode::process(AudioSampleBuffer& buffer,
         {
 
             while (samplesWritten < nSamples)
-            { 
+            {
 
                 int numSamplesToWrite = nSamples - samplesWritten;
 
@@ -709,7 +709,9 @@ void RecordNode::process(AudioSampleBuffer& buffer,
                     samplesWritten += numSamplesToWrite;
                     sampleCount += numSamplesToWrite;
 
-                } else {
+                }
+                else
+                {
 
                     numSamplesToWrite = BLOCK_LENGTH - sampleCount;
 
@@ -735,7 +737,7 @@ void RecordNode::process(AudioSampleBuffer& buffer,
             }
         }
 
-      //  std::cout << nSamples << " " << samplesWritten << " " << sampleCount << std::endl;
+        //  std::cout << nSamples << " " << samplesWritten << " " << sampleCount << std::endl;
 
         return;
 
diff --git a/Source/Processors/RecordNode.h b/Source/Processors/RecordNode.h
index ac4486113..7e3efe36b 100755
--- a/Source/Processors/RecordNode.h
+++ b/Source/Processors/RecordNode.h
@@ -102,14 +102,17 @@ public:
     */
     void createNewDirectory();
 
-    File getDataDirectory() {return rootFolder;}
+    File getDataDirectory()
+    {
+        return rootFolder;
+    }
 
     /** Signals when to create a new data directory when recording starts.*/
     bool newDirectoryNeeded;
 
     bool isRecording;
 
-     /** Generate a Matlab-compatible datestring */
+    /** Generate a Matlab-compatible datestring */
     String generateDateString();
 
 
@@ -173,7 +176,7 @@ private:
     /** Generates a default directory name, based on the current date and time */
     String generateDirectoryName();
 
-   
+
     /** Generate filename for a given channel */
     void updateFileName(Channel* ch);
 
diff --git a/Source/Processors/ReferenceNode.cpp b/Source/Processors/ReferenceNode.cpp
index 94bf9bdfd..fc87145ba 100644
--- a/Source/Processors/ReferenceNode.cpp
+++ b/Source/Processors/ReferenceNode.cpp
@@ -82,7 +82,7 @@ void ReferenceNode::process(AudioSampleBuffer& buffer,
                                 0, // sourceStartSample
                                 nSamples, // numSamples
                                 -1.0f // gain to apply to source
-                                );
+                               );
 
         for (int i = 0; i < buffer.getNumChannels(); i++)
         {
@@ -94,9 +94,9 @@ void ReferenceNode::process(AudioSampleBuffer& buffer,
                            0, // sourceStartSample
                            nSamples, // numSamples
                            1.0f // gain to apply to source
-                           );
+                          );
         }
-        
+
     }
 
 }
diff --git a/Source/Processors/Serial/PulsePal.cpp b/Source/Processors/Serial/PulsePal.cpp
index dc3552f21..03a2ca9e8 100644
--- a/Source/Processors/Serial/PulsePal.cpp
+++ b/Source/Processors/Serial/PulsePal.cpp
@@ -42,17 +42,17 @@ PulsePal::PulsePal()
 PulsePal::~PulsePal()
 {
 
-	serial.close();
+    serial.close();
 }
 
 void PulsePal::initialize()
 {
 
-	std::cout << "Searching for Pulse Pal..." << std::endl;
+    std::cout << "Searching for Pulse Pal..." << std::endl;
 
 
     //
-	// lsusb shows Device 104: ID 1eaf:0004
+    // lsusb shows Device 104: ID 1eaf:0004
     // updated udev rules file, but still need to run as root -- no idea why
     //
     // try this instead: sudo chmod o+rw /dev/ttyACM0
@@ -60,25 +60,25 @@ void PulsePal::initialize()
     // works fine, but you have to re-do it every time
     //
 
-	vector<ofSerialDeviceInfo> devices = serial.getDeviceList();
+    vector<ofSerialDeviceInfo> devices = serial.getDeviceList();
 
-	bool foundDevice = false;
+    bool foundDevice = false;
 
-	for (int devNum; devNum < devices.size(); devNum++)
-	{
-		int id = devices[devNum].getDeviceID();
-		string path = devices[devNum].getDevicePath();
+    for (int devNum; devNum < devices.size(); devNum++)
+    {
+        int id = devices[devNum].getDeviceID();
+        string path = devices[devNum].getDevicePath();
         string name = devices[devNum].getDeviceName();
 
-       // std::cout << "Device name: " << name << std::endl;
+        // std::cout << "Device name: " << name << std::endl;
 
         //#if (defined TARGET_LINUX)
-            string acm0 = "ACM0";
+        string acm0 = "ACM0";
         //#endif
 
         //#if (defined TARGET_OSX)
         //    string acm0 = "usbmodemfa131";
-       // #endif
+        // #endif
 
 
         size_t index = path.find(acm0);
@@ -90,9 +90,9 @@ void PulsePal::initialize()
 
             unsigned char bytesToWrite = 59;
 
-           serial.writeByte(bytesToWrite);
+            serial.writeByte(bytesToWrite);
 
-          // std::cout << "error number: " << a << std::endl;
+            // std::cout << "error number: " << a << std::endl;
 
             // while (serial.available() == 0)
             // {
@@ -104,7 +104,7 @@ void PulsePal::initialize()
             std::cout << "Got response: " << (int) resp << std::endl;
 
             if (resp == 254)
-                      {
+            {
                 std::cout << "FOUND A PULSE PAL." << std::endl;
                 foundDevice = true;
             }
@@ -117,162 +117,162 @@ void PulsePal::initialize()
             break;
         }
 
-	}
+    }
 
 
 }
 
 void PulsePal::setPhase1Duration(uint8_t channel, uint32_t timeInMicroseconds)
 {
-	constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
-	program(channel, 0, timeInMicroseconds);
+    constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
+    program(channel, 0, timeInMicroseconds);
 }
 
 void PulsePal::setInterPhaseInterval(uint8_t channel, uint32_t timeInMicroseconds)
 {
-	constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
-	program(channel, 1, timeInMicroseconds);
+    constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
+    program(channel, 1, timeInMicroseconds);
 }
 
 void PulsePal::setPhase2Duration(uint8_t channel, uint32_t timeInMicroseconds)
 {
-	constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
-	program(channel, 2, timeInMicroseconds);
+    constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
+    program(channel, 2, timeInMicroseconds);
 }
 
 void PulsePal::setInterPulseInterval(uint8_t channel, uint32_t timeInMicroseconds)
 {
-	constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
-	program(channel, 3, timeInMicroseconds);
+    constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
+    program(channel, 3, timeInMicroseconds);
 }
 
 void PulsePal::setBurstDuration(uint8_t channel, uint32_t timeInMicroseconds)
 {
-	constrain(&timeInMicroseconds, ZERO_uS, MAX_uS);
-	program(channel, 4, timeInMicroseconds);
+    constrain(&timeInMicroseconds, ZERO_uS, MAX_uS);
+    program(channel, 4, timeInMicroseconds);
 }
 
 void PulsePal::setBurstInterval(uint8_t channel, uint32_t timeInMicroseconds)
 {
-	constrain(&timeInMicroseconds, ZERO_uS, MAX_uS);
-	program(channel, 5, timeInMicroseconds);
+    constrain(&timeInMicroseconds, ZERO_uS, MAX_uS);
+    program(channel, 5, timeInMicroseconds);
 }
 
 void PulsePal::setStimulusTrainDuration(uint8_t channel, uint32_t timeInMicroseconds)
 {
-	constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
-	program(channel, 6, timeInMicroseconds);
+    constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
+    program(channel, 6, timeInMicroseconds);
 }
 
 void PulsePal::setStimulusTrainDelay(uint8_t channel, uint32_t timeInMicroseconds)
 {
-	constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
-	program(channel, 7, timeInMicroseconds);
+    constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
+    program(channel, 7, timeInMicroseconds);
 }
 
 void PulsePal::setBiphasic(uint8_t channel, bool isBiphasic)
 {
-	uint8_t command = 0;
+    uint8_t command = 0;
 
-	if (isBiphasic)
-	{
-		command = 1;
-	}
+    if (isBiphasic)
+    {
+        command = 1;
+    }
 
-	program(channel, 8, command);
+    program(channel, 8, command);
 }
 
 void PulsePal::setPhase1Voltage(uint8_t channel, float voltage)
 {
-	program(channel, 9, voltageToByte(voltage));
+    program(channel, 9, voltageToByte(voltage));
 }
 
 void PulsePal::setPhase2Voltage(uint8_t channel, float voltage)
 {
-	program(channel, 10, voltageToByte(voltage));
+    program(channel, 10, voltageToByte(voltage));
 }
 
 void PulsePal::updateDisplay(string line1, string line2)
 {
-	uint8_t message1 = 85;
+    uint8_t message1 = 85;
 
-	serial.writeByte(message1);
+    serial.writeByte(message1);
 
-	serial.writeBytes((unsigned char*) line1.data(), line1.size());
-	//serial.writeByte(0);
-	//serial.writeByte(RETURN);
-	serial.writeByte(254);
-	serial.writeBytes((unsigned char*) line2.data(), line2.size());
-	//serial.writeByte(0);
-	//serial.writeByte(RETURN);
+    serial.writeBytes((unsigned char*) line1.data(), line1.size());
+    //serial.writeByte(0);
+    //serial.writeByte(RETURN);
+    serial.writeByte(254);
+    serial.writeBytes((unsigned char*) line2.data(), line2.size());
+    //serial.writeByte(0);
+    //serial.writeByte(RETURN);
 
 }
 
 void PulsePal::program(uint8_t channel, uint8_t paramCode, uint32_t paramValue)
 {
-	std::cout << "sending 32-bit message" << std::endl;
+    std::cout << "sending 32-bit message" << std::endl;
 
-	uint8_t message1[3] = {79, paramCode, channel};
+    uint8_t message1[3] = {79, paramCode, channel};
 
-	uint8_t message2[4];
+    uint8_t message2[4];
 
-	// make sure byte order is little-endian:
-	message2[0] = (paramValue & 0xff);
-	message2[1] = (paramValue & 0xff00) >> 8;
-	message2[2] = (paramValue & 0xff0000) >> 16;
-	message2[3] = (paramValue & 0xff00000) >> 24;
+    // make sure byte order is little-endian:
+    message2[0] = (paramValue & 0xff);
+    message2[1] = (paramValue & 0xff00) >> 8;
+    message2[2] = (paramValue & 0xff0000) >> 16;
+    message2[3] = (paramValue & 0xff00000) >> 24;
 
-	serial.writeBytes(message1, 3);
-	serial.writeBytes(message2, 4);
+    serial.writeBytes(message1, 3);
+    serial.writeBytes(message2, 4);
 
-	std::cout << "Message 1: " << (int) message1[0] << " " << (int) message1[1] << " " << (int) message1[2] << std::endl;
-	std::cout << "Message 2: " << (int) message2[0] << " " << (int) message2[1] << " " << (int) message2[2] <<  " " << (int) message2[3] << std::endl;
+    std::cout << "Message 1: " << (int) message1[0] << " " << (int) message1[1] << " " << (int) message1[2] << std::endl;
+    std::cout << "Message 2: " << (int) message2[0] << " " << (int) message2[1] << " " << (int) message2[2] <<  " " << (int) message2[3] << std::endl;
 }
 
 
 void PulsePal::program(uint8_t channel, uint8_t paramCode, uint8_t paramValue)
 {
 
-	std::cout << "sending 8-bit message" << std::endl;
+    std::cout << "sending 8-bit message" << std::endl;
 
-	uint8_t message1[3] = {79, paramCode, channel};
+    uint8_t message1[3] = {79, paramCode, channel};
 
-	serial.writeBytes(message1, 3);
-	serial.writeBytes(&paramValue, 1);
+    serial.writeBytes(message1, 3);
+    serial.writeBytes(&paramValue, 1);
 
-	std::cout << "Message 1: " << (int) message1[0] << " " << (int) message1[1] << " " << (int) message1[2] << std::endl;
-	std::cout << "Message 2: " << paramValue << std::endl;
+    std::cout << "Message 1: " << (int) message1[0] << " " << (int) message1[1] << " " << (int) message1[2] << std::endl;
+    std::cout << "Message 2: " << paramValue << std::endl;
 }
 
 void PulsePal::constrain(uint32_t* value, uint32_t min, uint32_t max)
 {
 
-	// value must be a multiple of 50
-	if (*value % 50 > 0)
-	{
-		*value = *value - (*value % 50);
-	}
+    // value must be a multiple of 50
+    if (*value % 50 > 0)
+    {
+        *value = *value - (*value % 50);
+    }
 
-	if (*value < min)
-	{
-		*value = min;
-	}
+    if (*value < min)
+    {
+        *value = min;
+    }
 
-	if (*value > max)
-	{
-		*value = max;
-	}
+    if (*value > max)
+    {
+        *value = max;
+    }
 
 }
 
 uint8_t PulsePal::voltageToByte(float voltage)
 {
-	// input: -10 to 10 V
-	// output: 0-255
+    // input: -10 to 10 V
+    // output: 0-255
 
-	uint8_t output = (uint8_t) ((voltage+10)/20)*255;
+    uint8_t output = (uint8_t)((voltage+10)/20)*255;
 
-	return output;
+    return output;
 
 }
 
@@ -280,7 +280,7 @@ uint8_t PulsePal::voltageToByte(float voltage)
 void PulsePal::triggerChannel(uint8_t chan)
 {
     const uint8_t code = 1 << (chan-1);
-    
+
     uint8_t bytesToWrite[2] = {84, code};
 
     serial.writeBytes(bytesToWrite, 2);
diff --git a/Source/Processors/Serial/PulsePal.h b/Source/Processors/Serial/PulsePal.h
index 1e758da44..9b8bb2ad0 100644
--- a/Source/Processors/Serial/PulsePal.h
+++ b/Source/Processors/Serial/PulsePal.h
@@ -41,37 +41,37 @@
 class PulsePal
 {
 public:
-	PulsePal();
-	~PulsePal();
+    PulsePal();
+    ~PulsePal();
 
-	void initialize();
+    void initialize();
 
-	void setPhase1Duration(uint8_t channel, uint32_t timeInMicroseconds);
-	void setInterPhaseInterval(uint8_t channel, uint32_t timeInMicroseconds);
-	void setPhase2Duration(uint8_t channel, uint32_t timeInMicroseconds);
-	void setInterPulseInterval(uint8_t channel, uint32_t timeInMicroseconds);
-	void setBurstDuration(uint8_t channel, uint32_t timeInMicroseconds);
-	void setBurstInterval(uint8_t channel, uint32_t timeInMicroseconds);
-	void setStimulusTrainDuration(uint8_t channel, uint32_t timeInMicroseconds);
-	void setStimulusTrainDelay(uint8_t channel, uint32_t timeInMicroseconds);
-	void setBiphasic(uint8_t channel, bool isBiphasic);
-	void setPhase1Voltage(uint8_t channel, float voltage);
-	void setPhase2Voltage(uint8_t channel, float voltage);
+    void setPhase1Duration(uint8_t channel, uint32_t timeInMicroseconds);
+    void setInterPhaseInterval(uint8_t channel, uint32_t timeInMicroseconds);
+    void setPhase2Duration(uint8_t channel, uint32_t timeInMicroseconds);
+    void setInterPulseInterval(uint8_t channel, uint32_t timeInMicroseconds);
+    void setBurstDuration(uint8_t channel, uint32_t timeInMicroseconds);
+    void setBurstInterval(uint8_t channel, uint32_t timeInMicroseconds);
+    void setStimulusTrainDuration(uint8_t channel, uint32_t timeInMicroseconds);
+    void setStimulusTrainDelay(uint8_t channel, uint32_t timeInMicroseconds);
+    void setBiphasic(uint8_t channel, bool isBiphasic);
+    void setPhase1Voltage(uint8_t channel, float voltage);
+    void setPhase2Voltage(uint8_t channel, float voltage);
 
-	void triggerChannel(uint8_t channel);
+    void triggerChannel(uint8_t channel);
 
-	void updateDisplay(string line1, string line2);
+    void updateDisplay(string line1, string line2);
 
 private:
 
-	void constrain(uint32_t* value, uint32_t min, uint32_t max);
+    void constrain(uint32_t* value, uint32_t min, uint32_t max);
 
-	void program(uint8_t channel, uint8_t paramCode, uint32_t paramValue);
-	void program(uint8_t channel, uint8_t paramCode, uint8_t paramValue);
+    void program(uint8_t channel, uint8_t paramCode, uint32_t paramValue);
+    void program(uint8_t channel, uint8_t paramCode, uint8_t paramValue);
 
-	uint8_t voltageToByte(float voltage);
+    uint8_t voltageToByte(float voltage);
 
-	ofSerial serial;
+    ofSerial serial;
 
 };
 
diff --git a/Source/Processors/SourceNode.cpp b/Source/Processors/SourceNode.cpp
index 5a8b53ccc..51327d9a5 100755
--- a/Source/Processors/SourceNode.cpp
+++ b/Source/Processors/SourceNode.cpp
@@ -51,7 +51,7 @@ SourceNode::SourceNode(const String& name_)
     }
     else if (getName().equalsIgnoreCase("File Reader"))
     {
-            dataThread = new FileReaderThread(this); 
+        dataThread = new FileReaderThread(this);
     }
     else if (getName().equalsIgnoreCase("Rhythm FPGA"))
     {
@@ -212,14 +212,15 @@ AudioProcessorEditor* SourceNode::createEditor()
     {
         editor = new RHD2000Editor(this, (RHD2000Thread*) dataThread.get(), true);
 
-      //  RHD2000Editor* r2e = (RHD2000Editor*) editor.get();
-      //  r2e->scanPorts();
+        //  RHD2000Editor* r2e = (RHD2000Editor*) editor.get();
+        //  r2e->scanPorts();
     }
-  //  else if (getName().equalsIgnoreCase("File Reader"))
-  //  {
-   //     editor = new FileReaderEditor(this, (FileReaderThread*) dataThread.get(), true);
-   // }
-    else {
+    //  else if (getName().equalsIgnoreCase("File Reader"))
+    //  {
+    //     editor = new FileReaderEditor(this, (FileReaderThread*) dataThread.get(), true);
+    // }
+    else
+    {
         editor = new SourceNodeEditor(this, true);
     }
     return editor;
@@ -330,7 +331,7 @@ void SourceNode::process(AudioSampleBuffer& buffer,
 
     nSamples = inputBuffer->readAllFromBuffer(buffer, &timestamp, eventCodeBuffer, buffer.getNumSamples());
 
-    //std::cout << *buffer.getSampleData(0) << std::endl; 
+    //std::cout << *buffer.getSampleData(0) << std::endl;
 
     //std::cout << "Source node timestamp: " << timestamp << std::endl;
 
@@ -425,18 +426,18 @@ void SourceNode::loadCustomParametersFromXml()
 
     if (parametersAsXml != nullptr)
     {
-        // use parametersAsXml to restore state 
+        // use parametersAsXml to restore state
 
         forEachXmlChildElement(*parametersAsXml, xmlNode)
         {
-           if (xmlNode->hasTagName("FILENAME"))
+            if (xmlNode->hasTagName("FILENAME"))
             {
                 String filepath = xmlNode->getStringAttribute("path");
                 FileReaderEditor* fre = (FileReaderEditor*) getEditor();
                 fre->setFile(filepath);
 
             }
-        }   
+        }
     }
 
 }
\ No newline at end of file
diff --git a/Source/Processors/SourceNode.h b/Source/Processors/SourceNode.h
index fa2d66cfe..4c314d691 100755
--- a/Source/Processors/SourceNode.h
+++ b/Source/Processors/SourceNode.h
@@ -88,7 +88,7 @@ public:
     void saveCustomParametersToXml(XmlElement* parentElement);
     void loadCustomParametersFromXml();
 
-     bool tryEnablingEditor();
+    bool tryEnablingEditor();
 
 private:
 
@@ -111,7 +111,7 @@ private:
     int ttlState;
 
     void updateSettings();
-   
+
 
     JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SourceNode);
 
diff --git a/Source/Processors/SpikeDetector.cpp b/Source/Processors/SpikeDetector.cpp
index b5a32af9a..ea7228c96 100755
--- a/Source/Processors/SpikeDetector.cpp
+++ b/Source/Processors/SpikeDetector.cpp
@@ -206,7 +206,7 @@ void SpikeDetector::setChannel(int electrodeIndex, int channelNum, int newChanne
 {
 
     std::cout << "Setting electrode " << electrodeIndex << " channel " << channelNum <<
-               " to " << newChannel << std::endl;
+              " to " << newChannel << std::endl;
 
     *(electrodes[electrodeIndex]->channels+channelNum) = newChannel;
 }
@@ -235,7 +235,7 @@ void SpikeDetector::setChannelActive(int electrodeIndex, int subChannel, bool ac
         setParameter(98, 1);
     else
         setParameter(98, 0);
-    
+
 }
 
 bool SpikeDetector::isChannelActive(int electrodeIndex, int i)
@@ -263,7 +263,8 @@ void SpikeDetector::setParameter(int parameterIndex, float newValue)
     if (parameterIndex == 99 && currentElectrode > -1)
     {
         *(electrodes[currentElectrode]->thresholds+currentChannelIndex) = newValue;
-    } else if (parameterIndex == 98 && currentElectrode > -1)
+    }
+    else if (parameterIndex == 98 && currentElectrode > -1)
     {
         if (newValue == 0.0f)
             *(electrodes[currentElectrode]->isActive+currentChannelIndex) = false;
@@ -379,12 +380,14 @@ void SpikeDetector::addWaveformToSpikeObject(SpikeObject* s,
             //std::cout << currentIndex << std::endl;
 
         }
-    } else {
+    }
+    else
+    {
         for (int sample = 0; sample < spikeLength; sample++)
         {
 
-            // insert a blank spike if the 
-            s->data[currentIndex] = 0; 
+            // insert a blank spike if the
+            s->data[currentIndex] = 0;
             currentIndex++;
             sampleIndex++;
 
@@ -635,13 +638,13 @@ void SpikeDetector::saveCustomParametersToXml(XmlElement* parentElement)
 
     for (int i = 0; i < electrodes.size(); i++)
     {
-         XmlElement* electrodeNode = parentElement->createNewChildElement("ELECTRODE");
-         electrodeNode->setAttribute("name", electrodes[i]->name);
-         electrodeNode->setAttribute("numChannels", electrodes[i]->numChannels);
-         electrodeNode->setAttribute("prePeakSamples", electrodes[i]->prePeakSamples);
-         electrodeNode->setAttribute("postPeakSamples", electrodes[i]->postPeakSamples);
+        XmlElement* electrodeNode = parentElement->createNewChildElement("ELECTRODE");
+        electrodeNode->setAttribute("name", electrodes[i]->name);
+        electrodeNode->setAttribute("numChannels", electrodes[i]->numChannels);
+        electrodeNode->setAttribute("prePeakSamples", electrodes[i]->prePeakSamples);
+        electrodeNode->setAttribute("postPeakSamples", electrodes[i]->postPeakSamples);
 
-         for (int j = 0; j < electrodes[i]->numChannels; j++)
+        for (int j = 0; j < electrodes[i]->numChannels; j++)
         {
             XmlElement* channelNode = electrodeNode->createNewChildElement("SUBCHANNEL");
             channelNode->setAttribute("ch",*(electrodes[i]->channels+j));
@@ -659,13 +662,13 @@ void SpikeDetector::loadCustomParametersFromXml()
 
     if (parametersAsXml != nullptr)
     {
-        // use parametersAsXml to restore state 
+        // use parametersAsXml to restore state
 
         int electrodeIndex = -1;
 
         forEachXmlChildElement(*parametersAsXml, xmlNode)
         {
-           if (xmlNode->hasTagName("ELECTRODE"))
+            if (xmlNode->hasTagName("ELECTRODE"))
             {
 
                 electrodeIndex++;
@@ -674,7 +677,7 @@ void SpikeDetector::loadCustomParametersFromXml()
 
                 SpikeDetectorEditor* sde = (SpikeDetectorEditor*) getEditor();
                 sde->addElectrode(channelsPerElectrode);
-                
+
                 setElectrodeName(electrodeIndex+1, xmlNode->getStringAttribute("name"));
 
                 int channelIndex = -1;
@@ -692,7 +695,7 @@ void SpikeDetector::loadCustomParametersFromXml()
                 }
 
             }
-        }   
+        }
     }
 
 }
diff --git a/Source/Processors/Visualization/LfpDisplayCanvas.cpp b/Source/Processors/Visualization/LfpDisplayCanvas.cpp
index 2a905e37f..a3263fc2f 100755
--- a/Source/Processors/Visualization/LfpDisplayCanvas.cpp
+++ b/Source/Processors/Visualization/LfpDisplayCanvas.cpp
@@ -28,7 +28,7 @@
 LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
     screenBufferIndex(0), timebase(1.0f), displayGain(1.0f),   timeOffset(0.0f),
     processor(processor_),
-     displayBufferIndex(0)
+    displayBufferIndex(0)
 {
 
     nChans = processor->getNumInputs();
@@ -75,7 +75,7 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
     timebases.add("5.0");
     timebases.add("10.0");
 
-    
+
     spreads.add("10");
     spreads.add("20");
     spreads.add("30");
@@ -110,7 +110,7 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
     // add event display-specific controls (currently just an enable/disable button)
     for (int i = 0; i < 8; i++)
     {
-        
+
 
         eventDisplayInterface* eventOptions = new eventDisplayInterface(lfpDisplay, this, i);
         eventDisplayInterfaces.add(eventOptions);
@@ -149,7 +149,7 @@ void LfpDisplayCanvas::resized()
     }
 
 
-   // std::cout << "Canvas thinks LfpDisplay should be this high: " 
+    // std::cout << "Canvas thinks LfpDisplay should be this high: "
     //  << lfpDisplay->getTotalHeight() << std::endl;
 
 }
@@ -184,14 +184,14 @@ void LfpDisplayCanvas::update()
     lfpDisplay->setNumChannels(nChans);
 
     // update channel names
-	for (int i = 0; i < processor->getNumInputs(); i++)
+    for (int i = 0; i < processor->getNumInputs(); i++)
     {
 
-    	String chName = processor->channels[i]->getName();
+        String chName = processor->channels[i]->getName();
 
-    	//std::cout << chName << std::endl;
+        //std::cout << chName << std::endl;
 
-    	lfpDisplay->channelInfo[i]->setName(chName);
+        lfpDisplay->channelInfo[i]->setName(chName);
 
     }
 
@@ -213,11 +213,11 @@ void LfpDisplayCanvas::comboBoxChanged(ComboBox* cb)
     }
     else if (cb == spreadSelection)
     {
-         //spread = spreads[cb->getSelectedId()-1].getFloatValue();
-         lfpDisplay->setChannelHeight(spreads[cb->getSelectedId()-1].getIntValue());
-         //lfpDisplay->resized();
-         resized();
-         //std::cout << "Setting spread to " << spreads[cb->getSelectedId()-1].getFloatValue() << std::endl;
+        //spread = spreads[cb->getSelectedId()-1].getFloatValue();
+        lfpDisplay->setChannelHeight(spreads[cb->getSelectedId()-1].getIntValue());
+        //lfpDisplay->resized();
+        resized();
+        //std::cout << "Setting spread to " << spreads[cb->getSelectedId()-1].getFloatValue() << std::endl;
     }
 
     timescale->setTimebase(timebase);
@@ -306,9 +306,9 @@ void LfpDisplayCanvas::updateScreenBuffer()
     int valuesNeeded = (int) float(nSamples) / ratio;
 
 
-    if ( screenBufferIndex + valuesNeeded > maxSamples) // crop number of samples to fit cavas width
+    if (screenBufferIndex + valuesNeeded > maxSamples)  // crop number of samples to fit cavas width
     {
-            valuesNeeded = maxSamples - screenBufferIndex;
+        valuesNeeded = maxSamples - screenBufferIndex;
     }
 
     float subSampleOffset = 0.0;
@@ -359,7 +359,7 @@ void LfpDisplayCanvas::updateScreenBuffer()
             screenBufferIndex++;
 
         }
-                
+
 
     }
     else
@@ -428,7 +428,7 @@ void LfpDisplayCanvas::paint(Graphics& g)
 
 }
 
-void LfpDisplayCanvas::refresh() 
+void LfpDisplayCanvas::refresh()
 {
     updateScreenBuffer();
 
@@ -487,7 +487,7 @@ LfpTimescale::~LfpTimescale()
 void LfpTimescale::paint(Graphics& g)
 {
 
-    
+
 
     g.setFont(font);
 
@@ -630,24 +630,24 @@ void LfpDisplay::resized()
         LfpChannelDisplay* disp = channels[i];
 
         disp->setBounds(canvas->leftmargin,
-                totalHeight-disp->getChannelOverlap()/2,
-                getWidth(),
-                disp->getChannelHeight()+disp->getChannelOverlap());
+                        totalHeight-disp->getChannelOverlap()/2,
+                        getWidth(),
+                        disp->getChannelHeight()+disp->getChannelOverlap());
 
         LfpChannelDisplayInfo* info = channelInfo[i];
 
         info->setBounds(0,
-                totalHeight-disp->getChannelOverlap()/2,
-                canvas->leftmargin,
-                disp->getChannelHeight()+disp->getChannelOverlap());
+                        totalHeight-disp->getChannelOverlap()/2,
+                        canvas->leftmargin,
+                        disp->getChannelHeight()+disp->getChannelOverlap());
 
         totalHeight += disp->getChannelHeight();
 
     }
 
-    canvas->fullredraw = true; //issue full redraw 
+    canvas->fullredraw = true; //issue full redraw
 
-   // std::cout << "Total height: " << totalHeight << std::endl;
+    // std::cout << "Total height: " << totalHeight << std::endl;
 
 }
 
@@ -673,20 +673,22 @@ void LfpDisplay::refresh()
         if ((topBorder <= componentBottom && bottomBorder >= componentTop))
         {
             if (canvas->fullredraw)
-            {    
+            {
                 channels[i]->fullredraw = true;
                 channels[i]->repaint();
                 channelInfo[i]->repaint();
 
-            } else {
-                channels[i]->repaint(canvas->lastScreenBufferIndex-2, 0, (canvas->screenBufferIndex-canvas->lastScreenBufferIndex)+3, getChildComponent(i)->getHeight() ); //repaint only the updated portion
+            }
+            else
+            {
+                channels[i]->repaint(canvas->lastScreenBufferIndex-2, 0, (canvas->screenBufferIndex-canvas->lastScreenBufferIndex)+3, getChildComponent(i)->getHeight());  //repaint only the updated portion
                 // we redraw from -2 to +1 relative to the real redraw window, the -2 makes sure that the lines join nicely, and the +1 draws the vertical update line
             }
             //std::cout << i << std::endl;
         }
 
     }
-        
+
     canvas->fullredraw = false;
 }
 
@@ -726,32 +728,45 @@ int LfpDisplay::getChannelHeight()
 
 
 
- void LfpDisplay::mouseWheelMove(const MouseEvent&  e, const MouseWheelDetails&   wheel )   {
-    
+void LfpDisplay::mouseWheelMove(const MouseEvent&  e, const MouseWheelDetails&   wheel)
+{
+
     //std::cout << "Mouse wheel " <<  e.mods.isCommandDown() << "  " << wheel.deltaY << std::endl;
-    
-    if (e.mods.isCommandDown()){ // CTRL + scroll wheel -> change channel spacing 
-        // 
+
+    if (e.mods.isCommandDown())  // CTRL + scroll wheel -> change channel spacing
+    {
+        //
         // this should also scroll to keep the selected channel at a constant y!
         //
         int h = getChannelHeight();
-        if (wheel.deltaY>0){
-            setChannelHeight(h+1);            
-        } else{
+        if (wheel.deltaY>0)
+        {
+            setChannelHeight(h+1);
+        }
+        else
+        {
             if (h>5)
                 setChannelHeight(h-1);
         }
-    } else {
-        if(e.mods.isShiftDown())  {// SHIFT + scroll wheel -> change channel range
+    }
+    else
+    {
+        if (e.mods.isShiftDown())  // SHIFT + scroll wheel -> change channel range
+        {
             int h= getRange();
-            if (wheel.deltaY>0){
-                setRange(h+10);            
-            } else{
+            if (wheel.deltaY>0)
+            {
+                setRange(h+10);
+            }
+            else
+            {
                 if (h>11)
                     setRange(h-10);
             }
 
-        } else{ // just scroll
+        }
+        else    // just scroll
+        {
             //  passes the event up to the viewport so the screen scrolls
             if (viewport != nullptr && e.eventComponent == this) // passes only if it's not a listening event
                 viewport->mouseWheelMove(e.getEventRelativeTo(canvas), wheel);
@@ -759,11 +774,11 @@ int LfpDisplay::getChannelHeight()
         }
     }
 
-    canvas->fullredraw = true;//issue full redraw 
+    canvas->fullredraw = true;//issue full redraw
 
     refresh();
 
- }
+}
 
 
 void LfpDisplay::mouseDown(const MouseEvent& event)
@@ -772,17 +787,20 @@ void LfpDisplay::mouseDown(const MouseEvent& event)
     MouseEvent canvasevent = event.getEventRelativeTo(viewport);
     int y = canvasevent.getMouseDownY() + viewport->getViewPositionY(); // need to account for scrolling
 
-    int dist=0; int mindist=10000; int closest=5;
+    int dist=0;
+    int mindist=10000;
+    int closest=5;
     for (int n = 0; n < numChans; n++) // select closest instead of relying ot eventComponent
     {
         channels[n]->deselect();
-        
+
         int cpos=(channels[n]->getY() + (channels[n]->getHeight()/2));
-        dist=int(abs( y - cpos )); 
-    
+        dist=int(abs(y - cpos));
+
         //std::cout << "Mouse down at " << y << " pos is "<< cpos << "n:" << n << "  dist " << dist << std::endl;
 
-        if (dist<mindist) {
+        if (dist<mindist)
+        {
             mindist=dist-1;
             closest=n;
         }
@@ -793,7 +811,7 @@ void LfpDisplay::mouseDown(const MouseEvent& event)
 
     channels[closest]->select();
 
-    canvas->fullredraw = true;//issue full redraw 
+    canvas->fullredraw = true;//issue full redraw
 
     refresh();
 
@@ -805,9 +823,9 @@ bool LfpDisplay::setEventDisplayState(int ch, bool state)
     eventDisplayEnabled[ch] = state;
     return eventDisplayEnabled[ch];
 }
-    
 
-bool LfpDisplay::getEventDisplayState(int ch) 
+
+bool LfpDisplay::getEventDisplayState(int ch)
 {
     return eventDisplayEnabled[ch];
 }
@@ -820,7 +838,7 @@ LfpChannelDisplay::LfpChannelDisplay(LfpDisplayCanvas* c, LfpDisplay* d, int cha
 {
 
 
-	name = String(channelNumber+1); // default is to make the channelNumber the name
+    name = String(channelNumber+1); // default is to make the channelNumber the name
 
 
     channelHeightFloat = (float) channelHeight;
@@ -847,7 +865,7 @@ void LfpChannelDisplay::paint(Graphics& g)
 
 
 
-    //g.setColour(Colours::red); // draw oldest drawn sample position 
+    //g.setColour(Colours::red); // draw oldest drawn sample position
     //g.drawLine(canvas->lastScreenBufferIndex, 0, canvas->lastScreenBufferIndex, getHeight()-channelOverlap);
 
     int center = getHeight()/2;
@@ -871,13 +889,13 @@ void LfpChannelDisplay::paint(Graphics& g)
     g.drawLine(0, getHeight()/2, getWidth(), getHeight()/2);
 
     int stepSize = 1;
-    int from = 0; // for vertical line drawing in the LFP data 
+    int from = 0; // for vertical line drawing in the LFP data
     int to = 0;
 
     //for (int i = 0; i < getWidth()-stepSize; i += stepSize) // redraw entire display
     int ifrom = canvas->lastScreenBufferIndex - 3; // need to start drawing a bit before the actual redraw windowfor the interpolated line to join correctly
-    
-    if (ifrom < 0) 
+
+    if (ifrom < 0)
         ifrom = 0;
 
     int ito = canvas->screenBufferIndex - 1;
@@ -893,11 +911,13 @@ void LfpChannelDisplay::paint(Graphics& g)
     {
 
         // draw event markers
-        int rawEventState = canvas->getYCoord(canvas->getNumChannels(), i);// get last channel+1 in buffer (represents events) 
+        int rawEventState = canvas->getYCoord(canvas->getNumChannels(), i);// get last channel+1 in buffer (represents events)
         for (int ev_ch = 0; ev_ch < 8 ; ev_ch++) // for all event channels
         {
-            if (display->getEventDisplayState(ev_ch)){ // check if plotting for this channel is enabled
-                if ( rawEventState & (1 << ev_ch)){  // events are  representet by a bit code, so we have to extract the individual bits with a mask
+            if (display->getEventDisplayState(ev_ch))  // check if plotting for this channel is enabled
+            {
+                if (rawEventState & (1 << ev_ch))    // events are  representet by a bit code, so we have to extract the individual bits with a mask
+                {
                     g.setColour(display->channelColours[ev_ch*2]); // get color from lfp color scheme
                     g.setOpacity(0.35f);
                     g.drawLine(i, center-channelHeight/2 , i, center+channelHeight/2);
@@ -905,16 +925,16 @@ void LfpChannelDisplay::paint(Graphics& g)
             }
         }
 
-        //std::cout << "e " << canvas->getYCoord(canvas->getNumChannels()-1, i) << std::endl;          
-        
+        //std::cout << "e " << canvas->getYCoord(canvas->getNumChannels()-1, i) << std::endl;
+
         g.setColour(lineColour);
         g.setOpacity(1);
 
-       // drawLine makes for ok anti-aliased plots, but is pretty slow
+        // drawLine makes for ok anti-aliased plots, but is pretty slow
         g.drawLine(i,
-                  (canvas->getYCoord(chan, i)/range*channelHeightFloat)+getHeight()/2,
+                   (canvas->getYCoord(chan, i)/range*channelHeightFloat)+getHeight()/2,
                    i+stepSize,
-                    (canvas->getYCoord(chan, i+stepSize)/range*channelHeightFloat)+getHeight()/2);
+                   (canvas->getYCoord(chan, i+stepSize)/range*channelHeightFloat)+getHeight()/2);
 
         if (false) // switched back to line drawing now that we only draw partial updates
         {
@@ -923,38 +943,46 @@ void LfpChannelDisplay::paint(Graphics& g)
             double a = (canvas->getYCoord(chan, i)/range*channelHeightFloat)+getHeight()/2;
             double b = (canvas->getYCoord(chan, i+stepSize)/range*channelHeightFloat)+getHeight()/2;
 
-            if (a<b){
-                 from = (a);
-                 to = (b);
-            } else {
-                 from = (b);
-                 to = (a);
+            if (a<b)
+            {
+                from = (a);
+                to = (b);
+            }
+            else
+            {
+                from = (b);
+                to = (a);
             }
-            
-            if ((to-from) < 40){ // if there is too much vertical range in one pixel, don't draw the full line for speed reasons 
+
+            if ((to-from) < 40)  // if there is too much vertical range in one pixel, don't draw the full line for speed reasons
+            {
                 for (int j = from; j <= to; j += 1)
                 {
                     g.setPixel(i,j);
                 }
-            } else if ((to-from) < 100){
+            }
+            else if ((to-from) < 100)
+            {
                 for (int j = from; j <= to; j += 2)
                 {
                     g.setPixel(i,j);
                 }
-            } else {
+            }
+            else
+            {
                 g.setPixel(i,to);
                 g.setPixel(i,from);
             }
 
         }
-        
+
     }
 
- // g.setColour(lineColour.withAlpha(0.7f)); // alpha on seems to decrease draw speed
-   // g.setFont(channelFont);
-  //  g.setFont(channelHeightFloat*0.6);
+    // g.setColour(lineColour.withAlpha(0.7f)); // alpha on seems to decrease draw speed
+    // g.setFont(channelFont);
+    //  g.setFont(channelHeightFloat*0.6);
 
-   // g.drawText(String(chan+1), 10, center-channelHeight/2, 200, channelHeight, Justification::left, false);
+    // g.drawText(String(chan+1), 10, center-channelHeight/2, 200, channelHeight, Justification::left, false);
 
 
 }
@@ -997,8 +1025,8 @@ void LfpChannelDisplay::setChannelHeight(int c)
 {
     channelHeight = c;
     channelHeightFloat = (float) channelHeight;
-    //channelOverlap = channelHeight / 2; //clips data too early, 
-    channelOverlap = channelHeight *5;   
+    //channelOverlap = channelHeight / 2; //clips data too early,
+    channelOverlap = channelHeight *5;
 }
 
 int LfpChannelDisplay::getChannelHeight()
@@ -1020,7 +1048,7 @@ int LfpChannelDisplay::getChannelOverlap()
 
 void LfpChannelDisplay::setName(String name_)
 {
-	name = name_;
+    name = name_;
 }
 
 // -------------------------------
@@ -1046,7 +1074,7 @@ void LfpChannelDisplayInfo::paint(Graphics& g)
 
 }
 
- 
+
 
 // Event display Options --------------------------------------------------------------------
 
@@ -1078,20 +1106,23 @@ eventDisplayInterface::~eventDisplayInterface()
 void eventDisplayInterface::checkEnabledState()
 {
     isEnabled = display->getEventDisplayState(channelNumber);
-    
+
     //repaint();
 }
 
 void eventDisplayInterface::buttonClicked(Button* button)
 {
-  checkEnabledState();
-  if (isEnabled){
-    display->setEventDisplayState(channelNumber, false);
-  } else {
-    display->setEventDisplayState(channelNumber, true);
-  }
+    checkEnabledState();
+    if (isEnabled)
+    {
+        display->setEventDisplayState(channelNumber, false);
+    }
+    else
+    {
+        display->setEventDisplayState(channelNumber, true);
+    }
 
-  repaint();
+    repaint();
 
 }
 
@@ -1101,7 +1132,8 @@ void eventDisplayInterface::paint(Graphics& g)
 
     checkEnabledState();
 
-    if (isEnabled){
+    if (isEnabled)
+    {
         g.setColour(display->channelColours[channelNumber*2]);
         g.fillRoundedRectangle(2,2,18,18,5.0f);
     }
diff --git a/Source/Processors/Visualization/LfpDisplayCanvas.h b/Source/Processors/Visualization/LfpDisplayCanvas.h
index 59e538689..0438cbb46 100755
--- a/Source/Processors/Visualization/LfpDisplayCanvas.h
+++ b/Source/Processors/Visualization/LfpDisplayCanvas.h
@@ -45,7 +45,7 @@ class eventDisplayInterface;
 
 class LfpDisplayCanvas : public Visualizer,
     public ComboBox::Listener
-    
+
 {
 public:
     LfpDisplayCanvas(LfpDisplayNode* n);
@@ -100,7 +100,7 @@ private:
     static const int MAX_N_SAMP = 5000; // maximum display size in pixels
     //float waves[MAX_N_CHAN][MAX_N_SAMP*2]; // we need an x and y point for each sample
 
-    
+
 
 
     LfpDisplayNode* processor;
@@ -168,9 +168,9 @@ public:
 
     void setNumChannels(int numChannels);
     int getNumChannels();
-    
+
     int getTotalHeight();
-    
+
     void paint(Graphics& g);
 
     void refresh();
@@ -178,9 +178,9 @@ public:
     void resized();
 
     void mouseDown(const MouseEvent& event);
-    void mouseWheelMove(const MouseEvent&  event, const MouseWheelDetails&   wheel ) ;
+    void mouseWheelMove(const MouseEvent&  event, const MouseWheelDetails&   wheel) ;
+
 
-    
     void setRange(float range);
     int getRange();
 
@@ -288,7 +288,7 @@ public:
 private:
 
     int channelNumber;
-    
+
     bool isEnabled;
 
     LfpDisplay* display;
diff --git a/Source/Processors/Visualization/SpikeDisplayCanvas.cpp b/Source/Processors/Visualization/SpikeDisplayCanvas.cpp
index 92ebfe6bc..0cebfe1a3 100755
--- a/Source/Processors/Visualization/SpikeDisplayCanvas.cpp
+++ b/Source/Processors/Visualization/SpikeDisplayCanvas.cpp
@@ -20,7 +20,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 */
- 
+
 #include "SpikeDisplayCanvas.h"
 #include "../RecordNode.h"
 
@@ -168,7 +168,7 @@ bool SpikeDisplayCanvas::keyPressed(const KeyPress& key)
     if (key.isKeyCode(c.getKeyCode())) // C
     {
         spikeDisplay->clear();
-        
+
         std::cout << "Clearing display" << std::endl;
         return true;
     }
@@ -205,20 +205,20 @@ SpikeDisplay::~SpikeDisplay()
 
 void SpikeDisplay::clear()
 {
-   if (spikePlots.size() > 0)
-   {
+    if (spikePlots.size() > 0)
+    {
         for (int i = 0; i < spikePlots.size(); i++)
         {
             spikePlots[i]->clear();
         }
-   }
-        
+    }
+
 }
 
 void SpikeDisplay::removePlots()
 {
-   spikePlots.clear();
-        
+    spikePlots.clear();
+
 }
 
 void SpikeDisplay::addSpikePlot(int numChannels, int electrodeNum, String name_)
@@ -333,9 +333,9 @@ void SpikeDisplay::resized()
 
         }
 
-        totalHeight = (int) maxHeight + 50; 
+        totalHeight = (int) maxHeight + 50;
 
-       // std::cout << "New height = " << totalHeight << std::endl;
+        // std::cout << "New height = " << totalHeight << std::endl;
 
         setBounds(0, 0, getWidth(), totalHeight);
     }
@@ -356,7 +356,7 @@ void SpikeDisplay::plotSpike(const SpikeObject& spike, int electrodeNum)
 // ----------------------------------------------------------------
 
 SpikePlot::SpikePlot(SpikeDisplayCanvas* sdc, int elecNum, int p, String name_) :
-     canvas(sdc), isSelected(false), electrodeNumber(elecNum),  plotType(p),
+    canvas(sdc), isSelected(false), electrodeNumber(elecNum),  plotType(p),
     limitsChanged(true), name(name_), isRecording(false)
 
 {
@@ -449,7 +449,7 @@ void SpikePlot::processSpikeObject(const SpikeObject& s)
     {
         aboveThreshold = aboveThreshold | wAxes[i]->checkThreshold(s);
     }
-        
+
     if (aboveThreshold)
     {
         for (int i = 0; i < nWaveAx; i++)
@@ -458,7 +458,7 @@ void SpikePlot::processSpikeObject(const SpikeObject& s)
         for (int i = 0; i < nProjAx; i++)
             pAxes[i]->updateSpikeData(s);
     }
-    
+
 
     // then record it!
     if (recordNode->isRecording)
@@ -470,17 +470,19 @@ void SpikePlot::processSpikeObject(const SpikeObject& s)
 
             isRecording = true;
             //std::cout << "Start recording spikes." << std::endl;
-       
+
         }
 
         if (aboveThreshold)
         {
-             // write spike to disk
+            // write spike to disk
             writeSpike(s);
         }
 
-    } else {
-        
+    }
+    else
+    {
+
         if (isRecording)
         {
             // close file
@@ -500,7 +502,7 @@ void SpikePlot::openFile()
     filename = dataDirectory.getFullPathName();
     filename += File::separator;
     filename += name.removeCharacters(" ");
-    filename += ".spikes"; 
+    filename += ".spikes";
 
     std::cout << "OPENING FILE: " << filename << std::endl;
 
@@ -515,7 +517,9 @@ void SpikePlot::openFile()
 
         fwrite(header.toUTF8(), 1, header.getNumBytesAsUTF8(), file);
 
-    } else {
+    }
+    else
+    {
 
         // append it
         file = fopen(filename.toUTF8(), "ab");
@@ -542,7 +546,7 @@ void SpikePlot::writeSpike(const SpikeObject& s)
 
     packSpike(&s, spikeBuffer, MAX_SPIKE_BUFFER_LEN);
 
-    int totalBytes = s.nSamples * s.nChannels * 2 + // account for samples 
+    int totalBytes = s.nSamples * s.nChannels * 2 + // account for samples
                      s.nChannels * 4 +            // acount for threshold and gain
                      15;                        // 15 bytes in every SpikeObject
 
@@ -581,7 +585,7 @@ String SpikePlot::generateHeader()
     header += "';\n";
 
     header += "header.num_channels = ";
-    header += nChannels; 
+    header += nChannels;
     header += ";\n";
 
     header += "header.sampleRate = ";
@@ -666,8 +670,8 @@ void SpikePlot::resized()
     for (int i = 0; i < nWaveAx; i++)
     {
         wAxes[i]->setBounds(5 + (i % nWaveCols) * axesWidth/nWaveCols, 20 + (i/nWaveCols) * axesHeight, axesWidth/nWaveCols, axesHeight);
-        rangeButtons[i]->setBounds(8 + (i % nWaveCols) * axesWidth/nWaveCols, 
-                                   20 + (i/nWaveCols) * axesHeight + axesHeight - 18, 
+        rangeButtons[i]->setBounds(8 + (i % nWaveCols) * axesWidth/nWaveCols,
+                                   20 + (i/nWaveCols) * axesHeight + axesHeight - 18,
                                    25, 15);
     }
 
@@ -688,15 +692,17 @@ void SpikePlot::buttonClicked(Button* button)
     {
         ranges.set(index, 500.0f);
         label = "500";
-    } else if (ranges[index] == 500.0f)
+    }
+    else if (ranges[index] == 500.0f)
     {
         ranges.set(index, 100.0f);
         label = "100";
-    } else if  (ranges[index] == 100.0f)
+    }
+    else if (ranges[index] == 100.0f)
     {
         ranges.set(index, 250.0f);
         label = "250";
-    } 
+    }
 
     buttonThatWasClicked->setLabel(label);
 
@@ -709,7 +715,7 @@ void SpikePlot::setLimitsOnAxes()
     //std::cout<<"SpikePlot::setLimitsOnAxes()"<<std::endl;
 
     for (int i = 0; i < nWaveAx; i++)
-         wAxes[i]->setRange(ranges[i]);
+        wAxes[i]->setRange(ranges[i]);
 
     // Each projection sets its limits using the limits of the two waveform dims it represents.
     // Convert projection number to indices, and then set the limits using those indices
@@ -769,7 +775,7 @@ void SpikePlot::clear()
 // --------------------------------------------------
 
 
-WaveAxes::WaveAxes(int channel) : GenericAxes(channel), drawGrid(true), 
+WaveAxes::WaveAxes(int channel) : GenericAxes(channel), drawGrid(true),
     bufferSize(10), spikeIndex(0), thresholdLevel(0.0f), range(250.0f),
     isOverThresholdSlider(false), isDraggingThresholdSlider(false)
 {
@@ -784,7 +790,7 @@ WaveAxes::WaveAxes(int channel) : GenericAxes(channel), drawGrid(true),
     {
         SpikeObject so;
         generateEmptySpike(&so, 4);
-        
+
         spikeBuffer.add(so);
     }
 }
@@ -819,7 +825,7 @@ void WaveAxes::paint(Graphics& g)
     {
         return;
     }
-   
+
 
     for (int spikeNum = 0; spikeNum < bufferSize; spikeNum++)
     {
@@ -828,15 +834,15 @@ void WaveAxes::paint(Graphics& g)
         {
             g.setColour(Colours::grey);
             plotSpike(spikeBuffer[spikeNum], g);
-         }
+        }
 
     }
 
     g.setColour(Colours::white);
     plotSpike(spikeBuffer[spikeIndex], g);
-    
 
-    
+
+
 
 }
 
@@ -847,7 +853,7 @@ void WaveAxes::plotSpike(const SpikeObject& s, Graphics& g)
 
     //compute the spatial width for each waveform sample
     float dx = getWidth()/float(spikeBuffer[0].nSamples);
-    
+
     // type corresponds to channel so we need to calculate the starting
     // sample based upon which channel is getting plotted
     int sampIdx = 40*type; //spikeBuffer[0].nSamples * type; //
@@ -856,22 +862,22 @@ void WaveAxes::plotSpike(const SpikeObject& s, Graphics& g)
 
     float x = 0.0f;
 
-     for (int i = 0; i < s.nSamples-1; i++)
+    for (int i = 0; i < s.nSamples-1; i++)
     {
         //std::cout << s.data[sampIdx] << std::endl;
 
         if (*s.gain != 0)
         {
             float s1 = h/2 + float(s.data[sampIdx]-32768)/float(*s.gain)*1000.0f / range * h;
-            float s2 =  h/2 + float(s.data[sampIdx+1]-32768)/float(*s.gain)*1000.0f / range * h; 
+            float s2 =  h/2 + float(s.data[sampIdx+1]-32768)/float(*s.gain)*1000.0f / range * h;
 
-             g.drawLine(x, 
-                 s1, 
-                 x+dx, 
-                 s2);
+            g.drawLine(x,
+                       s1,
+                       x+dx,
+                       s2);
         }
 
-        
+
 
         sampIdx += dSamples;
         x += dx;
@@ -905,7 +911,7 @@ void WaveAxes::drawWaveformGrid(Graphics& g)
         else
             g.drawLine(0,h/2 + y/range*h, w, h/2+ y/range*h);
     }
-   
+
 }
 
 bool WaveAxes::updateSpikeData(const SpikeObject& s)
@@ -919,27 +925,27 @@ bool WaveAxes::updateSpikeData(const SpikeObject& s)
 
     //if (checkThreshold(newSpike))
     //{
-        spikeIndex++;
-        spikeIndex %= bufferSize;
+    spikeIndex++;
+    spikeIndex %= bufferSize;
 
-        spikeBuffer.set(spikeIndex, newSpike); 
-        return true;
+    spikeBuffer.set(spikeIndex, newSpike);
+    return true;
+
+    // } else {
+    //     return false;
+    // }
 
-   // } else {
-   //     return false;
-   // }
 
 
-    
 }
 
 bool WaveAxes::checkThreshold(const SpikeObject& s)
 {
     int sampIdx = 40*type;
 
-     for (int i = 0; i < s.nSamples-1; i++)
+    for (int i = 0; i < s.nSamples-1; i++)
     {
-        
+
         if (float(s.data[sampIdx]-32768)/float(*s.gain)*1000.0f > thresholdLevel)
         {
             return true;
@@ -962,7 +968,7 @@ void WaveAxes::clear()
     {
         SpikeObject so;
         generateEmptySpike(&so, 4);
-        
+
         spikeBuffer.add(so);
     }
 
@@ -972,35 +978,37 @@ void WaveAxes::clear()
 void WaveAxes::mouseMove(const MouseEvent& event)
 {
 
-   // Point<int> pos = event.getPosition();
+    // Point<int> pos = event.getPosition();
 
     float y = event.y;
 
     float h = getHeight()*(0.5f - thresholdLevel/range);
 
-   // std::cout << y << " " << h << std::endl;
+    // std::cout << y << " " << h << std::endl;
 
     if (y > h - 10.0f && y < h + 10.0f && !isOverThresholdSlider)
     {
-        thresholdColour = Colours::yellow; 
+        thresholdColour = Colours::yellow;
+
+        //  std::cout << "Yes." << std::endl;
 
-      //  std::cout << "Yes." << std::endl;
-        
         repaint();
 
         isOverThresholdSlider = true;
 
-       // cursorType = MouseCursor::DraggingHandCursor;
+        // cursorType = MouseCursor::DraggingHandCursor;
 
-    } else if ((y < h - 10.0f || y > h + 10.0f) && isOverThresholdSlider){
+    }
+    else if ((y < h - 10.0f || y > h + 10.0f) && isOverThresholdSlider)
+    {
 
         thresholdColour = Colours::red;
         repaint();
 
         isOverThresholdSlider = false;
 
-     //   cursorType = MouseCursor::NormalCursor;
-        
+        //   cursorType = MouseCursor::NormalCursor;
+
     }
 
 
@@ -1045,9 +1053,9 @@ void WaveAxes::mouseDrag(const MouseEvent& event)
 void WaveAxes::mouseExit(const MouseEvent& event)
 {
     if (isOverThresholdSlider)
-     {
+    {
         isOverThresholdSlider = false;
-        thresholdColour = Colours::red; 
+        thresholdColour = Colours::red;
         repaint();
     }
 }
@@ -1055,7 +1063,7 @@ void WaveAxes::mouseExit(const MouseEvent& event)
 // --------------------------------------------------
 
 ProjectionAxes::ProjectionAxes(int projectionNum) : GenericAxes(projectionNum), imageDim(500),
-                                                    rangeX(250), rangeY(250)
+    rangeX(250), rangeY(250)
 {
     projectionImage = Image(Image::RGB, imageDim, imageDim, true);
 
@@ -1063,7 +1071,7 @@ ProjectionAxes::ProjectionAxes(int projectionNum) : GenericAxes(projectionNum),
     //Graphics g(projectionImage);
     //g.setColour(Colours::red);
     //g.fillEllipse(20, 20, 300, 200);
-    
+
     n2ProjIdx(projectionNum, &ampDim1, &ampDim2);
 
 
@@ -1103,14 +1111,14 @@ bool ProjectionAxes::updateSpikeData(const SpikeObject& s)
 
     updateProjectionImage(s.data[idx1], s.data[idx2], *s.gain);
 
-	return true;
+    return true;
 }
 
 void ProjectionAxes::updateProjectionImage(uint16_t x, uint16_t y, uint16_t gain)
 {
     Graphics g(projectionImage);
 
-   // h/2 + float(s.data[sampIdx]-32768)/float(*s.gain)*1000.0f / range * h;
+    // h/2 + float(s.data[sampIdx]-32768)/float(*s.gain)*1000.0f / range * h;
 
     if (gain != 0)
     {
@@ -1118,7 +1126,7 @@ void ProjectionAxes::updateProjectionImage(uint16_t x, uint16_t y, uint16_t gain
         float yf = float(imageDim) - float(y-32768)/float(gain)*1000.0f; // in microvolts
 
         g.setColour(Colours::white);
-        g.fillEllipse(xf,yf,2.0f,2.0f); 
+        g.fillEllipse(xf,yf,2.0f,2.0f);
     }
 
 }
@@ -1149,7 +1157,7 @@ void ProjectionAxes::calcWaveformPeakIdx(const SpikeObject& s, int d1, int d2, i
 void ProjectionAxes::clear()
 {
     projectionImage.clear(Rectangle<int>(0, 0, projectionImage.getWidth(), projectionImage.getHeight()),
-                         Colours::black);
+                          Colours::black);
 
     repaint();
 }
@@ -1226,7 +1234,7 @@ bool GenericAxes::updateSpikeData(const SpikeObject& newSpike)
     }
 
     s = newSpike;
-	return true;
+    return true;
 }
 
 void GenericAxes::setYLims(double ymin, double ymax)
diff --git a/Source/Processors/Visualization/SpikeDisplayCanvas.h b/Source/Processors/Visualization/SpikeDisplayCanvas.h
index 1b3f835aa..ba91a18ef 100755
--- a/Source/Processors/Visualization/SpikeDisplayCanvas.h
+++ b/Source/Processors/Visualization/SpikeDisplayCanvas.h
@@ -100,7 +100,7 @@ public:
     SpikeDisplayNode* processor;
 
 private:
-    
+
     MidiBuffer* spikeBuffer;
 
     ScopedPointer<SpikeDisplay> spikeDisplay;
@@ -315,7 +315,10 @@ public:
     void mouseDrag(const MouseEvent& event);
 
     void setRange(float);
-    float getRange() {return range;}
+    float getRange()
+    {
+        return range;
+    }
 
     //MouseCursor getMouseCursor();
 
@@ -333,7 +336,7 @@ private:
 
     void drawThresholdSlider(Graphics& g);
 
-    
+
 
     Font font;
 
diff --git a/Source/Processors/Visualization/SpikeObject.cpp b/Source/Processors/Visualization/SpikeObject.cpp
index bb7ce020b..e6250ce5e 100755
--- a/Source/Processors/Visualization/SpikeObject.cpp
+++ b/Source/Processors/Visualization/SpikeObject.cpp
@@ -60,11 +60,11 @@ int packSpike(const SpikeObject* s, uint8_t* buffer, int bufferSize)
 
     if (idx >= MAX_SPIKE_BUFFER_LEN)
     {
-        std::cout << "Spike is larger than it should be. Size was: " << idx 
+        std::cout << "Spike is larger than it should be. Size was: " << idx
                   << " Max Size is: " << MAX_SPIKE_BUFFER_LEN << std::endl;
 
     }
-    
+
     makeBufferValid(buffer, bufferSize);
 
     return idx;
@@ -74,7 +74,7 @@ int packSpike(const SpikeObject* s, uint8_t* buffer, int bufferSize)
 // Simple method for deserializing a string of bytes into a Spike object
 bool unpackSpike(SpikeObject* s, const uint8_t* buffer, int bufferSize)
 {
-   // if (!isBufferValid(buffer, bufferSize))
+    // if (!isBufferValid(buffer, bufferSize))
     // 	return false;
 
     int idx = 0;
@@ -103,8 +103,8 @@ bool unpackSpike(SpikeObject* s, const uint8_t* buffer, int bufferSize)
     memcpy(&(s->threshold), buffer+idx, s->nChannels *2);
     idx += s->nChannels * 2;
 
-   // if (idx >= bufferSize)
-   // 		std::cout<<"Buffer Overrun! More data extracted than was given!"<<std::endl;
+    // if (idx >= bufferSize)
+    // 		std::cout<<"Buffer Overrun! More data extracted than was given!"<<std::endl;
 
     return true;
 
diff --git a/Source/UI/ControlPanel.cpp b/Source/UI/ControlPanel.cpp
index ac5319f98..65ffb46aa 100755
--- a/Source/UI/ControlPanel.cpp
+++ b/Source/UI/ControlPanel.cpp
@@ -750,7 +750,9 @@ String ControlPanel::getTextToAppend()
     if (t.length() > 0)
     {
         return "_" + t;
-    } else {
+    }
+    else
+    {
         return t;
     }
 }
@@ -762,7 +764,9 @@ String ControlPanel::getTextToPrepend()
     if (t.length() > 0)
     {
         return t + "_";
-    } else {
+    }
+    else
+    {
         return t;
     }
 }
@@ -787,10 +791,10 @@ void ControlPanel::loadStateFromXml(XmlElement* xml)
 {
 
     forEachXmlChildElement(*xml, xmlNode)
-     {
+    {
         if (xmlNode->hasTagName("CONTROLPANEL"))
         {
-            
+
             appendText->setText(xmlNode->getStringAttribute("appendText", ""), dontSendNotification);
             prependText->setText(xmlNode->getStringAttribute("prependText", ""), dontSendNotification);
 
diff --git a/Source/UI/EditorViewport.cpp b/Source/UI/EditorViewport.cpp
index b36413d39..d9f42be33 100755
--- a/Source/UI/EditorViewport.cpp
+++ b/Source/UI/EditorViewport.cpp
@@ -168,7 +168,7 @@ void EditorViewport::itemDragMove(const SourceDetails& dragSourceDetails)
 {
 
     int x = dragSourceDetails.localPosition.getX();
-   // int y = dragSourceDetails.localPosition.getY();
+    // int y = dragSourceDetails.localPosition.getY();
 
     if (canEdit)
     {
@@ -1393,7 +1393,8 @@ const String EditorViewport::loadState(File fileToLoad)
     return error;
 }
 /* Set parameters based on XML.*/
-void EditorViewport::setParametersByXML(GenericProcessor* targetProcessor, XmlElement* processorXML){
+void EditorViewport::setParametersByXML(GenericProcessor* targetProcessor, XmlElement* processorXML)
+{
     // Should probably do some error checking to make sure XML is valid, depending on how it treats errors (will likely just not update parameters, but error message could be nice.)
     int numberParameters=targetProcessor->getNumParameters();
     // Ditto channels. Not sure how to handle different channel sizes when variable sources (file reader etc. change). Maybe I should check number of channels vs source, but that requires hardcoding when source matters.
@@ -1408,21 +1409,25 @@ void EditorViewport::setParametersByXML(GenericProcessor* targetProcessor, XmlEl
     String parameterValue;
     float parameterFloat;
     //float testGrab;
-    
 
-    forEachXmlChildElementWithTagName(*processorXML, channelXML, "CHANNEL"){
+
+    forEachXmlChildElementWithTagName(*processorXML, channelXML, "CHANNEL")
+    {
         currentChannel=channelXML->getIntAttribute("name");
-        
-       // std::cout <<"currentChannel:"<< currentChannel  << std::endl;
+
+        // std::cout <<"currentChannel:"<< currentChannel  << std::endl;
         // Sets channel to change parameter on
         targetProcessor->setCurrentChannel(currentChannel-1);
 
-        forEachXmlChildElement(*channelXML, parameterXML){
-        
-            for (int j = 0; j < numberParameters; ++j){
+        forEachXmlChildElement(*channelXML, parameterXML)
+        {
+
+            for (int j = 0; j < numberParameters; ++j)
+            {
                 parameterNameForXML=targetProcessor->getParameterName(j);
 
-                if (parameterXML->getStringAttribute("name")==parameterNameForXML){
+                if (parameterXML->getStringAttribute("name")==parameterNameForXML)
+                {
                     parameterValue=parameterXML->getAllSubText();
                     parameterFloat=parameterValue.getFloatValue();
                     targetProcessor->setParameter(j, parameterFloat);
@@ -1431,7 +1436,7 @@ void EditorViewport::setParametersByXML(GenericProcessor* targetProcessor, XmlEl
                 }
 
             }
-            
+
 
         }
     }
diff --git a/Source/UI/ProcessorList.cpp b/Source/UI/ProcessorList.cpp
index 2c6d6ad15..ba5ee387c 100755
--- a/Source/UI/ProcessorList.cpp
+++ b/Source/UI/ProcessorList.cpp
@@ -86,7 +86,7 @@ ProcessorList::ProcessorList()
     sinks->addSubItem(new ProcessorListItem("Spike Viewer"));
     //sinks->addSubItem(new ProcessorListItem("WiFi Output"));
     //sinks->addSubItem(new ProcessorListItem("Arduino Output"));
-   // sinks->addSubItem(new ProcessorListItem("FPGA Output"));
+    // sinks->addSubItem(new ProcessorListItem("FPGA Output"));
     sinks->addSubItem(new ProcessorListItem("Pulse Pal"));
 
     ProcessorListItem* utilities = new ProcessorListItem("Utilities");
diff --git a/Source/UI/UIComponent.cpp b/Source/UI/UIComponent.cpp
index 9bdb45682..4be5834a3 100755
--- a/Source/UI/UIComponent.cpp
+++ b/Source/UI/UIComponent.cpp
@@ -92,7 +92,7 @@ UIComponent::UIComponent(MainWindow* mainWindow_, ProcessorGraph* pgraph, AudioC
     mainWindow->setMenuBar(this);
 #endif
 
-    //getEditorViewport()->loadState(File("/home/jsiegle/Programming/GUI/Builds/Linux/build/test.xml"));
+    getEditorViewport()->loadState(File("/home/jsiegle/Programming/GUI/Builds/Linux/build/test.xml"));
 
 }
 
@@ -385,9 +385,9 @@ bool UIComponent::perform(const InvocationInfo& info)
         case openConfiguration:
             {
                 FileChooser fc("Choose a file to load...",
-                      File::getCurrentWorkingDirectory(),
-                      "*.xml",
-                      true);
+                               File::getCurrentWorkingDirectory(),
+                               "*.xml",
+                               true);
 
                 if (fc.browseForFileToOpen())
                 {
@@ -405,9 +405,9 @@ bool UIComponent::perform(const InvocationInfo& info)
             {
 
                 FileChooser fc("Choose the file to save...",
-                   File::getCurrentWorkingDirectory(),
-                   "*",
-                   true);
+                               File::getCurrentWorkingDirectory(),
+                               "*",
+                               true);
 
                 if (fc.browseForFileToSave(true))
                 {
@@ -461,14 +461,14 @@ void UIComponent::saveStateToXml(XmlElement* xml)
 
 void UIComponent::loadStateFromXml(XmlElement* xml)
 {
-     forEachXmlChildElement(*xml, xmlNode)
-     {
+    forEachXmlChildElement(*xml, xmlNode)
+    {
         if (xmlNode->hasTagName("UICOMPONENT"))
         {
-            
+
             bool isProcessorListOpen = xmlNode->getBoolAttribute("isProcessorListOpen");
             bool isEditorViewportOpen = xmlNode->getBoolAttribute("isEditorViewportOpen");
-            
+
             if (!isProcessorListOpen)
             {
                 processorList->toggleState();
-- 
GitLab