예제 #1
0
func TestAddToPosition(t *testing.T) {
	p := Position(rational.New(1, 2))
	d := Duration(rational.New(1, 4))

	if p.Add(d) != Position(rational.New(3, 4)) {
		t.Errorf("Incorrect value for Add on Position")
	}
}
예제 #2
0
func TestAddToDuration(t *testing.T) {
	a := Duration(rational.New(1, 2))
	b := Duration(rational.New(1, 4))

	if a.Add(b) != Duration(rational.New(3, 4)) {
		t.Errorf("Incorrect value for Add on Duration")
	}
}
예제 #3
0
func NewDuration(a, b int) Duration {
	return Duration(rational.New(a, b))
}
예제 #4
0
func (t TimeSignature) DurationOfBar() Duration {
	return Duration(rational.Scale(rational.New(t.upper, 1), t.lower))
}
예제 #5
0
func Signature(upper, lower int) TimeSignature {
	return TimeSignature{upper, rational.New(1, lower)}
}
예제 #6
0
func NewPosition(a, b int) Position {
	return Position(rational.New(a, b))
}