46class GranularProcessor {
49 GranularProcessor(
const GranularProcessor& other);
51 [[nodiscard]] int32_t getSamplesToShutdown()
const {
return wrapsToShutdown * kModFXGrainBufferSize; }
57 void processGrainFX(std::span<StereoSample> buffer, int32_t grainRate, int32_t grainMix, int32_t grainDensity,
58 int32_t pitchRandomness, int32_t* postFXVolume,
bool anySoundComingIn,
float tempoBPM,
61 void clearGrainFXBuffer();
62 void grainBufferStolen() { grainBuffer =
nullptr; }
65 void setupGrainFX(int32_t grainRate, int32_t grainMix, int32_t grainDensity, int32_t pitchRandomness,
66 int32_t* postFXVolume,
float timePerInternalTick);
69 void setWrapsToShutdown();
70 void setupGrainsIfNeeded(int32_t writeIndex);
72 uint32_t bufferWriteIndex;
76 int32_t _grainFeedbackVol;
79 int32_t _pitchRandomness;
81 bool grainLastTickCountIsZero;
82 bool grainInitialized;
86 int32_t wrapsToShutdown;
88 int32_t _densityKnobPos{0};
89 int32_t _rateKnobPos{0};
90 int32_t _mixKnobPos{0};
94 bool bufferFull{
false};
97class GrainBuffer :
public Stealable {
99 GrainBuffer() =
delete;
100 GrainBuffer(GrainBuffer& other) =
delete;
101 GrainBuffer(
const GrainBuffer& other) =
delete;
103 bool mayBeStolen(
void* thingNotToStealFrom)
override {
104 if (thingNotToStealFrom !=
this) {
109 void steal(
char const* errorCode)
override { owner->grainBufferStolen(); };
112 StealableQueue getAppropriateQueue()
const override {
113 return StealableQueue::CURRENT_SONG_SAMPLE_DATA_REPITCHED_CACHE;
115 StereoSample& operator[](int32_t i) {
return sampleBuffer[i]; }
116 StereoSample operator[](int32_t i)
const {
return sampleBuffer[i]; }
void processGrainFX(std::span< StereoSample > buffer, int32_t grainRate, int32_t grainMix, int32_t grainDensity, int32_t pitchRandomness, int32_t *postFXVolume, bool anySoundComingIn, float tempoBPM, q31_t reverbAmount)
preset is currently converted from a param to a 0-4 preset inside the grain, which is probably not gr...
Definition GranularProcessor.cpp:47