Skip to content

Commit 33f325b

Browse files
committed
Fix AudioNode and RecordNode state updating
1 parent 0d6afd0 commit 33f325b

5 files changed

Lines changed: 27 additions & 11 deletions

File tree

Source/Processors/AudioNode/AudioNode.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ void AudioNode::addInputChannel(GenericProcessor* sourceNode, int chan)
113113

114114
setPlayConfigDetails(channelIndex+1,0,44100.0,128);
115115

116-
dataChannelArray.add(new DataChannel(*sourceNode->getDataChannel(chan)));
116+
auto dataChannel = sourceNode->getDataChannel(chan);
117+
auto dataChannelCopy = new DataChannel(*dataChannel);
118+
dataChannelCopy->setMonitored(dataChannel->isMonitored());
119+
120+
dataChannelArray.add(dataChannelCopy);
117121

118122
}
119123

@@ -534,4 +538,4 @@ void Expander::process(float* sampleData, int numSamples)
534538

535539
sampleData[i] = sampleData[i] * gain;
536540
}
537-
}
541+
}

Source/Processors/Channel/InfoObjects.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ DataChannel::DataChannel(const DataChannel& ch)
214214
m_type(ch.m_type),
215215
m_bitVolts(ch.m_bitVolts),
216216
m_isEnabled(true),
217-
m_isMonitored(ch.m_isMonitored),
218-
m_isRecording(ch.m_isRecording)
217+
m_isMonitored(false),
218+
m_isRecording(false)
219219
{
220220
}
221221

Source/Processors/Editors/ChannelSelector.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,9 +680,16 @@ void ChannelSelector::buttonClicked(Button* button)
680680

681681
if (acquisitionIsActive) // use setParameter to change parameter safely
682682
{
683-
AccessClass::getProcessorGraph()->
683+
if ( AccessClass::getProcessorGraph()->
684684
getRecordNode()->
685-
setChannelStatus(ch, status);
685+
setChannelStatus(ch, status) )
686+
{
687+
const_cast<DataChannel*>(ch)->setRecordState(status);
688+
}
689+
690+
// make sure that the button matches the system's actual state, in case
691+
// user's interaction was disallowed
692+
b->setToggleState(const_cast<DataChannel*>(ch)->getRecordState(), dontSendNotification);
686693
}
687694
else // change parameter directly
688695
{

Source/Processors/RecordNode/RecordNode.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,16 @@ RecordNode::~RecordNode()
6969

7070
void RecordNode::setChannel(const DataChannel* ch)
7171
{
72-
int channelNum = dataChannelArray.indexOf(ch);
72+
// int channelNum = dataChannelArray.indexOf(ch);
73+
int channelNum = getDataChannelIndex(ch->getSourceIndex(), ch->getSourceNodeID(), ch->getSubProcessorIdx());
7374

7475
std::cout << "Record node setting channel to " << channelNum << std::endl;
7576

7677
setCurrentChannel(channelNum);
7778

7879
}
7980

80-
void RecordNode::setChannelStatus(const DataChannel* ch, bool status)
81+
bool RecordNode::setChannelStatus(const DataChannel* ch, bool status)
8182
{
8283

8384
//std::cout << "Setting channel status!" << std::endl;
@@ -87,7 +88,8 @@ void RecordNode::setChannelStatus(const DataChannel* ch, bool status)
8788
setParameter(2, 1.0f);
8889
else
8990
setParameter(2, 0.0f);
90-
91+
92+
return status == dataChannelArray[currentChannel]->getRecordState();
9193
}
9294

9395

@@ -555,4 +557,4 @@ void RecordNode::updateRecordChannelIndexes()
555557
void RecordNode::addSpecialProcessorChannels(Array<EventChannel*>& channels)
556558
{
557559
eventChannelArray.addArray(channels);
558-
}
560+
}

Source/Processors/RecordNode/RecordNode.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,11 @@ class RecordNode : public GenericProcessor,
106106
/** Turns recording on and off for a particular channel.
107107
108108
Channel numbers are absolute (based on RecordNode channel mapping).
109+
110+
Returns a bool indicating whether the status update was successful (true)
111+
or blocked (false) because recording is currently in progress.
109112
*/
110-
void setChannelStatus(const DataChannel* ch, bool status);
113+
bool setChannelStatus(const DataChannel* ch, bool status);
111114

112115
/** Used to clear all connections prior to the start of acquisition.
113116
*/

0 commit comments

Comments
 (0)