Deluge Firmware 1.3.0
Build date: 2025.06.05
Loading...
Searching...
No Matches
live_pitch_shifter.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 "definitions_cxx.hpp"
21#include "processing/live/live_pitch_shifter_play_head.h"
22
23class LiveInputBuffer;
24
25class LivePitchShifter {
26public:
27 LivePitchShifter(OscType newInputType, int32_t phaseIncrement);
28 ~LivePitchShifter();
29 void giveInput(int32_t numSamples, int32_t inputType, int32_t phaseIncrement);
30 void render(int32_t* outputBuffer, int32_t numSamplesThisFunctionCall, int32_t phaseIncrement, int32_t amplitude,
31 int32_t amplitudeIncrement, int32_t interpolationBufferSize);
32
33 bool mayBeRemovedWithoutClick();
34
35#if INPUT_ENABLE_REPITCHED_BUFFER
36 void interpolate(int32_t* sampleRead, int32_t interpolationBufferSize, int32_t numChannelsNow, int32_t whichKernel);
37 int32_t* repitchedBuffer;
38 int32_t repitchedBufferWritePos;
39 uint64_t repitchedBufferNumSamplesWritten;
40 bool stillWritingToRepitchedBuffer;
41 int32_t interpolationBuffer[2][kInterpolationMaxNumSamples];
42 uint32_t oscPos;
43#endif
44
45 int8_t numChannels;
46 OscType inputType;
47
48 uint32_t crossfadeProgress; // Out of kMaxSampleValue
49 uint32_t crossfadeIncrement;
50 int32_t nextCrossfadeLength;
51 int32_t samplesTilHopEnd;
52 int32_t samplesIntoHop;
53
54 int32_t percThresholdForCut;
55
56 LivePitchShifterPlayHead playHeads[2];
57
58private:
59 void hopEnd(int32_t phaseIncrement, LiveInputBuffer* liveInputBuffer, uint64_t numRawSamplesProcessed,
60 uint64_t numRawSamplesProcessedLatest);
61 void considerRepitchedBuffer(int32_t phaseIncrement);
62 bool olderPlayHeadIsCurrentlySounding();
63};
Definition live_input_buffer.h:23
Definition live_pitch_shifter_play_head.h:34