@@ -541,6 +541,8 @@ void GenericProcessor::clearSettings()
541541 dataStreams.clearQuick (false );
542542 dataStreams.addArray (dataStreamsToKeep);
543543
544+ ttlEventChannel = nullptr ;
545+
544546 startTimestampsForBlock.clear ();
545547 startSamplesForBlock.clear ();
546548 numSamplesInBlock.clear ();
@@ -1231,7 +1233,7 @@ int GenericProcessor::processEventBuffer()
12311233
12321234 }
12331235 else if (static_cast <Event::Type> (*dataptr) == Event::Type::PROCESSOR_EVENT
1234- && static_cast <SystemEvent ::Type>(*(dataptr + 1 ) == EventChannel::Type::TTL))
1236+ && static_cast <EventChannel ::Type>(*(dataptr + 1 ) == EventChannel::Type::TTL))
12351237 {
12361238 uint16 sourceStreamId = *reinterpret_cast <const uint16*>(dataptr + 4 );
12371239 uint8 eventBit = *reinterpret_cast <const uint8*>(dataptr + 24 );
@@ -1240,7 +1242,7 @@ int GenericProcessor::processEventBuffer()
12401242 getEditor ()->setTTLState (sourceStreamId, eventBit, eventState);
12411243
12421244 } else if (static_cast <Event::Type> (*dataptr) == Event::Type::PROCESSOR_EVENT
1243- && static_cast <SystemEvent ::Type>(*(dataptr + 1 ) == EventChannel::Type::TEXT))
1245+ && static_cast <EventChannel ::Type>(*(dataptr + 1 ) == EventChannel::Type::TEXT))
12441246 {
12451247
12461248 TextEventPtr textEvent = TextEvent::deserialize (dataptr, getMessageChannel ());
@@ -1274,7 +1276,7 @@ int GenericProcessor::checkForEvents(bool checkForSpikes)
12741276 if (EventBase::getBaseType (meta.data ) == Event::Type::PROCESSOR_EVENT)
12751277 {
12761278
1277- if (static_cast <SystemEvent ::Type>(*(meta.data + 1 ) != EventChannel::Type::TEXT))
1279+ if (static_cast <EventChannel ::Type>(*(meta.data + 1 ) != EventChannel::Type::TEXT))
12781280 {
12791281 const EventChannel* eventChannel = getEventChannel (sourceProcessorId, sourceStreamId, sourceChannelIdx);
12801282
@@ -1338,11 +1340,14 @@ void GenericProcessor::addEvent(const Event* event, int sampleNum)
13381340
13391341void GenericProcessor::addTTLChannel (String name)
13401342{
1341- if (dataStreams.size () == 0 )
1342- return ;
1343+ if (dataStreams.size () == 0 )
1344+ {
1345+ return ;
1346+ }
13431347
1344- if (ttlEventChannel ! = nullptr )
1348+ if (ttlEventChannel = = nullptr )
13451349 {
1350+
13461351 EventChannel::Settings settings{
13471352 EventChannel::Type::TTL,
13481353 name,
@@ -1358,10 +1363,11 @@ void GenericProcessor::addTTLChannel(String name)
13581363
13591364 for (int i = 0 ; i < 8 ; i++)
13601365 ttlLineStates.add (false );
1361- }
1362- else {
1363- jassert (false ); // cannot add a second default TTL channel
1364- }
1366+ }
1367+ else {
1368+ jassert (false ); // this shouldn't be called twice in updateSettings()
1369+ }
1370+
13651371}
13661372
13671373
0 commit comments