34template <ComputeData InputType = std::vector<Kakshya::DataVariant>, ComputeData OutputType = InputType>
89 const auto fi = get_parameter_or<double>(
"fade_in_ratio", 0.1);
90 const auto fo = get_parameter_or<double>(
"fade_out_ratio", 0.1);
97 const auto factor = get_parameter_or<double>(
"stretch_factor", 1.0);
104 const auto samples = get_parameter_or<uint32_t>(
"delay_samples", 1000);
105 const auto fill = get_parameter_or<double>(
"fill_value", 0.0);
112 const auto start = get_parameter_or<double>(
"start_ratio", 0.0);
113 const auto end = get_parameter_or<double>(
"end_ratio", 1.0);
120 const auto target = get_parameter_or<size_t>(
"target_size",
size_t { 0 });
121 const auto cubic = get_parameter_or<bool>(
"use_cubic",
false);
125 std::vector<double> out(target);
158 if (name ==
"operation") {
159 if (
auto r = safe_any_cast<TemporalOperation>(value)) {
163 if (
auto r = safe_any_cast<std::string>(value)) {
164 if (
auto e = Reflect::string_to_enum_case_insensitive<TemporalOperation>(*r.value)) {
186 template <
typename Func>
191 for (
size_t i = 0; i < channels.size(); ++i) {
192 if constexpr (std::is_void_v<std::invoke_result_t<Func, std::span<double>>>) {
201 for (
size_t i = 0; i < channels.size(); ++i)
204 OperationHelper::reconstruct_from_double<InputType>(
m_working_buffer, structure_info));
234 template <
typename T>
238 if (!param.has_value())
239 return default_value;
241 auto result = safe_any_cast<T>(param);
242 return result.value_or(default_value);
256 if constexpr (std::is_same_v<InputType, OutputType>) {
Core::GlobalInputConfig input
output_type convert_result(std::vector< std::vector< double > > &result_data, DataStructureInfo &metadata)
Convert processed double data back to OutputType using metadata and optional callback.
static std::tuple< std::vector< std::span< double > >, DataStructureInfo > extract_structured_double(T &compute_data)
Extract structured double data from Datum container or direct ComputeData with automatic container ha...
std::vector< double > delay(std::span< const double > data, uint32_t delay_samples, double fill_value)
Prepend delay_samples zero-valued (or fill_value) samples, returning a new vector.
std::vector< double > time_stretch(std::span< const double > data, double stretch_factor)
Time-stretch via linear interpolation resampling Fast but alias-naive: no anti-aliasing pre-filter is...
void interpolate_cubic(std::span< const double > src, std::span< double > dst) noexcept
Catmull-Rom cubic interpolation from src into dst (caller sizes dst) Branchless boundary clamping; Ho...
std::vector< double > slice(std::span< const double > data, double start_ratio, double end_ratio)
Extract a contiguous slice by ratio, returning a new vector.
void fade(std::span< double > data, double fade_in_ratio, double fade_out_ratio) noexcept
Apply equal-power (cosine) fade-in then fade-out envelope in-place The cosine taper maintains constan...
void reverse(std::span< double > data) noexcept
Reverse temporal order in-place.
void interpolate_linear(std::span< const double > src, std::span< double > dst) noexcept
Linear interpolation from src into dst (caller sizes dst) Branchless inner loop with precomputed step...
constexpr std::string_view enum_to_string(EnumType value) noexcept
Universal enum to string converter using magic_enum (original case)
TransformationType
Categories of transformation operations for discovery and organization.
@ TEMPORAL
Time-based transformations (time-stretch, reverse, delay)
TemporalOperation
Specific temporal operations supported.
@ SLICE
Extract temporal slice.
@ TIME_REVERSE
Reverse temporal order.
@ TIME_STRETCH
Change playback speed.
@ DELAY
Add temporal delay.
@ FADE_IN_OUT
Apply fade envelope.
@ INTERPOLATE
Temporal interpolation.
Input/Output container for computation pipeline data flow with structure preservation.