Skip to content

Commit 078f505

Browse files
committed
Update scope and comments
1 parent 4901278 commit 078f505

1 file changed

Lines changed: 15 additions & 17 deletions

File tree

Source/Plugins/NetworkEvents/NetworkEvents.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ void NetworkEvents::createEventChannels()
123123
TTLchan->setName("Network Events output");
124124
TTLchan->setDescription("Triggers whenever \"TTL\" is received on the port.");
125125
TTLchan->setIdentifier("external.network.ttl");
126+
// Possibly add meta data (reason for ttl event?)
126127
eventChannelArray.add(TTLchan);
127128
TTLChannel = TTLchan;
128129
}
@@ -215,8 +216,8 @@ String NetworkEvents::handleSpecialMessages(const String& s)
215216
if (CoreServices::getRecordingStatus())
216217
{
217218
CoreServices::setRecordingStatus (false);
218-
return String ("StoppedRecording");
219-
}
219+
}
220+
return String("StoppedRecording");
220221
}
221222
else if (cmd.compareIgnoreCase ("IsAcquiring") == 0)
222223
{
@@ -248,10 +249,10 @@ String NetworkEvents::handleSpecialMessages(const String& s)
248249
}
249250
else if (cmd.compareIgnoreCase ("TTL") == 0)
250251
{
251-
// Default to chan 0 and off
252+
// Default to channel 0 and off (if no info sent)
252253
int channel = 0;
253254
bool onOff = false;
254-
/** First set optional parameters (name/value pairs)*/
255+
/** Set optional parameters (name/value pairs)*/
255256
String params = s.substring(cmd.length()).trim();
256257
StringPairArray dict = parseNetworkMessage(params);
257258

@@ -263,14 +264,14 @@ String NetworkEvents::handleSpecialMessages(const String& s)
263264

264265
if (key.compareIgnoreCase("Channel") == 0)
265266
{
266-
//Make sure in range
267+
// Make sure in range
267268
if (value <= 8 && value >= 0)
268269
{
269270
channel = value;
270271
}
271272
else
272273
{
273-
//Throw some kind of error here
274+
jassertfalse;
274275
}
275276
}
276277
else if (key.compareIgnoreCase("on") == 0)
@@ -284,10 +285,6 @@ String NetworkEvents::handleSpecialMessages(const String& s)
284285
{
285286
TTLQueue.push({ onOff, channel });
286287
}
287-
else
288-
{
289-
//Throw some error
290-
}
291288
}
292289

293290

@@ -302,7 +299,6 @@ void NetworkEvents::triggerEvent(StringTTL TTLmsg, juce::int64 timestamp)
302299
{
303300
juce::uint8 ttlData = TTLmsg.onOff << TTLmsg.eventChannel;
304301
TTLEventPtr event = TTLEvent::createTTLEvent(TTLChannel, timestamp, &ttlData, sizeof(juce::uint8), TTLmsg.eventChannel);
305-
std::cout << "adding event from ne" << std::endl;
306302
addEvent(TTLChannel, event, 0);
307303
}
308304

@@ -312,14 +308,16 @@ void NetworkEvents::process (AudioSampleBuffer& buffer)
312308
setTimestampAndSamples(CoreServices::getGlobalTimestamp(),0);
313309
juce::int64 timestamp = CoreServices::getGlobalTimestamp();
314310

315-
ScopedLock lock(queueLock);
316-
while (! networkMessagesQueue.empty())
317311
{
318-
const StringTS& msg = networkMessagesQueue.front();
319-
postTimestamppedStringToMidiBuffer (msg, timestamp);
320-
networkMessagesQueue.pop();
312+
ScopedLock lock(queueLock);
313+
while (!networkMessagesQueue.empty())
314+
{
315+
const StringTS& msg = networkMessagesQueue.front();
316+
postTimestamppedStringToMidiBuffer(msg, timestamp);
317+
networkMessagesQueue.pop();
318+
}
321319
}
322-
320+
323321
{
324322
ScopedLock TTLlock(TTLqueueLock);
325323
while (!TTLQueue.empty())

0 commit comments

Comments
 (0)