mirror of
https://codeberg.org/armin/justasample.git
synced 2026-09-01 12:20:48 +02:00
fixes, changes to gitignore
This commit is contained in:
parent
2ab046489f
commit
11d81cf1fd
17 changed files with 1160 additions and 16 deletions
56
Source/Sampler/Effects/RingMod.h
Normal file
56
Source/Sampler/Effects/RingMod.h
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
RingMod.h
|
||||
Created: 24 Jul 2026
|
||||
Author: Armin
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <JuceHeader.h>
|
||||
|
||||
#include "Effect.h"
|
||||
|
||||
/** Ring modulation effect driven by the LFO waveform. */
|
||||
class RingModEffect final : public Effect
|
||||
{
|
||||
public:
|
||||
void initialize(int /*numChannels*/, int /*fxSampleRate*/) override
|
||||
{
|
||||
}
|
||||
|
||||
void setMix(float m)
|
||||
{
|
||||
mix = juce::jlimit(0.f, 1.f, m);
|
||||
}
|
||||
|
||||
void updateParams(const SamplerParameters& samplerSound, bool /*modulating*/) override
|
||||
{
|
||||
setMix(samplerSound.modRingModMix->get());
|
||||
}
|
||||
|
||||
/** Process with a pre-computed LFO buffer for ring modulation. */
|
||||
void processWithLFO(juce::AudioBuffer<float>& buffer, int numSamples, const float* lfoBuffer)
|
||||
{
|
||||
for (int ch = 0; ch < buffer.getNumChannels(); ch++)
|
||||
{
|
||||
auto* data = buffer.getWritePointer(ch);
|
||||
for (int i = 0; i < numSamples; i++)
|
||||
{
|
||||
float dry = data[i];
|
||||
float modulated = dry * lfoBuffer[i];
|
||||
data[i] = dry + (modulated - dry) * mix;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void process(juce::AudioBuffer<float>& /*buffer*/, int /*numSamples*/, int /*startSample*/ = 0) override
|
||||
{
|
||||
// No-op without LFO buffer
|
||||
}
|
||||
|
||||
private:
|
||||
float mix{ 0.5f };
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue