StimProducer: add destroyAttachedStimulusBuffer virtual method
Implemented in base class and in derived class PcloudStimulusProducer.
This commit is contained in:
@@ -463,22 +463,7 @@ public:
|
||||
auto& stimProducer = dynamic_cast<PcloudStimulusProducer&>(
|
||||
context->stimBuffer->parent);
|
||||
|
||||
auto it = std::find(
|
||||
stimProducer.attachedStimulusBuffers.begin(),
|
||||
stimProducer.attachedStimulusBuffers.end(),
|
||||
context->stimBuffer);
|
||||
if (it != stimProducer.attachedStimulusBuffers.end())
|
||||
{
|
||||
stimProducer.attachedStimulusBuffers.erase(it);
|
||||
}
|
||||
|
||||
// Clear specialized buffer members if they match
|
||||
if (stimProducer.meshStimulusBuffer == context->stimBuffer)
|
||||
{ stimProducer.meshStimulusBuffer.reset(); }
|
||||
if (stimProducer.intensityStimulusBuffer == context->stimBuffer)
|
||||
{ stimProducer.intensityStimulusBuffer.reset(); }
|
||||
if (stimProducer.ambienceStimulusBuffer == context->stimBuffer)
|
||||
{ stimProducer.ambienceStimulusBuffer.reset(); }
|
||||
stimProducer.destroyAttachedStimulusBuffer(context->stimBuffer);
|
||||
|
||||
// Check if StimProducer has other buffers
|
||||
if (!stimProducer.attachedStimulusBuffers.empty())
|
||||
|
||||
@@ -205,6 +205,23 @@ PcloudStimulusProducer::getAttachedStimulusBuffer(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void PcloudStimulusProducer::destroyAttachedStimulusBuffer(
|
||||
const std::shared_ptr<StimulusBuffer>& buffer)
|
||||
{
|
||||
if (!buffer) { return; }
|
||||
|
||||
// Clear specialized buffer pointers if they match
|
||||
if (meshStimulusBuffer == buffer)
|
||||
{ meshStimulusBuffer.reset(); }
|
||||
if (intensityStimulusBuffer == buffer)
|
||||
{ intensityStimulusBuffer.reset(); }
|
||||
if (ambienceStimulusBuffer == buffer)
|
||||
{ ambienceStimulusBuffer.reset(); }
|
||||
|
||||
// Call base class implementation to remove from attachedStimulusBuffers
|
||||
StimulusProducer::destroyAttachedStimulusBuffer(buffer);
|
||||
}
|
||||
|
||||
std::shared_ptr<StimulusBuffer>
|
||||
PcloudStimulusProducer::getOrCreateAttachedStimulusBuffer(
|
||||
const std::shared_ptr<device::DeviceAttachmentSpec>& deviceAttachmentSpec
|
||||
|
||||
@@ -70,6 +70,9 @@ public:
|
||||
const std::shared_ptr<device::DeviceAttachmentSpec>& spec)
|
||||
const override;
|
||||
|
||||
void destroyAttachedStimulusBuffer(
|
||||
const std::shared_ptr<StimulusBuffer>& buffer) override;
|
||||
|
||||
protected:
|
||||
void stimFrameProductionTimesliceInd() override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user