23 #ifndef EDSP_DECODER_HPP 24 #define EDSP_DECODER_HPP 27 #include <edsp/io/internal/codec/decoder_impl.hpp> 29 namespace edsp {
namespace io {
38 template <
typename T, std::
size_t N = 1024>
52 bool open(
const edsp::string_view& file_path) {
53 return impl_.open(file_path);
68 return impl_.is_open();
77 return impl_.samples();
90 return impl_.frames();
101 return impl_.channels();
109 return impl_.duration();
117 return impl_.samplerate();
125 return impl_.seekable();
135 return impl_.seek(position);
144 return impl_.current();
156 template <
typename OutputIt>
158 return impl_.read(d_first, d_last);
162 decoder_impl<T, N> impl_;
166 #endif //EDSP_DECODER_HPP bool seekable() const noexcept
Checks if the audio file is seekable.
Definition: decoder.hpp:124
double duration() const noexcept
Returns the duration of the audio file in seconds.
Definition: decoder.hpp:108
index_type current() const noexcept
Returns the current frame position of the track in an audio file.
Definition: decoder.hpp:143
index_type read(OutputIt d_first, OutputIt d_last)
Attempts to read data from the audio file and stores the results in the range [first, last)
Definition: decoder.hpp:157
std::ptrdiff_t index_type
Definition: decoder.hpp:41
index_type samples() const noexcept
Returns the number of samples in the audio file.
Definition: decoder.hpp:76
index_type seek(index_type position) noexcept
Updates the current frame position for a track in an audio file.
Definition: decoder.hpp:134
double samplerate() const noexcept
Returns the sampling rate of the audio file in Hz.
Definition: decoder.hpp:116
index_type channels() const noexcept
Returns the number of channels in the audio file.
Definition: decoder.hpp:100
void close()
Closes the audio file.
Definition: decoder.hpp:59
bool open(const edsp::string_view &file_path)
Opens an audio file.
Definition: decoder.hpp:52
This class implements a decoder object to read data from supported audio files.
Definition: decoder.hpp:39
index_type frames() const noexcept
Definition: decoder.hpp:89
bool is_open() const noexcept
Checks if the there is an audio file opened.
Definition: decoder.hpp:67
Definition: amplifier.hpp:29
T value_type
Definition: decoder.hpp:42