Max 5 API Reference
|Increment the event serial number. |
|Get the current value of the event serial number. |
|Get a unique number for each Patcher file saved. |
This number can be read by objects that want to know if two messages they have received occurred at the same logical "time" (in response to the same event). Max increments the serial number for each tick of the clock, each key press, mouse click, and MIDI event. Note that this is different from the file serial number returned by the serialno() function. The file serial number is only incremented when patchers are saved in files. If more than one patcher is saved in a file, the file serial number will change but the event serial number will not.
Here is a Max patch that includes an object called simul that would use the information returned by evnum_get to return a 1 if the right and left inlets receive messages at the same time, 0 if not. The number boxes below show the results of clicking on the button objects or typing a key.
Get the current value of the event serial number.
Get a unique number for each Patcher file saved.
This function returns a serial number that is incremented each time a Patcher file is saved. This routine is useful for objects like table and coll that have multiple objects that refer to the same data, and can “embed” the data inside a Patcher file. If the serial number hasn’t changed since your object was last saved, you can detect this and avoid saving multiple copies of the object’s data.