mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
add compost utility
This commit is contained in:
parent
24d2a229f3
commit
b44f7c8f2a
14 changed files with 670 additions and 29 deletions
|
@ -89,7 +89,9 @@ namespace sprout {
|
|||
return phase_;
|
||||
}
|
||||
SPROUT_CONSTEXPR reference operator*() const {
|
||||
return amplitude_ * sprout::fixed::detail::sawtooth_value(frequency_ * value_type(index_) + phase_);
|
||||
return amplitude_ == 0 ? 0
|
||||
: amplitude_ * sprout::fixed::detail::sawtooth_value(frequency_ * value_type(index_) + phase_)
|
||||
;
|
||||
}
|
||||
SPROUT_CONSTEXPR pointer operator->() const {
|
||||
return &operator*()();
|
||||
|
@ -129,7 +131,9 @@ namespace sprout {
|
|||
return *this;
|
||||
}
|
||||
SPROUT_CONSTEXPR reference operator[](difference_type n) const {
|
||||
return amplitude_ * sprout::fixed::detail::sawtooth_value(frequency_ * value_type(index_ + n) + phase_);
|
||||
return amplitude_ == 0 ? 0
|
||||
: amplitude_ * sprout::fixed::detail::sawtooth_value(frequency_ * value_type(index_ + n) + phase_)
|
||||
;
|
||||
}
|
||||
SPROUT_CONSTEXPR sawtooth_iterator next() const {
|
||||
return sawtooth_iterator(*this, index_ + 1);
|
||||
|
|
|
@ -96,7 +96,9 @@ namespace sprout {
|
|||
}
|
||||
SPROUT_CONSTEXPR reference operator*() const {
|
||||
using sprout::sin;
|
||||
return amplitude_ * sin(d_ * value_type(index_) + phase_);
|
||||
return amplitude_ == 0 ? 0
|
||||
: amplitude_ * sin(d_ * value_type(index_) + phase_)
|
||||
;
|
||||
}
|
||||
SPROUT_CONSTEXPR pointer operator->() const {
|
||||
return &operator*()();
|
||||
|
@ -137,7 +139,9 @@ namespace sprout {
|
|||
}
|
||||
SPROUT_CONSTEXPR reference operator[](difference_type n) const {
|
||||
using sprout::sin;
|
||||
return amplitude_ * sin(d_ * value_type(index_ + n) + phase_);
|
||||
return amplitude_ == 0 ? 0
|
||||
: amplitude_ * sin(d_ * value_type(index_ + n) + phase_)
|
||||
;
|
||||
}
|
||||
SPROUT_CONSTEXPR sinusoid_iterator next() const {
|
||||
return sinusoid_iterator(*this, index_ + 1);
|
||||
|
|
|
@ -98,7 +98,9 @@ namespace sprout {
|
|||
return duty_;
|
||||
}
|
||||
SPROUT_CONSTEXPR reference operator*() const {
|
||||
return amplitude_ * sprout::fixed::detail::square_value(frequency_ * value_type(index_) + phase_, duty_);
|
||||
return amplitude_ == 0 ? 0
|
||||
: amplitude_ * sprout::fixed::detail::square_value(frequency_ * value_type(index_) + phase_, duty_)
|
||||
;
|
||||
}
|
||||
SPROUT_CONSTEXPR pointer operator->() const {
|
||||
return &operator*()();
|
||||
|
@ -138,7 +140,9 @@ namespace sprout {
|
|||
return *this;
|
||||
}
|
||||
SPROUT_CONSTEXPR reference operator[](difference_type n) const {
|
||||
return amplitude_ * sprout::fixed::detail::square_value(frequency_ * value_type(index_ + n) + phase_, duty_);
|
||||
return amplitude_ == 0 ? 0
|
||||
: amplitude_ * sprout::fixed::detail::square_value(frequency_ * value_type(index_ + n) + phase_, duty_)
|
||||
;
|
||||
}
|
||||
SPROUT_CONSTEXPR square_iterator next() const {
|
||||
return square_iterator(*this, index_ + 1);
|
||||
|
|
|
@ -89,7 +89,9 @@ namespace sprout {
|
|||
return phase_;
|
||||
}
|
||||
SPROUT_CONSTEXPR reference operator*() const {
|
||||
return amplitude_ * sprout::fixed::detail::triangle_value(frequency_ * value_type(index_) + phase_);
|
||||
return amplitude_ == 0 ? 0
|
||||
: amplitude_ * sprout::fixed::detail::triangle_value(frequency_ * value_type(index_) + phase_)
|
||||
;
|
||||
}
|
||||
SPROUT_CONSTEXPR pointer operator->() const {
|
||||
return &operator*()();
|
||||
|
@ -129,7 +131,9 @@ namespace sprout {
|
|||
return *this;
|
||||
}
|
||||
SPROUT_CONSTEXPR reference operator[](difference_type n) const {
|
||||
return amplitude_ * sprout::fixed::detail::triangle_value(frequency_ * value_type(index_ + n) + phase_);
|
||||
return amplitude_ == 0 ? 0
|
||||
: amplitude_ * sprout::fixed::detail::triangle_value(frequency_ * value_type(index_ + n) + phase_)
|
||||
;
|
||||
}
|
||||
SPROUT_CONSTEXPR triangle_iterator next() const {
|
||||
return triangle_iterator(*this, index_ + 1);
|
||||
|
|
|
@ -164,7 +164,7 @@ namespace sprout {
|
|||
return !(lhs < rhs);
|
||||
}
|
||||
template<typename Iterator1, typename T1, typename Iterator2, typename T2>
|
||||
inline SPROUT_CONSTEXPR decltype(std::declval<Iterator1, T1>() - std::declval<Iterator2, T2>())
|
||||
inline SPROUT_CONSTEXPR decltype(std::declval<Iterator1>() - std::declval<Iterator2>())
|
||||
operator-(sprout::valued_iterator<Iterator1, T1> const& lhs, sprout::valued_iterator<Iterator2, T2> const& rhs) {
|
||||
return lhs.base() - rhs.base();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue