Пример #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))
}