Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
zone_layer_select.hpp File Reference

Multi-layer (multi-mic / velocity-layer) selection over a SampleZoneMap. More...

#include <cstddef>
#include <pulp/audio/sample_zone_map.hpp>

Go to the source code of this file.

Namespaces

namespace  pulp
namespace  pulp::audio

Functions

std::size_t pulp::audio::select_layers (const SampleZoneMap &map, const ZoneSelectionRequest &request, ZoneSelection *out, std::size_t max_out) noexcept
 Resolve a trigger to every zone that should sound.

Detailed Description

Multi-layer (multi-mic / velocity-layer) selection over a SampleZoneMap.

ZoneSelector::select() returns the single best zone for a trigger. A multisample instrument often needs several zones to sound at once: multiple microphone positions, or overlapping velocity layers that crossfade. This helper returns every zone that should sound for one (note, velocity) trigger, while still rotating round-robin variations within each non-zero round_robin_group (so RR alternates are not all triggered together).

Selection rules:

  • A zone must match the request (key + velocity), same as ZoneSelector::matches().
  • round_robin_group == 0 zones are independent layers — all matching ones are emitted (this is the multi-mic / velocity-layer case).
  • round_robin_group != 0 zones are rotation variants — only the variant chosen by request.round_robin_step is emitted per group.

RT-safe when the map is immutable for the duration of the call: no allocation, no locking. O(zones^2) in the worst case, which is negligible for realistic zone counts.