StdPicture.setRGB()
or StdPicture.setARGB()
?
setRGB()
is recommended. Note that setting the alpha channel value to fully opaque is equivalent, however: setRGB(col, row, r, g, b)
is equivalent to setARGB(col, row, 255, r, g, b)
.
StdPicture.init(width, height)
: this method initializes an image with the corresponding dimensions where every pixel is black (i.e., whose red, green and blue color levels are all 0
).
StdIn
with newlines (rather than any whitespace) as separators?
StdIn.readLine()
reads every character until the next line.
t
. For example, "a: b:cd:e".split(":")
returns the String
array ["a", " b", "cd", "e"]
.
ticks
can be converted to beats
dividing by 48
: beats = ticks / 48
.
ticks
can be converted to beats
dividing by 48
: beats = ticks / 48
. (And they can be converted into multiples of StdMidi.THIRTYSECOND_NOTE
by dividing by 384
.)
double
values with ==
is, in general, risky. Is it OK to do in this assignment?
0.125
, the value of StdMidi.THIRTYSECOND_NOTE
, can be represented exactly as a double
-- and so can integer multiples of \(0.125 = 1/8\). This would not be the case for notes with duration of, say, a quarter note triplet (\(4/3\) beats), since \(4/3\) cannot be exactly represented as a double
.