livoxGen1: Implement StimBuff add/del from StimProducers

There seems to be a bug where two or more stimProducers
or stimBuffs get initialized at once but we can deal with that
tomorrow.
This commit is contained in:
2025-11-15 04:02:25 -04:00
parent e215e78aa5
commit 7a51f02d97
4 changed files with 281 additions and 93 deletions
@@ -100,6 +100,28 @@ void produceStimFrameAck(void)
{
}
std::shared_ptr<StimulusBuffer>
PcloudStimulusProducer::getOrCreateAttachedStimulusBuffer(
const std::shared_ptr<device::DeviceAttachmentSpec>& deviceAttachmentSpec,
int histbuffMs
)
{
// Check if buffer already exists (idempotent)
auto existingBuffer = getAttachedStimulusBuffer(deviceAttachmentSpec);
if (existingBuffer)
{ return existingBuffer; }
// Create new PcloudXyzStimulusBuffer (for now, always use XYZ type)
auto buffer = std::make_shared<PcloudXyzStimulusBuffer>(
*this, deviceAttachmentSpec, histbuffMs, openClInputConstraints);
// Add to collection
attachedStimulusBuffers.push_back(buffer);
// Update specialized member
xyzStimulusBuffer = buffer;
return buffer;
}
void PcloudStimulusProducer::stimFrameProductionTimesliceInd()
{
produceFrameReq({nullptr, nullptr});