-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.h
More file actions
115 lines (87 loc) · 3.29 KB
/
Main.h
File metadata and controls
115 lines (87 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#pragma once //only compile this file once!
#include "Palette.h"
#include "Homescreen.h"
//==============================================================================
class MainContentComponent : public AudioAppComponent
{
public:
//==============================================================================
MainContentComponent()
{
/*
levelSlider.setRange (0.0, 0.25);
levelSlider.setTextBoxStyle (Slider::TextBoxRight, false, 100, 20);
levelLabel.setText ("Noise Level", dontSendNotification);
addAndMakeVisible (levelSlider);
addAndMakeVisible (levelLabel);
setSize (600, 100);
setAudioChannels (2, 2);
*/
setLookAndFeel(&palette); //Let's define our UI looks
addAndMakeVisible(home);
setSize(1024,600);
}
~MainContentComponent() override
{
shutdownAudio();
}
void resized() override
{
/*
levelLabel .setBounds (10, 10, 90, 20);
levelSlider.setBounds (100, 10, getWidth() - 110, 20);
*/
home.setBounds(getLocalBounds());
}
void paint(Graphics& g) override
{
g.fillAll(Colours::white);
}
void prepareToPlay (int, double) override {}
void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) override
{
/*
auto* device = deviceManager.getCurrentAudioDevice();
auto activeInputChannels = device->getActiveInputChannels();
auto activeOutputChannels = device->getActiveOutputChannels();
auto maxInputChannels = activeInputChannels .getHighestBit() + 1;
auto maxOutputChannels = activeOutputChannels.getHighestBit() + 1;
auto level = (float) levelSlider.getValue();
for (auto channel = 0; channel < maxOutputChannels; ++channel)
{
if ((! activeOutputChannels[channel]) || maxInputChannels == 0)
{
bufferToFill.buffer->clear (channel, bufferToFill.startSample, bufferToFill.numSamples);
}
else
{
auto actualInputChannel = channel % maxInputChannels; // [1]
if (! activeInputChannels[channel]) // [2]
{
bufferToFill.buffer->clear (channel, bufferToFill.startSample, bufferToFill.numSamples);
}
else // [3]
{
auto* inBuffer = bufferToFill.buffer->getReadPointer (actualInputChannel,
bufferToFill.startSample);
auto* outBuffer = bufferToFill.buffer->getWritePointer (channel, bufferToFill.startSample);
for (auto sample = 0; sample < bufferToFill.numSamples; ++sample)
outBuffer[sample] = inBuffer[sample] * random.nextFloat() * level;
}
}
}
*/
}
void releaseResources() override {}
private:
/*
Random random;
Slider levelSlider;
Label levelLabel;
*/
//Components
Homescreen home;
//Tools
Palette palette;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent)
};