-
Notifications
You must be signed in to change notification settings - Fork 1
/
BlockComponent.hpp
91 lines (70 loc) · 2.89 KB
/
BlockComponent.hpp
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
//
// BlockComponent.hpp
// Blocks
//
// Created by Urban Lienert on 05.02.20.
// Copyright © 2020 Urban Lienert. All rights reserved.
//
#include <BlocksHeader.h>
#include "m_pd.h"
#include "LightpadProgram.hpp"
class BlockComponent : private juce::TouchSurface::Listener,
private juce::ControlButton::Listener,
private juce::Block::ProgramEventListener,
private juce::Timer
{
public:
BlockComponent (juce::Block::Ptr blockToUse, bool loadProgram);
~BlockComponent();
juce::Block::Ptr block;
juce::String *pdName;
b_mode blockMode;
int gridSize;
int lastTouched;
t_outlet *out_action;
t_outlet *out_info;
juce::NamedValueSet *messageSet;
// set Programm as default
void setDefault();
// set Mode in Lightpad Program
void setLightpadMode(juce::String name);
// set Grid Size
void setGridSize(int size);
// set Fader values
void setFaderValue(int index, float value);
// set Mixer values
void setMixerFaderValue(int index, float value);
void setMixerButtonValue(int index, float value);
// set Object Colours
void setColors(juce::OwnedArray<juce::LEDColour>* colors);
// set LED Color
void setLEDColor(int x, int y, juce::LEDColour *colour);
void setRectColor(int x, int y, int w, int h, juce::LEDColour *colour);
void setCircleColor(int x, int y, int r, juce::LEDColour *colour);
void setTriangleColor(int x, int y, int s, int deg, juce::LEDColour *colour);
void setNumberColor(int n, juce::LEDColour *colour);
void hideNumberColor();
void clearScreen();
// set Local Settings
void setSettingsValue(juce::String name, int value);
void setSettingsValue(juce::String name, juce::String option);
// output Infos
void outputInfos();
// messages
void addMessageToCheck(juce::Block::ProgramEventMessage *message);
void checkMessages(int param1);
void timerCallback() override;
void sendStampedMessage(juce::uint32 commandNr, juce::uint32 subCommandNr, juce::uint8 param1, juce::uint32 param2, juce::uint32 param3);
juce::ReadWriteLock *rwLock;
private:
int padIndexForTouch(const juce::TouchSurface::Touch& t);
/** Overridden from TouchSurface::Listener */
void touchChanged (juce::TouchSurface&, const juce::TouchSurface::Touch& t) override;
/** Overridden from ControlButton::Listener */
void buttonPressed (juce::ControlButton& b, juce::Block::Timestamp t) override;
/** Overridden from ControlButton::Listener */
void buttonReleased (juce::ControlButton& b, juce::Block::Timestamp t) override;
/** Overridden from Block::ProgramEventListener*/
void handleProgramEvent (juce::Block &source, const juce::Block::ProgramEventMessage &message) override;
JUCE_LEAK_DETECTOR (BlockComponent)
};