Deluge Firmware
1.3.0
Build date: 2026.08.22
Toggle main menu visibility
Loading...
Searching...
No Matches
live_pitch_shifter_play_head.h
1
/*
2
* Copyright © 2018-2023 Synthstrom Audible Limited
3
*
4
* This file is part of The Synthstrom Audible Deluge Firmware.
5
*
6
* The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
7
* terms of the GNU General Public License as published by the Free Software Foundation,
8
* either version 3 of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
* See the GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License along with this program.
15
* If not, see <https://www.gnu.org/licenses/>.
16
*/
17
18
#pragma once
19
20
#include "arm_neon_shim.h"
21
#include "definitions_cxx.hpp"
22
#include "dsp/interpolate/interpolate.h"
23
#include <array>
24
25
class
LivePitchShifter
;
26
class
LiveInputBuffer
;
27
28
enum class
PlayHeadMode {
29
REPITCHED_BUFFER,
30
RAW_REPITCHING,
31
RAW_DIRECT,
32
};
33
34
struct
LivePitchShifterPlayHead
{
35
void
render(int32_t* outputBuffer, int32_t numSamples, int32_t numChannels, int32_t phaseIncrement,
36
int32_t amplitude, int32_t amplitudeIncrement, int32_t* repitchedBuffer, int32_t* rawBuffer,
37
int32_t whichKernel, int32_t interpolationBufferSize);
38
int32_t getEstimatedPlaytimeRemaining(uint32_t repitchedBufferWritePos,
LiveInputBuffer
* liveInputBuffer,
39
int32_t phaseIncrement);
40
41
int32_t getNumRawSamplesBehindInput(
LiveInputBuffer
* liveInputBuffer,
LivePitchShifter
* livePitchShifter,
42
int32_t phaseIncrement);
43
44
void
fillInterpolationBuffer
(
LiveInputBuffer
* liveInputBuffer, int32_t numChannels);
45
46
// Default-initialised so a freshly-constructed play-head is fully defined: the OLDER head in particular is never
47
// touched by LivePitchShifter's constructor (it's only populated at the first hop, before it becomes audible),
48
// so without these its fields would be read-before-write garbage if ever inspected early.
49
PlayHeadMode mode{PlayHeadMode::RAW_DIRECT};
50
#if INPUT_ENABLE_REPITCHED_BUFFER
51
int32_t repitchedBufferReadPos{0};
52
#endif
53
int32_t rawBufferReadPos{0};
54
uint32_t oscPos{0};
55
56
deluge::dsp::Interpolator
interpolator_;
57
58
uint32_t percPos{0};
59
};
LiveInputBuffer
Definition
live_input_buffer.h:23
LivePitchShifter
Definition
live_pitch_shifter.h:25
LivePitchShifterPlayHead
Definition
live_pitch_shifter_play_head.h:34
LivePitchShifterPlayHead::fillInterpolationBuffer
void fillInterpolationBuffer(LiveInputBuffer *liveInputBuffer, int32_t numChannels)
Definition
live_pitch_shifter_play_head.cpp:173
deluge::dsp::Interpolator
Definition
interpolate.h:10