Lines Matching defs:event

54  * the event list in the correct time order.  Methods are also
79 * which initially contains one event, the meta-event End of Track.
82 // start with the end of track event
90 * Adds a new event to the track. However, if the event is already
92 * is kept in time order, meaning that this event inserted at the
95 * @param event the event to add
96 * @return <code>true</code> if the event did not already exist in the
99 public boolean add(MidiEvent event) {
100 if (event == null) {
105 if (!set.contains(event)) {
108 // get the last event
115 // if there is no eot event, add our immutable instance again
131 // and endoftrack event.
132 if (MidiUtils.isMetaEndOfTrack(event.getMessage())) {
133 // since end of track event is useful
137 // Otherwise, we only want a single eot event, so ignore.
138 if (event.getTick() > eotEvent.getTick()) {
139 eotEvent.setTick(event.getTick());
145 set.add(event);
147 // insert event such that events is sorted in increasing
151 if (event.getTick() >= ((MidiEvent)eventsList.get(i-1)).getTick()) {
156 // we're adding an event after the
161 // overwrite eot with new event
162 eventsList.set(eventsCount - 1, event);
164 if (eotEvent.getTick() < event.getTick()) {
165 eotEvent.setTick(event.getTick());
170 eventsList.add(i, event);
181 * Removes the specified event from the track.
182 * @param event the event to remove
183 * @return <code>true</code> if the event existed in the track and was removed,
186 public boolean remove(MidiEvent event) {
188 // this implementation allows removing the EOT event.
195 // to the last event, if the last non-EOT event is removed?
197 // by deleting events (unless the EOT event is removed)
199 if (set.remove(event)) {
200 int i = eventsList.indexOf(event);
212 * Obtains the event at the specified index.
213 * @param index the location of the desired event in the event vector
232 * @return the size of the track's event vector