This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Noise : public juce::AudioSource | |
{ | |
public: | |
void prepareToPlay(int samplesPerBlockExpected, double sampleRate) override | |
{ | |
// initialise the filter object | |
juce::dsp::ProcessSpec spec; | |
spec.maximumBlockSize = samplesPerBlockExpected; | |
spec.sampleRate = sampleRate; | |
spec.numChannels = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <JuceHeader.h> | |
class Noise : public juce::AudioSource | |
{ | |
public: | |
void prepareToPlay(int samplesPerBlockExpected, double sampleRate) override | |
{ | |
// nothing to do here, we can generate the noise without preparing anything | |
} | |
void releaseResources() override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CFxRbjFilter | |
{ | |
public: | |
CFxRbjFilter() | |
{ | |
// reset filter coeffs | |
b0a0=b1a0=b2a0=a1a0=a2a0=0.0; | |
// reset in/out history |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyBase | |
{ | |
public: | |
MyBase(int _x) : x(_x) {} | |
virtual ~MyBase() {} | |
virtual void say() = 0; | |
int x = 0; | |
private: | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class XQuantModule : public rack::Module | |
{ | |
public: | |
enum InputPorts | |
{ | |
FIRSTINPUT = 0, | |
LASTINPUT = 7 | |
}; | |
enum OutputPorts | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MixerCallBack : public AudioIODeviceCallback | |
{ | |
public: | |
std::vector<float> channelGains; | |
std::vector<float> channelPans; | |
MixerCallBack() | |
{ | |
channelGains.resize(16); | |
channelPans.resize(16); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void test_ap_player() | |
{ | |
int sr = 44100; | |
int bufsize = 512; | |
ScopedJuceInitialiser_GUI mm; | |
AudioProcessorGraph graph; | |
using IOProc = AudioProcessorGraph::AudioGraphIOProcessor; | |
auto innode = graph.addNode(std::make_unique<IOProc>(IOProc::audioInputNode)); | |
auto outnode = graph.addNode(std::make_unique<IOProc>(IOProc::audioOutputNode)); | |
innode->getProcessor()->setPlayConfigDetails(1, 2, sr, bufsize); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyCallback : public AudioIODeviceCallback | |
{ | |
public: | |
void audioDeviceIOCallback(const float** inputChannelData, int numInputChannels, | |
float** outputChannelData, int numOutputChannels, int numSamples) override | |
{ | |
for (int i = 0; i < numSamples; ++i) | |
{ | |
float sample = jmap(rng.nextFloat(), 0.0f, 1.0f, -noiseGain, noiseGain); | |
for (int j = 0; j < numOutputChannels; ++j) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class APGWrapper | |
{ | |
public: | |
AudioProcessorGraph graph; | |
void prepare (const dsp::ProcessSpec& spec) | |
{ | |
helperbuf.setSize(spec.numChannels, spec.maximumBlockSize); | |
graph.prepareToPlay(spec.sampleRate, spec.maximumBlockSize); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline void getSamples(int64 sourceindex, float* destbuf, int nframes, int numdestchans) | |
{ | |
auto ptrs = m_buf.getArrayOfReadPointers(); | |
for (int i = 0; i < nframes; ++i) | |
{ | |
if (sourceindex + i < m_buf.getNumSamples()) | |
{ | |
for (int j = 0; j < numdestchans; ++j) | |
destbuf[i*numdestchans + j] = ptrs[j][i + sourceindex]; | |
} |