initial; added noise
This commit is contained in:
40
noise/Source/MainComponent.cpp
Normal file
40
noise/Source/MainComponent.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "../JuceLibraryCode/JuceHeader.h"
|
||||
|
||||
class MainContentComponent : public AudioAppComponent {
|
||||
public:
|
||||
MainContentComponent() {
|
||||
setSize (800, 600);
|
||||
setAudioChannels (2, 2);
|
||||
this->random = Random();
|
||||
}
|
||||
|
||||
~MainContentComponent() {
|
||||
shutdownAudio();
|
||||
}
|
||||
|
||||
void prepareToPlay(int samplesPerBlockExpected, double sampleRate) override {}
|
||||
|
||||
void getNextAudioBlock(const AudioSourceChannelInfo& buf) override {
|
||||
for (int c = 0; c < buf.buffer->getNumChannels(); ++c) {
|
||||
float* const b = buf.buffer->getWritePointer(c, buf.startSample);
|
||||
|
||||
for (int s = 0; s < buf.numSamples; ++s) b[s] = random.nextFloat() * 0.25f - 0.125f;
|
||||
}
|
||||
}
|
||||
|
||||
void releaseResources() override {}
|
||||
|
||||
void paint (Graphics& g) override {
|
||||
g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));
|
||||
}
|
||||
|
||||
void resized() override {}
|
||||
|
||||
|
||||
private:
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent)
|
||||
Random random;
|
||||
};
|
||||
|
||||
|
||||
Component* createMainContentComponent() { return new MainContentComponent(); }
|
Reference in New Issue
Block a user