├── .gitignore
├── CIDECHAIN.jucer
├── JuceLibraryCode
├── BinaryData.cpp
├── BinaryData.h
├── JuceHeader.h
├── JucePluginDefines.h
├── ReadMe.txt
├── include_juce_audio_basics.cpp
├── include_juce_audio_basics.mm
├── include_juce_audio_devices.cpp
├── include_juce_audio_devices.mm
├── include_juce_audio_formats.cpp
├── include_juce_audio_formats.mm
├── include_juce_audio_plugin_client_AAX.cpp
├── include_juce_audio_plugin_client_AAX.mm
├── include_juce_audio_plugin_client_AU.r
├── include_juce_audio_plugin_client_AU_1.mm
├── include_juce_audio_plugin_client_AU_2.mm
├── include_juce_audio_plugin_client_AUv3.mm
├── include_juce_audio_plugin_client_RTAS.r
├── include_juce_audio_plugin_client_RTAS_1.cpp
├── include_juce_audio_plugin_client_RTAS_2.cpp
├── include_juce_audio_plugin_client_RTAS_3.cpp
├── include_juce_audio_plugin_client_RTAS_4.cpp
├── include_juce_audio_plugin_client_RTAS_utils.cpp
├── include_juce_audio_plugin_client_RTAS_utils.mm
├── include_juce_audio_plugin_client_Standalone.cpp
├── include_juce_audio_plugin_client_Unity.cpp
├── include_juce_audio_plugin_client_VST2.cpp
├── include_juce_audio_plugin_client_VST3.cpp
├── include_juce_audio_plugin_client_VST_utils.mm
├── include_juce_audio_plugin_client_utils.cpp
├── include_juce_audio_processors.cpp
├── include_juce_audio_processors.mm
├── include_juce_audio_utils.cpp
├── include_juce_audio_utils.mm
├── include_juce_core.cpp
├── include_juce_core.mm
├── include_juce_data_structures.cpp
├── include_juce_data_structures.mm
├── include_juce_dsp.cpp
├── include_juce_dsp.mm
├── include_juce_events.cpp
├── include_juce_events.mm
├── include_juce_graphics.cpp
├── include_juce_graphics.mm
├── include_juce_gui_basics.cpp
├── include_juce_gui_basics.mm
├── include_juce_gui_extra.cpp
└── include_juce_gui_extra.mm
├── LICENSE
├── Resource
└── bgimg.png
└── Source
├── Component_BandSplitter.cpp
├── Component_BandSplitter.h
├── Component_NumericSpinbox.cpp
├── Component_NumericSpinbox.h
├── Constants.h
├── DSP_Filter.h
├── Envelope_Data.h
├── Envelope_Editor.cpp
├── Envelope_Editor.h
├── Envelope_Fwd.h
├── Envelope_Manager.cpp
├── Envelope_Manager.h
├── Envelope_PointEdit.cpp
├── Envelope_PointEdit.h
├── Envelope_PointEditMultiband.cpp
├── Envelope_PointEditMultiband.h
├── Envelope_PreviewComponent.cpp
├── Envelope_PreviewComponent.h
├── Envelope_Serialization.h
├── Envelope_VoiceController.h
├── ParamAttachment.cpp
├── ParamAttachment.h
├── PluginEditor.cpp
├── PluginEditor.h
├── PluginProcessor.cpp
├── PluginProcessor.h
├── ValueNormalization.h
├── customlookandfeel.cpp
└── customlookandfeel.h
/.gitignore:
--------------------------------------------------------------------------------
1 | Builds/
2 |
--------------------------------------------------------------------------------
/CIDECHAIN.jucer:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
14 |
16 |
18 |
20 |
22 |
24 |
26 |
28 |
30 |
32 |
34 |
35 |
37 |
38 |
40 |
42 |
44 |
46 |
47 |
49 |
51 |
53 |
55 |
56 |
58 |
60 |
62 |
63 |
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 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/JuceLibraryCode/BinaryData.h:
--------------------------------------------------------------------------------
1 | /* =========================================================================================
2 |
3 | This is an auto-generated file: Any edits you make may be overwritten!
4 |
5 | */
6 |
7 | #pragma once
8 |
9 | namespace BinaryData
10 | {
11 | extern const char* bgimg_png;
12 | const int bgimg_pngSize = 24228;
13 |
14 | // Number of elements in the namedResourceList and originalFileNames arrays.
15 | const int namedResourceListSize = 1;
16 |
17 | // Points to the start of a list of resource names.
18 | extern const char* namedResourceList[];
19 |
20 | // Points to the start of a list of resource filenames.
21 | extern const char* originalFilenames[];
22 |
23 | // If you provide the name of one of the binary resource variables above, this function will
24 | // return the corresponding data and its size (or a null pointer if the name isn't found).
25 | const char* getNamedResource (const char* resourceNameUTF8, int& dataSizeInBytes);
26 |
27 | // If you provide the name of one of the binary resource variables above, this function will
28 | // return the corresponding original, non-mangled filename (or a null pointer if the name isn't found).
29 | const char* getNamedResourceOriginalFilename (const char* resourceNameUTF8);
30 | }
31 |
--------------------------------------------------------------------------------
/JuceLibraryCode/JuceHeader.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | This is the header file that your files should include in order to get all the
7 | JUCE library headers. You should avoid including the JUCE headers directly in
8 | your own source files, because that wouldn't pick up the correct configuration
9 | options for your app.
10 |
11 | */
12 |
13 | #pragma once
14 |
15 |
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 |
30 | #include "BinaryData.h"
31 |
32 | #if defined (JUCE_PROJUCER_VERSION) && JUCE_PROJUCER_VERSION < JUCE_VERSION
33 | /** If you've hit this error then the version of the Projucer that was used to generate this project is
34 | older than the version of the JUCE modules being included. To fix this error, re-save your project
35 | using the latest version of the Projucer or, if you aren't using the Projucer to manage your project,
36 | remove the JUCE_PROJUCER_VERSION define.
37 | */
38 | #error "This project was last saved using an outdated version of the Projucer! Re-save this project with the latest version to fix this error."
39 | #endif
40 |
41 |
42 | #if ! JUCE_DONT_DECLARE_PROJECTINFO
43 | namespace ProjectInfo
44 | {
45 | const char* const projectName = "CIDECHAIN";
46 | const char* const companyName = "Gomadare";
47 | const char* const versionString = "1.0.0";
48 | const int versionNumber = 0x10000;
49 | }
50 | #endif
51 |
--------------------------------------------------------------------------------
/JuceLibraryCode/JucePluginDefines.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #pragma once
9 |
10 | //==============================================================================
11 | // Audio plugin settings..
12 |
13 | #ifndef JucePlugin_Build_VST
14 | #define JucePlugin_Build_VST 0
15 | #endif
16 | #ifndef JucePlugin_Build_VST3
17 | #define JucePlugin_Build_VST3 1
18 | #endif
19 | #ifndef JucePlugin_Build_AU
20 | #define JucePlugin_Build_AU 1
21 | #endif
22 | #ifndef JucePlugin_Build_AUv3
23 | #define JucePlugin_Build_AUv3 0
24 | #endif
25 | #ifndef JucePlugin_Build_RTAS
26 | #define JucePlugin_Build_RTAS 0
27 | #endif
28 | #ifndef JucePlugin_Build_AAX
29 | #define JucePlugin_Build_AAX 0
30 | #endif
31 | #ifndef JucePlugin_Build_Standalone
32 | #define JucePlugin_Build_Standalone 1
33 | #endif
34 | #ifndef JucePlugin_Build_Unity
35 | #define JucePlugin_Build_Unity 0
36 | #endif
37 | #ifndef JucePlugin_Enable_IAA
38 | #define JucePlugin_Enable_IAA 0
39 | #endif
40 | #ifndef JucePlugin_Name
41 | #define JucePlugin_Name "CIDECHAIN"
42 | #endif
43 | #ifndef JucePlugin_Desc
44 | #define JucePlugin_Desc "CIDECHAIN"
45 | #endif
46 | #ifndef JucePlugin_Manufacturer
47 | #define JucePlugin_Manufacturer "Gomadare"
48 | #endif
49 | #ifndef JucePlugin_ManufacturerWebsite
50 | #define JucePlugin_ManufacturerWebsite ""
51 | #endif
52 | #ifndef JucePlugin_ManufacturerEmail
53 | #define JucePlugin_ManufacturerEmail ""
54 | #endif
55 | #ifndef JucePlugin_ManufacturerCode
56 | #define JucePlugin_ManufacturerCode 0x4d616e75
57 | #endif
58 | #ifndef JucePlugin_PluginCode
59 | #define JucePlugin_PluginCode 0x4f387a6a
60 | #endif
61 | #ifndef JucePlugin_IsSynth
62 | #define JucePlugin_IsSynth 0
63 | #endif
64 | #ifndef JucePlugin_WantsMidiInput
65 | #define JucePlugin_WantsMidiInput 1
66 | #endif
67 | #ifndef JucePlugin_ProducesMidiOutput
68 | #define JucePlugin_ProducesMidiOutput 0
69 | #endif
70 | #ifndef JucePlugin_IsMidiEffect
71 | #define JucePlugin_IsMidiEffect 0
72 | #endif
73 | #ifndef JucePlugin_EditorRequiresKeyboardFocus
74 | #define JucePlugin_EditorRequiresKeyboardFocus 0
75 | #endif
76 | #ifndef JucePlugin_Version
77 | #define JucePlugin_Version 1.0.0
78 | #endif
79 | #ifndef JucePlugin_VersionCode
80 | #define JucePlugin_VersionCode 0x10000
81 | #endif
82 | #ifndef JucePlugin_VersionString
83 | #define JucePlugin_VersionString "1.0.0"
84 | #endif
85 | #ifndef JucePlugin_VSTUniqueID
86 | #define JucePlugin_VSTUniqueID JucePlugin_PluginCode
87 | #endif
88 | #ifndef JucePlugin_VSTCategory
89 | #define JucePlugin_VSTCategory kPlugCategEffect
90 | #endif
91 | #ifndef JucePlugin_Vst3Category
92 | #define JucePlugin_Vst3Category "Fx|Stereo"
93 | #endif
94 | #ifndef JucePlugin_AUMainType
95 | #define JucePlugin_AUMainType 'aumf'
96 | #endif
97 | #ifndef JucePlugin_AUSubType
98 | #define JucePlugin_AUSubType JucePlugin_PluginCode
99 | #endif
100 | #ifndef JucePlugin_AUExportPrefix
101 | #define JucePlugin_AUExportPrefix CIDECHAINAU
102 | #endif
103 | #ifndef JucePlugin_AUExportPrefixQuoted
104 | #define JucePlugin_AUExportPrefixQuoted "CIDECHAINAU"
105 | #endif
106 | #ifndef JucePlugin_AUManufacturerCode
107 | #define JucePlugin_AUManufacturerCode JucePlugin_ManufacturerCode
108 | #endif
109 | #ifndef JucePlugin_CFBundleIdentifier
110 | #define JucePlugin_CFBundleIdentifier com.Gomadare.CIDECHAIN
111 | #endif
112 | #ifndef JucePlugin_RTASCategory
113 | #define JucePlugin_RTASCategory 0
114 | #endif
115 | #ifndef JucePlugin_RTASManufacturerCode
116 | #define JucePlugin_RTASManufacturerCode JucePlugin_ManufacturerCode
117 | #endif
118 | #ifndef JucePlugin_RTASProductId
119 | #define JucePlugin_RTASProductId JucePlugin_PluginCode
120 | #endif
121 | #ifndef JucePlugin_RTASDisableBypass
122 | #define JucePlugin_RTASDisableBypass 0
123 | #endif
124 | #ifndef JucePlugin_RTASDisableMultiMono
125 | #define JucePlugin_RTASDisableMultiMono 0
126 | #endif
127 | #ifndef JucePlugin_AAXIdentifier
128 | #define JucePlugin_AAXIdentifier com.Gomadare.CIDECHAIN
129 | #endif
130 | #ifndef JucePlugin_AAXManufacturerCode
131 | #define JucePlugin_AAXManufacturerCode JucePlugin_ManufacturerCode
132 | #endif
133 | #ifndef JucePlugin_AAXProductId
134 | #define JucePlugin_AAXProductId JucePlugin_PluginCode
135 | #endif
136 | #ifndef JucePlugin_AAXCategory
137 | #define JucePlugin_AAXCategory 0
138 | #endif
139 | #ifndef JucePlugin_AAXDisableBypass
140 | #define JucePlugin_AAXDisableBypass 0
141 | #endif
142 | #ifndef JucePlugin_AAXDisableMultiMono
143 | #define JucePlugin_AAXDisableMultiMono 0
144 | #endif
145 | #ifndef JucePlugin_IAAType
146 | #define JucePlugin_IAAType 0x6175726d
147 | #endif
148 | #ifndef JucePlugin_IAASubType
149 | #define JucePlugin_IAASubType JucePlugin_PluginCode
150 | #endif
151 | #ifndef JucePlugin_IAAName
152 | #define JucePlugin_IAAName "Gomadare: CIDECHAIN"
153 | #endif
154 | #ifndef JucePlugin_VSTNumMidiInputs
155 | #define JucePlugin_VSTNumMidiInputs 16
156 | #endif
157 | #ifndef JucePlugin_VSTNumMidiOutputs
158 | #define JucePlugin_VSTNumMidiOutputs 16
159 | #endif
160 |
--------------------------------------------------------------------------------
/JuceLibraryCode/ReadMe.txt:
--------------------------------------------------------------------------------
1 |
2 | Important Note!!
3 | ================
4 |
5 | The purpose of this folder is to contain files that are auto-generated by the Projucer,
6 | and ALL files in this folder will be mercilessly DELETED and completely re-written whenever
7 | the Projucer saves your project.
8 |
9 | Therefore, it's a bad idea to make any manual changes to the files in here, or to
10 | put any of your own files in here if you don't want to lose them. (Of course you may choose
11 | to add the folder's contents to your version-control system so that you can re-merge your own
12 | modifications after the Projucer has saved its changes).
13 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_basics.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_basics.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_devices.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_devices.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_formats.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_formats.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_AAX.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_AAX.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_AU.r:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_AU_1.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_AU_2.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_AUv3.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_RTAS.r:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_RTAS_1.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_RTAS_2.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_RTAS_3.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_RTAS_4.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_RTAS_utils.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_RTAS_utils.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_Standalone.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_Unity.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_VST2.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_VST3.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_VST_utils.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_plugin_client_utils.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_processors.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_processors.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_utils.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_audio_utils.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_core.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_core.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_data_structures.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_data_structures.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_dsp.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_dsp.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_events.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_events.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_graphics.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_graphics.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_gui_basics.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_gui_basics.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_gui_extra.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/JuceLibraryCode/include_juce_gui_extra.mm:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | IMPORTANT! This file is auto-generated each time you save your
4 | project - if you alter its contents, your changes may be overwritten!
5 |
6 | */
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/Resource/bgimg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gomadare0/Cidechain/418883e1527239ef5a7737b78fa1938710e19122/Resource/bgimg.png
--------------------------------------------------------------------------------
/Source/Component_BandSplitter.cpp:
--------------------------------------------------------------------------------
1 | #include "Component_BandSplitter.h"
2 |
3 | double myplug::BandSplitView::calcNormalizedLogPos(double hz)
4 | {
5 | double logStart = log10(minFreq_);
6 | double logLength = log10(maxFreq_) - logStart;
7 | return (log10(hz) - logStart) / logLength;
8 | }
9 |
10 | double myplug::BandSplitView::calcScreenLogPos(double hz)
11 | {
12 | return getWidth() * calcNormalizedLogPos(hz);
13 | }
14 |
15 | double myplug::BandSplitView::calcHzFromLogScreenPos(double x)
16 | {
17 | double logStart = log10(minFreq_);
18 | double logLength = log10(maxFreq_) - logStart;
19 | return std::pow(10.0, x / getWidth() * logLength + logStart);
20 | }
21 |
22 | void myplug::BandSplitView::callListeners()
23 | {
24 | for (auto& i : listeners_)
25 | {
26 | i->selectedBandChanged(this);
27 | i->splitFrequencyChanged(this);
28 | }
29 | }
30 |
31 | void myplug::BandSplitView::paint(juce::Graphics& g)
32 | {
33 | auto bgColour = juce::Colour(0.0f, 0.0f, 0.15f, 1.0f);
34 | g.setColour(bgColour);
35 | g.fillAll();
36 |
37 | // Draw Spectrum
38 | juce::Path topline;
39 | juce::PathStrokeType stroke(1.5, juce::PathStrokeType::JointStyle::curved);
40 | topline.startNewSubPath(-1.0, getHeight());
41 | int beginningIndex = (float)fftSize / sampleRate_ * minFreq_;
42 | int endingIndex = (float)fftSize / sampleRate_ * std::clamp(sampleRate_ / 2.0, 0, maxFreq_);
43 | if (beginningIndex == 0) ++beginningIndex; // ignore lowest band
44 |
45 | for (int i = beginningIndex; i < endingIndex; ++i)
46 | {
47 | float freq = (float)sampleRate_ / fftSize * i;
48 | float amplitude = 0.0;
49 | if (freq == 0) freq = 1;
50 | for (int bufIndex = 0; bufIndex < recentfftResult_.size(); ++bufIndex)
51 | {
52 | amplitude += recentfftResult_[bufIndex][i];
53 | }
54 | if (recentfftResult_.size() != 0)
55 | amplitude /= recentfftResult_.size();
56 |
57 | float xPos = calcScreenLogPos(freq);
58 | float yPos = (amplitude / 60.0 + 1.0) * (-1.0) * getHeight() + getHeight();
59 | topline.lineTo(xPos, yPos);
60 | }
61 |
62 | g.setColour(juce::Colours::grey);
63 | g.strokePath(topline, stroke);
64 |
65 | // Draw Band Splitter
66 | g.setColour(juce::Colours::grey.brighter());
67 | g.drawLine(calcScreenLogPos(lowmidFreq_), 0.0, calcScreenLogPos(lowmidFreq_), getHeight(), mouseInsectedHandle_ == 0 ? 3.0 : 1.5f);
68 | g.drawLine(calcScreenLogPos(midhighFreq_), 0.0, calcScreenLogPos(midhighFreq_), getHeight(), mouseInsectedHandle_ == 1 ? 3.0 : 1.5f);
69 |
70 | // Draw BGColour
71 | g.setColour(juce::Colour(82, 125, 255).withAlpha(currentBand_ == Band::low ? 0.3f : 0.1f).brighter(mouseInsectedBand_ == Band::low ? 0.8f : 0.0f));
72 | g.fillRect(0.0, 0.0, calcScreenLogPos(lowmidFreq_), getHeight());
73 | g.setColour(juce::Colour(168, 111, 206).withAlpha(currentBand_ == Band::mid ? 0.3f : 0.1f).brighter(mouseInsectedBand_ == Band::mid ? 0.8f : 0.0f));
74 | g.fillRect(calcScreenLogPos(lowmidFreq_), 0.0, calcScreenLogPos(midhighFreq_) - calcScreenLogPos(lowmidFreq_), getHeight());
75 | g.setColour(juce::Colour(252, 86, 156).withAlpha(currentBand_ == Band::high ? 0.3f : 0.1f).brighter(mouseInsectedBand_ == Band::high ? 0.8f : 0.0f));
76 | g.fillRect(calcScreenLogPos(midhighFreq_), 0.0, getWidth(), getHeight());
77 |
78 | // Draw Freq
79 | auto font = g.getCurrentFont();
80 | juce::String lowmidLabel;
81 | lowmidLabel << static_cast(lowmidFreq_) << "Hz";
82 | juce::Rectangle lowmidlabel_area = { static_cast(calcScreenLogPos(lowmidFreq_)) + 5, 1, font.getStringWidth(lowmidLabel), 10 };
83 | if (lowmidlabel_area.getRight() > getWidth())
84 | {
85 | lowmidlabel_area.setX(lowmidlabel_area.getX() - (lowmidlabel_area.getRight() - getWidth()) - 5);
86 | }
87 | g.setColour(juce::Colours::grey.brighter());
88 | g.drawText(lowmidLabel, lowmidlabel_area, juce::Justification::centredTop);
89 |
90 | juce::String midhighLabel;
91 | midhighLabel << static_cast(midhighFreq_) << "Hz";
92 | juce::Rectangle midhighlabel_area = { static_cast(calcScreenLogPos(midhighFreq_)) + 5, 1, font.getStringWidth(midhighLabel), 10 };
93 | if (midhighlabel_area.intersectRectangle(lowmidlabel_area))
94 | {
95 | midhighlabel_area.setY(midhighlabel_area.getY() + 15);
96 | }
97 | if (midhighlabel_area.getRight() > getWidth())
98 | {
99 | midhighlabel_area.setX(midhighlabel_area.getX() - (midhighlabel_area.getRight() - getWidth()) - 5);
100 | }
101 | g.setColour(juce::Colours::grey.brighter());
102 | g.drawText(midhighLabel, midhighlabel_area, juce::Justification::centredTop);
103 | }
104 |
105 | void myplug::BandSplitView::update()
106 | {
107 | if (isNextFFTBlockReady_)
108 | {
109 | // set fftResult
110 | int index = 0;
111 | fftResult_.fill(0.0);
112 | float hzPerBin = (float)sampleRate_ / fftSize;
113 | for (auto& i : fftResult_)
114 | {
115 | // convert to gain & tilting
116 | float log2coeff = index == 0 ? 0.0f : log2f(hzPerBin * index / 1000.0);
117 | i = std::clamp(juce::Decibels::gainToDecibels((fftData_[index] + fftData_[fftSize - index - 1]) / (float)fftSize, -200.0f) + log2coeff * 4.5, -60.0, 0.0);
118 | ++index;
119 | }
120 |
121 | recentfftResult_.push_back(fftResult_);
122 | if (recentfftResult_.size() > integralSampleLength_)
123 | {
124 | recentfftResult_.pop_front();
125 | }
126 |
127 | isNextFFTBlockReady_ = false;
128 |
129 | repaint();
130 | }
131 |
132 | // Update Mouse Cursor
133 | if (mouseInsectedHandle_ >= 0)
134 | {
135 | setMouseCursor(juce::MouseCursor::LeftRightResizeCursor);
136 | }
137 | else
138 | {
139 | setMouseCursor(juce::MouseCursor::NormalCursor);
140 | }
141 | }
142 |
143 | void myplug::BandSplitView::mouseDown(const juce::MouseEvent& e)
144 | {
145 | if (mouseInsectedBand_ >= 0)
146 | {
147 | currentBand_ = mouseInsectedBand_;
148 | callListeners();
149 | }
150 | }
151 |
152 | void myplug::BandSplitView::mouseDrag(const juce::MouseEvent& e)
153 | {
154 | if (mouseInsectedHandle_ == 0)
155 | {
156 | lowmidFreq_ = std::clamp(calcHzFromLogScreenPos(e.x), minFreq_, midhighFreq_ - 10);
157 | callListeners();
158 | }
159 | else if (mouseInsectedHandle_ == 1)
160 | {
161 | midhighFreq_ = std::clamp(calcHzFromLogScreenPos(e.x), lowmidFreq_ + 10, maxFreq_);
162 | callListeners();
163 | }
164 | }
165 |
166 | void myplug::BandSplitView::mouseMove(const juce::MouseEvent& e)
167 | {
168 | if (e.x < calcScreenLogPos(lowmidFreq_))
169 | {
170 | mouseInsectedBand_ = Band::low;
171 | }
172 | else if (calcScreenLogPos(lowmidFreq_) <= e.x && e.x < calcScreenLogPos(midhighFreq_))
173 | {
174 | mouseInsectedBand_ = Band::mid;
175 | }
176 | else
177 | {
178 | mouseInsectedBand_ = Band::high;
179 | }
180 |
181 | int xTolerance = 5;
182 | if (abs(e.x - calcScreenLogPos(lowmidFreq_)) <= xTolerance)
183 | {
184 | mouseInsectedHandle_ = 0;
185 | mouseInsectedBand_ = -1;
186 | }
187 | else if (abs(e.x - calcScreenLogPos(midhighFreq_)) <= xTolerance)
188 | {
189 | mouseInsectedHandle_ = 1;
190 | mouseInsectedBand_ = -1;
191 | }
192 | else
193 | {
194 | mouseInsectedHandle_ = -1;
195 | }
196 | }
197 |
198 | void myplug::BandSplitView::mouseExit(const juce::MouseEvent& e)
199 | {
200 | mouseInsectedBand_ = -1;
201 | mouseInsectedHandle_ = -1;
202 | }
203 |
--------------------------------------------------------------------------------
/Source/Component_BandSplitter.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "Constants.h"
5 |
6 | namespace myplug
7 | {
8 | class BandSplitView : public juce::AnimatedAppComponent
9 | {
10 | public:
11 | class Listener
12 | {
13 | public:
14 | virtual ~Listener() = default;
15 | virtual void splitFrequencyChanged(BandSplitView*){}
16 | virtual void selectedBandChanged(BandSplitView*){}
17 | };
18 |
19 | private:
20 |
21 | enum Band
22 | {
23 | low = 0, mid, high, kNumBands,
24 | };
25 |
26 | std::array& fftData_;
27 | std::array fftResult_;
28 | std::deque> recentfftResult_;
29 | bool& isNextFFTBlockReady_;
30 |
31 | int& sampleRate_;
32 | int integralSampleLength_ = 48000 / fftSize * 0.1;
33 |
34 | int minFreq_ = 20;
35 | int maxFreq_ = 20000;
36 | int currentBand_ = Band::low;
37 |
38 | double lowmidFreq_ = 200.0;
39 | double midhighFreq_ = 8000.0;
40 |
41 | std::vector listeners_;
42 |
43 | // Mouse
44 | int mouseInsectedHandle_ = -1;
45 | int mouseInsectedBand_ = -1;
46 |
47 | double calcNormalizedLogPos(double hz);
48 | double calcScreenLogPos(double hz);
49 | double calcHzFromLogScreenPos(double x);
50 | void callListeners();
51 |
52 | public:
53 | BandSplitView(std::array& fftData, bool& isNextFFTBlockReady, int& samplerate)
54 | : fftData_(fftData)
55 | , isNextFFTBlockReady_(isNextFFTBlockReady)
56 | , sampleRate_(samplerate)
57 | {
58 | setFramesPerSecond(30);
59 | fftResult_.fill(0.0);
60 | }
61 |
62 | void paint(juce::Graphics& g) override;
63 | void update() override;
64 |
65 | int getSampleRate() { return sampleRate_; }
66 | int getSelectedBand() { return currentBand_; }
67 | double getLowMidFreq() { return lowmidFreq_; }
68 | double getMidHighFreq() { return midhighFreq_; }
69 |
70 | void setLowMidFreq(double freq) { lowmidFreq_ = freq; }
71 | void setMidHighFreq(double freq) { midhighFreq_ = freq; }
72 | //void resized() override;
73 |
74 | void addListener(BandSplitView::Listener* listener) { listeners_.push_back(listener); }
75 | void removeListener(BandSplitView::Listener* listener)
76 | {
77 | listeners_.erase(std::remove(listeners_.begin(), listeners_.end(), listener), listeners_.end());
78 | }
79 |
80 | void mouseDown(const juce::MouseEvent& e) override;
81 | void mouseDrag(const juce::MouseEvent& e) override;
82 | void mouseMove(const juce::MouseEvent& e) override;
83 | void mouseExit(const juce::MouseEvent& e) override;
84 | };
85 | }
--------------------------------------------------------------------------------
/Source/Component_NumericSpinbox.cpp:
--------------------------------------------------------------------------------
1 | #include "Component_NumericSpinbox.h"
2 |
3 | void myplug::NumericSpinBox::updateMouseCur(const juce::MouseEvent& e)
4 | {
5 | if (getLocalBounds().contains(e.x, e.y))
6 | {
7 | setMouseCursor(juce::MouseCursor::UpDownResizeCursor);
8 | }
9 | else
10 | {
11 | setMouseCursor(juce::MouseCursor::NormalCursor);
12 | }
13 | }
14 |
15 | void myplug::NumericSpinBox::updateNumFromTextinput()
16 | {
17 | if (textinput_.getText() != "")
18 | {
19 | if (useCustomParser_)
20 | {
21 | setNumber(customParser_(textinput_.getText()));
22 | }
23 | else
24 | {
25 | if (isInteger_)
26 | {
27 | setNumber(textinput_.getText().getIntValue());
28 | }
29 | else
30 | {
31 | setNumber(textinput_.getText().getDoubleValue());
32 | }
33 | }
34 | for (const auto& i : listeners_)
35 | {
36 | i->onNumberChanged(this);
37 | i->startGesture(this);
38 | i->endGesture(this);
39 | }
40 | }
41 |
42 | textinput_.setVisible(false);
43 | textinput_.setText("");
44 | }
45 |
46 | myplug::NumericSpinBox::NumericSpinBox()
47 | : globalMouseListener_(*this)
48 | {
49 | textinput_.addListener(this);
50 | addChildComponent(textinput_);
51 |
52 | juce::Desktop::getInstance().addGlobalMouseListener(&globalMouseListener_);
53 | }
54 |
55 | myplug::NumericSpinBox::~NumericSpinBox()
56 | {
57 | textinput_.removeListener(this);
58 | juce::Desktop::getInstance().removeGlobalMouseListener(&globalMouseListener_);
59 | }
60 |
61 | void myplug::NumericSpinBox::paint(juce::Graphics& g)
62 | {
63 | g.setColour(isMouseOver() ? colour_background_mouseover_ : colour_background_);
64 | g.fillAll();
65 |
66 | g.setColour(colour_border_);
67 | g.drawRect(getLocalBounds(), 1.0f);
68 |
69 | float border = getLocalBounds().getHeight() * 0.1f;
70 | float textHeight = getLocalBounds().getHeight() - border * 2;
71 | float textMaxWidth = getLocalBounds().getWidth() - border * 2;
72 | g.setColour(colour_font_);
73 | auto font = g.getCurrentFont();
74 | font.setHeight(textHeight);
75 | g.setFont(font);
76 |
77 | if (useValueList_)
78 | {
79 | size_t index = static_cast((num_ - min_) / (max_ - min_) * (valueList_.size() - 1));
80 | g.drawText(prefix_ + valueList_[index] + suffix_, border, border, textMaxWidth, textHeight, juce::Justification::centred);
81 | }
82 | else
83 | {
84 | std::ostringstream numToText;
85 | numToText << std::fixed << std::setprecision(decimalDigit_) << num_;
86 | g.drawText(prefix_ + juce::String(numToText.str()) + suffix_, border, border, textMaxWidth, textHeight, juce::Justification::centred);
87 | }
88 | }
89 |
90 | void myplug::NumericSpinBox::resized()
91 | {
92 | textinput_.setBounds(getLocalBounds());
93 | }
94 |
95 | void myplug::NumericSpinBox::setColour(NumericSpinBox::Colours colourType, const juce::Colour& newColour)
96 | {
97 | switch (colourType)
98 | {
99 | case NumericSpinBox::Colours::Background: colour_background_ = newColour; break;
100 | case NumericSpinBox::Colours::BackgroundMouseover: colour_background_mouseover_ = newColour; break;
101 | case NumericSpinBox::Colours::Border: colour_border_ = newColour; break;
102 | case NumericSpinBox::Colours::Font: colour_font_ = newColour; break;
103 | default: break;
104 | }
105 | repaint();
106 | }
107 |
108 | void myplug::NumericSpinBox::mouseDown(const juce::MouseEvent& e)
109 | {
110 | for (const auto& i : listeners_)
111 | {
112 | i->startGesture(this);
113 | }
114 | }
115 |
116 | void myplug::NumericSpinBox::mouseGlobDown(const juce::MouseEvent& e)
117 | {
118 | if (!getScreenBounds().contains(e.getScreenPosition()) && textinput_.isVisible())
119 | {
120 | updateNumFromTextinput();
121 | }
122 | }
123 |
124 | void myplug::NumericSpinBox::mouseDrag(const juce::MouseEvent& e)
125 | {
126 | auto delta = e.getPosition() - prevMousePos_;
127 | dy_ += -delta.y / 50.0 * mouseSensitivity_;
128 | int dyFloor = floor(dy_);
129 | if (dyFloor >= 1 || dyFloor <= -1)
130 | {
131 | num_ = std::clamp(num_ + incrementAmount_ * dyFloor, min_, max_);
132 | dy_ -= dyFloor;
133 | for (const auto& i : listeners_)
134 | {
135 | i->onNumberChanged(this);
136 | }
137 | }
138 |
139 | repaint();
140 | prevMousePos_ = e.getPosition();
141 | }
142 |
143 | void myplug::NumericSpinBox::mouseMove(const juce::MouseEvent& e)
144 | {
145 | repaint();
146 | prevMousePos_ = e.getPosition();
147 | updateMouseCur(e);
148 | }
149 |
150 | void myplug::NumericSpinBox::mouseExit(const juce::MouseEvent& e)
151 | {
152 | repaint();
153 | updateMouseCur(e);
154 | for (const auto& i : listeners_)
155 | {
156 | i->endGesture(this);
157 | }
158 | }
159 |
160 | void myplug::NumericSpinBox::mouseUp(const juce::MouseEvent& e)
161 | {
162 | dy_ = 0.0;
163 | }
164 |
165 | void myplug::NumericSpinBox::mouseDoubleClick(const juce::MouseEvent& e)
166 | {
167 | textinput_.setVisible(true);
168 | textinput_.grabKeyboardFocus();
169 | }
170 |
171 | void myplug::NumericSpinBox::textEditorReturnKeyPressed(juce::TextEditor& e)
172 | {
173 | updateNumFromTextinput();
174 | }
175 |
--------------------------------------------------------------------------------
/Source/Component_NumericSpinbox.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace myplug
6 | {
7 | class NumericSpinBox : public juce::Component, public juce::TextEditor::Listener
8 | {
9 | public:
10 | enum class Colours
11 | {
12 | Background,
13 | BackgroundMouseover,
14 | Border,
15 | Font
16 | };
17 |
18 | class Listener
19 | {
20 | public:
21 | virtual ~Listener() = default;
22 | virtual void onNumberChanged(NumericSpinBox*) = 0;
23 | virtual void startGesture(NumericSpinBox*){}
24 | virtual void endGesture(NumericSpinBox*){}
25 | };
26 |
27 | private:
28 | class GlobalMouseListener : public juce::MouseListener
29 | {
30 | NumericSpinBox& parent_;
31 | public:
32 | GlobalMouseListener(NumericSpinBox& component) : parent_(component)
33 | {
34 |
35 | }
36 | void mouseDown(const juce::MouseEvent& e) override
37 | {
38 | parent_.mouseGlobDown(e);
39 | }
40 | } globalMouseListener_;
41 |
42 | std::vector listeners_;
43 | juce::String prefix_;
44 | juce::String suffix_;
45 | std::vector valueList_;
46 | bool useValueList_ = false;
47 | std::function customParser_;
48 | bool useCustomParser_ = false;
49 | double num_ = 0.0;
50 | double incrementAmount_ = 1.0;
51 | double max_ = std::numeric_limits::max();
52 | double min_ = std::numeric_limits::min();
53 | int decimalDigit_ = 0;
54 | double dy_ = 0.0;
55 | bool isInteger_ = true;
56 | double mouseSensitivity_ = 1.0;
57 |
58 | juce::Point prevMousePos_;
59 |
60 | juce::TextEditor textinput_;
61 |
62 | juce::Colour colour_background_ = juce::Colour(0.0f, 0.0f, 0.2f, 1.0f);;
63 | juce::Colour colour_background_mouseover_ = juce::Colour(0.0f, 0.0f, 0.3f, 1.0f);
64 | juce::Colour colour_border_ = juce::Colours::mediumpurple;
65 | juce::Colour colour_font_ = juce::Colours::white;
66 |
67 | void updateMouseCur(const juce::MouseEvent& g);
68 | void updateNumFromTextinput();
69 |
70 | public:
71 | NumericSpinBox();
72 | ~NumericSpinBox();
73 |
74 | void paint(juce::Graphics& g) override;
75 | void resized() override;
76 |
77 | double getCurrentNumber() { return num_; }
78 | double getIncrementAmount() { return incrementAmount_; }
79 | double getMaximum() { return max_; }
80 | double getMinimum() { return min_; }
81 | int getDecimalDigit() { return decimalDigit_; }
82 | juce::String getPrefix() { return prefix_; }
83 | juce::String getSuffix() { return suffix_; }
84 | const std::vector& getValueList() { return valueList_; }
85 |
86 | void useValueList() { useValueList_ = true; }
87 | void dontUseValueList() { useValueList_ = false; }
88 | void useCustomParser() { useCustomParser_ = true; }
89 | void dontUseCustomParser() { useCustomParser_ = false; }
90 | void setNumber(double num) { num_ = std::clamp(num, min_, max_); notifyValueChanged(); }
91 | void setIncrementAmount(double incrementAmount) { incrementAmount_ = incrementAmount; }
92 | void setMaximum(double max)
93 | {
94 | if (max >= min_)
95 | { max_ = max;
96 | } }
97 | void setMinimum(double min) { if (min <= max_) { min_ = min; } }
98 | void setDicimalDigit(int decimalDigit) { decimalDigit_ = decimalDigit; }
99 | void setPrefix(const juce::String& prefix) { prefix_ = prefix; }
100 | void setSuffix(const juce::String& suffix) { suffix_ = suffix; }
101 | void setIsInteger(bool shouldbeint) { isInteger_ = shouldbeint; decimalDigit_ = 0; }
102 | void setMouseSensitivity(double sensitivity = 1.0) { mouseSensitivity_ = sensitivity; }
103 | void setColour(NumericSpinBox::Colours colourType, const juce::Colour& newColour);
104 |
105 | void notifyValueChanged() { repaint(); }
106 |
107 | // When using value list, the ratio between (maxValue - minValue) is used as index
108 | // if automaticallyAdjustMinMax is true, min is set to 0 & max is set to list.size()-1 & incrementamount is set to 1
109 | void setValueList(const std::vector& list, bool useValueList = true, bool automaticallyAdjustMinMax = true)
110 | {
111 | valueList_ = list;
112 | useValueList_ = useValueList;
113 | if(automaticallyAdjustMinMax) min_ = 0; max_ = list.size() - 1; incrementAmount_ = 1;
114 | }
115 |
116 | // test input is passed, and expected to return number(known as index or value)
117 | void setCustomParser(std::function parser, bool useCustomParser = true) { customParser_ = parser; useCustomParser_ = useCustomParser; }
118 |
119 | void addListener(NumericSpinBox::Listener* listener) { listeners_.push_back(listener); }
120 | void removeListener(NumericSpinBox::Listener* listener)
121 | {
122 | listeners_.erase(std::remove(listeners_.begin(), listeners_.end(), listener), listeners_.end());
123 | }
124 |
125 | void mouseDown(const juce::MouseEvent& e) override;
126 | void mouseGlobDown(const juce::MouseEvent& e);
127 | void mouseDrag(const juce::MouseEvent& e) override;
128 | void mouseMove(const juce::MouseEvent& e) override;
129 | void mouseExit(const juce::MouseEvent& e) override;
130 | void mouseUp(const juce::MouseEvent& e) override;
131 | void mouseDoubleClick(const juce::MouseEvent& e) override;
132 | void textEditorReturnKeyPressed(juce::TextEditor& e) override;
133 | };
134 | }
--------------------------------------------------------------------------------
/Source/Constants.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace
4 | {
5 | constexpr int fftOrder = 10;
6 | constexpr int fftSize = 1 << fftOrder;
7 | constexpr float PIf = 3.1415926535897932;
8 | constexpr int declickCacheLength = 1000;
9 | }
--------------------------------------------------------------------------------
/Source/DSP_Filter.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "Constants.h"
3 | #include
4 |
5 | namespace myplug::DSP
6 | {
7 | class FilterBase
8 | {
9 | public:
10 | virtual float processSample(float i) = 0;
11 | };
12 |
13 | class Butterworth_2nd : public FilterBase
14 | {
15 | float a0 = 1, a1 = 0, a2 = 0, b0 = 0, b1 = 0, b2 = 0;
16 | float x1 = 0, x2 = 0, y1 = 0, y2 = 0;
17 |
18 | public:
19 | void calcCoeff(float sampleRate, float freq, bool isHighPass)
20 | {
21 | const float omega = 2.0 * PIf * freq / sampleRate;
22 | const float sqrt2 = 1.41421356;
23 |
24 | a0 = 2 + sqrt2 * std::sinf(omega);
25 | a1 = -4 * std::cosf(omega);
26 | a2 = 2 - sqrt2 * std::sinf(omega);
27 |
28 | if (!isHighPass)
29 | {
30 | b0 = 1 - std::cos(omega);
31 | b1 = 2 - 2 * std::cos(omega);
32 | b2 = 1 - std::cos(omega);
33 | }
34 | else
35 | {
36 | b0 = 1 + std::cos(omega);
37 | b1 = - 2 - 2 * std::cos(omega);
38 | b2 = 1 + std::cos(omega);
39 | }
40 | }
41 |
42 | float processSample(float i)
43 | {
44 | float y = b0 * i + b1 * x1 + b2 * x2 - a1 * y1 - a2 * y2;
45 | y /= a0;
46 |
47 | x2 = x1;
48 | x1 = i;
49 | y2 = y1;
50 | y1 = y;
51 |
52 | return y;
53 | }
54 | };
55 | }
--------------------------------------------------------------------------------
/Source/Envelope_Data.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include "ValueNormalization.h"
10 |
11 | namespace myplug
12 | {
13 | namespace envelope
14 | {
15 | enum class InterpolationType
16 | {
17 | Linear,
18 | Sigmoid,
19 | Step
20 | };
21 | enum class LoopState
22 | {
23 | None,
24 | LoopStart,
25 | LoopEnd,
26 | };
27 |
28 | struct Point
29 | {
30 | double x = 0.0;
31 | double y = 0.0;
32 | double param1 = 0.0;
33 | InterpolationType interpolation = InterpolationType::Linear;
34 | LoopState loop = LoopState::None;
35 | };
36 |
37 | struct EnvelopeGenerator
38 | {
39 | private:
40 | std::vector points;
41 | std::string name_;
42 |
43 | public:
44 | void addPoint(double xPos, double yPos, InterpolationType interpolation = InterpolationType::Sigmoid, double Param1 = 0.0, LoopState loop = LoopState::None)
45 | {
46 | points.push_back(Point{xPos, yPos, Param1, interpolation, loop });
47 | std::sort(points.begin(), points.end(), [](Point& l, Point& r) { return l.x < r.x; });
48 | }
49 | void removeNearestPoint(double xPos)
50 | {
51 | if (points.size() == 0)
52 | {
53 | return;
54 | }
55 | auto targetItr = points.begin();
56 | double minDistance = std::numeric_limits::max();
57 | for (auto itr = points.begin(); itr != points.end(); ++itr)
58 | {
59 | double currentDistance = abs(xPos - itr->x);
60 | if (currentDistance > minDistance)
61 | {
62 | points.erase(targetItr);
63 | points.shrink_to_fit();
64 | return;
65 | }
66 | else
67 | {
68 | minDistance = currentDistance;
69 | targetItr = itr;
70 | }
71 | }
72 | }
73 | void removePoint(size_t index)
74 | {
75 | if (index >= points.size())
76 | {
77 | return;
78 | }
79 | points.erase(points.begin() + index);
80 | points.shrink_to_fit();
81 | }
82 |
83 | void setName(const std::string& name) { name_ = name; }
84 | void setPoint(size_t index, const Point& point)
85 | {
86 | if (index < points.size())
87 | {
88 | points[index] = point;
89 | }
90 | }
91 |
92 | int getLeftPointIndex(double xPos)
93 | {
94 | if (points.size() == 0)
95 | {
96 | return 0;
97 | }
98 | else if (xPos <= points.begin()->x)
99 | {
100 | return -1;
101 | }
102 | else if (xPos >= (--points.end())->x)
103 | {
104 | return points.size()-1;
105 | }
106 | else
107 | {
108 | for (auto itr = points.begin(); itr != points.end(); ++itr)
109 | {
110 | if (itr->x <= xPos && (itr + 1)->x > xPos)
111 | {
112 | return std::distance(points.begin(), itr);
113 | }
114 | }
115 | return -1;
116 | }
117 | }
118 | int getRightPointIndex(double xPos)
119 | {
120 | if (points.size() == 0)
121 | {
122 | return 0;
123 | }
124 | else if (xPos <= points.begin()->x)
125 | {
126 | return 0;
127 | }
128 | else if (xPos >= (--points.end())->x)
129 | {
130 | return points.size();
131 | }
132 | else
133 | {
134 | for (auto itr = points.begin(); itr != points.end(); ++itr)
135 | {
136 | if (itr->x <= xPos && (itr + 1)->x > xPos)
137 | {
138 | return std::distance(points.begin(), itr) + 1;
139 | }
140 | }
141 | return -1;
142 | }
143 | }
144 | double getInterpolatedValue(double xPos)
145 | {
146 | if (points.size() == 0)
147 | {
148 | return 0.0;
149 | }
150 | else if (xPos <= getFirstPoint().x)
151 | {
152 | double ret = getFirstPoint().y;
153 | return ret;
154 | }
155 | else if (xPos >= getLastPoint().x)
156 | {
157 | double ret = getLastPoint().y;
158 | return ret;
159 | }
160 | else
161 | {
162 | bool canReturn = false;
163 | double ret = 0.0;
164 | for (int k = 0; k < getNumPoint(); ++k)
165 | {
166 | if (points[k].x <= xPos && points[k+1].x > xPos)
167 | {
168 | const Point& first = points[k];
169 | const Point& last = points[k+1];
170 |
171 | switch (first.interpolation)
172 | {
173 | case InterpolationType::Linear:
174 | ret = (last.y - first.y) / (last.x - first.x) * (xPos - first.x) + first.y;
175 | canReturn = true;
176 | break;
177 | case InterpolationType::Sigmoid:
178 | {
179 | double x = normalizeValue(xPos, first.x, last.x);
180 | double y = 0.0;
181 | auto calcSigmoid = [](double a, double x) { return 1.0 / (1.0 + exp(-1.0 * a * x)); };
182 | if (first.param1 == 0.0)
183 | {
184 | // same as linear
185 | y = (last.y - first.y) * x + first.y;
186 | }
187 | else
188 | {
189 | // sigmoid
190 | if (first.param1 > 0)
191 | {
192 | y = (2.0 * calcSigmoid(first.param1, x) - 1) / (2.0 * calcSigmoid(first.param1, 1) - 1);
193 | }
194 | else
195 | {
196 | y = (calcSigmoid(first.param1, x - 1.0) - calcSigmoid(first.param1, -1.0)) / (calcSigmoid(first.param1, 0.0) - calcSigmoid(first.param1, -1.0));
197 | }
198 |
199 | y = denormalizeValue(y, first.y, last.y);
200 | }
201 | ret = y;
202 | canReturn = true;
203 | }
204 | break;
205 | case InterpolationType::Step:
206 | ret = first.y;
207 | canReturn = true;
208 | break;
209 | default:
210 | break;
211 | }
212 | }
213 | if (canReturn == true)
214 | {
215 | return ret;
216 | }
217 | }
218 | }
219 |
220 | return 0.0;
221 | }
222 | double getXRange()
223 | {
224 | if (points.size() < 2)
225 | {
226 | return 0.0;
227 | }
228 | return (--points.end())->x - points.begin()->x;
229 | }
230 | double getYRange()
231 | {
232 | if (points.size() < 2)
233 | {
234 | return 0.0;
235 | }
236 | double max = points.begin()->y; double min = points.begin()->y;
237 | for (const auto& i : points)
238 | {
239 | if (i.y > max) max = i.y;
240 | if (i.y < min) min = i.y;
241 | }
242 | return max - min;
243 | }
244 | size_t getNumPoint() { return points.size(); }
245 | Point& getPoint(size_t index)
246 | {
247 | // Index is out of range
248 | assert(index < points.size());
249 |
250 | return points[index];
251 | }
252 | Point& getFirstPoint()
253 | {
254 | if (points.size() == 0)
255 | {
256 | // No point in points
257 | assert(true);
258 | }
259 | return points[0];
260 | }
261 | Point& getLastPoint()
262 | {
263 | if (points.size() == 0)
264 | {
265 | // No point in points
266 | assert(false);
267 | }
268 | if (points.size() == 1)
269 | {
270 | return points[0];
271 | }
272 | return points[points.size()-1];
273 | }
274 |
275 | const std::string& getName() { return name_; }
276 |
277 | void sortPoints()
278 | {
279 | std::sort(points.begin(), points.end(), [](Point& l, Point& r) { return l.x < r.x; });
280 | }
281 | void clearPoints()
282 | {
283 | points.clear();
284 | }
285 | };
286 |
287 | struct CachedEnvelopeGenerator : public EnvelopeGenerator
288 | {
289 | double resolution_ = 0.001;
290 | double prevLength = 0.0;
291 | std::vector buffer;
292 |
293 | public:
294 | void setResolution(double res)
295 | {
296 | resolution_ = res;
297 | }
298 |
299 | double getResolution()
300 | {
301 | return resolution_;
302 | }
303 |
304 | double getCachedInterpolatitonValue(double xPos)
305 | {
306 | if (buffer.size() == 0)
307 | {
308 | return 0.0;
309 | }
310 | else if (xPos <= 0.0)
311 | {
312 | return *buffer.begin();
313 | }
314 | else if (xPos >= buffer.size() * resolution_)
315 | {
316 | return *(--buffer.end());
317 | }
318 | else
319 | {
320 | size_t index = std::floor(xPos / resolution_);
321 | double dy = buffer[std::clamp(index + 1, 0, buffer.size()-1)] - buffer[index];
322 | return dy / resolution_ * (xPos - index * resolution_) + buffer[index];
323 | }
324 | }
325 |
326 | // if endXPos < 0, render till last
327 | void render(double startXPos = 0.0, double endXPos = -1.0)
328 | {
329 | double length = getLastPoint().x;
330 | double curPos = 0;
331 |
332 | // resize vector
333 | if (length != prevLength)
334 | {
335 | buffer.resize(getLastPoint().x / resolution_ + 1);
336 | }
337 |
338 | size_t endIndex = endXPos < 0.0 ? buffer.size() - 1 : endXPos / resolution_;
339 |
340 | for (size_t i = (startXPos / resolution_); i < endIndex; ++i)
341 | {
342 | buffer[i] = getInterpolatedValue(curPos);
343 | curPos += resolution_;
344 | }
345 |
346 | // buf of last point to get better soundings
347 | buffer[buffer.size() - 1] = getLastPoint().y;
348 | }
349 | };
350 | }
351 | }
--------------------------------------------------------------------------------
/Source/Envelope_Editor.cpp:
--------------------------------------------------------------------------------
1 | #include "Envelope_Editor.h"
2 |
3 | myplug::envelope::EnvelopeEditor::EnvelopeEditor()
4 | : pointEditScroll_(false)
5 | , pointEdit_(envManager_)
6 | {
7 | pointEdit_.setFramesPerSecond(60);
8 | pointEdit_.setCallbackWhenShownRangeChanged([&]() {this->updateScrollBarRange(); });
9 | pointEdit_.getGridDataRef().verticalGridSubdiv = 4;
10 | pointEdit_.getGridDataRef().horizontalGridInterval = 0.25;
11 | pointEditScroll_.setAutoHide(false);
12 | showgridButton_.setButtonText("Show Grid");
13 | showgridButton_.setToggleState(true, juce::NotificationType::sendNotification);
14 | snapgridButton_.setButtonText("Snap to Grid");
15 | snapgridButton_.setToggleState(true, juce::NotificationType::sendNotification);
16 |
17 | label_griddiv_.setText("Grid Division", juce::NotificationType::dontSendNotification);
18 | spin_griddivY_.setPrefix("Y ");
19 | spin_griddivY_.setNumber(4);
20 | spin_griddivY_.setMinimum(1);
21 | spin_griddivY_.setMaximum(16);
22 | spin_griddivY_.addListener(this);
23 | spin_griddivX_.setPrefix("X ");
24 | spin_griddivX_.setNumber(4);
25 | spin_griddivX_.setMinimum(1);
26 | spin_griddivX_.setMaximum(16);
27 | spin_griddivX_.addListener(this);
28 |
29 | showgridButton_.addListener(this);
30 | snapgridButton_.addListener(this);
31 |
32 | addAndMakeVisible(pointEdit_);
33 | addAndMakeVisible(pointEditScroll_);
34 | addAndMakeVisible(showgridButton_);
35 | addAndMakeVisible(snapgridButton_);
36 | addAndMakeVisible(label_griddiv_);
37 | addAndMakeVisible(spin_griddivY_);
38 | addAndMakeVisible(spin_griddivX_);
39 |
40 | pointEditScroll_.addListener(this);
41 | }
42 |
43 | myplug::envelope::EnvelopeEditor::~EnvelopeEditor()
44 | {
45 | showgridButton_.removeListener(this);
46 | snapgridButton_.removeListener(this);
47 | pointEditScroll_.removeListener(this);
48 | }
49 |
50 | void myplug::envelope::EnvelopeEditor::paint(juce::Graphics& g)
51 | {
52 | g.setColour(juce::Colour(0.0f, 0.0f, 0.1f, 1.0f));
53 | g.fillAll();
54 | }
55 |
56 | void myplug::envelope::EnvelopeEditor::resized()
57 | {
58 | // Set PointEdit Bounds
59 | const int border = 10;
60 | const int margin = 5;
61 | auto pointEditBounds = getLocalBounds().reduced(border, border).withTrimmedBottom(50);
62 | pointEdit_.setBounds(pointEditBounds);
63 | pointEditScroll_.setBounds(pointEditBounds.withPosition(pointEditBounds.getX(), pointEditBounds.getHeight() + pointEditBounds.getY() + margin).withHeight(10));
64 |
65 | // Buttons
66 | double footerYPos = getLocalBounds().getHeight() - 32;
67 | showgridButton_.setSize(100,20);
68 | showgridButton_.setTopLeftPosition(border, footerYPos);
69 | snapgridButton_.setSize(100, 20);
70 | snapgridButton_.setTopLeftPosition(border + 100, footerYPos);
71 |
72 | label_griddiv_.setBounds(border + 250, footerYPos, 100, 20);
73 | spin_griddivY_.setBounds(border + 350, footerYPos, 50, 20);
74 | spin_griddivX_.setBounds(border + 410, footerYPos, 50, 20);
75 |
76 | // Adjust ScrollBar Range
77 | updateScrollBarRange();
78 | }
79 |
80 | void myplug::envelope::EnvelopeEditor::updateScrollBarRange()
81 | {
82 | if (envManager_ != nullptr)
83 | {
84 | if (envManager_->getEnvGeneratorPtr() == nullptr) return;
85 |
86 | auto pointsPtr = envManager_->getEnvGeneratorPtr();
87 | if (pointsPtr->getNumPoint() <= 1)
88 | {
89 | pointEditScroll_.setRangeLimits(0.0, 1.0);
90 | pointEditScroll_.setCurrentRange(0.0, 1.0);
91 | }
92 | else
93 | {
94 | pointEditScroll_.setRangeLimits(0.0, pointEdit_.getZoomedWidth());
95 | pointEditScroll_.setCurrentRange(pointEdit_.getOffsetX(), pointEdit_.getLocalBounds().getWidth());
96 | }
97 | }
98 | }
99 |
100 | void myplug::envelope::EnvelopeEditor::scrollBarMoved(juce::ScrollBar*, double newRangeStart)
101 | {
102 | pointEdit_.setOffsetX(newRangeStart);
103 | }
104 |
105 | void myplug::envelope::EnvelopeEditor::buttonClicked(juce::Button* button)
106 | {
107 | if (button == &showgridButton_)
108 | {
109 | if (showgridButton_.getToggleState())
110 | {
111 | pointEdit_.getGridDataRef().isHorizontalGridVisible = true;
112 | pointEdit_.getGridDataRef().isVerticalGridVisible = true;
113 | }
114 | else
115 | {
116 | pointEdit_.getGridDataRef().isHorizontalGridVisible = false;
117 | pointEdit_.getGridDataRef().isVerticalGridVisible = false;
118 | }
119 | }
120 | else if (button == &snapgridButton_)
121 | {
122 | if (snapgridButton_.getToggleState())
123 | {
124 | pointEdit_.setSnap(true);
125 | }
126 | else
127 | {
128 | pointEdit_.setSnap(false);
129 | }
130 | }
131 | }
132 |
133 | void myplug::envelope::EnvelopeEditor::onNumberChanged(NumericSpinBox* spinbox)
134 | {
135 | if (spinbox == &spin_griddivY_)
136 | {
137 | pointEdit_.getGridDataRef().verticalGridSubdiv = spin_griddivY_.getCurrentNumber();
138 | }
139 | else if (spinbox == &spin_griddivX_)
140 | {
141 | pointEdit_.getGridDataRef().horizontalGridInterval = 1.0 / spin_griddivX_.getCurrentNumber();
142 | }
143 | }
144 |
--------------------------------------------------------------------------------
/Source/Envelope_Editor.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "Envelope_Fwd.h"
5 | #include "Envelope_Data.h"
6 | #include "Envelope_Manager.h"
7 | #include "Envelope_PointEditMultiband.h"
8 | #include "Component_NumericSpinbox.h"
9 |
10 | namespace myplug
11 | {
12 | namespace envelope
13 | {
14 | class EnvelopeEditor : public juce::Component, public juce::ScrollBar::Listener, public juce::ToggleButton::Listener, public NumericSpinBox::Listener
15 | {
16 | public:
17 | PointEditMB pointEdit_;
18 |
19 | private:
20 | EnvelopeManager* envManager_ = nullptr;
21 |
22 | // Controls
23 | juce::ScrollBar pointEditScroll_;
24 | juce::ToggleButton showgridButton_;
25 | juce::ToggleButton snapgridButton_;
26 | juce::Label label_griddiv_;
27 | myplug::NumericSpinBox spin_griddivY_;
28 | myplug::NumericSpinBox spin_griddivX_;
29 |
30 | public:
31 | EnvelopeEditor();
32 | ~EnvelopeEditor();
33 |
34 | void paint(juce::Graphics& g) override;
35 | void resized() override;
36 | void updateScrollBarRange();
37 |
38 | void fitToEnvelope()
39 | {
40 | pointEdit_.setZoomRateToWholeRange();
41 | updateScrollBarRange();
42 | }
43 | void setEnvelopeManager(EnvelopeManager* envManager)
44 | {
45 | envManager_ = envManager;
46 | pointEdit_.setNewEnvelopeManager(envManager);
47 | updateScrollBarRange();
48 | }
49 |
50 | EnvelopeManager* const getEnvelopeManager() { return envManager_; }
51 |
52 | void scrollBarMoved(juce::ScrollBar* scrollBarThatHasMoved, double newRangeStart) override;
53 | void buttonClicked(juce::Button* button) override;
54 | void onNumberChanged(NumericSpinBox*) override;
55 | };
56 | }
57 | }
--------------------------------------------------------------------------------
/Source/Envelope_Fwd.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace myplug
4 | {
5 | namespace envelope
6 | {
7 | class EnvelopeVoiceController;
8 | class EnvelopeManager;
9 | class PointEditListener;
10 | class PointEdit;
11 | class PointEditMBListener;
12 | class PointEditMB;
13 | }
14 | }
--------------------------------------------------------------------------------
/Source/Envelope_Manager.cpp:
--------------------------------------------------------------------------------
1 | #include "Envelope_Manager.h"
2 | #include "Envelope_VoiceController.h"
3 |
4 | void myplug::envelope::EnvelopeManager::registerEnvGenerator(CachedEnvelopeGenerator* envGenerator)
5 | {
6 | envGenerator_.push_back(envGenerator);
7 | }
8 |
9 | void myplug::envelope::EnvelopeManager::removeEnvGenerator(CachedEnvelopeGenerator* envGenerator)
10 | {
11 | envGenerator_.erase(std::remove(envGenerator_.begin(), envGenerator_.end(), envGenerator), envGenerator_.end());
12 | }
13 |
14 | void myplug::envelope::EnvelopeManager::clearEnvVoices()
15 | {
16 | envControllers_.clear();
17 | }
18 |
19 | void myplug::envelope::EnvelopeManager::addEnvVoiceController(EnvelopeVoiceController* envVoice)
20 | {
21 | if (envVoice != nullptr)
22 | {
23 | envControllers_.push_back(envVoice);
24 | envVoice->setManagerPtr(this);
25 | }
26 | }
27 |
28 | void myplug::envelope::EnvelopeManager::removeEnvVoiceController(EnvelopeVoiceController* envVoice)
29 | {
30 | envVoice->setManagerPtr(nullptr);
31 | envControllers_.erase(std::remove(envControllers_.begin(), envControllers_.end(), envVoice), envControllers_.end());
32 | }
33 |
34 | void myplug::envelope::EnvelopeManager::setRate(double rate)
35 | {
36 | envelopeRate_ = rate;
37 | for (const auto& i : envControllers_)
38 | {
39 | i->notifyRateHasChanged();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Source/Envelope_Manager.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "Envelope_Fwd.h"
4 | #include "Envelope_Data.h"
5 |
6 | #include
7 |
8 | namespace myplug
9 | {
10 | namespace envelope
11 | {
12 | enum class LoopMode
13 | {
14 | Oneshot,
15 | Loop,
16 | PingpongLoop,
17 | LoopThenRelease,
18 | PingPongLoopThenRelease,
19 | LoopThenJumptoRelease,
20 | PingPongLoopThenJumptoRelease,
21 | };
22 |
23 | class EnvelopeManager
24 | {
25 | std::vector envGenerator_;
26 | std::vector envControllers_;
27 | LoopMode loopMode_ = LoopMode::Oneshot;
28 |
29 | double envelopeRate_ = 1.0;
30 | double envelopeAttackTime_ = 0.0;
31 |
32 | public:
33 | void registerEnvGenerator(CachedEnvelopeGenerator* envGenerator);
34 | void removeEnvGenerator(CachedEnvelopeGenerator* envGenerator);
35 | void clearEnvVoices();
36 |
37 | void addEnvVoiceController(EnvelopeVoiceController* envVoice);
38 | void removeEnvVoiceController(EnvelopeVoiceController* envVoice);
39 |
40 | void setRate(double rate);
41 | void setAttackTime(double time) { envelopeAttackTime_ = time; }
42 | void setLoopMode(LoopMode mode) { loopMode_ = mode; }
43 |
44 | double getRate() { return envelopeRate_; }
45 | double getAttackTime() { return envelopeAttackTime_; }
46 | LoopMode getLoopMode() { return loopMode_; }
47 | CachedEnvelopeGenerator* getEnvGeneratorPtr()
48 | {
49 | if (envGenerator_.size() == 0)
50 | {
51 | return nullptr;
52 | }
53 | return *envGenerator_.begin();
54 | }
55 |
56 | CachedEnvelopeGenerator* getSpecificEnvGeneratorPtrFromName(const std::string& name)
57 | {
58 | for (const auto& i : envGenerator_)
59 | {
60 | if (i->getName() == name)
61 | {
62 | return i;
63 | }
64 | }
65 | return nullptr;
66 | }
67 | std::vector& getEnvGeneratorsPtr() { return envGenerator_; }
68 | std::vector& getVoiceControllerRef() { return envControllers_; }
69 | };
70 | }
71 | }
--------------------------------------------------------------------------------
/Source/Envelope_PointEdit.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "Envelope_PointEdit.h"
3 | #include "Envelope_VoiceController.h"
4 |
5 | //
6 | // PointEdit Component
7 | //
8 |
9 | double myplug::envelope::PointEdit::calcScreenXPos(double x)
10 | {
11 | return x * zoomRate_ - offsetX_;
12 | }
13 |
14 | double myplug::envelope::PointEdit::calcEnvGenXPos(double x)
15 | {
16 | return (x + offsetX_) / zoomRate_;
17 | }
18 |
19 | double myplug::envelope::PointEdit::calcScreenYPos(double y)
20 | {
21 | return y * getLocalBounds().getHeight() * (-1.0) + getLocalBounds().getHeight();
22 | }
23 |
24 | double myplug::envelope::PointEdit::calcEnvGenYPos(double y)
25 | {
26 | return (-y + getLocalBounds().getHeight()) / getLocalBounds().getHeight();
27 | }
28 |
29 | void myplug::envelope::PointEdit::setZoomRateToWholeRange()
30 | {
31 | if (envManager_ == nullptr) return;
32 | if (envManager_->getEnvGeneratorPtr() == nullptr) return;
33 |
34 | offsetX_ = 0.0;
35 | zoomRate_ = getLocalBounds().getWidth() / envManager_->getEnvGeneratorPtr()->getXRange();
36 | baseZoomRate_ = zoomRate_;
37 | }
38 |
39 | double myplug::envelope::PointEdit::getZoomedWidth()
40 | {
41 | if (envManager_ == nullptr) return 0.0;
42 | if (envManager_->getEnvGeneratorPtr() == nullptr) return 0.0;
43 |
44 | auto pointsPtr = envManager_->getEnvGeneratorPtr();
45 | return zoomRate_ * pointsPtr->getLastPoint().x;
46 | }
47 |
48 |
49 | void myplug::envelope::PointEdit::updateHandleIntersectionInfo(const juce::MouseEvent& e)
50 | {
51 | mouseIntersectedBranchIndex_ = -1;
52 | mouseIntersectedHandleIndex_ = -1;
53 |
54 | // Handle intersection test
55 | const auto& envGen = envManager_->getEnvGeneratorPtr();
56 | auto pointsPtr = envManager_->getEnvGeneratorPtr();
57 | const auto& localBounds = getLocalBounds();
58 | int index = 0;
59 | for (int k = 0; k < envGen->getNumPoint(); ++k)
60 | {
61 | auto& i = envGen->getPoint(k);
62 | juce::Path circle;
63 | circle.addEllipse(
64 | calcScreenXPos(i.x) - circleRadius_,
65 | calcScreenYPos(i.y) - circleRadius_,
66 | circleRadius_ * 2.0,
67 | circleRadius_ * 2.0);
68 | if (circle.contains(e.x, e.y))
69 | {
70 | mouseIntersectedHandleIndex_ = index;
71 | break;
72 | }
73 |
74 | index++;
75 | }
76 |
77 | // Branch Intersection Test
78 | const double heighttolerance = 20.0;
79 | auto yPos = calcScreenYPos(envGen->getInterpolatedValue(calcEnvGenXPos(e.position.x)));
80 | if (abs(yPos - e.position.y) <= heighttolerance && mouseIntersectedHandleIndex_ < 0)
81 | {
82 | mouseIntersectedBranchIndex_ = envGen->getLeftPointIndex(calcEnvGenXPos(e.position.x));
83 | }
84 |
85 | // Bounds Intersection Test
86 | if (getLocalBounds().contains(e.position.toInt()))
87 | {
88 | isMouseOnBounds_ = true;
89 | }
90 | else
91 | {
92 | isMouseOnBounds_ = false;
93 | }
94 | }
95 |
96 | void myplug::envelope::PointEdit::updateGridIntersectionInfo(const juce::MouseEvent& e)
97 | {
98 | mouseIntersectedHGridIndex_ = -1;
99 | mouseIntersectedVGridIndex_ = -1;
100 |
101 | const auto& localBounds = getLocalBounds();
102 |
103 | // Grid Intersection Test
104 | if (snapToGrid_)
105 | {
106 | // Horizontally
107 | if (grid_.isHorizontalGridVisible || grid_.isHorizontalSubGridVisible)
108 | {
109 | double xInterval = grid_.horizontalGridInterval;
110 | double maxWidth = std::max(getZoomedWidth(), localBounds.getWidth());
111 | if (grid_.isHorizontalSubGridVisible)
112 | {
113 | xInterval /= grid_.horizontalSubGridSubdiv;
114 | }
115 | for (int i = 0; i <= maxWidth / xInterval / zoomRate_; ++i)
116 | {
117 | if (abs(e.x - calcScreenXPos(xInterval * i)) <= snapDistance_)
118 | {
119 | mouseIntersectedHGridIndex_ = i;
120 | }
121 | }
122 | }
123 |
124 | // Vertically
125 | if (grid_.isVerticalGridVisible || grid_.isVerticalSubGridVisible)
126 | {
127 | double yInterval = 1.0 * localBounds.getHeight() / grid_.verticalGridSubdiv;
128 | if (grid_.isVerticalSubGridVisible)
129 | {
130 | yInterval /= grid_.verticalSubGridSubdiv;
131 | }
132 | for (int i = 0; i <= localBounds.getHeight() / yInterval; ++i)
133 | {
134 | if (abs(e.y - (yInterval * i)) <= snapDistance_)
135 | {
136 | mouseIntersectedVGridIndex_ = i;
137 | }
138 | }
139 | }
140 | }
141 | }
142 |
143 | myplug::envelope::PointEdit::PointEdit(EnvelopeManager* envManager) : envManager_(envManager)
144 | {
145 | }
146 |
147 | void myplug::envelope::PointEdit::paint(juce::Graphics& g)
148 | {
149 | g.setColour(juce::Colour(0.0f, 0.0f, 0.15f, 1.0f));
150 | g.fillAll();
151 |
152 | // Debugging
153 | /*
154 | g.setColour(juce::Colours::white);
155 | juce::String str;
156 | str << "HGrid:" << mouseIntersectedHGridIndex_ << "\nVGrid:" << mouseIntersectedVGridIndex_;
157 | g.drawText(str, 0.0, 0.0, 300.0, 10.0, juce::Justification::topLeft);
158 | */
159 |
160 | if (envManager_ == nullptr)
161 | {
162 | g.setColour(juce::Colours::white);
163 | juce::String text_nothing{ "There's nothing to draw." };
164 | juce::Rectangle textArea{ g.getCurrentFont().getStringWidth(text_nothing), 10 };
165 | textArea.setPosition(getLocalBounds().getCentreX() - textArea.getWidth() / 2, getLocalBounds().getCentreY() - textArea.getHeight() / 2);
166 | g.drawText(text_nothing, textArea, juce::Justification::centredLeft);
167 |
168 | }
169 | else
170 | {
171 | auto envgen = envManager_->getEnvGeneratorPtr();
172 | const auto& localBounds = getLocalBounds();
173 | double previousXPosition = 0.0;
174 | envelope::Point initPoint;
175 | envelope::Point& previousPoint = initPoint;
176 | int index = 0;
177 |
178 | // Draw Grids
179 | if (grid_.isHorizontalGridVisible)
180 | {
181 | g.setColour(juce::Colour(0.0f, 0.0f, 0.3f, 1.0f));
182 | double maxWidth = std::max(getZoomedWidth(), localBounds.getWidth());
183 | for (int w = 0; w < maxWidth / grid_.horizontalGridInterval / zoomRate_; ++w)
184 | {
185 | double xPos = w * grid_.horizontalGridInterval;
186 | g.drawLine(calcScreenXPos(xPos), 0.0, calcScreenXPos(xPos), localBounds.getHeight(), 1.0f);
187 | }
188 | }
189 | if (grid_.isHorizontalSubGridVisible)
190 | {
191 | g.setColour(juce::Colour(0.0f, 0.0f, 0.20f, 1.0f));
192 | double interval = grid_.horizontalGridInterval / grid_.horizontalSubGridSubdiv;
193 | double maxWidth = std::max(getZoomedWidth(), localBounds.getWidth());
194 | for (int w = 0; w < maxWidth / interval / zoomRate_; ++w)
195 | {
196 | double xPos = w * interval;
197 | g.drawLine(calcScreenXPos(xPos), 0.0, calcScreenXPos(xPos), localBounds.getHeight(), 1.0f);
198 | }
199 | }
200 | if (grid_.isVerticalGridVisible)
201 | {
202 | g.setColour(juce::Colour(0.0f, 0.0f, 0.3f, 1.0f));
203 | double interval = 1.0 * localBounds.getHeight() / grid_.verticalGridSubdiv;
204 | for (int h = 0; h < grid_.verticalGridSubdiv - 1; ++h)
205 | {
206 | double yPos = h * interval + interval;
207 | g.drawLine(0.0, yPos, localBounds.getWidth(), yPos, 1.0f);
208 | }
209 | }
210 | if (grid_.isVerticalSubGridVisible)
211 | {
212 | g.setColour(juce::Colour(0.0f, 0.0f, 0.20f, 1.0f));
213 | double interval = 1.0 * localBounds.getHeight() / grid_.verticalSubGridSubdiv / grid_.verticalGridSubdiv;
214 | for (int h = 0; h < (grid_.verticalGridSubdiv * grid_.verticalSubGridSubdiv) - 1; ++h)
215 | {
216 | double yPos = h * interval + interval;
217 | g.drawLine(0.0, yPos, localBounds.getWidth(), yPos, 1.0f);
218 | }
219 | }
220 |
221 | // Draw Grid Units
222 | {
223 | const int border = 5;
224 | const int textHeight = 10;
225 | if (grid_.isHorizontalGridVisible)
226 | {
227 | g.setColour(juce::Colour(0.0f, 0.0f, 0.5f, 1.0f));
228 | double maxWidth = std::max(getZoomedWidth(), localBounds.getWidth());
229 | for (int w = 0; w < maxWidth / grid_.horizontalGridInterval / zoomRate_; ++w)
230 | {
231 | double xPos = w * grid_.horizontalGridInterval;
232 | g.drawText(
233 | grid_.horizontalLabel(w),
234 | calcScreenXPos(xPos) + border + (w == 0 ? 10 : 0),
235 | localBounds.getHeight() - border - textHeight,
236 | grid_.horizontalGridInterval * zoomRate_ - border * 2.0,
237 | textHeight,
238 | juce::Justification::topLeft);
239 | }
240 | }
241 | if (grid_.isVerticalGridVisible)
242 | {
243 | g.setColour(juce::Colour(0.0f, 0.0f, 0.5f, 1.0f));
244 | double interval = 1.0 * localBounds.getHeight() / grid_.verticalGridSubdiv;
245 | int gridCount = grid_.verticalGridSubdiv;
246 | if (grid_.isVerticalSubGridVisible)
247 | {
248 | gridCount *= grid_.verticalSubGridSubdiv;
249 | interval /= grid_.verticalSubGridSubdiv;
250 | }
251 | for (int h = 0; h < gridCount; ++h)
252 | {
253 | double yPos = (gridCount - h) * interval;
254 | g.drawText(
255 | grid_.verticalLabel(h),
256 | border,
257 | yPos - textHeight - border - (h == 0 ? 10 : 0),
258 | 200.0,
259 | textHeight,
260 | juce::Justification::topLeft);
261 | }
262 | }
263 | }
264 |
265 | // Draw VoicePos Indicator
266 | g.setColour(juce::Colours::grey);
267 | for (const auto& i : envManager_->getVoiceControllerRef())
268 | {
269 | g.drawLine(
270 | calcScreenXPos(i->getXPos()),
271 | 0.0,
272 | calcScreenXPos(i->getXPos()),
273 | getHeight(),
274 | 2.0f
275 | );
276 | }
277 |
278 |
279 | for (int k = 0; k < envgen->getNumPoint(); ++k)
280 | {
281 | auto& i = envgen->getPoint(k);
282 | // Draw interpolated lines
283 |
284 | // Skip when segments and a branch is out of the bounds.
285 | if (calcScreenXPos(i.x) < localBounds.getX() || calcScreenXPos(previousPoint.x) > localBounds.getWidth())
286 | {
287 | previousXPosition = i.x * zoomRate_;
288 | previousPoint = i;
289 | index++;
290 | continue;
291 | }
292 |
293 |
294 | double linethickness = (index - 1) == mouseIntersectedBranchIndex_ ? 3.0 : 1.0;
295 |
296 | switch (previousPoint.interpolation)
297 | {
298 | case InterpolationType::Linear:
299 | g.setColour(juce::Colours::white);
300 | g.drawLine(
301 | calcScreenXPos(previousPoint.x),
302 | calcScreenYPos(previousPoint.y),
303 | calcScreenXPos(i.x),
304 | calcScreenYPos(i.y),
305 | linethickness);
306 | break;
307 | case InterpolationType::Sigmoid:
308 | {
309 | double plotInterval = 3 / zoomRate_;
310 | double length = i.x - previousPoint.x;
311 | double prevX = previousPoint.x;
312 | double nextX = std::clamp(prevX + plotInterval, 0.0, i.x);
313 | g.setColour(juce::Colours::white);
314 |
315 | // when previousPoint.x == i.x, getInterpolatedValue(prevX) and getInterpolatedValue(nextX) will return the same value.
316 | if (previousPoint.x == i.x)
317 | {
318 | g.drawLine(
319 | calcScreenXPos(previousPoint.x),
320 | calcScreenYPos(previousPoint.y),
321 | calcScreenXPos(i.x),
322 | calcScreenYPos(i.y),
323 | linethickness);
324 | }
325 | else
326 | {
327 | juce::Path stroke;
328 | juce::PathStrokeType strokeType(linethickness, juce::PathStrokeType::JointStyle::curved);
329 | stroke.startNewSubPath(calcScreenXPos(prevX), calcScreenYPos(envManager_->getEnvGeneratorPtr()->getInterpolatedValue(prevX)));
330 |
331 | while (length >= 0)
332 | {
333 | stroke.lineTo(calcScreenXPos(nextX), calcScreenYPos(envManager_->getEnvGeneratorPtr()->getInterpolatedValue(nextX)));
334 |
335 | //prevX = nextX;
336 | nextX = std::clamp(nextX + plotInterval, 0.0, i.x - 0.0000001);
337 |
338 | length = length - plotInterval;
339 | }
340 | g.strokePath(stroke, strokeType);
341 | }
342 | }
343 | break;
344 | case InterpolationType::Step:
345 | g.setColour(juce::Colours::white);
346 | g.drawLine(
347 | calcScreenXPos(previousPoint.x),
348 | calcScreenYPos(previousPoint.y),
349 | calcScreenXPos(i.x),
350 | calcScreenYPos(previousPoint.y),
351 | linethickness);
352 | g.drawLine(
353 | calcScreenXPos(i.x),
354 | calcScreenYPos(previousPoint.y),
355 | calcScreenXPos(i.x),
356 | calcScreenYPos(i.y),
357 | linethickness);
358 | break;
359 | default:
360 | break;
361 | }
362 |
363 | // Draw segments
364 | if (isMouseOnBounds_)
365 | {
366 | g.setColour(juce::Colours::white);
367 | g.drawEllipse(
368 | calcScreenXPos(i.x) - circleRadius_,
369 | calcScreenYPos(i.y) - circleRadius_,
370 | circleRadius_ * 2.0,
371 | circleRadius_ * 2.0,
372 | 1.0);
373 | if (index == mouseIntersectedHandleIndex_)
374 | {
375 | g.setColour(juce::Colours::mediumpurple);
376 | g.fillEllipse(
377 | calcScreenXPos(i.x) - circleRadius_,
378 | calcScreenYPos(i.y) - circleRadius_,
379 | circleRadius_ * 2.0,
380 | circleRadius_ * 2.0
381 | );
382 | }
383 | }
384 |
385 | previousXPosition = i.x * zoomRate_;
386 | previousPoint = i;
387 | index++;
388 | }
389 | }
390 | }
391 |
392 | void myplug::envelope::PointEdit::update()
393 | {
394 | this->repaint();
395 |
396 | // Change Mouse Cursor
397 | if (mouseIntersectedHandleIndex_ >= 0)
398 | {
399 | setMouseCursor(juce::MouseCursor::PointingHandCursor);
400 | }
401 | else if (mouseIntersectedBranchIndex_ >= 0)
402 | {
403 | setMouseCursor(juce::MouseCursor::UpDownResizeCursor);
404 | }
405 | else
406 | {
407 | setMouseCursor(juce::MouseCursor::NormalCursor);
408 | }
409 | //updateScrollBarRange();
410 | }
411 |
412 | void myplug::envelope::PointEdit::resized()
413 | {
414 |
415 | }
416 |
417 | void myplug::envelope::PointEdit::mouseMove(const juce::MouseEvent& e)
418 | {
419 | updateHandleIntersectionInfo(e);
420 | updateGridIntersectionInfo(e);
421 | prevMousePos = e.position;
422 | }
423 |
424 | void myplug::envelope::PointEdit::mouseDown(const juce::MouseEvent& e)
425 | {
426 | if (e.source.getCurrentModifiers().isRightButtonDown())
427 | {
428 | if (mouseIntersectedHandleIndex_ >= 0)
429 | {
430 | juce::PopupMenu m;
431 | juce::PopupMenu::Options option;
432 | auto envgen = envManager_->getEnvGeneratorPtr();
433 | m.addSectionHeader("Shape");
434 | m.addItem(1, "Linear");
435 | m.addItem(2, "Step");
436 | m.addItem(3, "Curve");
437 |
438 | auto pointsPtr = envManager_->getEnvGeneratorPtr();
439 |
440 | if ((mouseIntersectedHandleIndex_ > 0 && mouseIntersectedHandleIndex_ < pointsPtr->getNumPoint() - 1) || (mouseIntersectedHandleIndex_ == pointsPtr->getNumPoint() - 1 && isEndPointMovableHorizontally == true))
441 | {
442 | m.addSeparator();
443 | m.addItem(4, "Delete Point");
444 | }
445 | m.showMenuAsync(option, [&](int i)
446 | {
447 | auto pointsPtr = envManager_->getEnvGeneratorPtr();
448 | if (mouseIntersectedHandleIndex_ < 0) { return; }
449 | switch (i)
450 | {
451 | case 1:
452 | pointsPtr->getPoint(mouseIntersectedHandleIndex_).interpolation = envelope::InterpolationType::Linear;
453 | break;
454 | case 2:
455 | pointsPtr->getPoint(mouseIntersectedHandleIndex_).interpolation = envelope::InterpolationType::Step;
456 | break;
457 | case 3:
458 | pointsPtr->getPoint(mouseIntersectedHandleIndex_).interpolation = envelope::InterpolationType::Sigmoid;
459 | break;
460 | case 4:
461 | pointsPtr->removePoint(mouseIntersectedHandleIndex_);
462 | pointsPtr->render();
463 | default:
464 | break;
465 | }
466 | callAllListeners();
467 | });
468 | }
469 | }
470 | }
471 |
472 | void myplug::envelope::PointEdit::mouseDrag(const juce::MouseEvent& e)
473 | {
474 | auto pointsPtr = envManager_->getEnvGeneratorPtr();
475 |
476 | // LMB is Down
477 | if (e.source.getCurrentModifiers().isLeftButtonDown())
478 | {
479 | // Move Handles
480 | // X
481 | if (mouseIntersectedHandleIndex_ >= 0)
482 | {
483 | if (0 < mouseIntersectedHandleIndex_ && mouseIntersectedHandleIndex_ < pointsPtr->getNumPoint() - 1)
484 | {
485 | // Clamp or move the specified handle
486 | auto& prevPointPosX = pointsPtr->getPoint(mouseIntersectedHandleIndex_ - 1).x;
487 | auto& midPointPosX = pointsPtr->getPoint(mouseIntersectedHandleIndex_).x;
488 | auto& nextPointPosX = pointsPtr->getPoint(mouseIntersectedHandleIndex_ + 1).x;
489 |
490 | if (calcScreenXPos(prevPointPosX) < e.x && e.x < calcScreenXPos(nextPointPosX))
491 | {
492 | if (mouseIntersectedHGridIndex_ >= 0)
493 | {
494 | // Snap
495 | double xInterval = grid_.horizontalGridInterval;
496 | if (grid_.isHorizontalSubGridVisible)
497 | {
498 | xInterval /= grid_.horizontalSubGridSubdiv;
499 | }
500 |
501 | midPointPosX = xInterval * mouseIntersectedHGridIndex_;
502 | }
503 | else
504 | {
505 | midPointPosX = calcEnvGenXPos(e.x);
506 | }
507 | }
508 | else if (calcScreenXPos(prevPointPosX) >= e.x)
509 | {
510 | midPointPosX = prevPointPosX;
511 | }
512 | else if (calcScreenXPos(nextPointPosX) <= e.x)
513 | {
514 | midPointPosX = nextPointPosX;
515 | }
516 | }
517 | else if (mouseIntersectedHandleIndex_ == 0)
518 | {
519 |
520 | }
521 | else if (mouseIntersectedHandleIndex_ == pointsPtr->getNumPoint() - 1)
522 | {
523 | auto& prevPointPosX = pointsPtr->getPoint(mouseIntersectedHandleIndex_ - 1).x;
524 | auto& lastPointPosX = pointsPtr->getPoint(mouseIntersectedHandleIndex_).x;
525 |
526 | if (isEndPointMovableHorizontally)
527 | {
528 | if (calcScreenXPos(prevPointPosX) < e.x)
529 | {
530 |
531 | lastPointPosX = calcEnvGenXPos(e.x);
532 |
533 | }
534 | else if (calcScreenXPos(prevPointPosX) >= e.x)
535 | {
536 | lastPointPosX = prevPointPosX;
537 | }
538 | }
539 | }
540 | }
541 |
542 | // Y
543 | if (mouseIntersectedHandleIndex_ >= 0)
544 | {
545 | if (mouseIntersectedVGridIndex_ >= 0)
546 | {
547 | // Snap
548 | double yInterval = 1.0 * getLocalBounds().getHeight() / grid_.verticalGridSubdiv;
549 | if (grid_.isHorizontalSubGridVisible)
550 | {
551 | yInterval /= grid_.verticalSubGridSubdiv;
552 | }
553 |
554 | pointsPtr->getPoint(mouseIntersectedHandleIndex_).y = calcEnvGenYPos(yInterval * mouseIntersectedVGridIndex_);
555 | }
556 | else
557 | {
558 | pointsPtr->getPoint(mouseIntersectedHandleIndex_).y = calcEnvGenYPos(std::clamp(e.y, 0.0, getLocalBounds().getHeight()));
559 | }
560 | }
561 |
562 | // Move Braches
563 | if (mouseIntersectedBranchIndex_ >= 0 && mouseIntersectedBranchIndex_ <= pointsPtr->getNumPoint() - 2)
564 | {
565 | auto deltaPos = e.position - prevMousePos;
566 | auto& point = pointsPtr->getPoint(mouseIntersectedBranchIndex_);
567 | const double ySensitivity = 0.05 * pow(1.05, abs(point.param1));
568 | double direction = -1.0;
569 |
570 | if (pointsPtr->getPoint(mouseIntersectedBranchIndex_).y > pointsPtr->getPoint(mouseIntersectedBranchIndex_ + 1).y)
571 | direction = 1.0;
572 |
573 | point.param1 = std::clamp(point.param1 + direction * deltaPos.y * ySensitivity, -100.0, 100.0);
574 | }
575 |
576 | }
577 | // MMB is Down
578 | else if (e.source.getCurrentModifiers().isMiddleButtonDown())
579 | {
580 |
581 | }
582 | pointsPtr->render();
583 | updateGridIntersectionInfo(e);
584 | prevMousePos = e.position;
585 | }
586 |
587 | void myplug::envelope::PointEdit::mouseUp(const juce::MouseEvent& e)
588 | {
589 | updateHandleIntersectionInfo(e);
590 | updateGridIntersectionInfo(e);
591 | callbackWhenShownRangeChanged_();
592 | callAllListeners();
593 | }
594 |
595 | void myplug::envelope::PointEdit::mouseExit(const juce::MouseEvent& e)
596 | {
597 | updateHandleIntersectionInfo(e);
598 | updateGridIntersectionInfo(e);
599 | }
600 |
601 | void myplug::envelope::PointEdit::mouseDoubleClick(const juce::MouseEvent& e)
602 | {
603 | if (e.mods.isLeftButtonDown())
604 | {
605 | auto envgen = envManager_->getEnvGeneratorPtr();
606 | \
607 | if (mouseIntersectedHandleIndex_ > 0)
608 | {
609 | if (mouseIntersectedHandleIndex_ != envgen->getNumPoint() - 1 || isEndPointMovableHorizontally != false)
610 | {
611 | envgen->removePoint(mouseIntersectedHandleIndex_);
612 | }
613 | }
614 | else
615 | {
616 | envgen->addPoint(calcEnvGenXPos(e.x), calcEnvGenYPos(e.y), envelope::InterpolationType::Sigmoid);
617 | }
618 | envgen->render();
619 | callAllListeners();
620 | }
621 | }
622 |
623 | void myplug::envelope::PointEdit::mouseWheelMove(const juce::MouseEvent& e, const juce::MouseWheelDetails& wheel)
624 | {
625 | zoomRate_ = std::clamp(
626 | zoomRate_ + zoomRate_ * wheel.deltaY,
627 | canShrinkBeyondEndPoint_ ? baseZoomRate_ / zoomRateRange_ : baseZoomRate_,
628 | baseZoomRate_ * zoomRateRange_);
629 | callbackWhenShownRangeChanged_();
630 | }
631 |
632 | void myplug::envelope::PointEdit::callAllListeners()
633 | {
634 | for (const auto& i : listener_)
635 | {
636 | i->handleMoved(this);
637 | }
638 | }
639 |
--------------------------------------------------------------------------------
/Source/Envelope_PointEdit.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "Envelope_Fwd.h"
6 | #include "Envelope_Data.h"
7 | #include "Envelope_Manager.h"
8 |
9 | namespace myplug
10 | {
11 | namespace envelope
12 | {
13 | struct GridInfo
14 | {
15 | bool isVerticalGridVisible = true;
16 | bool isVerticalSubGridVisible = false;
17 | bool isHorizontalGridVisible = true;
18 | bool isHorizontalSubGridVisible = false;
19 |
20 | int verticalGridSubdiv = 3;
21 | int verticalSubGridSubdiv = 3;
22 | double horizontalGridInterval = 0.2;
23 | int horizontalSubGridSubdiv = 3;
24 |
25 | std::function verticalLabel = [](int index) -> juce::String { return juce::String{ index }; };
26 | std::function horizontalLabel = [](int index) -> juce::String { return juce::String{ index }; };
27 | };
28 |
29 | class PointEditListener
30 | {
31 | public:
32 | virtual ~PointEditListener() = default;
33 | virtual void handleMoved(PointEdit* p) = 0;
34 | };
35 |
36 | class PointEdit : public juce::AnimatedAppComponent
37 | {
38 | EnvelopeManager* envManager_;
39 | std::function callbackWhenShownRangeChanged_;
40 | std::vector listener_;
41 |
42 | // Zoom & Offset
43 | double zoomRateRange_ = 5.0;
44 | double baseZoomRate_ = 1000.0;
45 | double zoomRate_ = 1000.0;
46 | double offsetX_ = 0.0;
47 |
48 | // Handles
49 | const double circleRadius_ = 7.0;
50 | bool isEndPointMovableHorizontally = true;
51 |
52 | // Mouse
53 | int mouseIntersectedHandleIndex_ = -1;
54 | int mouseIntersectedBranchIndex_ = -1;
55 | int mouseIntersectedHGridIndex_ = -1;
56 | int mouseIntersectedVGridIndex_ = -1;
57 | juce::Point prevMousePos;
58 | bool isMouseDown_ = false;
59 | bool isMouseOnBounds_ = false;
60 | bool canShrinkBeyondEndPoint_ = true;
61 |
62 | GridInfo grid_;
63 | bool snapToGrid_ = true;
64 | double snapDistance_ = 10.0;
65 |
66 | void updateHandleIntersectionInfo(const juce::MouseEvent& e);
67 | void updateGridIntersectionInfo(const juce::MouseEvent& e);
68 |
69 | protected:
70 | void paint(juce::Graphics& g) override;
71 | void update() override;
72 | void resized() override;
73 | void mouseMove(const juce::MouseEvent& e) override;
74 | void mouseDown(const juce::MouseEvent& e) override;
75 | void mouseDrag(const juce::MouseEvent& e) override;
76 | void mouseUp(const juce::MouseEvent& e) override;
77 | void mouseExit(const juce::MouseEvent& e) override;
78 | void mouseDoubleClick(const juce::MouseEvent& e) override;
79 | void mouseWheelMove(const juce::MouseEvent& e, const juce::MouseWheelDetails& wheel) override;
80 | void callAllListeners();
81 |
82 | public:
83 | PointEdit(EnvelopeManager* envManager);
84 | double calcScreenXPos(double x);
85 | double calcEnvGenXPos(double x);
86 | double calcScreenYPos(double y); // 0.0 <= y <= 1.0
87 | double calcEnvGenYPos(double y);
88 |
89 | void setSnap(bool snap) { snapToGrid_ = snap; }
90 | void setCallbackWhenShownRangeChanged(std::function callbackWhenShownRangeChanged) { callbackWhenShownRangeChanged_ = callbackWhenShownRangeChanged; }
91 | void setZoomRateToWholeRange();
92 | void setZoomRate(double rate) { zoomRate_ = rate; }
93 | void setOffsetX(double x) { offsetX_ = x; }
94 | void setEndPointXMovement(bool isMovable) { isEndPointMovableHorizontally = isMovable; }
95 | void setZoomRateRestriction(bool canShrinkBeyondEndPoint) { canShrinkBeyondEndPoint_ = canShrinkBeyondEndPoint; }
96 | void setNewEnvelopeManager(EnvelopeManager* envManager) { envManager_ = envManager; }
97 |
98 | double getZoomRate() { return zoomRate_; }
99 | double getOffsetX() { return offsetX_; }
100 | double getZoomedWidth();
101 | EnvelopeManager* getEnvelopeManager() { return envManager_; }
102 | GridInfo& getGridDataRef() { return grid_; }
103 |
104 | void addListener(PointEditListener* listener) { listener_.push_back(listener); }
105 | void removeListener(PointEditListener* listener) { listener_.erase(std::remove(listener_.begin(), listener_.end(), listener), listener_.end()); }
106 | };
107 | }
108 | }
--------------------------------------------------------------------------------
/Source/Envelope_PointEditMultiband.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "Envelope_PointEditMultiband.h"
3 | #include "Envelope_VoiceController.h"
4 |
5 | //
6 | // PointEditMB Component
7 | //
8 |
9 | double myplug::envelope::PointEditMB::calcScreenXPos(double x)
10 | {
11 | return x * zoomRate_ - offsetX_;
12 | }
13 |
14 | double myplug::envelope::PointEditMB::calcEnvGenXPos(double x)
15 | {
16 | return (x + offsetX_) / zoomRate_;
17 | }
18 |
19 | double myplug::envelope::PointEditMB::calcScreenYPos(double y)
20 | {
21 | return y * getLocalBounds().getHeight() * (-1.0) + getLocalBounds().getHeight();
22 | }
23 |
24 | double myplug::envelope::PointEditMB::calcEnvGenYPos(double y)
25 | {
26 | return (-y + getLocalBounds().getHeight()) / getLocalBounds().getHeight();
27 | }
28 |
29 | void myplug::envelope::PointEditMB::setZoomRateToWholeRange()
30 | {
31 | if (envManager_ == nullptr) return;
32 | if (envManager_->getEnvGeneratorPtr() == nullptr) return;
33 |
34 | offsetX_ = 0.0;
35 | zoomRate_ = getLocalBounds().getWidth() / envManager_->getEnvGeneratorPtr()->getXRange();
36 | baseZoomRate_ = zoomRate_;
37 | }
38 |
39 | double myplug::envelope::PointEditMB::getZoomedWidth()
40 | {
41 | if (envManager_ == nullptr) return 0.0;
42 | if (envManager_->getEnvGeneratorPtr() == nullptr) return 0.0;
43 |
44 | return zoomRate_ * envManager_->getEnvGeneratorPtr()->getLastPoint().x;
45 | }
46 |
47 |
48 | void myplug::envelope::PointEditMB::updateHandleIntersectionInfo(const juce::MouseEvent& e)
49 | {
50 | mouseIntersectedBranchIndex_ = -1;
51 | mouseIntersectedHandleIndex_ = -1;
52 |
53 | // Handle intersection test
54 | auto envGen = envManager_->getEnvGeneratorPtr();
55 | if (!envGen)
56 | {
57 | return;
58 | }
59 | if (isMultiband_)
60 | {
61 | envGen = envManager_->getSpecificEnvGeneratorPtrFromName(editingBand_);
62 | }
63 |
64 | const auto& localBounds = getLocalBounds();
65 |
66 | for (int k = 0; k < envGen->getNumPoint(); ++k)
67 | {
68 | auto& i = envGen->getPoint(k);
69 | juce::Path circle;
70 | circle.addEllipse(
71 | calcScreenXPos(i.x) - circleRadius_,
72 | calcScreenYPos(i.y) - circleRadius_,
73 | circleRadius_ * 2.0,
74 | circleRadius_ * 2.0);
75 | if (circle.contains(e.x, e.y))
76 | {
77 | mouseIntersectedHandleIndex_ = k;
78 | break;
79 | }
80 | }
81 |
82 | // Branch Intersection Test
83 | const double heighttolerance = 20.0;
84 | auto yPos = calcScreenYPos(envGen->getCachedInterpolatitonValue(calcEnvGenXPos(e.position.x)));
85 | if (abs(yPos - e.position.y) <= heighttolerance && mouseIntersectedHandleIndex_ < 0)
86 | {
87 | mouseIntersectedBranchIndex_ = envGen->getLeftPointIndex(calcEnvGenXPos(e.position.x));
88 | }
89 |
90 | // Bounds Intersection Test
91 | if (getLocalBounds().contains(e.position.toInt()))
92 | {
93 | isMouseOnBounds_ = true;
94 | }
95 | else
96 | {
97 | isMouseOnBounds_ = false;
98 | }
99 | }
100 |
101 | void myplug::envelope::PointEditMB::updateGridIntersectionInfo(const juce::MouseEvent& e)
102 | {
103 | mouseIntersectedHGridIndex_ = -1;
104 | mouseIntersectedVGridIndex_ = -1;
105 |
106 | const auto& localBounds = getLocalBounds();
107 |
108 | // Grid Intersection Test
109 | if (snapToGrid_)
110 | {
111 | // Horizontally
112 | if (grid_.isHorizontalGridVisible || grid_.isHorizontalSubGridVisible)
113 | {
114 | double xInterval = grid_.horizontalGridInterval;
115 | double maxWidth = std::max(getZoomedWidth(), localBounds.getWidth());
116 | if (grid_.isHorizontalSubGridVisible)
117 | {
118 | xInterval /= grid_.horizontalSubGridSubdiv;
119 | }
120 | for (int i = 0; i <= maxWidth / xInterval / zoomRate_; ++i)
121 | {
122 | if (abs(e.x - calcScreenXPos(xInterval * i)) <= snapDistance_)
123 | {
124 | mouseIntersectedHGridIndex_ = i;
125 | }
126 | }
127 | }
128 |
129 | // Vertically
130 | if (grid_.isVerticalGridVisible || grid_.isVerticalSubGridVisible)
131 | {
132 | double yInterval = 1.0 * localBounds.getHeight() / grid_.verticalGridSubdiv;
133 | if (grid_.isVerticalSubGridVisible)
134 | {
135 | yInterval /= grid_.verticalSubGridSubdiv;
136 | }
137 | for (int i = 0; i <= localBounds.getHeight() / yInterval; ++i)
138 | {
139 | if (abs(e.y - (yInterval * i)) <= snapDistance_)
140 | {
141 | mouseIntersectedVGridIndex_ = i;
142 | }
143 | }
144 | }
145 | }
146 | }
147 |
148 | myplug::envelope::PointEditMB::PointEditMB(EnvelopeManager* envManager) : envManager_(envManager)
149 | {
150 | }
151 |
152 | void myplug::envelope::PointEditMB::paint(juce::Graphics& g)
153 | {
154 | g.setColour(juce::Colour(0.0f, 0.0f, 0.15f, 1.0f));
155 | g.fillAll();
156 |
157 | // Debugging
158 | /*
159 | g.setColour(juce::Colours::white);
160 | juce::String str;
161 | str << "HGrid:" << mouseIntersectedHGridIndex_ << "\nVGrid:" << mouseIntersectedVGridIndex_;
162 | g.drawText(str, 0.0, 0.0, 300.0, 10.0, juce::Justification::topLeft);
163 | */
164 |
165 | if (envManager_ == nullptr)
166 | {
167 | g.setColour(juce::Colours::white);
168 | juce::String text_nothing{ "There's nothing to draw." };
169 | juce::Rectangle textArea{ g.getCurrentFont().getStringWidth(text_nothing), 10 };
170 | textArea.setPosition(getLocalBounds().getCentreX() - textArea.getWidth() / 2, getLocalBounds().getCentreY() - textArea.getHeight() / 2);
171 | g.drawText(text_nothing, textArea, juce::Justification::centredLeft);
172 |
173 | }
174 | else
175 | {
176 | auto envgen = envManager_->getEnvGeneratorPtr();
177 | const auto& localBounds = getLocalBounds();
178 | double previousXPosition = 0.0;
179 | envelope::Point initPoint;
180 | envelope::Point& previousPoint = initPoint;
181 | int index = 0;
182 |
183 | // Draw Grids
184 | if (grid_.isHorizontalGridVisible)
185 | {
186 | g.setColour(juce::Colour(0.0f, 0.0f, 0.3f, 1.0f));
187 | double maxWidth = std::max(getZoomedWidth(), localBounds.getWidth());
188 | for (int w = 0; w < maxWidth / grid_.horizontalGridInterval / zoomRate_; ++w)
189 | {
190 | double xPos = w * grid_.horizontalGridInterval;
191 | g.drawLine(calcScreenXPos(xPos), 0.0, calcScreenXPos(xPos), localBounds.getHeight(), 1.0f);
192 | }
193 | }
194 | if (grid_.isHorizontalSubGridVisible)
195 | {
196 | g.setColour(juce::Colour(0.0f, 0.0f, 0.20f, 1.0f));
197 | double interval = grid_.horizontalGridInterval / grid_.horizontalSubGridSubdiv;
198 | double maxWidth = std::max(getZoomedWidth(), localBounds.getWidth());
199 | for (int w = 0; w < maxWidth / interval / zoomRate_; ++w)
200 | {
201 | double xPos = w * interval;
202 | g.drawLine(calcScreenXPos(xPos), 0.0, calcScreenXPos(xPos), localBounds.getHeight(), 1.0f);
203 | }
204 | }
205 | if (grid_.isVerticalGridVisible)
206 | {
207 | g.setColour(juce::Colour(0.0f, 0.0f, 0.3f, 1.0f));
208 | double interval = 1.0 * localBounds.getHeight() / grid_.verticalGridSubdiv;
209 | for (int h = 0; h < grid_.verticalGridSubdiv - 1; ++h)
210 | {
211 | double yPos = h * interval + interval;
212 | g.drawLine(0.0, yPos, localBounds.getWidth(), yPos, 1.0f);
213 | }
214 | }
215 | if (grid_.isVerticalSubGridVisible)
216 | {
217 | g.setColour(juce::Colour(0.0f, 0.0f, 0.20f, 1.0f));
218 | double interval = 1.0 * localBounds.getHeight() / grid_.verticalSubGridSubdiv / grid_.verticalGridSubdiv;
219 | for (int h = 0; h < (grid_.verticalGridSubdiv * grid_.verticalSubGridSubdiv) - 1; ++h)
220 | {
221 | double yPos = h * interval + interval;
222 | g.drawLine(0.0, yPos, localBounds.getWidth(), yPos, 1.0f);
223 | }
224 | }
225 |
226 | // Draw Grid Units
227 | {
228 | const int border = 5;
229 | const int textHeight = 10;
230 | if (grid_.isHorizontalGridVisible)
231 | {
232 | g.setColour(juce::Colour(0.0f, 0.0f, 0.5f, 1.0f));
233 | double maxWidth = std::max(getZoomedWidth(), localBounds.getWidth());
234 | for (int w = 0; w < maxWidth / grid_.horizontalGridInterval / zoomRate_; ++w)
235 | {
236 | double xPos = w * grid_.horizontalGridInterval;
237 | g.drawText(
238 | grid_.horizontalLabel(w),
239 | calcScreenXPos(xPos) + border + (w == 0 ? 10 : 0),
240 | localBounds.getHeight() - border - textHeight,
241 | grid_.horizontalGridInterval * zoomRate_ - border * 2.0,
242 | textHeight,
243 | juce::Justification::topLeft);
244 | }
245 | }
246 | if (grid_.isVerticalGridVisible)
247 | {
248 | g.setColour(juce::Colour(0.0f, 0.0f, 0.5f, 1.0f));
249 | double interval = 1.0 * localBounds.getHeight() / grid_.verticalGridSubdiv;
250 | int gridCount = grid_.verticalGridSubdiv;
251 | if (grid_.isVerticalSubGridVisible)
252 | {
253 | gridCount *= grid_.verticalSubGridSubdiv;
254 | interval /= grid_.verticalSubGridSubdiv;
255 | }
256 | for (int h = 0; h < gridCount; ++h)
257 | {
258 | double yPos = (gridCount - h) * interval;
259 | g.drawText(
260 | grid_.verticalLabel(h),
261 | border,
262 | yPos - textHeight - border - (h == 0 ? 10 : 0),
263 | 200.0,
264 | textHeight,
265 | juce::Justification::topLeft);
266 | }
267 | }
268 | }
269 |
270 | // Draw VoicePos Indicator
271 | g.setColour(juce::Colours::grey);
272 | for (const auto& i : envManager_->getVoiceControllerRef())
273 | {
274 | g.drawLine(
275 | calcScreenXPos(i->getXPos()),
276 | 0.0,
277 | calcScreenXPos(i->getXPos()),
278 | getHeight(),
279 | 2.0f
280 | );
281 | }
282 |
283 | if (envgen)
284 | {
285 | auto pointsPtr = envgen;
286 |
287 | for (int band = 0; band < (isMultiband_ ? 3 : 1); ++band)
288 | {
289 | previousPoint = initPoint;
290 | index = 0;
291 | previousXPosition = 0.0;
292 | std::string currentBand = "";
293 | if (isMultiband_)
294 | {
295 | switch (band)
296 | {
297 | case 0:
298 | currentBand = "low";
299 | //points = &envManager_->getSpecificEnvGeneratorPtrFromName("low")->points;
300 | pointsPtr = envManager_->getSpecificEnvGeneratorPtrFromName("low");
301 | envgen = envManager_->getSpecificEnvGeneratorPtrFromName("low");
302 | break;
303 | case 1:
304 | currentBand = "mid";
305 | pointsPtr = envManager_->getSpecificEnvGeneratorPtrFromName("mid");
306 | envgen = envManager_->getSpecificEnvGeneratorPtrFromName("mid");
307 | break;
308 | case 2:
309 | currentBand = "high";
310 | pointsPtr = envManager_->getSpecificEnvGeneratorPtrFromName("high");
311 | envgen = envManager_->getSpecificEnvGeneratorPtrFromName("high");
312 | break;
313 | }
314 | }
315 |
316 |
317 | for (int k = 0 ; k < pointsPtr->getNumPoint(); ++k)
318 | {
319 | auto& i = pointsPtr->getPoint(k);
320 | if (isMultiband_)
321 | {
322 | switch (band)
323 | {
324 | case 0:
325 | g.setColour(juce::Colour(82, 125, 255)); break;
326 | case 1:
327 | g.setColour(juce::Colour(168, 111, 206)); break;
328 | case 2:
329 | g.setColour(juce::Colour(252, 86, 156)); break;
330 | }
331 | }
332 | else
333 | {
334 | g.setColour(juce::Colours::white);
335 | }
336 |
337 | // Draw interpolated lines
338 |
339 | // Skip when segments and a branch is out of the bounds.
340 | if (calcScreenXPos(i.x) < localBounds.getX() || calcScreenXPos(previousPoint.x) > localBounds.getWidth())
341 | {
342 | previousXPosition = i.x * zoomRate_;
343 | previousPoint = i;
344 | index++;
345 | continue;
346 | }
347 |
348 | bool thicken = false;
349 | if (isMultiband_)
350 | {
351 | if (currentBand == editingBand_) thicken = (index - 1) == mouseIntersectedBranchIndex_;
352 | }
353 | else
354 | {
355 | thicken = (index - 1) == mouseIntersectedBranchIndex_;
356 | }
357 | double linethickness = thicken ? 3.0 : 1.0;
358 |
359 | switch (previousPoint.interpolation)
360 | {
361 | case InterpolationType::Linear:
362 | g.drawLine(
363 | calcScreenXPos(previousPoint.x),
364 | calcScreenYPos(previousPoint.y),
365 | calcScreenXPos(i.x),
366 | calcScreenYPos(i.y),
367 | linethickness);
368 | break;
369 | case InterpolationType::Sigmoid:
370 | {
371 | double plotInterval = 3 / zoomRate_;
372 | double length = i.x - previousPoint.x;
373 | double prevX = previousPoint.x;
374 | double nextX = std::clamp(prevX + plotInterval, 0.0, i.x);
375 |
376 | // when previousPoint.x == i.x, getInterpolatedValue(prevX) and getInterpolatedValue(nextX) will return the same value.
377 | if (previousPoint.x == i.x)
378 | {
379 | g.drawLine(
380 | calcScreenXPos(previousPoint.x),
381 | calcScreenYPos(previousPoint.y),
382 | calcScreenXPos(i.x),
383 | calcScreenYPos(i.y),
384 | linethickness);
385 | }
386 | else
387 | {
388 | juce::Path stroke;
389 | juce::PathStrokeType strokeType(linethickness, juce::PathStrokeType::JointStyle::curved);
390 | stroke.startNewSubPath(calcScreenXPos(prevX), calcScreenYPos(envgen->getInterpolatedValue(prevX)));
391 |
392 | while (length >= 0)
393 | {
394 | stroke.lineTo(calcScreenXPos(nextX), calcScreenYPos(envgen->getInterpolatedValue(nextX)));
395 |
396 | //prevX = nextX;
397 | nextX = std::clamp(nextX + plotInterval, 0.0, i.x - 0.0000001);
398 |
399 | length = length - plotInterval;
400 | }
401 | g.strokePath(stroke, strokeType);
402 | }
403 | }
404 | break;
405 | case InterpolationType::Step:
406 | g.drawLine(
407 | calcScreenXPos(previousPoint.x),
408 | calcScreenYPos(previousPoint.y),
409 | calcScreenXPos(i.x),
410 | calcScreenYPos(previousPoint.y),
411 | linethickness);
412 | g.drawLine(
413 | calcScreenXPos(i.x),
414 | calcScreenYPos(previousPoint.y),
415 | calcScreenXPos(i.x),
416 | calcScreenYPos(i.y),
417 | linethickness);
418 | break;
419 | default:
420 | break;
421 | }
422 |
423 | // Draw segments
424 | bool drawSeg = true;
425 | if (isMouseOnBounds_)
426 | {
427 | if (isMultiband_)
428 | {
429 | if (currentBand != editingBand_)
430 | {
431 | drawSeg = false;
432 | }
433 | }
434 |
435 | if (drawSeg)
436 | {
437 | g.setColour(juce::Colours::white);
438 | g.drawEllipse(
439 | calcScreenXPos(i.x) - circleRadius_,
440 | calcScreenYPos(i.y) - circleRadius_,
441 | circleRadius_ * 2.0,
442 | circleRadius_ * 2.0,
443 | 1.0);
444 |
445 | if (index == mouseIntersectedHandleIndex_)
446 | {
447 | g.setColour(juce::Colours::mediumpurple);
448 | g.fillEllipse(
449 | calcScreenXPos(i.x) - circleRadius_,
450 | calcScreenYPos(i.y) - circleRadius_,
451 | circleRadius_ * 2.0,
452 | circleRadius_ * 2.0
453 | );
454 | }
455 | }
456 | }
457 |
458 | previousXPosition = i.x * zoomRate_;
459 | previousPoint = i;
460 | index++;
461 | }
462 | }
463 | }
464 | }
465 | }
466 |
467 | void myplug::envelope::PointEditMB::update()
468 | {
469 | this->repaint();
470 |
471 | // Change Mouse Cursor
472 | if (mouseIntersectedHandleIndex_ >= 0)
473 | {
474 | setMouseCursor(juce::MouseCursor::PointingHandCursor);
475 | }
476 | else if (mouseIntersectedBranchIndex_ >= 0)
477 | {
478 | setMouseCursor(juce::MouseCursor::UpDownResizeCursor);
479 | }
480 | else
481 | {
482 | setMouseCursor(juce::MouseCursor::NormalCursor);
483 | }
484 | }
485 |
486 | void myplug::envelope::PointEditMB::resized()
487 | {
488 |
489 | }
490 |
491 | void myplug::envelope::PointEditMB::mouseMove(const juce::MouseEvent& e)
492 | {
493 | updateHandleIntersectionInfo(e);
494 | updateGridIntersectionInfo(e);
495 | prevMousePos = e.position;
496 | }
497 |
498 | void myplug::envelope::PointEditMB::mouseDown(const juce::MouseEvent& e)
499 | {
500 | if (e.source.getCurrentModifiers().isRightButtonDown())
501 | {
502 | if (mouseIntersectedHandleIndex_ >= 0)
503 | {
504 | juce::PopupMenu m;
505 | juce::PopupMenu::Options option;
506 | auto pointsPtr = envManager_->getEnvGeneratorPtr();
507 | if (isMultiband_)
508 | {
509 | pointsPtr = envManager_->getSpecificEnvGeneratorPtrFromName(editingBand_);
510 | }
511 |
512 | m.addSectionHeader("Shape");
513 | m.addItem(1, "Linear");
514 | m.addItem(2, "Step");
515 | m.addItem(3, "Curve");
516 |
517 | if ((mouseIntersectedHandleIndex_ > 0 &&mouseIntersectedHandleIndex_ < pointsPtr->getNumPoint() - 1) || (mouseIntersectedHandleIndex_ == pointsPtr->getNumPoint() - 1 && isEndPointMovableHorizontally == true))
518 | {
519 | m.addSeparator();
520 | m.addItem(4, "Delete Point");
521 | }
522 | m.showMenuAsync(option, [&](int i)
523 | {
524 | auto pointsPtr = envManager_->getEnvGeneratorPtr();
525 | if (isMultiband_)
526 | {
527 | pointsPtr = envManager_->getSpecificEnvGeneratorPtrFromName(editingBand_);
528 | }
529 |
530 | if (mouseIntersectedHandleIndex_ < 0) { return; }
531 | switch (i)
532 | {
533 | case 1:
534 | pointsPtr->getPoint(mouseIntersectedHandleIndex_).interpolation = envelope::InterpolationType::Linear;
535 | break;
536 | case 2:
537 | pointsPtr->getPoint(mouseIntersectedHandleIndex_).interpolation = envelope::InterpolationType::Step;
538 | break;
539 | case 3:
540 | pointsPtr->getPoint(mouseIntersectedHandleIndex_).interpolation = envelope::InterpolationType::Sigmoid;
541 | break;
542 | case 4:
543 | pointsPtr->removePoint(mouseIntersectedHandleIndex_);
544 | pointsPtr->render();
545 | default:
546 | break;
547 | }
548 | callAllListeners();
549 | });
550 | }
551 | }
552 | }
553 |
554 | void myplug::envelope::PointEditMB::mouseDrag(const juce::MouseEvent& e)
555 | {
556 | auto pointsPtr = envManager_->getEnvGeneratorPtr();
557 | if (isMultiband_)
558 | {
559 | pointsPtr = envManager_->getSpecificEnvGeneratorPtrFromName(editingBand_);
560 | }
561 |
562 | // LMB is Down
563 | if (e.source.getCurrentModifiers().isLeftButtonDown())
564 | {
565 | // Move Handles
566 | // X
567 | if (mouseIntersectedHandleIndex_ >= 0)
568 | {
569 | if (0 < mouseIntersectedHandleIndex_ && mouseIntersectedHandleIndex_ < pointsPtr->getNumPoint()-1)
570 | {
571 | // Clamp or move the specified handle
572 | auto& prevPointPosX = pointsPtr->getPoint(mouseIntersectedHandleIndex_-1).x;
573 | auto& midPointPosX = pointsPtr->getPoint(mouseIntersectedHandleIndex_).x;
574 | auto& nextPointPosX = pointsPtr->getPoint(mouseIntersectedHandleIndex_+1).x;
575 |
576 | if (calcScreenXPos(prevPointPosX) < e.x && e.x < calcScreenXPos(nextPointPosX))
577 | {
578 | if (mouseIntersectedHGridIndex_ >= 0)
579 | {
580 | // Snap
581 | double xInterval = grid_.horizontalGridInterval;
582 | if (grid_.isHorizontalSubGridVisible)
583 | {
584 | xInterval /= grid_.horizontalSubGridSubdiv;
585 | }
586 |
587 | midPointPosX = xInterval * mouseIntersectedHGridIndex_;
588 | }
589 | else
590 | {
591 | midPointPosX = calcEnvGenXPos(e.x);
592 | }
593 | }
594 | else if (calcScreenXPos(prevPointPosX) >= e.x)
595 | {
596 | midPointPosX = prevPointPosX;
597 | }
598 | else if (calcScreenXPos(nextPointPosX) <= e.x)
599 | {
600 | midPointPosX = nextPointPosX;
601 | }
602 | }
603 | else if (mouseIntersectedHandleIndex_ == 0)
604 | {
605 |
606 | }
607 | else if (mouseIntersectedHandleIndex_ == pointsPtr->getNumPoint() - 1)
608 | {
609 | auto& prevPointPosX = pointsPtr->getPoint(mouseIntersectedHandleIndex_ - 1).x;
610 | auto& lastPointPosX = pointsPtr->getPoint(mouseIntersectedHandleIndex_ ).x;
611 |
612 | if (isEndPointMovableHorizontally)
613 | {
614 | if (calcScreenXPos(prevPointPosX) < e.x)
615 | {
616 |
617 | lastPointPosX = calcEnvGenXPos(e.x);
618 |
619 | }
620 | else if (calcScreenXPos(prevPointPosX) >= e.x)
621 | {
622 | lastPointPosX = prevPointPosX;
623 | }
624 | }
625 | }
626 | }
627 |
628 | // Y
629 | if (mouseIntersectedHandleIndex_ >= 0)
630 | {
631 | if (mouseIntersectedVGridIndex_ >= 0)
632 | {
633 | // Snap
634 | double yInterval = 1.0 * getLocalBounds().getHeight() / grid_.verticalGridSubdiv;
635 | if (grid_.isHorizontalSubGridVisible)
636 | {
637 | yInterval /= grid_.verticalSubGridSubdiv;
638 | }
639 |
640 | pointsPtr->getPoint(mouseIntersectedHandleIndex_).y = calcEnvGenYPos(yInterval * mouseIntersectedVGridIndex_);
641 | }
642 | else
643 | {
644 | pointsPtr->getPoint(mouseIntersectedHandleIndex_).y = calcEnvGenYPos(std::clamp(e.y, 0.0, getLocalBounds().getHeight()));
645 | }
646 | }
647 |
648 | // Move Braches
649 | if (mouseIntersectedBranchIndex_ >= 0 && mouseIntersectedBranchIndex_ <= pointsPtr->getNumPoint() - 2)
650 | {
651 | auto deltaPos = e.position - prevMousePos;
652 | auto envgen = envManager_->getEnvGeneratorPtr();
653 | if (isMultiband_)
654 | {
655 | envgen = envManager_->getSpecificEnvGeneratorPtrFromName(editingBand_);
656 | }
657 | auto& point = pointsPtr->getPoint(mouseIntersectedBranchIndex_);
658 | const double ySensitivity = 0.05 * pow(1.05, abs(point.param1));
659 | double direction = -1.0;
660 |
661 | if (pointsPtr->getPoint(mouseIntersectedBranchIndex_).y > pointsPtr->getPoint(mouseIntersectedBranchIndex_+1).y)
662 | direction = 1.0;
663 |
664 | point.param1 = std::clamp(point.param1 + direction * deltaPos.y * ySensitivity, -100.0, 100.0);
665 | }
666 |
667 | }
668 | // MMB is Down
669 | else if (e.source.getCurrentModifiers().isMiddleButtonDown())
670 | {
671 |
672 | }
673 |
674 | pointsPtr->render();
675 | updateGridIntersectionInfo(e);
676 | prevMousePos = e.position;
677 | }
678 |
679 | void myplug::envelope::PointEditMB::mouseUp(const juce::MouseEvent& e)
680 | {
681 | updateHandleIntersectionInfo(e);
682 | updateGridIntersectionInfo(e);
683 | callbackWhenShownRangeChanged_();
684 | callAllListeners();
685 | }
686 |
687 | void myplug::envelope::PointEditMB::mouseExit(const juce::MouseEvent& e)
688 | {
689 | updateHandleIntersectionInfo(e);
690 | updateGridIntersectionInfo(e);
691 | }
692 |
693 | void myplug::envelope::PointEditMB::mouseDoubleClick(const juce::MouseEvent& e)
694 | {
695 | if (e.mods.isLeftButtonDown())
696 | {
697 | auto envgen = envManager_->getEnvGeneratorPtr();
698 | if (isMultiband_)
699 | {
700 | envgen = envManager_->getSpecificEnvGeneratorPtrFromName(editingBand_);
701 | }
702 |
703 | if (mouseIntersectedHandleIndex_ > 0)
704 | {
705 | if (mouseIntersectedHandleIndex_ != envgen->getNumPoint() - 1 || isEndPointMovableHorizontally != false)
706 | {
707 | envgen->removePoint(mouseIntersectedHandleIndex_);
708 | }
709 | }
710 | else
711 | {
712 | envgen->addPoint(calcEnvGenXPos(e.x), calcEnvGenYPos(e.y), envelope::InterpolationType::Sigmoid);
713 | }
714 | envgen->render();
715 | callAllListeners();
716 | }
717 | }
718 |
719 | void myplug::envelope::PointEditMB::mouseWheelMove(const juce::MouseEvent& e, const juce::MouseWheelDetails& wheel)
720 | {
721 | zoomRate_ = std::clamp(
722 | zoomRate_ + zoomRate_ * wheel.deltaY,
723 | canShrinkBeyondEndPoint_ ? baseZoomRate_ / zoomRateRange_ : baseZoomRate_,
724 | baseZoomRate_ * zoomRateRange_);
725 | callbackWhenShownRangeChanged_();
726 | }
727 |
728 | void myplug::envelope::PointEditMB::callAllListeners()
729 | {
730 | for (const auto& i : listener_)
731 | {
732 | i->handleMoved(this);
733 | }
734 | }
735 |
--------------------------------------------------------------------------------
/Source/Envelope_PointEditMultiband.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "Envelope_Fwd.h"
6 | #include "Envelope_Data.h"
7 | #include "Envelope_Manager.h"
8 |
9 | namespace myplug
10 | {
11 | namespace envelope
12 | {
13 | struct GridInfo
14 | {
15 | bool isVerticalGridVisible = true;
16 | bool isVerticalSubGridVisible = false;
17 | bool isHorizontalGridVisible = true;
18 | bool isHorizontalSubGridVisible = false;
19 |
20 | int verticalGridSubdiv = 3;
21 | int verticalSubGridSubdiv = 3;
22 | double horizontalGridInterval = 0.2;
23 | int horizontalSubGridSubdiv = 3;
24 |
25 | std::function verticalLabel = [](int index) -> juce::String { return juce::String{ index }; };
26 | std::function horizontalLabel = [](int index) -> juce::String { return juce::String{ index }; };
27 | };
28 |
29 | class PointEditMBListener
30 | {
31 | public:
32 | virtual ~PointEditMBListener() = default;
33 | virtual void handleMoved(PointEditMB* p) = 0;
34 | };
35 |
36 | class PointEditMB : public juce::AnimatedAppComponent
37 | {
38 | EnvelopeManager* envManager_;
39 | std::function callbackWhenShownRangeChanged_;
40 | std::vector listener_;
41 |
42 | // Zoom & Offset
43 | double zoomRateRange_ = 5.0;
44 | double baseZoomRate_ = 1000.0;
45 | double zoomRate_ = 1000.0;
46 | double offsetX_ = 0.0;
47 |
48 | // Handles
49 | const double circleRadius_ = 7.0;
50 | bool isEndPointMovableHorizontally = true;
51 |
52 | // Mouse
53 | int mouseIntersectedHandleIndex_ = -1;
54 | int mouseIntersectedBranchIndex_ = -1;
55 | int mouseIntersectedHGridIndex_ = -1;
56 | int mouseIntersectedVGridIndex_ = -1;
57 | juce::Point prevMousePos;
58 | bool isMouseDown_ = false;
59 | bool isMouseOnBounds_ = false;
60 | bool canShrinkBeyondEndPoint_ = true;
61 |
62 | GridInfo grid_;
63 | bool snapToGrid_ = true;
64 | double snapDistance_ = 10.0;
65 |
66 | bool isMultiband_ = false;
67 | std::string editingBand_ = "low";
68 |
69 | void updateHandleIntersectionInfo(const juce::MouseEvent& e);
70 | void updateGridIntersectionInfo(const juce::MouseEvent& e);
71 |
72 | protected:
73 | void paint(juce::Graphics& g) override;
74 | void update() override;
75 | void resized() override;
76 | void mouseMove(const juce::MouseEvent& e) override;
77 | void mouseDown(const juce::MouseEvent& e) override;
78 | void mouseDrag(const juce::MouseEvent& e) override;
79 | void mouseUp(const juce::MouseEvent& e) override;
80 | void mouseExit(const juce::MouseEvent& e) override;
81 | void mouseDoubleClick(const juce::MouseEvent& e) override;
82 | void mouseWheelMove(const juce::MouseEvent& e, const juce::MouseWheelDetails& wheel) override;
83 | void callAllListeners();
84 |
85 | public:
86 | PointEditMB(EnvelopeManager* envManager);
87 | double calcScreenXPos(double x);
88 | double calcEnvGenXPos(double x);
89 | double calcScreenYPos(double y); // 0.0 <= y <= 1.0
90 | double calcEnvGenYPos(double y);
91 |
92 | void setMultiband(bool shouldBeMultiband) { isMultiband_ = shouldBeMultiband; }
93 | void setEditingBand(const std::string& editingBand = "mid") { editingBand_ = editingBand; }
94 |
95 | void setSnap(bool snap) { snapToGrid_ = snap; }
96 | void setCallbackWhenShownRangeChanged(std::function callbackWhenShownRangeChanged) { callbackWhenShownRangeChanged_ = callbackWhenShownRangeChanged; }
97 | void setZoomRateToWholeRange();
98 | void setZoomRate(double rate) { zoomRate_ = rate; }
99 | void setOffsetX(double x) { offsetX_ = x; }
100 | void setEndPointXMovement(bool isMovable) { isEndPointMovableHorizontally = isMovable; }
101 | void setZoomRateRestriction(bool canShrinkBeyondEndPoint) { canShrinkBeyondEndPoint_ = canShrinkBeyondEndPoint; }
102 | void setNewEnvelopeManager(EnvelopeManager* envManager) { envManager_ = envManager; }
103 |
104 | double getZoomRate() { return zoomRate_; }
105 | double getOffsetX() { return offsetX_; }
106 | double getZoomedWidth();
107 | EnvelopeManager* getEnvelopeManager() { return envManager_; }
108 | GridInfo& getGridDataRef() { return grid_; }
109 |
110 | void addListener(PointEditMBListener* listener) { listener_.push_back(listener); }
111 | void removeListener(PointEditMBListener* listener) { listener_.erase(std::remove(listener_.begin(), listener_.end(), listener), listener_.end()); }
112 | };
113 | }
114 | }
--------------------------------------------------------------------------------
/Source/Envelope_PreviewComponent.cpp:
--------------------------------------------------------------------------------
1 | #include "Envelope_PreviewComponent.h"
2 |
3 | void myplug::envelope::EnvelopePreviewComponent::paint(juce::Graphics& g)
4 | {
5 | g.setColour(juce::Colour(0.0f, 0.0f, isMouseOver() ? 0.2f : 0.15f, 1.0f));
6 | g.fillAll();
7 |
8 | if (envgen_ != nullptr)
9 | {
10 | double linethickness = 1.0;
11 |
12 | double zoomRate = getLocalBounds().getWidth() / envgen_->getXRange();
13 | auto calcScreenXPos = [&](double x) -> double { return x * zoomRate; };
14 | auto calcScreenYPos = [&](double y) -> double { return y * getLocalBounds().getHeight() * (-1.0) + getLocalBounds().getHeight(); };
15 | envelope::Point previousPoint;
16 |
17 | auto pointsPtr = envgen_;
18 |
19 | for (int b = 3; b >= 0; --b)
20 | {
21 | if (b == 0)
22 | {
23 | pointsPtr = envgen_;
24 | linethickness = 1.5;
25 | g.setColour(juce::Colours::white);
26 | }
27 | else
28 | {
29 | pointsPtr = envgenMB_[b-1];
30 | linethickness = 0.5;
31 | switch (b)
32 | {
33 | case 1:
34 | g.setColour(juce::Colour(82, 125, 255)); break;
35 | case 2:
36 | g.setColour(juce::Colour(168, 111, 206)); break;
37 | case 3:
38 | g.setColour(juce::Colour(252, 86, 156)); break;
39 | default:
40 | break;
41 | }
42 | }
43 | previousPoint = Point();
44 |
45 | for (int k = 0; k < pointsPtr->getNumPoint(); ++k)
46 | {
47 | auto& i = pointsPtr->getPoint(k);
48 |
49 | // Draw interpolated lines
50 | switch (previousPoint.interpolation)
51 | {
52 | case InterpolationType::Linear:
53 | g.drawLine(
54 | calcScreenXPos(previousPoint.x),
55 | calcScreenYPos(previousPoint.y),
56 | calcScreenXPos(i.x),
57 | calcScreenYPos(i.y),
58 | linethickness);
59 | break;
60 | case InterpolationType::Sigmoid:
61 | {
62 | double plotInterval = 3 / zoomRate;
63 | double length = i.x - previousPoint.x;
64 | double prevX = previousPoint.x;
65 | double nextX = std::clamp(prevX + plotInterval, 0.0, i.x);
66 |
67 | // when previousPoint.x == i.x, getInterpolatedValue(prevX) and getInterpolatedValue(nextX) will return the same value.
68 | if (previousPoint.x == i.x)
69 | {
70 | g.drawLine(
71 | calcScreenXPos(previousPoint.x),
72 | calcScreenYPos(previousPoint.y),
73 | calcScreenXPos(i.x),
74 | calcScreenYPos(i.y),
75 | linethickness);
76 | }
77 | else
78 | {
79 | juce::Path stroke;
80 | juce::PathStrokeType strokeType(linethickness, juce::PathStrokeType::JointStyle::curved);
81 | stroke.startNewSubPath(calcScreenXPos(prevX), calcScreenYPos(pointsPtr->getInterpolatedValue(prevX)));
82 |
83 | while (length >= 0)
84 | {
85 | stroke.lineTo(calcScreenXPos(nextX), calcScreenYPos(pointsPtr->getInterpolatedValue(nextX)));
86 |
87 | nextX = std::clamp(nextX + plotInterval, 0.0, i.x - 0.0000001);
88 |
89 | length = length - plotInterval;
90 | }
91 | g.strokePath(stroke, strokeType);
92 | }
93 | }
94 | break;
95 | case InterpolationType::Step:
96 | g.drawLine(
97 | calcScreenXPos(previousPoint.x),
98 | calcScreenYPos(previousPoint.y),
99 | calcScreenXPos(i.x),
100 | calcScreenYPos(previousPoint.y),
101 | linethickness);
102 | g.drawLine(
103 | calcScreenXPos(i.x),
104 | calcScreenYPos(previousPoint.y),
105 | calcScreenXPos(i.x),
106 | calcScreenYPos(i.y),
107 | linethickness);
108 | break;
109 | default:
110 | break;
111 | }
112 |
113 | previousPoint = i;
114 | }
115 | }
116 | }
117 | }
118 |
119 | void myplug::envelope::EnvelopePreviewComponent::mouseDown(const juce::MouseEvent& e)
120 | {
121 | callListeners();
122 | }
123 |
124 | void myplug::envelope::EnvelopePreviewComponent::mouseMove(const juce::MouseEvent& e)
125 | {
126 | repaint();
127 | }
128 |
129 | void myplug::envelope::EnvelopePreviewComponent::mouseExit(const juce::MouseEvent& e)
130 | {
131 | repaint();
132 | }
133 |
--------------------------------------------------------------------------------
/Source/Envelope_PreviewComponent.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "Envelope_Data.h"
5 | #include "Envelope_Editor.h"
6 |
7 | namespace myplug
8 | {
9 | namespace envelope
10 | {
11 | class EnvelopePreviewComponent : public juce::AnimatedAppComponent, public envelope::PointEditMBListener
12 | {
13 | public:
14 | class Listener
15 | {
16 | public:
17 | virtual ~Listener() = default;
18 | virtual void clicked(EnvelopePreviewComponent*) = 0;
19 | };
20 | private:
21 | envelope::EnvelopeGenerator* envgen_ = nullptr;
22 | std::array envgenMB_ = {nullptr, nullptr, nullptr};
23 | std::vector listeners_;
24 | void callListeners()
25 | {
26 | for (const auto& i : listeners_)
27 | {
28 | i->clicked(this);
29 | }
30 | }
31 | public:
32 | EnvelopePreviewComponent()
33 | {
34 | setFramesPerSecond(10);
35 | }
36 |
37 | void setEnvelopeGenerator(EnvelopeGenerator* envgen, std::array envgenMB)
38 | {
39 | envgen_ = envgen;
40 | envgenMB_ = envgenMB;
41 | }
42 | void paint(juce::Graphics& g) override;
43 | void update() override
44 | {
45 | repaint();
46 | }
47 |
48 | void handleMoved(PointEditMB* p) override
49 | {
50 | if(p->getEnvelopeManager()->getEnvGeneratorPtr() == envgen_)
51 | repaint();
52 | }
53 |
54 | void addListener(EnvelopePreviewComponent::Listener* listener) { listeners_.push_back(listener); }
55 | void removeListener(EnvelopePreviewComponent::Listener* listener) { listeners_.erase(std::remove(listeners_.begin(), listeners_.end(), listener), listeners_.end()); }
56 |
57 | void mouseDown(const juce::MouseEvent& e) override;
58 | void mouseMove(const juce::MouseEvent& e) override;
59 | void mouseExit(const juce::MouseEvent& e) override;
60 | };
61 | }
62 | }
--------------------------------------------------------------------------------
/Source/Envelope_Serialization.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "Envelope_Data.h"
5 |
6 | namespace myplug::envelope
7 | {
8 | juce::ValueTree serializeEnvGen(EnvelopeGenerator& envgen)
9 | {
10 | using namespace juce;
11 | ValueTree tree("EnvelopeGenerator");
12 |
13 | for (size_t i = 0; i < envgen.getNumPoint(); ++i)
14 | {
15 | ValueTree child("Point");
16 | const auto& point = envgen.getPoint(i);
17 | child.setProperty("XPos", point.x, nullptr);
18 | child.setProperty("YPos", point.y, nullptr);
19 | child.setProperty("Loop", static_cast(point.loop), nullptr);
20 | child.setProperty("Interpolation", static_cast(point.interpolation), nullptr);
21 | child.setProperty("Param1", point.param1, nullptr);
22 |
23 | tree.addChild(child, i, nullptr);
24 | }
25 |
26 | return tree;
27 | }
28 |
29 | void deserializeEnvGen(EnvelopeGenerator& envgen, const juce::ValueTree& tree)
30 | {
31 | using namespace juce;
32 |
33 | envgen.clearPoints();
34 | for (size_t i = 0; i < tree.getNumChildren(); ++i)
35 | {
36 | Point point;
37 | auto child = tree.getChild(i);
38 | point.x = child.getPropertyAsValue("XPos", nullptr).getValue();
39 | point.y = child.getPropertyAsValue("YPos", nullptr).getValue();
40 | point.loop = static_cast(int(child.getPropertyAsValue("Loop", nullptr).getValue()));
41 | point.interpolation = static_cast(int(child.getPropertyAsValue("Interpolation", nullptr).getValue()));
42 | point.param1 = child.getPropertyAsValue("Param1", nullptr).getValue();
43 |
44 | envgen.addPoint(point.x, point.y, point.interpolation, point.param1, point.loop);
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/Source/Envelope_VoiceController.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "Envelope_Fwd.h"
4 |
5 | namespace myplug
6 | {
7 | namespace envelope
8 | {
9 | // The instance is intended to be owned by SynthVoice or equivalents.
10 | // then pointer of this class is registered to EnvelopeManager so that gui can access to the voicecontroller through EnvManager
11 | class EnvelopeVoiceController
12 | {
13 | myplug::envelope::EnvelopeManager* parentManager_ = nullptr;
14 | double rate_ = 1.0; // set through envManager
15 | double deltaX_ = 0.0;
16 | double x_ = 0.0;
17 | bool isReturning_ = false; // pingpong loop
18 | bool prevNoteOn = false;
19 | double loopStartX_ = 0.0;
20 | double loopEndX_ = 0.0;
21 |
22 | double getXPosWithLoop(bool isNoteOn = false, double offset = 0.0, bool* retShouldReturn = nullptr)
23 | {
24 | if (parentManager_ == nullptr) return 0.0;
25 | //const auto& points = parentManager_->getEnvGeneratorPtr()->getPointsRef();
26 |
27 | double bufx = x_ + offset * (isReturning_ == false ? 1.0 : -1.0);
28 |
29 | if (isNoteOn)
30 | {
31 | if (bufx > loopEndX_)
32 | {
33 | switch (parentManager_->getLoopMode())
34 | {
35 | case envelope::LoopMode::Loop:
36 | // Jump to start
37 | bufx -= (loopEndX_ - loopStartX_);
38 | break;
39 | case envelope::LoopMode::LoopThenRelease:
40 | bufx -= (loopEndX_ - loopStartX_);
41 | break;
42 | case envelope::LoopMode::LoopThenJumptoRelease:
43 | bufx -= (loopEndX_ - loopStartX_);
44 | break;
45 | case envelope::LoopMode::PingpongLoop:
46 | bufx -= deltaX_ * rate_ * 2.0;
47 | if (retShouldReturn) *retShouldReturn = true;
48 | break;
49 | case envelope::LoopMode::PingPongLoopThenRelease:
50 | bufx -= deltaX_ * rate_ * 2.0;
51 | if (retShouldReturn) *retShouldReturn = true;
52 | break;
53 | case envelope::LoopMode::PingPongLoopThenJumptoRelease:
54 | bufx -= deltaX_ * rate_ * 2.0;
55 | if (retShouldReturn) *retShouldReturn = true;
56 | break;
57 | default:
58 | break;
59 | }
60 | }
61 | else if (bufx < loopStartX_ && isReturning_ == true)
62 | {
63 | // Ping Pong
64 | bufx += deltaX_ * rate_ * 2.0;
65 | if (retShouldReturn) *retShouldReturn = false;
66 | }
67 | }
68 | else
69 | {
70 | if (prevNoteOn == true) // when note-on turned into note-off
71 | {
72 | switch (parentManager_->getLoopMode())
73 | {
74 | case envelope::LoopMode::LoopThenJumptoRelease:
75 | bufx = loopEndX_;
76 | break;
77 | case envelope::LoopMode::PingPongLoopThenRelease:
78 | if (retShouldReturn) *retShouldReturn = false;
79 | break;
80 | case envelope::LoopMode::PingPongLoopThenJumptoRelease:
81 | bufx = loopEndX_;
82 | if (retShouldReturn) *retShouldReturn = false;
83 | break;
84 | default:
85 | break;
86 | }
87 | }
88 |
89 | if (bufx > loopEndX_)
90 | {
91 | switch (parentManager_->getLoopMode())
92 | {
93 | case envelope::LoopMode::Loop:
94 | // Jump to start
95 | bufx -= (loopEndX_ - loopStartX_);
96 | break;
97 | case envelope::LoopMode::PingpongLoop:
98 | bufx -= deltaX_ * rate_ * 2.0;
99 | if (retShouldReturn) *retShouldReturn = true;
100 | break;
101 | default:
102 | break;
103 | }
104 | }
105 | else if (bufx < loopStartX_ && isReturning_ == true && parentManager_->getLoopMode() == envelope::LoopMode::PingpongLoop)
106 | {
107 | // Ping Pong
108 | bufx += deltaX_ * rate_ * 2.0;
109 | if (retShouldReturn) *retShouldReturn = false;
110 | }
111 | }
112 |
113 | return bufx;
114 | }
115 |
116 | public:
117 | // Automatically called in EnvelopeManager::addEnvVoiceController()
118 | void setManagerPtr(EnvelopeManager* ptr) { parentManager_ = ptr; }
119 |
120 | double getCurrentValue(double offsetInRatioOfDeltaX_ = 0.0, bool isNoteOn = false)
121 | {
122 | if (parentManager_ != nullptr)
123 | {
124 | return parentManager_->getEnvGeneratorPtr()->getCachedInterpolatitonValue(getXPosWithLoop(isNoteOn, offsetInRatioOfDeltaX_ * deltaX_ * rate_));
125 | }
126 | else
127 | {
128 | return 0.0;
129 | }
130 | }
131 | void setXPos(double x)
132 | {
133 | x_ = x;
134 | }
135 | double getXPos()
136 | {
137 | return x_;
138 | }
139 | bool getIsXAmongEnvelope()
140 | {
141 | if (parentManager_->getEnvGeneratorPtr() == nullptr)
142 | {
143 | return false;
144 | }
145 | auto points = parentManager_->getEnvGeneratorPtr();
146 | return x_ <= points->getFirstPoint().x || points->getLastPoint().x <= x_ ? false : true;
147 | }
148 | void update(bool isNoteOn = false, bool dontUpdateBeyondEnvgen = false)
149 | {
150 | if (parentManager_ == nullptr) return;
151 |
152 | if (dontUpdateBeyondEnvgen)
153 | {
154 | auto points = parentManager_->getEnvGeneratorPtr();
155 | if (getXPosWithLoop(isNoteOn, deltaX_ * rate_) > points->getLastPoint().x)
156 | {
157 | prevNoteOn = isNoteOn;
158 | return;
159 | }
160 | }
161 | x_ = getXPosWithLoop(isNoteOn, deltaX_ * rate_, &isReturning_);
162 |
163 | prevNoteOn = isNoteOn;
164 | }
165 |
166 | void reset() { x_ = 0.0; isReturning_ = false; }
167 | void setDelta(double delta) { deltaX_ = delta; }
168 | void notifyRateHasChanged() { rate_ = parentManager_->getRate(); }
169 | void notifyLoopPosChanged()
170 | {
171 | auto points = parentManager_->getEnvGeneratorPtr();
172 | for (int i = 0; i < points->getNumPoint(); ++i)
173 | {
174 | if (points->getPoint(i).loop == LoopState::LoopStart)
175 | {
176 | loopStartX_ = points->getPoint(i).x;
177 | }
178 | else if (points->getPoint(i).loop == LoopState::LoopEnd)
179 | {
180 | loopEndX_ = points->getPoint(i).x;
181 | }
182 | }
183 | }
184 | };
185 | }
186 | }
--------------------------------------------------------------------------------
/Source/ParamAttachment.cpp:
--------------------------------------------------------------------------------
1 | #include "ParamAttachment.h"
2 |
3 | #include "PluginEditor.h"
4 |
5 | void myplug::Listener_PlugEditGUIScaling::endGesture(NumericSpinBox* s)
6 | {
7 | if (proc_)
8 | {
9 | static_cast(proc_)->setMyplugGUIScaling(s->getCurrentNumber() / 100.0);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Source/ParamAttachment.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "Component_NumericSpinbox.h"
5 | #include "Component_BandSplitter.h"
6 | #include "Envelope_PointEditMultiband.h"
7 |
8 | namespace myplug
9 | {
10 | class NumericSpinboxParameterAttachment : NumericSpinBox::Listener
11 | {
12 | public:
13 | NumericSpinboxParameterAttachment(juce::RangedAudioParameter& parameter, NumericSpinBox& spinbox, juce::UndoManager* undoManager = nullptr)
14 | : attachment_(parameter, [&spinbox](float num) {spinbox.setNumber(num); }, undoManager)
15 | {
16 | sendInitialUpdate();
17 | spinbox.addListener(this);
18 | }
19 | ~NumericSpinboxParameterAttachment() override
20 | {
21 | spinbox_.removeListener(this);
22 | }
23 | void sendInitialUpdate()
24 | {
25 | attachment_.sendInitialUpdate();
26 | }
27 |
28 | protected:
29 | void onNumberChanged(NumericSpinBox* box) override
30 | {
31 | attachment_.setValueAsCompleteGesture(box->getCurrentNumber());
32 | }
33 |
34 | private:
35 | NumericSpinBox spinbox_;
36 | juce::ParameterAttachment attachment_;
37 | };
38 |
39 | class BandSplitViewParameterAttachment : protected BandSplitView::Listener
40 | {
41 | public:
42 | BandSplitViewParameterAttachment(juce::RangedAudioParameter& parameter, BandSplitView& view, envelope::PointEditMB& pointedit, int leftBand, juce::UndoManager* undoManager = nullptr)
43 | : attachment_(parameter, [&](float num)
44 | {
45 | if (leftband_ == 0)
46 | {
47 | view_.setLowMidFreq(num);
48 | }
49 | else if (leftband_ == 1)
50 | {
51 | view_.setMidHighFreq(num);
52 | }
53 | }, undoManager)
54 | , view_(view)
55 | , leftband_(leftBand)
56 | , pointedit_(pointedit)
57 | {
58 | sendInitialUpdate();
59 | view_.addListener(this);
60 | }
61 | ~BandSplitViewParameterAttachment() override
62 | {
63 | view_.removeListener(this);
64 | }
65 | void sendInitialUpdate()
66 | {
67 | attachment_.sendInitialUpdate();
68 | }
69 | protected:
70 | void splitFrequencyChanged(BandSplitView* v) override
71 | {
72 | if (leftband_ == 0)
73 | {
74 | attachment_.setValueAsCompleteGesture(v->getLowMidFreq());
75 | }
76 | else if (leftband_ == 1)
77 | {
78 | attachment_.setValueAsCompleteGesture(v->getMidHighFreq());
79 | }
80 | }
81 | void selectedBandChanged(BandSplitView* v) override
82 | {
83 | int band = v->getSelectedBand();
84 | switch (band)
85 | {
86 | case 0:
87 | pointedit_.setEditingBand("low");
88 | break;
89 | case 1:
90 | pointedit_.setEditingBand("mid");
91 | break;
92 | case 2:
93 | pointedit_.setEditingBand("high");
94 | break;
95 | default:
96 | break;
97 | }
98 | }
99 | private:
100 | int leftband_;
101 | BandSplitView& view_;
102 | envelope::PointEditMB& pointedit_;
103 | juce::ParameterAttachment attachment_;
104 | };
105 |
106 | class Listener_EnvTrg : public juce::ComboBox::Listener
107 | {
108 | envelope::PointEditMB& view_;
109 | public:
110 | Listener_EnvTrg(envelope::PointEditMB& view)
111 | : view_(view)
112 | {
113 |
114 | }
115 | void comboBoxChanged(juce::ComboBox* c) override
116 | {
117 | if (c->getSelectedItemIndex() == 0)
118 | {
119 | view_.setMultiband(false);
120 | }
121 | else
122 | {
123 | view_.setMultiband(true);
124 | }
125 | }
126 | };
127 |
128 | class Listener_PlugEditGUIScaling : public myplug::NumericSpinBox::Listener
129 | {
130 | void* proc_;
131 | public:
132 | Listener_PlugEditGUIScaling(void* PluginEditorPtr) : proc_(PluginEditorPtr) {}
133 |
134 | void onNumberChanged(NumericSpinBox*) override {}
135 | void startGesture(NumericSpinBox*) override {}
136 | void endGesture(NumericSpinBox*) override;
137 | };
138 |
139 | class GenericListener : public juce::AudioProcessorParameter::Listener
140 | {
141 | std::function listenerFunc_ = nullptr;
142 |
143 | public:
144 | void setListener(std::function func)
145 | {
146 | listenerFunc_ = func;
147 | }
148 |
149 | void parameterValueChanged(int parameterIndex, float newValue) override
150 | {
151 | if (listenerFunc_)
152 | listenerFunc_(newValue);
153 | }
154 | void parameterGestureChanged(int parameterIndex, bool gestureIsStarting) override
155 | {
156 |
157 | }
158 | };
159 | }
--------------------------------------------------------------------------------
/Source/PluginEditor.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file contains the basic framework code for a JUCE plugin editor.
5 |
6 | ==============================================================================
7 | */
8 |
9 | #include "PluginProcessor.h"
10 | #include "PluginEditor.h"
11 |
12 | #include "../JuceLibraryCode/BinaryData.h"
13 |
14 | //==============================================================================
15 | MyplugAudioProcessorEditor::MyplugAudioProcessorEditor(MyplugAudioProcessor& p, juce::AudioProcessorValueTreeState& vts)
16 | : AudioProcessorEditor(&p), audioProcessor(p), apvtsRef(vts), bandsplitview_(p.fftData, p.nextFFTBlockReady, p.samplerate)
17 | , param_mix_(*vts.getParameter("Mix"), slider_mix_)
18 | , param_midimode_(*vts.getParameter("Midi_Trg_Mode"), combo_midimode_)
19 | , param_lfoenabled_(*vts.getParameter("Lfo_Enabled"), button_lfo_)
20 | , param_lfonumerator_(*vts.getParameter("Lfo_Numerator"), spin_rate_numerator_)
21 | , param_lfodenominator_(*vts.getParameter("Lfo_Denominator"), spin_rate_denominator_)
22 | , param_envtrg_(*vts.getParameter("EnvTrg"), combo_envmode_)
23 | , param_lfostop_(*vts.getParameter("Lfo_Stop"), button_lfostop_)
24 | , param_lfomultiplier_(*vts.getParameter("Lfo_Multiplier"), spin_rate_seq_)
25 | , param_offset_(*vts.getParameter("Lfo_Offset"), spin_rate_offset_)
26 | , param_lowmidFreq_(*vts.getParameter("Low_Mid_Freq"), bandsplitview_, envedit_.pointEdit_, 0)
27 | , param_midhighFreq_(*vts.getParameter("Mid_High_Freq"), bandsplitview_, envedit_.pointEdit_, 1)
28 | , param_hold_(*vts.getParameter("HoldValue"), button_hold_)
29 | , param_declick_(*vts.getParameter("Declick"), button_declick_)
30 | , param_declicklen_(*vts.getParameter("DeclickLength"), spin_declicklen_)
31 | , paramListener_envtrg_(envedit_.pointEdit_)
32 | , param_guiscaling_(this)
33 | {
34 | // Make sure that before the constructor has finished, you've set the
35 | // editor's size to whatever you need it to be.
36 | setSize(1280, 720);
37 |
38 | // ----------- Read GUI Settings -----------
39 | {
40 | juce::ApplicationProperties appprop;
41 | juce::PropertiesFile::Options options;
42 | options.applicationName = "CIDECHAIN"; options.filenameSuffix = ".editorSettings";
43 | appprop.setStorageParameters(options);
44 | juce::PropertiesFile* setting = appprop.getUserSettings();
45 |
46 | setMyplugGUIScaling(setting->getDoubleValue("GUIScaling", 1.0));
47 |
48 | appprop.closeFiles();
49 | }
50 |
51 | envedit_.setBounds(65, 190, 940, 500);
52 | envedit_.setEnvelopeManager(&p.envmng_);
53 | envedit_.fitToEnvelope();
54 | envedit_.pointEdit_.setEndPointXMovement(false);
55 | envedit_.pointEdit_.setZoomRateRestriction(false);
56 | addAndMakeVisible(envedit_);
57 |
58 | for (int i = 0; i < previewFrames; ++i)
59 | {
60 | preview_[i].setBounds(0, 0, 108, 91);
61 | preview_[i].setTopLeftPosition(75 + i * 10 + i * 108, 75);
62 | preview_[i].setEnvelopeGenerator(&p.envgen_[i], {&p.envgenMB_[i][0], &p.envgenMB_[i][1], &p.envgenMB_[i][2] });
63 | preview_[i].addListener(this);
64 | envedit_.pointEdit_.addListener(&preview_[i]);
65 |
66 | addAndMakeVisible(preview_[i]);
67 | }
68 |
69 | slider_mix_.setRange(0.0, 100.0, 0.01);
70 | slider_mix_.setNumDecimalPlacesToDisplay(0);
71 | slider_mix_.setTextValueSuffix("%");
72 | slider_mix_.setTextBoxStyle(juce::Slider::NoTextBox, true, 0, 0);
73 | slider_mix_.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag);
74 | slider_mix_.textFromValueFunction = nullptr;
75 |
76 | combo_midimode_.addItemList({"OFF", "Loop while note-on", "Oneshot"}, 1);
77 | param_midimode_.sendInitialUpdate();
78 |
79 | spin_rate_numerator_.setMinimum(1);
80 | spin_rate_numerator_.setMaximum(8);
81 | spin_rate_numerator_.setDicimalDigit(0);
82 | spin_rate_denominator_.setValueList({ "1/1","1/2","1/2d (3/4)","1/2t (1/3)","1/4","1/4d (3/8)","1/4t (1/6)","1/8","1/8d (3/16)","1/8t (1/12)","1/16","1/16d (3/32)","1/16t (1/24)", "1/32"});
83 | spin_rate_denominator_.setCustomParser(
84 | [](const juce::String& text) -> double
85 | {
86 | bool containSlash = text.contains("/");
87 | juce::String buf = text.removeCharacters(" ");
88 | juce::String left = buf.upToFirstOccurrenceOf("/", false, false);
89 | const char* leftTable[] = {u8"1", u8"2", u8"2d", u8"2t", u8"4", u8"4d", u8"4t", u8"8", u8"8d", u8"8t", u8"16", u8"16d", u8"16t", u8"32"};
90 | const char* wholeTable1[] = { u8"1/1", u8"1/2", u8"1/2d", u8"1/2t", u8"1/4", u8"1/4d", u8"1/4t", u8"1/8", u8"1/8d", u8"1/8t", u8"1/16", u8"1/16d", u8"1/16t", u8"1/32" };
91 | const char* wholeTable2[] = { u8"1/1", u8"1/2", u8"3/4", u8"1/3", u8"1/4", u8"3/8", u8"1/6", u8"1/8", u8"3/16", u8"1/12", u8"1/16", u8"3/32", u8"1/24", u8"1/32" };
92 | if (!containSlash)
93 | {
94 | for (int i = 0; i < sizeof(leftTable) / sizeof(char*); ++i)
95 | {
96 | if (std::strncmp(leftTable[i], left.toRawUTF8(), 3) == 0)
97 | {
98 | return i;
99 | }
100 | }
101 | if (left == "12")
102 | {
103 | return 9;
104 | }
105 | else if (left == "24")
106 | {
107 | return 12;
108 | }
109 | return 0;
110 | }
111 | else
112 | {
113 | for (int i = 0; i < sizeof(wholeTable1) / sizeof(char*); ++i)
114 | {
115 | if (std::strncmp(wholeTable1[i], buf.toRawUTF8(), 6) == 0)
116 | {
117 | return i;
118 | }
119 | if (std::strncmp(wholeTable2[i], buf.toRawUTF8(), 5) == 0)
120 | {
121 | return i;
122 | }
123 | }
124 | return 0;
125 | }
126 | }
127 | );
128 |
129 | spin_rate_seq_.setMinimum(0.1);
130 | spin_rate_seq_.setMaximum(10.0);
131 | spin_rate_seq_.setPrefix("x ");
132 | spin_rate_seq_.setIncrementAmount(0.1);
133 | spin_rate_seq_.setDicimalDigit(1);
134 |
135 | spin_rate_offset_.setMinimum(0.0);
136 | spin_rate_offset_.setMaximum(100.0);
137 | spin_rate_offset_.setPrefix("Offset ");
138 | spin_rate_offset_.setSuffix("%");
139 | spin_rate_offset_.setIncrementAmount(0.1);
140 | spin_rate_offset_.setDicimalDigit(1);
141 | spin_rate_offset_.setMouseSensitivity(10.0);
142 |
143 | button_lfostop_.setButtonText("Don't use LFO when paused");
144 |
145 | combo_envmode_.addItemList({"Disabled", "Enabled"}, 1);
146 | combo_envmode_.addListener(¶mListener_envtrg_);
147 | param_envtrg_.sendInitialUpdate();
148 |
149 | button_hold_.setButtonText("Hold Value");
150 | button_declick_.setButtonText("Declick");
151 |
152 | spin_declicklen_.setMinimum(1.0);
153 | spin_declicklen_.setMaximum(1000.0);
154 | spin_declicklen_.setSuffix("spls");
155 | spin_rate_offset_.setIncrementAmount(1);
156 | spin_rate_offset_.setDicimalDigit(0);
157 |
158 | spin_guiScaling_.setColour(myplug::NumericSpinBox::Colours::Background, juce::Colour(12, 96, 173));
159 | spin_guiScaling_.setColour(myplug::NumericSpinBox::Colours::BackgroundMouseover, juce::Colour(69, 160, 243));
160 | spin_guiScaling_.setColour(myplug::NumericSpinBox::Colours::Border, juce::Colour(183, 218, 250));
161 | spin_guiScaling_.setMinimum(minScale_ * 100);
162 | spin_guiScaling_.setMaximum(maxScale_ * 100);
163 | spin_guiScaling_.setSuffix("%");
164 | spin_guiScaling_.setIncrementAmount(10);
165 | spin_guiScaling_.setDicimalDigit(0);
166 | spin_guiScaling_.setNumber(guiScaling_ * 100);
167 | spin_guiScaling_.addListener(¶m_guiscaling_);
168 |
169 | addAndMakeVisible(slider_mix_);
170 | addAndMakeVisible(combo_midimode_);
171 | addAndMakeVisible(button_lfo_);
172 | addAndMakeVisible(spin_rate_numerator_);
173 | addAndMakeVisible(spin_rate_denominator_);
174 | addAndMakeVisible(spin_rate_seq_);
175 | addAndMakeVisible(spin_rate_offset_);
176 | addAndMakeVisible(combo_envmode_);
177 | addAndMakeVisible(button_lfostop_);
178 | addAndMakeVisible(bandsplitview_);
179 | addAndMakeVisible(button_hold_);
180 | addAndMakeVisible(button_declick_);
181 | addAndMakeVisible(spin_declicklen_);
182 | addAndMakeVisible(spin_guiScaling_);
183 |
184 | setLookAndFeel(&customlookandfeel);
185 | }
186 |
187 | MyplugAudioProcessorEditor::~MyplugAudioProcessorEditor()
188 | {
189 | setLookAndFeel(nullptr);
190 | for (int i = 0; i < previewFrames; ++i)
191 | {
192 | preview_[i].removeListener(this);
193 | envedit_.pointEdit_.removeListener(&preview_[i]);
194 | }
195 | combo_envmode_.removeListener(¶mListener_envtrg_);
196 |
197 | // ----------- Write GUI Settings -----------
198 | juce::ApplicationProperties appprop;
199 | juce::PropertiesFile::Options options;
200 | options.applicationName = "CIDECHAIN"; options.filenameSuffix = ".editorSettings";
201 | appprop.setStorageParameters(options);
202 |
203 | juce::PropertiesFile* setting = appprop.getUserSettings();
204 |
205 | setting->setValue("GUIScaling", getGUIScaling());
206 |
207 | setting->save();
208 | appprop.closeFiles();
209 | }
210 |
211 | //==============================================================================
212 | void MyplugAudioProcessorEditor::paint (juce::Graphics& g)
213 | {
214 | // (Our component is opaque, so we must completely fill the background with a solid colour)
215 | g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
216 |
217 | juce::Image backgroundImg = juce::ImageCache::getFromMemory(BinaryData::bgimg_png, BinaryData::bgimg_pngSize);
218 | g.drawImageAt(backgroundImg, 0, 0);
219 | }
220 |
221 | void MyplugAudioProcessorEditor::resized()
222 | {
223 | // This is generally where you'll want to lay out the positions of any
224 | // subcomponents in your editor..
225 |
226 | slider_mix_.setBounds(1045,222,60,60);
227 | combo_midimode_.setBounds(1035, 316, 205, 25);
228 | button_lfo_.setBounds(1075, 357, 25, 20);
229 | spin_rate_numerator_.setBounds(1035, 379, 37, 25);
230 | spin_rate_denominator_.setBounds(1097, 379, 143, 25);
231 | spin_rate_seq_.setBounds(1035, 415, 205, 25);
232 | spin_rate_offset_.setBounds(1035, 452, 205, 25);
233 | button_lfostop_.setBounds(1035, 489, 205, 25);
234 | combo_envmode_.setBounds(1035, 539, 205, 25);
235 | bandsplitview_.setBounds(1035, 571, 205, 100);
236 | button_hold_.setBounds(1124, 197, 116, 25);
237 | button_declick_.setBounds(1124, 227, 116, 25);
238 | spin_declicklen_.setBounds(1124, 257, 116, 25);
239 | spin_guiScaling_.setBounds(278, 9, 64, 23);
240 | }
241 |
242 | void MyplugAudioProcessorEditor::clicked(myplug::envelope::EnvelopePreviewComponent* c)
243 | {
244 | for (int i = 0; i < 10; ++i)
245 | {
246 | if (c == preview_ + i)
247 | {
248 | apvtsRef.getParameter("Banks")->setValueNotifyingHost(i / 9.0f);
249 | previewingIndex_ = i;
250 | break;
251 | }
252 | }
253 | }
--------------------------------------------------------------------------------
/Source/PluginEditor.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file contains the basic framework code for a JUCE plugin editor.
5 |
6 | ==============================================================================
7 | */
8 |
9 | #pragma once
10 |
11 | #include
12 | #include "PluginProcessor.h"
13 |
14 | #include "Envelope_Editor.h"
15 | #include "Envelope_PreviewComponent.h"
16 | #include "Component_NumericSpinbox.h"
17 | #include "Component_BandSplitter.h"
18 | #include "customlookandfeel.h"
19 | #include "ParamAttachment.h"
20 |
21 | constexpr size_t previewFrames = 10;
22 |
23 | //==============================================================================
24 | /**
25 | */
26 | class MyplugAudioProcessorEditor
27 | : public juce::AudioProcessorEditor
28 | , public myplug::envelope::EnvelopePreviewComponent::Listener
29 | {
30 | public:
31 | MyplugAudioProcessorEditor (MyplugAudioProcessor&, juce::AudioProcessorValueTreeState&);
32 | ~MyplugAudioProcessorEditor() override;
33 |
34 | //==============================================================================
35 | void paint (juce::Graphics&) override;
36 | void resized() override;
37 |
38 | void setMyplugGUIScaling(float newScale)
39 | {
40 | guiScaling_ = std::clamp(newScale, minScale_, maxScale_);
41 | juce::Desktop::getInstance().setGlobalScaleFactor(guiScaling_);
42 | repaint();
43 | }
44 | float getGUIScaling() { return guiScaling_; }
45 |
46 | protected:
47 | void clicked(myplug::envelope::EnvelopePreviewComponent*) override;
48 |
49 | private:
50 | // This reference is provided as a quick way for your editor to
51 | // access the processor object that created it.
52 | MyplugAudioProcessor& audioProcessor;
53 | juce::AudioProcessorValueTreeState& apvtsRef;
54 |
55 | myplug::CustomLookAndFeel customlookandfeel;
56 | myplug::envelope::EnvelopeEditor envedit_;
57 | myplug::envelope::EnvelopePreviewComponent preview_[previewFrames];
58 | int previewingIndex_ = 0;
59 | juce::Slider slider_mix_;
60 | juce::ComboBox combo_midimode_;
61 | juce::ToggleButton button_lfo_;
62 | myplug::NumericSpinBox spin_rate_numerator_;
63 | myplug::NumericSpinBox spin_rate_denominator_;
64 | myplug::NumericSpinBox spin_rate_seq_;
65 | myplug::NumericSpinBox spin_rate_offset_;
66 | juce::ToggleButton button_lfostop_;
67 | juce::ComboBox combo_envmode_;
68 | myplug::BandSplitView bandsplitview_;
69 | juce::ToggleButton button_hold_;
70 | juce::ToggleButton button_declick_;
71 | myplug::NumericSpinBox spin_declicklen_;
72 |
73 | // GUI Scaling
74 | float maxScale_ = 4.0;
75 | float minScale_ = 0.3;
76 | float guiScaling_ = 1.0;
77 | myplug::NumericSpinBox spin_guiScaling_;
78 |
79 | // Param Listener
80 | juce::SliderParameterAttachment param_mix_;
81 | juce::ComboBoxParameterAttachment param_midimode_;
82 | juce::ButtonParameterAttachment param_lfoenabled_;
83 | myplug::NumericSpinboxParameterAttachment param_lfonumerator_;
84 | myplug::NumericSpinboxParameterAttachment param_lfodenominator_;
85 | myplug::NumericSpinboxParameterAttachment param_lfomultiplier_;
86 | myplug::NumericSpinboxParameterAttachment param_offset_;
87 | myplug::BandSplitViewParameterAttachment param_lowmidFreq_;
88 | myplug::BandSplitViewParameterAttachment param_midhighFreq_;
89 | juce::ComboBoxParameterAttachment param_envtrg_;
90 | juce::ButtonParameterAttachment param_lfostop_;
91 | juce::ButtonParameterAttachment param_hold_;
92 | juce::ButtonParameterAttachment param_declick_;
93 | myplug::NumericSpinboxParameterAttachment param_declicklen_;
94 |
95 | myplug::Listener_EnvTrg paramListener_envtrg_;
96 | myplug::Listener_PlugEditGUIScaling param_guiscaling_;
97 |
98 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MyplugAudioProcessorEditor)
99 | };
100 |
--------------------------------------------------------------------------------
/Source/PluginProcessor.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gomadare0/Cidechain/418883e1527239ef5a7737b78fa1938710e19122/Source/PluginProcessor.cpp
--------------------------------------------------------------------------------
/Source/PluginProcessor.h:
--------------------------------------------------------------------------------
1 | /*
2 | ==============================================================================
3 |
4 | This file contains the basic framework code for a JUCE plugin processor.
5 |
6 | ==============================================================================
7 | */
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | #include "Envelope_Data.h"
14 | #include "Envelope_Manager.h"
15 | #include "Envelope_VoiceController.h"
16 | #include "ParamAttachment.h"
17 | #include "Constants.h"
18 | #include "DSP_Filter.h"
19 |
20 | //==============================================================================
21 | /**
22 | */
23 | class MyplugAudioProcessor : public juce::AudioProcessor
24 | {
25 | public:
26 | //==============================================================================
27 | MyplugAudioProcessor();
28 | ~MyplugAudioProcessor() override;
29 |
30 | //==============================================================================
31 | void prepareToPlay (double sampleRate, int samplesPerBlock) override;
32 | void releaseResources() override;
33 |
34 | #ifndef JucePlugin_PreferredChannelConfigurations
35 | bool isBusesLayoutSupported (const BusesLayout& layouts) const override;
36 | #endif
37 |
38 | void processBlock (juce::AudioBuffer&, juce::MidiBuffer&) override;
39 |
40 | //==============================================================================
41 | juce::AudioProcessorEditor* createEditor() override;
42 | bool hasEditor() const override;
43 |
44 | //==============================================================================
45 | const juce::String getName() const override;
46 |
47 | bool acceptsMidi() const override;
48 | bool producesMidi() const override;
49 | bool isMidiEffect() const override;
50 | double getTailLengthSeconds() const override;
51 |
52 | //==============================================================================
53 | int getNumPrograms() override;
54 | int getCurrentProgram() override;
55 | void setCurrentProgram (int index) override;
56 | const juce::String getProgramName (int index) override;
57 | void changeProgramName (int index, const juce::String& newName) override;
58 |
59 | //==============================================================================
60 | void getStateInformation (juce::MemoryBlock& destData) override;
61 | void setStateInformation (const void* data, int sizeInBytes) override;
62 |
63 | public:
64 | // Envelopes
65 | myplug::envelope::EnvelopeManager envmng_;
66 | myplug::envelope::CachedEnvelopeGenerator envgen_[10];
67 | myplug::envelope::CachedEnvelopeGenerator envgenMB_[10][3];
68 | myplug::envelope::EnvelopeVoiceController envVoice_;
69 |
70 | // Envtrigger Buffer
71 | std::array fifo;
72 | std::array fftData;
73 | int fifoIndex = 0;
74 | bool nextFFTBlockReady = false;
75 | int samplerate = 48000;
76 |
77 | private:
78 | void pushNextSampleIntoFifo(float sample);
79 | void updateLFORate(double bpm = 120.0);
80 | void recalcAndUpdateXPos(juce::AudioPlayHead& playhead);
81 |
82 | juce::dsp::WindowingFunction windowFunc;
83 | juce::dsp::FFT fft;
84 | juce::AudioProcessorValueTreeState apvts;
85 | juce::AudioProcessorValueTreeState::ParameterLayout createParamLayout();
86 | int midiVoices = 0;
87 | bool isMidiTriggered = false;
88 | juce::AudioPlayHead::CurrentPositionInfo prevPosInfo_;
89 |
90 | std::array declickCache_;
91 | int declickCacheIndex_ = 0;
92 | std::array declickCacheMB_[3];
93 | int declickCacheMBIndex_ = 0;
94 |
95 | // Params
96 | juce::RangedAudioParameter* param_banks_;
97 | juce::RangedAudioParameter* param_mix_;
98 | juce::RangedAudioParameter* param_miditrg_;
99 | juce::RangedAudioParameter* param_lfoenabled_;
100 | juce::RangedAudioParameter* param_lfonumerator_;
101 | juce::RangedAudioParameter* param_lfodenominator_;
102 | juce::RangedAudioParameter* param_lfomultiplier_;
103 | juce::RangedAudioParameter* param_lfooffset_;
104 | juce::RangedAudioParameter* param_lfostop_;
105 | juce::RangedAudioParameter* param_envTrg_;
106 | juce::RangedAudioParameter* param_lowmidFreq_;
107 | juce::RangedAudioParameter* param_midhighFreq_;
108 | juce::RangedAudioParameter* param_hold_;
109 | juce::RangedAudioParameter* param_declick_;
110 | juce::RangedAudioParameter* param_declicklen_;
111 |
112 | myplug::GenericListener listener_banks_;
113 | myplug::GenericListener listener_lowmidFreq_;
114 | myplug::GenericListener listener_midhighFreq_;
115 |
116 | // Filters
117 | myplug::DSP::Butterworth_2nd lowmid_lp_[2][2];
118 | myplug::DSP::Butterworth_2nd lowmid_hp_[2][2];
119 | myplug::DSP::Butterworth_2nd midhigh_lp_[2][2];
120 | myplug::DSP::Butterworth_2nd midhigh_hp_[2][2];
121 |
122 | //==============================================================================
123 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MyplugAudioProcessor)
124 | };
125 |
--------------------------------------------------------------------------------
/Source/ValueNormalization.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace myplug
4 | {
5 | template
6 | [[nodiscard]] T normalizeValue(const T& value, const T& min, const T& max)
7 | {
8 | T length = max - min;
9 | if(length == 0.0)
10 | {
11 | return 0.0;
12 | }
13 | return (value - min) / length;
14 | }
15 |
16 | template
17 | [[nodiscard]] T denormalizeValue(const T& normalizedValue, const T& min, const T& max)
18 | {
19 | T length = max - min;
20 | return normalizedValue * length + min;
21 | }
22 | }
--------------------------------------------------------------------------------
/Source/customlookandfeel.cpp:
--------------------------------------------------------------------------------
1 | #include "customlookandfeel.h"
2 |
3 | myplug::CustomLookAndFeel::CustomLookAndFeel()
4 | {
5 | setColour(juce::ScrollBar::ColourIds::thumbColourId, juce::Colours::mediumpurple);
6 | setColour(juce::Slider::ColourIds::rotarySliderFillColourId, juce::Colours::darkgrey);
7 | setColour(juce::Slider::ColourIds::trackColourId, juce::Colours::mediumpurple);
8 | setColour(juce::ComboBox::ColourIds::backgroundColourId, juce::Colour(0.0f, 0.0f, 0.2f, 1.0f));
9 | setColour(juce::ComboBox::ColourIds::outlineColourId, juce::Colours::mediumpurple);
10 | setColour(juce::PopupMenu::ColourIds::backgroundColourId, juce::Colour(0.0f, 0.0f, 0.1f, 1.0f));
11 | setColour(juce::PopupMenu::ColourIds::highlightedBackgroundColourId, juce::Colour(0.0f, 0.0f, 0.2f, 1.0f));
12 | setColour(juce::TextEditor::ColourIds::backgroundColourId, juce::Colour(0.0f, 0.0f, 0.3f, 1.0f));
13 | }
14 |
15 | void myplug::CustomLookAndFeel::drawRotarySlider(juce::Graphics& g, int x, int y, int width, int height, float sliderPosProportional, float rotaryStartAngle, float rotaryEndAngle, juce::Slider& slider)
16 | {
17 | auto angle = rotaryStartAngle + sliderPosProportional * (rotaryEndAngle - rotaryStartAngle);
18 | auto Pi = juce::MathConstants::pi;
19 | float thickness = 5.0f;
20 | float arcRad = Pi / 3.0f;
21 |
22 | // background
23 | g.setColour(findColour(juce::Slider::ColourIds::rotarySliderFillColourId));
24 | juce::Path bgPath;
25 | juce::PathStrokeType stroke(thickness, juce::PathStrokeType::JointStyle::curved, juce::PathStrokeType::EndCapStyle::rounded);
26 | bgPath.addCentredArc(width / 2, height / 2, width / 2 - thickness / 2, height / 2 - thickness / 2, 0.0, rotaryStartAngle, rotaryEndAngle, true);
27 | g.strokePath(bgPath, stroke);
28 |
29 | // foreground
30 | g.setColour(findColour(juce::Slider::ColourIds::trackColourId));
31 | juce::Path fgPath;
32 | fgPath.addCentredArc(width / 2, height / 2, width / 2 - thickness / 2, height / 2 - thickness / 2, 0.0, rotaryStartAngle, angle, true);
33 | g.strokePath(fgPath, stroke);
34 |
35 | // draw text
36 | float fontheight = g.getCurrentFont().getHeight();
37 | g.setColour(findColour(juce::Slider::ColourIds::trackColourId).brighter());
38 | g.drawText(slider.getTextFromValue(slider.getValue()), 0, height / 2 - fontheight / 2, width, fontheight, juce::Justification::centred);
39 | }
40 |
--------------------------------------------------------------------------------
/Source/customlookandfeel.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace myplug
6 | {
7 | class CustomLookAndFeel : public juce::LookAndFeel_V4
8 | {
9 | public:
10 | CustomLookAndFeel();
11 | void drawRotarySlider(juce::Graphics& g, int x, int y, int width, int height, float sliderPosProportional, float rotaryStartAngle, float rotaryEndAngle, juce::Slider& slider) override;
12 | };
13 | }
--------------------------------------------------------------------------------