Skip to content

Commit 01a5d27

Browse files
committed
Some buffer fixes
1 parent 4398adb commit 01a5d27

4 files changed

Lines changed: 11 additions & 10 deletions

File tree

Source/Processors/DataThreads/DataBuffer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
DataBuffer::DataBuffer(int chans, int size)
2727
: abstractFifo(size), buffer(chans, size), numChans(chans)
2828
{
29-
timestampBuffer = new int64[size];
30-
eventCodeBuffer = new uint64[size];
29+
timestampBuffer.malloc(size);
30+
eventCodeBuffer.malloc(size);
3131

3232
}
3333

@@ -43,8 +43,8 @@ void DataBuffer::clear()
4343
void DataBuffer::resize(int chans, int size)
4444
{
4545
buffer.setSize(chans, size);
46-
timestampBuffer = new int64[size];
47-
eventCodeBuffer = new uint64[size];
46+
timestampBuffer.malloc(size);
47+
eventCodeBuffer.malloc(size);
4848

4949
numChans = chans;
5050
}

Source/Processors/DataThreads/DataBuffer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class DataBuffer
6060
AbstractFifo abstractFifo;
6161
AudioSampleBuffer buffer;
6262

63-
int64* timestampBuffer;
64-
uint64* eventCodeBuffer;
63+
HeapBlock<int64> timestampBuffer;
64+
HeapBlock<uint64> eventCodeBuffer;
6565

6666
int numChans;
6767

Source/Processors/DataThreads/RHD2000Thread.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ RHD2000Thread::RHD2000Thread(SourceNode* sn) : DataThread(sn),
139139
dacChannelsToUpdate[k] = true;
140140
dacStream[k] = 0;
141141
setDACthreshold(k, 65534);
142-
dacChannels[k] = -1;
142+
dacChannels[k] = 0;
143143
dacThresholds[k] = 0;
144144
}
145145

@@ -205,6 +205,7 @@ void RHD2000Thread::setDACchannel(int dacOutput, int channel)
205205
{
206206
dacChannels[dacOutput] = channel - channelCount;
207207
dacStream[dacOutput] = i;
208+
break;
208209
}
209210
else
210211
{
@@ -507,7 +508,7 @@ void RHD2000Thread::scanPorts()
507508
evalBoard->setMaxTimeStep(64);
508509
evalBoard->setContinuousRunMode(false);
509510

510-
Rhd2000DataBlock* dataBlock =
511+
ScopedPointer<Rhd2000DataBlock> dataBlock =
511512
new Rhd2000DataBlock(evalBoard->getNumEnabledDataStreams(), evalBoard->isUSB3());
512513

513514
Array<int> sumGoodDelays;
@@ -1598,7 +1599,7 @@ bool RHD2000Thread::updateBuffer()
15981599
}
15991600
}
16001601

1601-
evalBoard->setTtlMode(ttlMode);
1602+
evalBoard->setTtlMode(ttlMode ? 1 : 0);
16021603
evalBoard->enableExternalFastSettle(fastTTLSettleEnabled);
16031604
evalBoard->setExternalFastSettleChannel(fastSettleTTLChannel);
16041605
evalBoard->setDacHighpassFilter(desiredDAChpf);

Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ void Rhd2000EvalBoard::selectDacDataStream(int dacChannel, int stream)
11001100
return;
11011101
}
11021102

1103-
if (stream < 0 || stream > MAX_NUM_DATA_STREAMS(usb3)) {
1103+
if (stream < 0 || stream > MAX_NUM_DATA_STREAMS(usb3)+1) {
11041104
cerr << "Error in Rhd2000EvalBoard::selectDacDataStream: stream out of range." << endl;
11051105
return;
11061106
}

0 commit comments

Comments
 (0)