Skip to content

Commit

Permalink
Apply formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiegle committed May 14, 2024
1 parent 5f5371f commit 0317ccb
Show file tree
Hide file tree
Showing 22 changed files with 1,824 additions and 1,755 deletions.
100 changes: 52 additions & 48 deletions Source/AccessClass.cpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/*
------------------------------------------------------------------
------------------------------------------------------------------
This file is part of the Open Ephys GUI
Copyright (C) 2014 Open Ephys
This file is part of the Open Ephys GUI
Copyright (C) 2024 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 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.
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/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

Expand All @@ -33,57 +33,58 @@ namespace AccessClass
namespace
{

UIComponent* ui = nullptr;
EditorViewport* ev = nullptr;
ProcessorList* pl = nullptr;
DataViewport* dv = nullptr;
ProcessorGraph* pg = nullptr;
ControlPanel* cp = nullptr;
MessageCenter* mc = nullptr;
AudioComponent* ac = nullptr;
GraphViewer* gv = nullptr;
PluginManager* pm = nullptr;
std::unique_ptr<ActionBroadcaster> bc;
}
UIComponent* ui = nullptr;
EditorViewport* ev = nullptr;
ProcessorList* pl = nullptr;
DataViewport* dv = nullptr;
ProcessorGraph* pg = nullptr;
ControlPanel* cp = nullptr;
MessageCenter* mc = nullptr;
AudioComponent* ac = nullptr;
GraphViewer* gv = nullptr;
PluginManager* pm = nullptr;
std::unique_ptr<ActionBroadcaster> bc;
} // namespace

void setUIComponent(UIComponent* ui_)
void setUIComponent (UIComponent* ui_)
{
if (ui != nullptr) return;
if (ui != nullptr)
return;
ui = ui_;

ev = ui->getEditorViewport();
dv = ui->getDataViewport();
pl = ui->getProcessorList();
gv = ui->getGraphViewer();

}

void setProcessorGraph(ProcessorGraph* pg_)
void setProcessorGraph (ProcessorGraph* pg_)
{
if (pg != nullptr) return;
pg = pg_;
if (pg != nullptr)
return;
pg = pg_;

pm = pg->getPluginManager();
mc = pg->getMessageCenter();

bc = std::make_unique<ActionBroadcaster>();
bc->addActionListener(mc);
bc->addActionListener (mc);
}

void setAudioComponent(AudioComponent* ac_)
void setAudioComponent (AudioComponent* ac_)
{
if (ac != nullptr) return;
if (ac != nullptr)
return;
ac = ac_;
}

void setControlPanel(ControlPanel* cp_)
void setControlPanel (ControlPanel* cp_)
{
if (cp != nullptr) return;
if (cp != nullptr)
return;
cp = cp_;
}



void shutdownBroadcaster()
{
bc = nullptr;
Expand Down Expand Up @@ -158,7 +159,8 @@ UndoManager* getUndoManager()
return pg->getUndoManager();
}

void clearAccessClassStateForTesting() {
void clearAccessClassStateForTesting()
{
ui = nullptr;
ev = nullptr;
pl = nullptr;
Expand All @@ -172,20 +174,22 @@ void clearAccessClassStateForTesting() {
bc.reset();
}

MidiBuffer* ExternalProcessorAccessor::getMidiBuffer(GenericProcessor* proc)
MidiBuffer* ExternalProcessorAccessor::getMidiBuffer (GenericProcessor* proc)
{
return proc->m_currentMidiBuffer;
return proc->m_currentMidiBuffer;
}


void ExternalProcessorAccessor::injectNumSamples(GenericProcessor *proc, uint16_t dataStream, uint32_t numSamples) {
void ExternalProcessorAccessor::injectNumSamples (GenericProcessor* proc, uint16_t dataStream, uint32_t numSamples)
{
proc->numSamplesInBlock[dataStream] = numSamples;
}

//**Set the MessageCenter for testing only**//
void setMessageCenter(MessageCenter * mc_){
if(pg != nullptr) return;
void setMessageCenter (MessageCenter* mc_)
{
if (pg != nullptr)
return;
mc = mc_;
}

}
} // namespace AccessClass
29 changes: 10 additions & 19 deletions Source/AccessClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
------------------------------------------------------------------
This file is part of the Open Ephys GUI
Copyright (C) 2014 Open Ephys
Copyright (C) 2024 Open Ephys
------------------------------------------------------------------
Expand All @@ -24,12 +24,9 @@
#ifndef __ACCESSCLASS_H_CE1DC2DE__
#define __ACCESSCLASS_H_CE1DC2DE__



#include "../JuceLibraryCode/JuceHeader.h"
#include "TestableExport.h"


class UIComponent;
class EditorViewport;
class ProcessorList;
Expand All @@ -42,24 +39,21 @@ class GraphViewer;
class PluginManager;
class GenericProcessor;



namespace AccessClass
{


/** Sets the object's UIComponent and copies all the necessary pointers
* from the UIComponent. */
void setUIComponent(UIComponent*);
void setUIComponent (UIComponent*);

/** Sets the object's ProcessorGraph */
void setProcessorGraph(ProcessorGraph*);
void setProcessorGraph (ProcessorGraph*);

/** Sets the object's AudioComponent */
void setAudioComponent(AudioComponent*);
void setAudioComponent (AudioComponent*);

/** Sets the object's ControlPanel */
void setControlPanel(ControlPanel*);
void setControlPanel (ControlPanel*);

/** Returns a pointer to the application's EditorViewport. */
EditorViewport* getEditorViewport();
Expand Down Expand Up @@ -100,8 +94,7 @@ UndoManager* getUndoManager();
/** Returns a pointer to the application's ActionBroadcaster */
ActionBroadcaster* getBroadcaster();

void TESTABLE setMessageCenter(MessageCenter * mc_);

void TESTABLE setMessageCenter (MessageCenter* mc_);

/** Clears all of the global state in AccessClass. Only for use in testing. */
void TESTABLE clearAccessClassStateForTesting();
Expand All @@ -115,13 +108,11 @@ void shutdownBroadcaster();

class TESTABLE ExternalProcessorAccessor
{

public:
static MidiBuffer* getMidiBuffer(GenericProcessor* proc);
static void injectNumSamples(GenericProcessor* proc, uint16_t dataStream, uint32_t numSamples);
};

static MidiBuffer* getMidiBuffer (GenericProcessor* proc);
static void injectNumSamples (GenericProcessor* proc, uint16_t dataStream, uint32_t numSamples);
};

}; // namespace AccessClass

#endif // __ACCESSCLASS_H_CE1DC2DE__
#endif // __ACCESSCLASS_H_CE1DC2DE__
Loading

0 comments on commit 0317ccb

Please sign in to comment.