Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
26477e6363 | ||
|
239590c94e | ||
|
a0e42ad5e6 | ||
|
70814d62a1 | ||
|
1dbf859ee9 |
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,3 +1,3 @@
|
|||||||
[submodule "lib/midi"]
|
[submodule "lib/midi"]
|
||||||
path = lib/midi
|
path = lib/midi
|
||||||
url = git@engi.evolpe.it:pi/midi.git
|
url = https://engi.evolpe.it/pi/midi
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
var C = c47;
|
var C = chord (c 3 1) (g 3 1) (c 4 1);
|
||||||
var E = e47;
|
var G = chord (g 3 1) (d 4 1) (g 4 1);
|
||||||
var G = g47;
|
|
||||||
var A = a37;
|
|
||||||
|
|
||||||
oct 5;
|
oct 5;
|
||||||
par (C 4) e e f g;
|
par (C) e e f g;
|
||||||
par (G 4) g f e d;
|
par (G) g f e d;
|
||||||
par (C 4) c c d e;
|
par (C) c c d e;
|
||||||
par (G 4) e d d;
|
par (G) e (d 5 (1/4)) (d 5 (1/2));
|
||||||
par (C 4) e e f g;
|
par (C) e e f g;
|
||||||
par (G 4) g f e d;
|
par (G) g f e d;
|
||||||
par (C 4) c c d e;
|
par (C) c c d e;
|
||||||
par (G 4) d c;
|
par (G) (d 4 (3/4)) c;
|
||||||
par (C 4) c
|
par (C) (c 4 1)
|
||||||
|
@ -596,6 +596,8 @@ struct Number
|
|||||||
auto simplify() const -> Number; ///< Returns self, but with gcd(num, den) == 1
|
auto simplify() const -> Number; ///< Returns self, but with gcd(num, den) == 1
|
||||||
void simplify_inplace(); ///< Update self, to have gcd(num, den) == 1
|
void simplify_inplace(); ///< Update self, to have gcd(num, den) == 1
|
||||||
|
|
||||||
|
auto floor() const -> Number; ///< Round to first lower integer
|
||||||
|
|
||||||
bool operator==(Number const&) const;
|
bool operator==(Number const&) const;
|
||||||
bool operator!=(Number const&) const;
|
bool operator!=(Number const&) const;
|
||||||
std::strong_ordering operator<=>(Number const&) const;
|
std::strong_ordering operator<=>(Number const&) const;
|
||||||
@ -608,6 +610,7 @@ struct Number
|
|||||||
Number& operator*=(Number const& rhs);
|
Number& operator*=(Number const& rhs);
|
||||||
Number operator/(Number const& rhs) const;
|
Number operator/(Number const& rhs) const;
|
||||||
Number& operator/=(Number const& rhs);
|
Number& operator/=(Number const& rhs);
|
||||||
|
Number operator%(Number const& rhs) const;
|
||||||
|
|
||||||
/// Parses source contained by token into a Number instance
|
/// Parses source contained by token into a Number instance
|
||||||
static Result<Number> from(Token token);
|
static Result<Number> from(Token token);
|
||||||
|
@ -48,6 +48,13 @@ void Number::simplify_inplace()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto Number::floor() const -> Number
|
||||||
|
{
|
||||||
|
auto copy = simplify();
|
||||||
|
copy = copy - (copy % Number(1));
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
bool Number::operator==(Number const& rhs) const
|
bool Number::operator==(Number const& rhs) const
|
||||||
{
|
{
|
||||||
return (*this <=> rhs) == 0;
|
return (*this <=> rhs) == 0;
|
||||||
@ -119,6 +126,11 @@ Number& Number::operator/=(Number const& rhs)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Number Number::operator%(Number const& rhs) const
|
||||||
|
{
|
||||||
|
return Number{num % rhs.num}.simplify();
|
||||||
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, Number const& n)
|
std::ostream& operator<<(std::ostream& os, Number const& n)
|
||||||
{
|
{
|
||||||
return n.den == 1
|
return n.den == 1
|
||||||
|
Loading…
Reference in New Issue
Block a user