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

◆ set_loop_region()

void MayaFlux::Kakshya::SoundStreamContainer::set_loop_region ( const Region region)
overridevirtual

Set the loop region using a Region.

Parameters
regionThe region to use for looping

Defines the temporal bounds for looped playback or processing.

Implements MayaFlux::Kakshya::StreamContainer.

Definition at line 492 of file SoundStreamContainer.cpp.

493{
494 m_loop_region = region;
495
496 if (m_looping_enabled && !region.start_coordinates.empty()) {
497 std::vector<uint64_t> current_pos(m_read_position.size());
498 for (size_t i = 0; i < m_read_position.size(); ++i) {
499 current_pos[i] = m_read_position[i].load();
500 }
501
502 bool outside_loop = false;
503 for (size_t i = 0; i < current_pos.size() && i < region.start_coordinates.size() && i < region.end_coordinates.size(); ++i) {
504 if (current_pos[i] < region.start_coordinates[i] || current_pos[i] > region.end_coordinates[i]) {
505 outside_loop = true;
506 break;
507 }
508 }
509
510 if (outside_loop) {
511 set_read_position(region.start_coordinates);
512 }
513 }
514}
std::vector< std::atomic< uint64_t > > m_read_position
void set_read_position(const std::vector< uint64_t > &position) override
Set the current read position in the primary temporal dimension per channel.

References MayaFlux::Kakshya::Region::end_coordinates, m_loop_region, m_looping_enabled, m_read_position, set_read_position(), and MayaFlux::Kakshya::Region::start_coordinates.

Referenced by MayaFlux::Kakshya::DynamicSoundStream::enable_circular_buffer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: