Skip to content

Commit fa48de6

Browse files
committed
Add ability for info objects to hold their own index in their owner processor
1 parent 0c0dead commit fa48de6

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

Source/Processors/Channel/InfoObjects.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,23 @@ HistoryObject::HistoryObject() {}
3030
NamedInfoObject::NamedInfoObject() {}
3131

3232
//NodeInfoBase
33-
NodeInfoBase::NodeInfoBase(uint16 id) :
34-
m_nodeID(id)
33+
NodeInfoBase::NodeInfoBase(uint16 id, uint16 idx) :
34+
m_nodeID(id), m_nodeIdx(idx)
3535
{}
3636

3737
NodeInfoBase::~NodeInfoBase()
3838
{}
3939

40-
unsigned int NodeInfoBase::getCurrentNodeID() const
40+
uint16 NodeInfoBase::getCurrentNodeID() const
4141
{
4242
return m_nodeID;
4343
}
4444

45+
uint16 NodeInfoBase::getCurrentNodeChannelIdx() const
46+
{
47+
return m_nodeIdx;
48+
}
49+
4550
String NodeInfoBase::getCurrentNodeType() const
4651
{
4752
return m_currentNodeType;
@@ -143,7 +148,7 @@ String NamedInfoObject::getDescription() const
143148

144149
//InfoObjectCommon
145150
InfoObjectCommon::InfoObjectCommon(uint16 idx, uint16 typeidx, float sampleRate, const GenericProcessor* source, uint16 subproc)
146-
: NodeInfoBase(source->getNodeId()),
151+
: NodeInfoBase(source->getNodeId(), idx),
147152
SourceProcessorInfo(source, subproc),
148153
m_sourceIndex(idx),
149154
m_sourceTypeIndex(typeidx),

Source/Processors/Channel/InfoObjects.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,19 @@ class PLUGIN_API NodeInfoBase
4949
public:
5050
virtual ~NodeInfoBase();
5151
/** Gets the ID of the processor which currently owns this copy of the info object */
52-
unsigned int getCurrentNodeID() const;
52+
uint16 getCurrentNodeID() const;
53+
/** Gets the index of this channel in the processor which currently owns this copy of the info object */
54+
uint16 getCurrentNodeChannelIdx() const;
5355
/** Gets the type of the processor which currently owns this copy of the info object */
5456
String getCurrentNodeType() const;
5557
/** Gets the name of the processor which currently owns this copy of the info object */
5658
String getCurrentNodeName() const;
5759
protected:
5860
NodeInfoBase() = delete;
59-
NodeInfoBase(uint16 id);
61+
NodeInfoBase(uint16 id, uint16 idx);
62+
private:
6063
uint16 m_nodeID{ 0 };
64+
uint16 m_nodeIdx{ 0 };
6165
String m_currentNodeType;
6266
String m_currentNodeName;
6367
};

Source/Processors/GenericProcessor/GenericProcessor.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ void GenericProcessor::updateChannelIndexes(bool updateNodeID)
412412
if (updateNodeID)
413413
{
414414
channel->m_nodeID = nodeId;
415+
channel->m_nodeIdx = i;
415416
channel->m_currentNodeName = getName();
416417
channel->m_currentNodeType = getName(); //Fix when the ability to name individual processors is implemented
417418
}
@@ -424,6 +425,7 @@ void GenericProcessor::updateChannelIndexes(bool updateNodeID)
424425
if (updateNodeID)
425426
{
426427
channel->m_nodeID = nodeId;
428+
channel->m_nodeIdx = i;
427429
channel->m_currentNodeName = getName();
428430
channel->m_currentNodeType = getName(); //Fix when the ability to name individual processors is implemented
429431
}
@@ -436,6 +438,7 @@ void GenericProcessor::updateChannelIndexes(bool updateNodeID)
436438
if (updateNodeID)
437439
{
438440
channel->m_nodeID = nodeId;
441+
channel->m_nodeIdx = i;
439442
channel->m_currentNodeName = getName();
440443
channel->m_currentNodeType = getName(); //Fix when the ability to name individual processors is implemented
441444
}

0 commit comments

Comments
 (0)