Open Ephys GUI
 All Classes Functions Variables Pages
ProcessorGraph.h
1 /*
2  ------------------------------------------------------------------
3 
4  This file is part of the Open Ephys GUI
5  Copyright (C) 2012 Open Ephys
6 
7  ------------------------------------------------------------------
8 
9  This program is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #ifndef __PROCESSORGRAPH_H_124F8B50__
25 #define __PROCESSORGRAPH_H_124F8B50__
26 
27 #include "../../JuceLibraryCode/JuceHeader.h"
28 
29 #include "../AccessClass.h"
30 
31 /**
32 
33  Owns all processors and constructs the signal chain.
34 
35  The GUI revolves around the ProcessorGraph, which enables the user to
36  dynamically update the signal chain. This object creates and deletes
37  all of the processors that handle data, and holds the rules for connecting
38  them prior to data acquisition.
39 
40  The user is able to modify the ProcessGraph through the EditorViewport
41 
42  @see EditorViewport, GenericProcessor, GenericEditor, RecordNode,
43  AudioNode, Configuration, MessageCenter
44 
45 */
46 
47 
48 class GenericProcessor;
49 class RecordNode;
50 class AudioNode;
52 
53 class ProcessorGraph : public AudioProcessorGraph,
54  public AccessClass,
55  public ChangeListener
56 {
57 public:
59  ~ProcessorGraph();
60 
61  void* createNewProcessor(String& description);
62  GenericProcessor* createProcessorFromDescription(String& description);
63 
64  void removeProcessor(GenericProcessor* processor);
65 
66  void clearSignalChain();
67 
68  bool enableProcessors();
69  bool disableProcessors();
70 
71  RecordNode* getRecordNode();
72  AudioNode* getAudioNode();
73 
74  void updateConnections(Array<SignalChainTabButton*, CriticalSection>);
75 
76  bool processorWithSameNameExists(const String& name);
77 
78  void changeListenerCallback(ChangeBroadcaster* source);
79 
80  // void saveState();
81  // void loadState();
82 
83 private:
84 
85  int currentNodeId;
86 
87  enum nodeIds
88  {
89  RECORD_NODE_ID = 900,
90  AUDIO_NODE_ID = 901,
91  OUTPUT_NODE_ID = 902,
92  RESAMPLING_NODE_ID = 903
93  };
94 
95  void createDefaultNodes();
96  void clearConnections();
97 
98 };
99 
100 
101 
102 #endif // __PROCESSORGRAPH_H_124F8B50__