Skip to content

Instantly share code, notes, and snippets.

/*******************************************************************************
The block below describes the properties of this PIP. A PIP is a short snippet
of code that can be read by the Projucer and used to generate a JUCE project.
BEGIN_JUCE_PIP_METADATA
name: MultichannelVolume
dependencies: juce_audio_basics, juce_audio_devices, juce_audio_formats, juce_audio_plugin_client,
juce_audio_processors, juce_audio_utils, juce_core, juce_data_structures, juce_events,
static VstEffectInterface* constructEffect (const ModuleHandle::Ptr& module)
{
VstEffectInterface* effect = nullptr;
try
{
const IdleCallRecursionPreventer icrp;
_fpreset();
JUCE_VST_LOG ("Creating VST instance: " + module->pluginName);
class smbPitchShifter
{
public:
smbPitchShifter() {}
void prepareToPlay()
{
memset(gInFIFO, 0, MAX_FRAME_LENGTH * sizeof(float));
memset(gOutFIFO, 0, MAX_FRAME_LENGTH * sizeof(float));
memset(gFFTworksp, 0, 2 * MAX_FRAME_LENGTH * sizeof(float));
memset(gLastPhase, 0, (MAX_FRAME_LENGTH / 2 + 1) * sizeof(float));
#pragma once
#include <random>
#include "../JuceLibraryCode/JuceHeader.h"
class NoiseGenerator
{
public:
NoiseGenerator() {}
void toggleSound(bool isOn, int chan, double sampleRate, double gain)
#include <stdio.h>
#include <stdlib.h>
#include "aeffect.h"
#include "aeffectx.h"
#define vst_export __declspec(dllexport)
// prototype for external function
vst_export struct AEffect* VSTPluginMain(audioMasterCallback audioMaster);
@Xenakios
Xenakios / plugin.c
Last active January 10, 2019 18:03
#include <stdio.h>
#include <stdlib.h>
#include "aeffect.h"
#include "aeffectx.h"
#define vst_export __declspec(dllexport)
// prototype for external function
vst_export struct AEffect* VSTPluginMain(audioMasterCallback audioMaster);
void saveToXml(File dest, std::vector<std::vector<int>> src)
{
if (dest.exists())
dest.deleteFile();
XmlElement chordselem("chords");
for (int i=0;i<src.size();++i)
{
XmlElement* chordelem = chordselem.createNewChildElement("chord_"+String(i));
for (int j = 0; j < src[i].size(); ++j)
{
class MyAudioCallback : public AudioIODeviceCallback
{
public:
MyAudioCallback() {}
void audioDeviceIOCallback(const float **inputChannelData, int numInputChannels,
float **outputChannelData, int numOutputChannels, int numSamples) override
{
for (int i = 0; i < numSamples; ++i)
{
float sample = jmap(m_rnd.nextFloat(), 0.0f, 1.0f, -0.1f, 0.1f);
class MyAudioSource : public AudioSource
{
public:
MyAudioSource() {}
void prepareToPlay(int samplesPerBlockExpected, double sampleRate) override
{}
void releaseResources() override
{}
void getNextAudioBlock(const AudioSourceChannelInfo & bufferToFill) override
{
// Requires the Juce audio_utils module for AudioProcessorPlayer
class MyAudioProcessor : public AudioProcessor
{
public:
MyAudioProcessor() {}
const String getName() const override { return "MyAudioProcessor"; }
void prepareToPlay(double sampleRate, int maximumExpectedSamplesPerBlock) override {}
void releaseResources() override {}
void processBlock(AudioBuffer<float>& buffer, MidiBuffer & midiMessages) override