diff --git a/Source/Processors/DataThreads/RHD2000Editor.cpp b/Source/Processors/DataThreads/RHD2000Editor.cpp index e5048cce4bbe77cf899113d20abb872e927690e6..dc5a9d7279bdb837b6713d14d50b17a9d149b04b 100644 --- a/Source/Processors/DataThreads/RHD2000Editor.cpp +++ b/Source/Processors/DataThreads/RHD2000Editor.cpp @@ -826,7 +826,7 @@ void RHD2000Editor::channelChanged(int chan) { electrodeButtons[i]->setChannelNum(chan); electrodeButtons[i]->repaint(); - board->assignAudioOut(i, chan); + board->setDACchannel(i, chan); } } @@ -891,10 +891,10 @@ void RHD2000Editor::loadCustomParameters(XmlElement* xml) bandwidthInterface->setLowerBandwidth(xml->getDoubleAttribute("LowCut")); bandwidthInterface->setUpperBandwidth(xml->getDoubleAttribute("HighCut")); adcButton->setToggleState(xml->getBoolAttribute("ADCsOn"), sendNotification); - electrodeButtons[0]->setChannelNum(xml->getIntAttribute("AudioOutputL")); - board->assignAudioOut(0, xml->getIntAttribute("AudioOutputL")); - electrodeButtons[1]->setChannelNum(xml->getIntAttribute("AudioOutputR")); - board->assignAudioOut(1, xml->getIntAttribute("AudioOutputR")); + //electrodeButtons[0]->setChannelNum(xml->getIntAttribute("AudioOutputL")); + //board->assignAudioOut(0, xml->getIntAttribute("AudioOutputL")); + //electrodeButtons[1]->setChannelNum(xml->getIntAttribute("AudioOutputR")); + //board->assignAudioOut(1, xml->getIntAttribute("AudioOutputR")); audioInterface->setNoiseSlicerLevel(xml->getIntAttribute("NoiseSlicer")); ttlSettleCombo->setSelectedId(xml->getIntAttribute("TTLFastSettle")); dacTTLButton->setToggleState(xml->getBoolAttribute("DAC_TTL"), sendNotification); diff --git a/Source/Processors/DataThreads/RHD2000Thread.cpp b/Source/Processors/DataThreads/RHD2000Thread.cpp index 581efe2671269410a37255851c5c4f971c2fce73..7e682e533d2c48980bb1aa4a468e38b10aa149ec 100644 --- a/Source/Processors/DataThreads/RHD2000Thread.cpp +++ b/Source/Processors/DataThreads/RHD2000Thread.cpp @@ -195,13 +195,26 @@ void RHD2000Thread::setDACthreshold(int dacOutput, float threshold) // evalBoard->setDacThresholdVoltage(dacOutput,threshold); } -void RHD2000Thread::setDACchannel(int dacOutput, int stream, int channel) +void RHD2000Thread::setDACchannel(int dacOutput, int channel) { - dacChannels[dacOutput] = channel; - dacStream[dacOutput] = stream; - dacChannelsToUpdate[dacOutput] = true; - dacOutputShouldChange = true; - // evalBoard->updateDacAssignment(dacOutput, channel); // doesn't really change anything, but keep things in sync... + if (channel < getNumHeadstageOutputs()) + { + int channelCount = 0; + for (int i = 0; i < enabledStreams.size(); i++) + { + if (channel < channelCount + numChannelsPerDataStream[i]) + { + dacChannels[dacOutput] = channel - channelCount; + dacStream[dacOutput] = i; + } + else + { + channelCount += numChannelsPerDataStream[i]; + } + } + dacChannelsToUpdate[dacOutput] = true; + dacOutputShouldChange = true; + } } Array<int> RHD2000Thread::getDACchannels() @@ -1083,7 +1096,7 @@ int RHD2000Thread::getChannelsInHeadstage(int hsNum) return headstagesArray[hsNum]->getNumChannels(); } -void RHD2000Thread::assignAudioOut(int dacChannel, int dataChannel) +/*void RHD2000Thread::assignAudioOut(int dacChannel, int dataChannel) { if (deviceFound) { @@ -1103,7 +1116,7 @@ void RHD2000Thread::assignAudioOut(int dacChannel, int dataChannel) // to avoid problems } -} +}*/ void RHD2000Thread::enableAdcs(bool t) { diff --git a/Source/Processors/DataThreads/RHD2000Thread.h b/Source/Processors/DataThreads/RHD2000Thread.h index cd05cc70780280a3e78f81c22475e1b11c6e8743..01801e116e4eff364fea2be6e0b53be764810191 100644 --- a/Source/Processors/DataThreads/RHD2000Thread.h +++ b/Source/Processors/DataThreads/RHD2000Thread.h @@ -101,7 +101,6 @@ public: int endIndex, double sampleRate, double frequency); int getNumEventChannels(); - void assignAudioOut(int dacChannel, int dataChannel); void enableAdcs(bool); bool isAcquisitionActive(); @@ -110,7 +109,7 @@ public: int modifyChannelName(int channel, String newName); void getEventChannelNames(StringArray &Names); Array<int> getDACchannels(); - void setDACchannel(int dacOutput, int stream, int channel); + void setDACchannel(int dacOutput, int channel); void setDACthreshold(int dacOutput, float threshold); void setDefaultNamingScheme(int scheme); diff --git a/Source/Processors/SpikeSorter/SpikeSorter.cpp b/Source/Processors/SpikeSorter/SpikeSorter.cpp index 3fab6eb2a9f4d49beac900f6bb22827f85c102ed..e29b2db7c41d089ec4db2df2b5c9fe2b063ffb90 100644 --- a/Source/Processors/SpikeSorter/SpikeSorter.cpp +++ b/Source/Processors/SpikeSorter/SpikeSorter.cpp @@ -410,7 +410,7 @@ void SpikeSorter::assignDACtoChannel(int dacOutput, int channel) RHD2000Thread* th = getRhythmAccess(); if (th != nullptr) { - th->setDACchannel(dacOutput, channels[channel]->sourceNodeId, channels[channel]->index); // this is probably wrong (JHS) + th->setDACchannel(dacOutput, channel); // this is probably wrong (JHS) } }