2025-01-06 21:33:28 +00:00
|
|
|
/*
|
|
|
|
Alpha Juno Oscillator POC
|
|
|
|
|
|
|
|
Copyright 2024 Gordon JC Pearce <gordonjcp@gjcp.net>
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
|
|
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
|
|
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
|
|
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "DistrhoPlugin.hpp"
|
|
|
|
|
|
|
|
START_NAMESPACE_DISTRHO
|
|
|
|
|
|
|
|
class AlphaOsc : public Plugin {
|
|
|
|
public:
|
|
|
|
enum Parameters {
|
2025-01-07 12:04:48 +00:00
|
|
|
pSqrMode,
|
|
|
|
pSawMode,
|
2025-01-07 14:02:31 +00:00
|
|
|
pSubMode,
|
|
|
|
pSubLevel,
|
2025-01-07 12:04:48 +00:00
|
|
|
|
2025-01-07 14:02:31 +00:00
|
|
|
pPWMRate,
|
|
|
|
pPWMDepth,
|
2025-01-06 21:33:28 +00:00
|
|
|
|
|
|
|
parameterCount
|
|
|
|
};
|
|
|
|
|
|
|
|
AlphaOsc();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
const char *getLabel() const override { return "AlphaOsc"; }
|
|
|
|
const char *getDescription() const override {
|
|
|
|
return "Alpha Juno Oscillator Proof of Concept";
|
|
|
|
}
|
|
|
|
const char *getMaker() const override { return "Gordonjcp"; }
|
|
|
|
const char *getLicense() const override { return "ISC"; }
|
|
|
|
uint32_t getVersion() const override { return d_version(1, 0, 0); }
|
|
|
|
int64_t getUniqueId() const override { return d_cconst('A', 'O', 's', 'c'); }
|
|
|
|
|
|
|
|
// Initialisation
|
|
|
|
void initAudioPort(bool input, uint32_t index, AudioPort &port) override;
|
2025-01-07 12:04:48 +00:00
|
|
|
void initParameter(uint32_t index, Parameter ¶meter) override;
|
2025-01-07 17:50:23 +00:00
|
|
|
|
|
|
|
void activate() override;
|
|
|
|
|
2025-01-07 12:04:48 +00:00
|
|
|
void setParameterValue(uint32_t index, float value) override;
|
|
|
|
float getParameterValue(uint32_t index) const override;
|
2025-01-06 21:33:28 +00:00
|
|
|
|
|
|
|
// Processing
|
|
|
|
void run(const float **, float **outputs, uint32_t frames, const MidiEvent *midiEvents, uint32_t midiEventCount) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
double sampleRate;
|
2025-01-07 12:04:48 +00:00
|
|
|
uint32_t omega, lfoOmega;
|
|
|
|
uint32_t phase, lfoPhase;
|
|
|
|
|
2025-01-07 17:50:23 +00:00
|
|
|
uint8_t notequeue[8];
|
|
|
|
|
2025-01-07 14:50:57 +00:00
|
|
|
uint8_t note = 48; // last heard MIDI note
|
|
|
|
float freq = 130.8; // C3, an octave below Middle C
|
|
|
|
float gate = 0; // output attenuation
|
2025-01-07 12:04:48 +00:00
|
|
|
|
2025-01-08 01:24:12 +00:00
|
|
|
float pwmrate = 0, pwmdepth = 0, sublevel = 0;
|
|
|
|
uint8_t sqrmode = 0, sawmode = 0, submode = 0;
|
2025-01-07 12:04:48 +00:00
|
|
|
|
2025-01-07 14:02:31 +00:00
|
|
|
float hpfx = 0, hpfy = 0;
|
2025-01-06 21:33:28 +00:00
|
|
|
|
|
|
|
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AlphaOsc);
|
|
|
|
};
|
|
|
|
|
2025-01-07 12:04:48 +00:00
|
|
|
END_NAMESPACE_DISTRHO
|