livoxGen1: Add StimBuffs to PcloudStimProd

* PcloudStimulusProducer now has member sh_ptr<StimulusBuffer>s.
* StimulusProducer now has a vector<sh_ptr<StimulusBuffer>s.

Created new stimbuff-type-specific
Pcloud[Xyz|I|Ambience]StimulusBuffer classes for representing each
stim feature exposed by livoxGen1's PcloudStimulusProducer.
This commit is contained in:
2025-11-14 23:19:32 -04:00
parent 8a7dc10892
commit 98a493a8a1
7 changed files with 159 additions and 2 deletions
+6 -1
View File
@@ -6,6 +6,7 @@
#include <memory>
#include <user/spMcRingBuffer.h>
#include "stimulusFrame.h"
#include "deviceAttachmentSpec.h"
namespace smo {
namespace stim_buff {
@@ -24,9 +25,12 @@ class StimulusBuffer
public:
explicit StimulusBuffer(
std::shared_ptr<StimulusProducer> &producer,
const std::shared_ptr<device::DeviceAttachmentSpec>
&deviceAttachmentSpec,
int histbuffMs,
const SpMcRingBuffer::InputEngineConstraints& ringBufferConstraints)
: producer(producer),
deviceAttachmentSpec(deviceAttachmentSpec),
histbuffMs(histbuffMs),
frames_(static_cast<size_t>(histbuffMs / CONFIG_STIMBUFF_FRAME_PERIOD_MS)),
ringBufferConstraints(ringBufferConstraints),
@@ -45,10 +49,11 @@ public:
public:
std::shared_ptr<StimulusProducer> producer;
std::shared_ptr<device::DeviceAttachmentSpec> deviceAttachmentSpec;
int histbuffMs;
std::vector<StimulusFrame> frames_;
protected:
int histbuffMs;
SpMcRingBuffer::InputEngineConstraints ringBufferConstraints;
SpMcRingBuffer ringBuffer;
};
+7
View File
@@ -19,6 +19,9 @@
namespace smo {
namespace stim_buff {
// Forward declaration
class StimulusBuffer;
/**
* StimulusProducer manages a collection of stimulus frames with simultaneity stamps.
*
@@ -66,6 +69,9 @@ public:
void allowNextStimulusFrame()
{ frameAssemblyRateLimiter.release(); }
std::shared_ptr<StimulusBuffer> getAttachedStimulusBuffer(
const std::shared_ptr<device::DeviceAttachmentSpec>& spec) const;
protected:
SpinLock frameAssemblyRateLimiter;
@@ -82,6 +88,7 @@ private:
public:
std::shared_ptr<device::DeviceAttachmentSpec> deviceAttachmentSpec;
std::vector<std::shared_ptr<StimulusBuffer>> attachedStimulusBuffers;
private:
boost::asio::io_service& ioService;