Permalink
Browse files

Added ExampleProcessor code

  • Loading branch information...
jsiegle
jsiegle committed Dec 6, 2012
1 parent c0ca736 commit 8a954b90a68182cd6b936a7d1ded72c36073793e
Showing with 151 additions and 1 deletion.
  1. +1 −1 Source/Processors/EventDetector.h
  2. +81 −0 Source/Processors/ExampleProcessor.cpp
  3. +69 −0 Source/Processors/ExampleProcessor.h
@@ -35,7 +35,7 @@
Searches for threshold crossings and sends out TTL events.
- @see GenericProcessor, EventDetectorEditor
+ @see GenericProcessor
*/
@@ -0,0 +1,81 @@
+/*
+ ------------------------------------------------------------------
+
+ This file is part of the Open Ephys GUI
+ Copyright (C) 2012 Open Ephys
+
+ ------------------------------------------------------------------
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include <stdio.h>
+#include "ExampleProcessor.h"
+
+ExampleProcessor::ExampleProcessor()
+ : GenericProcessor("Example Processor") //, threshold(200.0), state(true)
+
+{
+
+ //parameters.add(Parameter("thresh", 0.0, 500.0, 200.0, 0));
+
+}
+
+ExampleProcessor::~ExampleProcessor()
+{
+
+}
+
+
+
+void ExampleProcessor::setParameter (int parameterIndex, float newValue)
+{
+
+ //Parameter& p = parameters.getReference(parameterIndex);
+ //p.setValue(newValue, 0);
+
+ //threshold = newValue;
+
+ //std::cout << float(p[0]) << std::endl;
+
+}
+
+void ExampleProcessor::process(AudioSampleBuffer &buffer,
+ MidiBuffer &events,
+ int& nSamples)
+{
+
+ // for (int i = 0; i < nSamples; i++)
+ // {
+ //
+ // if ((*buffer.getSampleData(0, i) < -threshold) && !state)
+ // {
+ //
+ // // generate midi event
+ // addEvent(events, TTL, i);
+ //
+ // state = true;
+ //
+ // } else if ((*buffer.getSampleData(0, i) > -threshold + bufferZone) && state)
+ // {
+ // state = false;
+ // }
+ //
+ //
+ // }
+
+
+}
@@ -0,0 +1,69 @@
+/*
+ ------------------------------------------------------------------
+
+ This file is part of the Open Ephys GUI
+ Copyright (C) 2012 Open Ephys
+
+ ------------------------------------------------------------------
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef __EXAMPLEPROCESSOR_H_91811542__
+#define __EXAMPLEPROCESSOR_H_91811542__
+
+#ifdef _WIN32
+#include <Windows.h>
+#endif
+
+#include "../../JuceLibraryCode/JuceHeader.h"
+#include "GenericProcessor.h"
+
+/**
+
+ This is a description of the processor's function.
+
+ @see GenericProcessor
+
+*/
+
+class ExampleProcessor : public GenericProcessor
+
+{
+public:
+
+ ExampleProcessor();
+ ~ExampleProcessor();
+
+ bool isSource() {return false;}
+ bool isSink() {return false;}
+
+ void process (AudioSampleBuffer &buffer, MidiBuffer &events, int& nSamples);
+ void setParameter (int parameterIndex, float newValue);
+
+private:
+
+ // private variables and methods go here
+ //
+ // e.g.:
+ //
+ // float threshold;
+ // bool state;
+
+ JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ExampleProcessor);
+
+};
+
+#endif // __EXAMPLEPROCESSOR_H_91811542__

0 comments on commit 8a954b9

Please sign in to comment.