OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
r8b_stretcher.hpp
1#pragma once
2#include <ossia/detail/config.hpp>
3
4#include <ossia/dataflow/graph_node.hpp>
5#include <ossia/dataflow/nodes/media.hpp>
6#include <ossia/dataflow/token_request.hpp>
7
8#if __has_include(<CDSPResampler.h>)
9#include <CDSPResampler.h>
10
11#include <r8bbase.cpp>
12#else
13#include <r8brain-free-src/CDSPResampler.h>
14#endif
15namespace ossia
16{
17
18struct r8b_stretcher
19{
20 // void run_repitch_r8b(
21 // const ossia::token_request& t,
22 // ossia::exec_state_facade e,
23 // const std::size_t chan,
24 // const std::size_t len,
25 // const int64_t samples_to_read,
26 // const int64_t samples_to_write,
27 // ossia::audio_port& ap) noexcept
28 // {
29 // // speed == 0.5 -> 2 times more samples
30 //
31 // double target_rate = this->m_fileSampleRate / t.speed;
32 //
33 // std::vector<std::unique_ptr<r8b::CDSPResampler24>> resamplers;
34 // std::vector<std::pair<double*, int>> lastResampled;
35 // for (std::size_t i = 0; i < channels(); ++i)
36 // {
37 // /* Create the resampler objects. */
38 // ap.channel(i).resize(t.offset.impl + samples_to_write);
39 //
40 // if(resamplers.size() < channels())
41 // {
42 // lastResampled.push_back({});
43 // resamplers.emplace_back(std::make_unique<r8b::CDSPResampler24>(this->m_fileSampleRate,
44 // target_rate, std::max(int64_t(16384), samples_to_read)));
45 //
46 // }
47 // double* input = const_cast<double*>(&m_data[i][t.prev_date]);
48 // double* output = nullptr;
49 // int res = resamplers[i]->process(input, samples_to_read, output);
50 //
51 // std::cerr << "read: " << samples_to_read
52 // << " ; write: " << samples_to_write
53 // << " ; rate: " << target_rate
54 // << " ; res: " << res
55 // << std::endl;
56 // for(int j = 0; j < samples_to_write; j++)
57 // {
58 // ap.channel(i)[j + t.offset] = output[j];
59 // }
60 // do_fade(
61 // t.start_discontinuous, t.end_discontinuous, ap.channel(i),
62 // t.offset.impl, samples_to_write);
63 // }
64 // }
65};
66}
Definition git_info.h:7