Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
stretcher.h
1// SPDX-FileCopyrightText: © 2019-2020, 2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <cstddef>
7
8#include "utils/audio.h"
9#include "utils/units.h"
10
11namespace zrythm::dsp
12{
13
17class Stretcher
18{
19public:
20 enum class Backend
21 {
24
27
30 };
31
45 static std::unique_ptr<Stretcher> create_rubberband (
46 units::sample_rate_t samplerate,
47 unsigned channels,
48 double time_ratio,
49 double pitch_ratio,
50 bool realtime);
51
52public:
53 ~Stretcher ();
54
55 // Delete copy/move until properly implemented
56 Stretcher (const Stretcher &) = delete;
57 Stretcher &operator= (const Stretcher &) = delete;
58 Stretcher (Stretcher &&) = delete;
59 Stretcher &operator= (Stretcher &&) = delete;
60
74 const float * in_samples_l,
75 const float * in_samples_r,
76 size_t in_samples_size,
77 float * out_samples_l,
78 float * out_samples_r,
79 size_t out_samples_wanted);
80
84 unsigned int get_latency () const;
85
86 void set_time_ratio (double ratio);
87
98
99private:
100 struct Impl;
101 std::unique_ptr<Impl> pimpl_;
102
103 // Private constructor used by factory method
104 Stretcher ();
105};
106
107} // namespace zrythm::dsp
unsigned int get_latency() const
Get latency in number of samples.
@ SBSMS
SBSMS - Subband Sinusoidal Modeling Synthesis.
Definition stretcher.h:29
static std::unique_ptr< Stretcher > create_rubberband(units::sample_rate_t samplerate, unsigned channels, double time_ratio, double pitch_ratio, bool realtime)
Create a new Stretcher using the rubberband backend.
zrythm::utils::audio::AudioBuffer stretch_interleaved(zrythm::utils::audio::AudioBuffer &in_samples)
Perform stretching.
signed_frame_t stretch(const float *in_samples_l, const float *in_samples_r, size_t in_samples_size, float *out_samples_l, float *out_samples_r, size_t out_samples_wanted)
Perform stretching.
int_fast64_t signed_frame_t
Signed type for frame index.
Definition types.h:75