Created
July 22, 2020 14:31
-
-
Save Xenakios/8c4962c321226945adcf9b536ed9668c to your computer and use it in GitHub Desktop.
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) | |
{ | |
outputChannelData[j][i] = sample; | |
} | |
} | |
} | |
void audioDeviceAboutToStart(AudioIODevice* device) override | |
{ | |
} | |
void audioDeviceStopped() override | |
{ | |
} | |
float noiseGain = 0.05f; | |
private: | |
Random rng; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment