Skip to content
Snippets Groups Projects
Commit 004457e6 authored by Aaron Cuevas Lopez's avatar Aaron Cuevas Lopez
Browse files

Update Arduino output plugin

parent 87e093b5
Branches
Tags
No related merge requests found
...@@ -97,15 +97,15 @@ void ArduinoOutput::setDevice (String devName) ...@@ -97,15 +97,15 @@ void ArduinoOutput::setDevice (String devName)
} }
void ArduinoOutput::handleEvent (int eventType, MidiMessage& event, int sampleNum) void ArduinoOutput::handleEvent (const EventChannel* eventInfo, const MidiMessage& event, int sampleNum)
{ {
if (eventType == TTL) if (Event::getEventType(event) == EventChannel::TTL)
{ {
const uint8* dataptr = event.getRawData(); TTLEventPtr ttl = TTLEvent::deserializeFromMessage(event, eventInfo);
//int eventNodeId = *(dataptr+1); //int eventNodeId = *(dataptr+1);
const int eventId = *(dataptr + 2); const int eventId = ttl->getState() ? 1: 0;
const int eventChannel = *(dataptr + 3); const int eventChannel = ttl->getChannel();
// std::cout << "Received event from " << eventNodeId // std::cout << "Received event from " << eventNodeId
// << " on channel " << eventChannel // << " on channel " << eventChannel
...@@ -197,7 +197,7 @@ bool ArduinoOutput::disable() ...@@ -197,7 +197,7 @@ bool ArduinoOutput::disable()
} }
void ArduinoOutput::process (AudioSampleBuffer& buffer, MidiBuffer& events) void ArduinoOutput::process (AudioSampleBuffer& buffer)
{ {
checkForEvents (events); checkForEvents ();
} }
...@@ -46,14 +46,14 @@ public: ...@@ -46,14 +46,14 @@ public:
~ArduinoOutput(); ~ArduinoOutput();
/** Searches for events and triggers the Arduino output when appropriate. */ /** Searches for events and triggers the Arduino output when appropriate. */
void process (AudioSampleBuffer& buffer, MidiBuffer& events) override; void process (AudioSampleBuffer& buffer) override;
/** Currently unused. Future uses may include changing the TTL trigger channel /** Currently unused. Future uses may include changing the TTL trigger channel
or the output channel of the Arduino. */ or the output channel of the Arduino. */
void setParameter (int parameterIndex, float newValue) override; void setParameter (int parameterIndex, float newValue) override;
/** Convenient interface for responding to incoming events. */ /** Convenient interface for responding to incoming events. */
void handleEvent (int eventType, MidiMessage& event, int sampleNum) override; void handleEvent (const EventChannel* eventInfo, const MidiMessage& event, int sampleNum) override;
/** Called immediately prior to the start of data acquisition. */ /** Called immediately prior to the start of data acquisition. */
bool enable() override; bool enable() override;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment