Skip to content

Commit 1ea3b55

Browse files
committed
Cleaned and finished up.
1 parent 022d8be commit 1ea3b55

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

Source/Plugins/NetworkEvents/NetworkEvents.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ void NetworkEvents::createEventChannels()
9999
TTLchan->setName("Network Events output");
100100
TTLchan->setDescription("Triggers whenever \"TTL\" is received on the port.");
101101
TTLchan->setIdentifier("external.network.ttl");
102-
// Possibly add meta data (reason for ttl event?)
103102
eventChannelArray.add(TTLchan);
104103
TTLChannel = TTLchan;
105104
}
@@ -225,9 +224,9 @@ String NetworkEvents::handleSpecialMessages(const String& s)
225224
}
226225
else if (cmd.compareIgnoreCase ("TTL") == 0)
227226
{
228-
// Default to channel 0 and off (if no info sent)
229-
int channel = 0;
230-
bool onOff = false;
227+
// Default to channel 0 and off (if no optional info sent)
228+
int channel = 1;
229+
bool onOff = 0;
231230
/** Set optional parameters (name/value pairs)*/
232231
String params = s.substring(cmd.length()).trim();
233232
StringPairArray dict = parseNetworkMessage(params);
@@ -241,7 +240,7 @@ String NetworkEvents::handleSpecialMessages(const String& s)
241240
if (key.compareIgnoreCase("Channel") == 0)
242241
{
243242
// Make sure in range
244-
if (value <= 8 && value >= 0)
243+
if (value <= 8 && value >= 1)
245244
{
246245
channel = value;
247246
}
@@ -265,13 +264,13 @@ String NetworkEvents::handleSpecialMessages(const String& s)
265264

266265

267266

268-
return "TTL Handled";
267+
return "TTL Handled: Channel=" + String(channel) + " on=" + String(onOff);
269268
}
270269

271270
return String ("NotHandled");
272271
}
273272

274-
void NetworkEvents::triggerEvent(StringTTL TTLmsg, juce::int64 timestamp)
273+
void NetworkEvents::triggerTTLEvent(StringTTL TTLmsg, juce::int64 timestamp)
275274
{
276275
juce::uint8 ttlData = TTLmsg.onOff << TTLmsg.eventChannel;
277276
TTLEventPtr event = TTLEvent::createTTLEvent(TTLChannel, timestamp, &ttlData, sizeof(juce::uint8), TTLmsg.eventChannel);
@@ -299,7 +298,7 @@ void NetworkEvents::process (AudioSampleBuffer& buffer)
299298
while (!TTLQueue.empty())
300299
{
301300
const StringTTL& TTLmsg = TTLQueue.front();
302-
triggerEvent(TTLmsg, timestamp);
301+
triggerTTLEvent(TTLmsg, timestamp);
303302
TTLQueue.pop();
304303
}
305304
}

Source/Plugins/NetworkEvents/NetworkEvents.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class NetworkEvents : public GenericProcessor
186186
const EventChannel* messageChannel{ nullptr };
187187
const EventChannel* TTLChannel{ nullptr };
188188

189-
void triggerEvent(StringTTL TTLmsg, juce::int64 timestamp);
189+
void triggerTTLEvent(StringTTL TTLmsg, juce::int64 timestamp);
190190

191191
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NetworkEvents);
192192
};

0 commit comments

Comments
 (0)