1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

add compost left_channel, right_channel

This commit is contained in:
bolero-MURAKAMI 2012-11-24 23:28:07 +09:00
parent 597d05563b
commit 7da0aa0343
4 changed files with 91 additions and 1 deletions

View file

@ -3,5 +3,7 @@
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/compost/formats/as_pcm_wave.hpp> #include <sprout/compost/formats/as_pcm_wave.hpp>
#include <sprout/compost/formats/left_channel.hpp>
#include <sprout/compost/formats/right_channel.hpp>
#endif // #ifndef SPROUT_COMPOST_FORMATS_HPP #endif // #ifndef SPROUT_COMPOST_FORMATS_HPP

View file

@ -0,0 +1,44 @@
#ifndef SPROUT_COMPOST_FORMATS_LEFT_CHANNEL_HPP
#define SPROUT_COMPOST_FORMATS_LEFT_CHANNEL_HPP
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/range/adaptor/steps.hpp>
namespace sprout {
namespace compost {
namespace formats {
//
// left_channel_forwarder
//
class left_channel_forwarder {};
//
// left_channel
//
namespace {
SPROUT_STATIC_CONSTEXPR sprout::compost::formats::left_channel_forwarder left_channel{};
} // anonymous-namespace
//
// operator|
//
template<typename Range, typename T>
inline SPROUT_CONSTEXPR auto
operator|(Range&& lhs, left_channel_forwarder const& rhs)
-> decltype(
sprout::forward<Range>(lhs)
| sprout::adaptors::steps(2)
)
{
return sprout::forward<Range>(lhs)
| sprout::adaptors::steps(2)
;
}
} // namespace formats
using sprout::compost::formats::left_channel;
} // namespace compost
} // namespace sprout
#endif // #ifndef SPROUT_COMPOST_FORMATS_LEFT_CHANNEL_HPP

View file

@ -0,0 +1,44 @@
#ifndef SPROUT_COMPOST_FORMATS_RIGHT_CHANNEL_HPP
#define SPROUT_COMPOST_FORMATS_RIGHT_CHANNEL_HPP
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/range/adaptor/steps.hpp>
namespace sprout {
namespace compost {
namespace formats {
//
// right_channel_forwarder
//
class right_channel_forwarder {};
//
// right_channel
//
namespace {
SPROUT_STATIC_CONSTEXPR sprout::compost::formats::right_channel_forwarder right_channel{};
} // anonymous-namespace
//
// operator|
//
template<typename Range, typename T>
inline SPROUT_CONSTEXPR auto
operator|(Range&& lhs, right_channel_forwarder const& rhs)
-> decltype(
sprout::forward<Range>(lhs)
| sprout::adaptors::steps(2, 1)
)
{
return sprout::forward<Range>(lhs)
| sprout::adaptors::steps(2, 1)
;
}
} // namespace formats
using sprout::compost::formats::right_channel;
} // namespace compost
} // namespace sprout
#endif // #ifndef SPROUT_COMPOST_FORMATS_RIGHT_CHANNEL_HPP

View file

@ -5,7 +5,7 @@
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/utility/as_lvalue.hpp> #include <sprout/utility/as_lvalue.hpp>
#include <sprout/type_traits.hpp> #include <sprout/type_traits/lvalue_reference.hpp>
namespace sprout { namespace sprout {
// //