Make audio::fade_out return true length

This commit is contained in:
Nikita Lisitsa 2023-01-11 15:23:04 +03:00
parent 104d4a92a0
commit a279fbfcb8

View file

@ -16,12 +16,12 @@ namespace psemek::audio
: stream_(std::move(stream)) : stream_(std::move(stream))
, length_(length) , length_(length)
, start_(start) , start_(start)
, total_length_(stream_->played() + start_.samples() + length_.samples())
{} {}
std::optional<std::size_t> length() const override std::optional<std::size_t> length() const override
{ {
// TODO: compute fade_out length using the number of samples already played return total_length_;
return stream_->length();
} }
std::size_t played() const override std::size_t played() const override
@ -62,6 +62,7 @@ namespace psemek::audio
duration length_; duration length_;
duration start_; duration start_;
std::size_t current_ = 0; std::size_t current_ = 0;
std::size_t total_length_ = 0;
}; };
} }