2#include <ossia/dataflow/audio_stretch_mode.hpp>
3#include <ossia/dataflow/nodes/timestretch/raw_stretcher.hpp>
4#include <ossia/dataflow/nodes/timestretch/repitch_stretcher.hpp>
5#include <ossia/dataflow/nodes/timestretch/rubberband_stretcher.hpp>
6#include <ossia/detail/variant.hpp>
13 time_value date, ossia::audio_stretch_mode mode, std::size_t channels,
14 std::size_t fileSampleRate)
19 case audio_stretch_mode::None: {
20 if(
auto s = ossia::get_if<ossia::raw_stretcher>(&m_stretch))
22 s->next_sample_to_read = date.impl;
26 m_stretch.emplace<raw_stretcher>(date.impl);
30 case audio_stretch_mode::Repitch:
31 case audio_stretch_mode::RepitchMediumQ:
32 case audio_stretch_mode::RepitchFastestQ: {
33 if(
auto s = ossia::get_if<ossia::repitch_stretcher>(&m_stretch);
34 s && s->repitchers.size() == channels)
36 s->next_sample_to_read = date.impl;
40 m_stretch.emplace<repitch_stretcher>(
41 get_samplerate_preset(mode), channels, 1024, date.impl);
45 case audio_stretch_mode::RubberBandStandard:
46 case audio_stretch_mode::RubberBandPercussive:
47 case ossia::audio_stretch_mode::RubberBandStandardHQ:
48 case ossia::audio_stretch_mode::RubberBandPercussiveHQ: {
49 m_stretch.emplace<rubberband_stretcher>(
50 get_rubberband_preset(mode), channels, fileSampleRate, date.impl);
58 run(T& audio_fetcher,
const ossia::token_request& t, ossia::exec_state_facade e,
59 double tempo_ratio, std::size_t chan, std::size_t len, int64_t samples_to_read,
60 int64_t samples_to_write, int64_t samples_offset, ossia::audio_port& ap)
62 ossia::visit([&](
auto& stretcher) {
64 audio_fetcher, t, e, tempo_ratio, chan, len, samples_to_read, samples_to_write,
69 ossia::variant<raw_stretcher, rubberband_stretcher, repitch_stretcher> m_stretch;