MCPcopy Create free account
hub / github.com/DamRsn/NeuralNote / NeuralNoteMainView

Method NeuralNoteMainView

NeuralNote/Source/Components/NeuralNoteMainView.cpp:7–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "NeuralNoteMainView.h"
6
7NeuralNoteMainView::NeuralNoteMainView(NeuralNoteAudioProcessor& processor)
8 : mProcessor(processor)
9 , mVisualizationPanel(&processor)
10 , mTranscriptionOptions(processor)
11 , mNoteOptions(processor)
12 , mQuantizePanel(processor)
13{
14 mProcessor.addListenerToStateValueTree(this);
15 jassert(mProcessor.getValueTree().hasProperty(NnId::PlayheadCenteredId));
16
17 mRecordButton = std::make_unique<DrawableButton>("RecordButton", DrawableButton::ButtonStyle::ImageRaw);
18 mRecordButton->setClickingTogglesState(true);
19 mRecordButton->setColour(DrawableButton::ColourIds::backgroundColourId, Colours::transparentBlack);
20 mRecordButton->setColour(DrawableButton::ColourIds::backgroundOnColourId, Colours::transparentBlack);
21 mRecordButton->setTooltip(NeuralNoteTooltips::record);
22
23 auto record_off_drawable =
24 Drawable::createFromImageData(BinaryData::recordingoff_svg, BinaryData::recordingoff_svgSize);
25 auto record_on_drawable =
26 Drawable::createFromImageData(BinaryData::recordingon_svg, BinaryData::recordingon_svgSize);
27
28 mRecordButton->setImages(
29 record_off_drawable.get(), nullptr, nullptr, nullptr, record_on_drawable.get(), nullptr, nullptr);
30
31 mRecordButton->onClick = [this]() {
32 bool is_on = mRecordButton->getToggleState();
33
34 // Recording started
35 if (is_on) {
36 mProcessor.getSourceAudioManager()->startRecording();
37 } else {
38 // Recording has ended, set processor state to processing
39 mProcessor.getSourceAudioManager()->stopRecording();
40 }
41
42 updateEnablements();
43 };
44
45 mRecordButton->setToggleState(mProcessor.getState() == Recording, NotificationType::dontSendNotification);
46
47 addAndMakeVisible(*mRecordButton);
48
49 mClearButton = std::make_unique<DrawableButton>("ClearButton", DrawableButton::ButtonStyle::ImageRaw);
50 mClearButton->setClickingTogglesState(false);
51 mClearButton->setColour(DrawableButton::ColourIds::backgroundColourId, Colours::transparentBlack);
52 mClearButton->setColour(DrawableButton::ColourIds::backgroundOnColourId, Colours::transparentBlack);
53 mClearButton->setTooltip(NeuralNoteTooltips::clear);
54
55 auto bin_drawable = Drawable::createFromImageData(BinaryData::deleteicon_svg, BinaryData::deleteicon_svgSize);
56 mClearButton->setImages(bin_drawable.get());
57
58 mClearButton->onClick = [this]() {
59 mProcessor.clear();
60 mVisualizationPanel.clear();
61 updateEnablements();
62 };
63 addAndMakeVisible(*mClearButton);
64

Callers

nothing calls this directly

Calls 11

startRecordingMethod · 0.80
getSourceAudioManagerMethod · 0.80
stopRecordingMethod · 0.80
getStateMethod · 0.80
getPlayerMethod · 0.80
setPlayingStateMethod · 0.80
checkForUpdateMethod · 0.80
setTooltipMethod · 0.45
clearMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected