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)
#define REAPERAPI_NO_LICE
#define REAPERAPI_IMPLEMENT
#include "lice.h"
#include "reaper_plugin_functions.h"
#include <memory>
#include <map>
struct MyDLGTEMPLATE : DLGTEMPLATE
{
#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
{