MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ read_region()

std::vector< Kakshya::DataVariant > MayaFlux::IO::SoundFileReader::read_region ( const FileRegion region)
overridevirtual

Read a specific region from the file.

Parameters
regionRegion to read.
Returns
DataVariant containing region data.

Implements MayaFlux::IO::FileReader.

Definition at line 690 of file SoundFileReader.cpp.

691{
692 if (region.start_coordinates.empty()) {
693 set_error("Invalid region");
694 return {};
695 }
696
697 uint64_t start = region.start_coordinates[0];
698 uint64_t end = region.end_coordinates.empty() ? start : region.end_coordinates[0];
699 uint64_t num_frames = (end > start) ? (end - start) : 1;
700
701 return read_frames(num_frames, start);
702}
void set_error(const std::string &error) const
Set the last error message.
std::vector< Kakshya::DataVariant > read_frames(uint64_t num_frames, uint64_t offset=0)
Read a specific number of frames from the file.

References MayaFlux::IO::FileRegion::end_coordinates, read_frames(), set_error(), and MayaFlux::IO::FileRegion::start_coordinates.

+ Here is the call graph for this function: