Skip to content

Instantly share code, notes, and snippets.

// 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
#include "../JuceLibraryCode/JuceHeader.h"
#ifdef JUCE_WINDOWS
#include "windows.h"
#endif
void test_gain_speeds(int numsamples, int numchannels, int processingmode)
{
AudioBuffer<float> buffer(numchannels, numsamples);
auto bufptrs = buffer.getArrayOfWritePointers();
Random rng;
// .h
class XYPadComponent : public Component, public Value::Listener
{
public:
XYPadComponent(BinauralSpatAudioProcessor& p);
void valueChanged(Value& value) override;
void mouseDrag(const MouseEvent& ev) override;
void mouseWheelMove(const MouseEvent& ev, const MouseWheelDetails& det) override;
void paint(Graphics& g) override;
#include <iostream>
#include "aeffectx.h"
#include <dlfcn.h>
typedef AEffect* (*PluginEntryProc) (audioMasterCallback audioMaster);
VstIntPtr mycallback (AEffect* effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void* ptr, float opt)
{
if (opcode == audioMasterVersion)
{
// .h
/*
==============================================================================
This file was auto-generated!
==============================================================================
*/
/*
== SOUL example code ==
"Minimum-Viable-Piano"
You probably won't want to use this patch to replace your Bosendorfer,
but it shows how to play some re-pitched external sample data, and
it'll do a pretty good job of recreating some early 1990s rave piano.
In memory of Philip Meehan, who recorded these piano samples for use in
void test_soul()
{
SF_INFO outinfo;
memset(&outinfo,0,sizeof(SF_INFO));
int outlen = 4*44100;
ClassicRingtone tone;
std::cout << "soul dsp num outputs : " << tone.getOutputEndpoints().size() << "\n";
outinfo.channels = tone.getOutputEndpoints().size();
outinfo.format = SF_FORMAT_FLOAT|SF_FORMAT_WAV;
outinfo.samplerate = 44100;
int g_my_action_id1 = 0;
// the callback should handle all the actions handled by this single plugin
// so, don't add new callback functions separately for each action!
bool hookCommandProc(int command, int flag)
{
if (command != 0 && command == g_my_action_id1)
{
ShowConsoleMsg("Extension test action executed.\n");
#include "../JuceLibraryCode/JuceHeader.h"
class MyCallback : public AudioIODeviceCallback
{
public:
MyCallback() {}
void audioDeviceIOCallback(const float ** inputChannelData,
int numInputChannels, float ** outputChannelData, int numOutputChannels, int numSamples) override
{
for (int i = 0; i < numSamples; ++i)
int main(int argc, char* argv[])
{
ScopedJuceInitialiser_GUI gui_init;
AudioDeviceManager aman;
String err = aman.initialiseWithDefaultDevices(0, 2);
if (err.isEmpty())
{
std::cout << "device opened : " << aman.getCurrentAudioDevice()->getName() << "\n";
ToneGeneratorAudioSource tonesource; // Juce provided AudioSource based sine generator
tonesource.setFrequency(440.0);