From b5eb51dc9ecc0a3dbb89052bdce2e9412942bcf9 Mon Sep 17 00:00:00 2001 From: Aaron Cuevas Lopez <aacuelo@teleco.upv.es> Date: Fri, 17 Oct 2014 00:25:20 +0200 Subject: [PATCH] Fix channel selector in channel mapper not updating channel number correctly --- Source/Processors/Editors/ChannelSelector.cpp | 19 ++++++++++++++++--- Source/Processors/Editors/ChannelSelector.h | 4 ++++ .../GenericProcessor/GenericProcessor.cpp | 1 + 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Source/Processors/Editors/ChannelSelector.cpp b/Source/Processors/Editors/ChannelSelector.cpp index 7a82ff1b3..7f11d5223 100755 --- a/Source/Processors/Editors/ChannelSelector.cpp +++ b/Source/Processors/Editors/ChannelSelector.cpp @@ -129,6 +129,19 @@ void ChannelSelector::setNumChannels(int numChans) } } + //Reassign numbers according to the actual channels (useful for channel mapper) + std::cout << parameterButtons.size() << " - " << recordButtons.size() << " - " <<audioButtons.size() << std::endl; + for (int n = 0; n < parameterButtons.size(); n++) + { + int num = ((GenericEditor*)getParentComponent())->getChannel(n)->num + 1; + parameterButtons[n]->setChannel(num); + if (isNotSink) + { + recordButtons[n]->setChannel(num); + audioButtons[n]->setChannel(num); + } + } + refreshButtonBoundaries(); } @@ -343,9 +356,9 @@ void ChannelSelector::activateButtons() void ChannelSelector::inactivateRecButtons() { - recActive = false; + recActive = false; - for (int i = 0; i < recordButtons.size(); i++) + for (int i = 0; i < recordButtons.size(); i++) { recordButtons[i]->setActive(false); recordButtons[i]->repaint(); @@ -355,7 +368,7 @@ void ChannelSelector::inactivateRecButtons() void ChannelSelector::activateRecButtons() { - recActive = true; + recActive = true; for (int i = 0; i < recordButtons.size(); i++) { diff --git a/Source/Processors/Editors/ChannelSelector.h b/Source/Processors/Editors/ChannelSelector.h index 7db6ef2b4..3eff6ca7b 100755 --- a/Source/Processors/Editors/ChannelSelector.h +++ b/Source/Processors/Editors/ChannelSelector.h @@ -303,6 +303,10 @@ public: } //Channel* getChannel() {return ch;} void setActive(bool t); + void setChannel(int n) + { + num = n; + } private: void paintButton(Graphics& g, bool isMouseOver, bool isButtonDown); diff --git a/Source/Processors/GenericProcessor/GenericProcessor.cpp b/Source/Processors/GenericProcessor/GenericProcessor.cpp index 73f6e3fdf..7a5936740 100755 --- a/Source/Processors/GenericProcessor/GenericProcessor.cpp +++ b/Source/Processors/GenericProcessor/GenericProcessor.cpp @@ -321,6 +321,7 @@ void GenericProcessor::update() Channel* ch = new Channel(*sourceChan); ch->setProcessor(this); ch->bitVolts = ch->bitVolts*getDefaultBitVolts(); + ch->num = i; if (i < recordStatus.size()) { -- GitLab