41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
#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(); }
|