From 8320509025f0dc4dd37f7e1e4ebc1bb216d94000 Mon Sep 17 00:00:00 2001 From: Pavel Kulik Date: Thu, 5 Oct 2023 10:47:01 -0700 Subject: [PATCH] Add unique String key to DataStream --- Source/Processors/GenericProcessor/GenericProcessor.cpp | 4 +--- Source/Processors/RecordNode/RecordNode.cpp | 4 ++-- Source/Processors/Settings/DataStream.h | 3 +++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Processors/GenericProcessor/GenericProcessor.cpp b/Source/Processors/GenericProcessor/GenericProcessor.cpp index cd8b9d74c..75428e569 100755 --- a/Source/Processors/GenericProcessor/GenericProcessor.cpp +++ b/Source/Processors/GenericProcessor/GenericProcessor.cpp @@ -986,9 +986,7 @@ void GenericProcessor::update() { Array streamNames; for (auto stream : dataStreams) - { - streamNames.add(stream->getName()); - } + streamNames.add(stream->getKey()); SelectedStreamParameter* p = (SelectedStreamParameter*)param; p->setStreamNames(streamNames); parameterValueChanged(p); diff --git a/Source/Processors/RecordNode/RecordNode.cpp b/Source/Processors/RecordNode/RecordNode.cpp index 27efa9241..8056231d8 100755 --- a/Source/Processors/RecordNode/RecordNode.cpp +++ b/Source/Processors/RecordNode/RecordNode.cpp @@ -138,8 +138,8 @@ void RecordNode::parameterValueChanged(Parameter* p) Array streamNames = ((SelectedStreamParameter*)p)->getStreamNames(); for (auto stream : dataStreams) { - String key = String(stream->getSourceNodeId()) + " | " + stream->getName(); - if (key == streamNames[((CategoricalParameter*)p)->getSelectedIndex()]) + String key = stream->getKey(); + if (key == streamNames[((SelectedStreamParameter*)p)->getSelectedIndex()]) { synchronizer.setMainDataStream(stream->getStreamId()); break; diff --git a/Source/Processors/Settings/DataStream.h b/Source/Processors/Settings/DataStream.h index 3ab05c4d7..89d84976d 100644 --- a/Source/Processors/Settings/DataStream.h +++ b/Source/Processors/Settings/DataStream.h @@ -114,6 +114,9 @@ class PLUGIN_API DataStream : /** Returns the unique ID for this stream*/ uint16 getStreamId() const; + /** Returns a unique String for this stream */ + String getKey() const { return String(getSourceNodeId()) + "|" + getName(); } + /** Returns true if this DataStream has a device associated with it.*/ bool hasDevice() const;