Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

(Note: This information is only applicable to the current development branch of the GUI)

Data in the GUI is divided into three main types:

...

An event or spike cannot be instantiated manually by the use of the new operator. Instead, each event class has a specialized static factory method that takes all the necessary data to create an event as well as its channel definition, so it can check that no mismatch exists. Once created, an event or spike cannot be modified. An example of event creation could be:

TextEventPtr textEvent = TextEvent::createTextEvent(textEventChannelPointer, timestamp, "Event Text");

Note that special pointer types have been created for each class to ensure that no memory leaks exist. Those are typedefs to Juce’s ScopedPointers templated to the right classes.

...

The handleEvent() and handleSpike() methods contain, as part of their arguments, a const reference to a MidiMessage which contains the serialized event as well as a const pointer to the matching channel definition. Event classes feature a static method to deserialize those messages into objects, similar to the create methods. In the same way, they need a pointer to the channel definition so it can know how to interpret the serialized data. An example would be:

TextEventPtr textEvent = TextEvent::deserializeFromMessage(midiMessage, channelPointer);

...