Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/classes/javax/sound/midi/MidiEvent.java
41159 views
1
/*
2
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package javax.sound.midi;
27
28
/**
29
* MIDI events contain a MIDI message and a corresponding time-stamp expressed
30
* in ticks, and can represent the MIDI event information stored in a MIDI file
31
* or a {@link Sequence} object. The duration of a tick is specified by the
32
* timing information contained in the MIDI file or {@code Sequence} object.
33
* <p>
34
* In Java Sound, {@code MidiEvent} objects are typically contained in a
35
* {@link Track}, and {@code Tracks} are likewise contained in a
36
* {@code Sequence}.
37
*
38
* @author David Rivas
39
* @author Kara Kytle
40
*/
41
public class MidiEvent {
42
43
/**
44
* The MIDI message for this event.
45
*/
46
private final MidiMessage message;
47
48
/**
49
* The tick value for this event.
50
*/
51
private long tick;
52
53
/**
54
* Constructs a new {@code MidiEvent}.
55
*
56
* @param message the MIDI message contained in the event
57
* @param tick the time-stamp for the event, in MIDI ticks
58
*/
59
public MidiEvent(MidiMessage message, long tick) {
60
61
this.message = message;
62
this.tick = tick;
63
}
64
65
/**
66
* Obtains the MIDI message contained in the event.
67
*
68
* @return the MIDI message
69
*/
70
public MidiMessage getMessage() {
71
return message;
72
}
73
74
/**
75
* Sets the time-stamp for the event, in MIDI ticks.
76
*
77
* @param tick the new time-stamp, in MIDI ticks
78
*/
79
public void setTick(long tick) {
80
this.tick = tick;
81
}
82
83
/**
84
* Obtains the time-stamp for the event, in MIDI ticks.
85
*
86
* @return the time-stamp for the event, in MIDI ticks
87
*/
88
public long getTick() {
89
return tick;
90
}
91
}
92
93