Exemplo n.º 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")
	}
}
Exemplo n.º 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")
	}
}
Exemplo n.º 3
0
func NewDuration(a, b int) Duration {
	return Duration(rational.New(a, b))
}
Exemplo n.º 4
0
func (t TimeSignature) DurationOfBar() Duration {
	return Duration(rational.Scale(rational.New(t.upper, 1), t.lower))
}
Exemplo n.º 5
0
func Signature(upper, lower int) TimeSignature {
	return TimeSignature{upper, rational.New(1, lower)}
}
Exemplo n.º 6
0
func NewPosition(a, b int) Position {
	return Position(rational.New(a, b))
}