15 lines
413 B
C++
15 lines
413 B
C++
#include <psemek/audio/effect/fade_out.hpp>
|
|
#include <psemek/audio/effect/envelope.hpp>
|
|
#include <psemek/math/interval.hpp>
|
|
|
|
namespace psemek::audio
|
|
{
|
|
|
|
stream_ptr fade_in(stream_ptr stream, duration length, duration start)
|
|
{
|
|
return envelope(std::move(stream), [start, length](duration time){
|
|
return math::clamp(static_cast<float>(time.frames() - start.frames()) / length.frames(), {0.f, 1.f});
|
|
});
|
|
}
|
|
|
|
}
|