diff --git a/examples/BLOCKS/BlocksDrawing/BlocksDrawing.jucer b/examples/BLOCKS/BlocksDrawing/BlocksDrawing.jucer
index e1cb9e0c4b..0329ec36ff 100644
--- a/examples/BLOCKS/BlocksDrawing/BlocksDrawing.jucer
+++ b/examples/BLOCKS/BlocksDrawing/BlocksDrawing.jucer
@@ -8,8 +8,10 @@
-
+
+
diff --git a/examples/BLOCKS/BlocksDrawing/Builds/LinuxMakefile/Makefile b/examples/BLOCKS/BlocksDrawing/Builds/LinuxMakefile/Makefile
index 607278f769..ee94b6cf2b 100644
--- a/examples/BLOCKS/BlocksDrawing/Builds/LinuxMakefile/Makefile
+++ b/examples/BLOCKS/BlocksDrawing/Builds/LinuxMakefile/Makefile
@@ -67,6 +67,7 @@ endif
OBJECTS_APP := \
$(JUCE_OBJDIR)/Main_90ebc5c2.o \
+ $(JUCE_OBJDIR)/MainComponent_a6ffb4a5.o \
$(JUCE_OBJDIR)/include_juce_audio_basics_8a4e984a.o \
$(JUCE_OBJDIR)/include_juce_audio_devices_63111d02.o \
$(JUCE_OBJDIR)/include_juce_audio_formats_15f82001.o \
@@ -83,6 +84,8 @@ OBJECTS_APP := \
.PHONY: clean all
+all : $(JUCE_OUTDIR)/$(JUCE_TARGET_APP)
+
$(JUCE_OUTDIR)/$(JUCE_TARGET_APP) : check-pkg-config $(OBJECTS_APP) $(RESOURCES)
@echo Linking "BlocksDrawing - App"
-$(V_AT)mkdir -p $(JUCE_BINDIR)
@@ -95,6 +98,11 @@ $(JUCE_OBJDIR)/Main_90ebc5c2.o: ../../Source/Main.cpp
@echo "Compiling Main.cpp"
$(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<"
+$(JUCE_OBJDIR)/MainComponent_a6ffb4a5.o: ../../Source/MainComponent.cpp
+ -$(V_AT)mkdir -p $(JUCE_OBJDIR)
+ @echo "Compiling MainComponent.cpp"
+ $(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<"
+
$(JUCE_OBJDIR)/include_juce_audio_basics_8a4e984a.o: ../../JuceLibraryCode/include_juce_audio_basics.cpp
-$(V_AT)mkdir -p $(JUCE_OBJDIR)
@echo "Compiling include_juce_audio_basics.cpp"
diff --git a/examples/BLOCKS/BlocksDrawing/Builds/MacOSX/BlocksDrawing.xcodeproj/project.pbxproj b/examples/BLOCKS/BlocksDrawing/Builds/MacOSX/BlocksDrawing.xcodeproj/project.pbxproj
index b10498f328..f92ba350dd 100644
--- a/examples/BLOCKS/BlocksDrawing/Builds/MacOSX/BlocksDrawing.xcodeproj/project.pbxproj
+++ b/examples/BLOCKS/BlocksDrawing/Builds/MacOSX/BlocksDrawing.xcodeproj/project.pbxproj
@@ -20,6 +20,7 @@
C5B65EEA10D40B2770FE8937 = {isa = PBXBuildFile; fileRef = ABA9D69C67D0234528DEB39B; };
19DBB78B919C4774330FCED5 = {isa = PBXBuildFile; fileRef = BA174BBB2231F7A8D1621BE9; };
F1C1D8F4BDE85067F5E61D08 = {isa = PBXBuildFile; fileRef = 49F51637C89080A76F65E9F7; };
+ D354A0AD7CBDBDD1D8132ECC = {isa = PBXBuildFile; fileRef = 3A534A7474110674C69C1FC9; };
F3102423A2C8D91FE1D9B41E = {isa = PBXBuildFile; fileRef = B0CCD8CF994F3F797BB6D208; };
853E27BAF3F496A77507B0F3 = {isa = PBXBuildFile; fileRef = C80A487F061CBA873D8E3F10; };
8BB421F938D69A28CEC1DE59 = {isa = PBXBuildFile; fileRef = EDC56FC7BB77C81B88EABC68; };
@@ -41,6 +42,7 @@
2AF21CDE4EFD3BBA599DE77E = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "include_juce_gui_extra.mm"; path = "../../JuceLibraryCode/include_juce_gui_extra.mm"; sourceTree = "SOURCE_ROOT"; };
2C5EEC55C1DCC5A3372873C8 = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; };
38BEC0B6AFAFA022B355CC1B = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MainComponent.h; path = ../../Source/MainComponent.h; sourceTree = "SOURCE_ROOT"; };
+ 3A534A7474110674C69C1FC9 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = MainComponent.cpp; path = ../../Source/MainComponent.cpp; sourceTree = "SOURCE_ROOT"; };
49F51637C89080A76F65E9F7 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Main.cpp; path = ../../Source/Main.cpp; sourceTree = "SOURCE_ROOT"; };
4ABD70F1E7F6F48AF857A965 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppConfig.h; path = ../../JuceLibraryCode/AppConfig.h; sourceTree = "SOURCE_ROOT"; };
574E29C4D824BEE95F94E7D6 = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Info-App.plist"; path = "Info-App.plist"; sourceTree = "SOURCE_ROOT"; };
@@ -80,8 +82,9 @@
F5D89B3EFBF1FF94452EA34D = {isa = PBXFileReference; lastKnownFileType = file; name = "juce_audio_processors"; path = "../../../../../modules/juce_audio_processors"; sourceTree = "SOURCE_ROOT"; };
AA00B6CDF58EE5901BBEF67C = {isa = PBXGroup; children = (
C4BD68C22BCD71B945684B0A,
- 38BEC0B6AFAFA022B355CC1B,
- 49F51637C89080A76F65E9F7, ); name = Source; sourceTree = ""; };
+ 49F51637C89080A76F65E9F7,
+ 3A534A7474110674C69C1FC9,
+ 38BEC0B6AFAFA022B355CC1B, ); name = Source; sourceTree = ""; };
9886851267A0D1BF2E10BA86 = {isa = PBXGroup; children = (
AA00B6CDF58EE5901BBEF67C, ); name = BlocksDrawing; sourceTree = ""; };
ACF438DCCC7951F80306FB81 = {isa = PBXGroup; children = (
@@ -160,8 +163,9 @@
"JucePlugin_Build_AAX=0",
"JucePlugin_Build_Standalone=0", );
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
- HEADER_SEARCH_PATHS = ("../../JuceLibraryCode", "../../../../../modules", "/juce_audio_plugin_client", "$(inherited)");
+ HEADER_SEARCH_PATHS = ("../../JuceLibraryCode", "../../../../../modules", "/Users/ROLIEngineer/Documents/JUCE/modules/juce_audio_plugin_client", "$(inherited)");
INFOPLIST_FILE = Info-App.plist;
+ INFOPLIST_PREPROCESS = NO;
INSTALL_PATH = "$(HOME)/Applications";
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET_ppc = 10.4;
@@ -191,8 +195,9 @@
"JucePlugin_Build_Standalone=0", );
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
- HEADER_SEARCH_PATHS = ("../../JuceLibraryCode", "../../../../../modules", "/juce_audio_plugin_client", "$(inherited)");
+ HEADER_SEARCH_PATHS = ("../../JuceLibraryCode", "../../../../../modules", "/Users/ROLIEngineer/Documents/JUCE/modules/juce_audio_plugin_client", "$(inherited)");
INFOPLIST_FILE = Info-App.plist;
+ INFOPLIST_PREPROCESS = NO;
INSTALL_PATH = "$(HOME)/Applications";
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET_ppc = 10.4;
@@ -242,6 +247,7 @@
19DBB78B919C4774330FCED5, ); runOnlyForDeploymentPostprocessing = 0; };
6F1EAB6EC19EDAB88EF14DE0 = {isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = (
F1C1D8F4BDE85067F5E61D08,
+ D354A0AD7CBDBDD1D8132ECC,
F3102423A2C8D91FE1D9B41E,
853E27BAF3F496A77507B0F3,
8BB421F938D69A28CEC1DE59,
diff --git a/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2015/BlocksDrawing_App.vcxproj b/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2015/BlocksDrawing_App.vcxproj
index 66419a8a77..676f6af690 100644
--- a/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2015/BlocksDrawing_App.vcxproj
+++ b/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2015/BlocksDrawing_App.vcxproj
@@ -16,6 +16,7 @@
{CFD78289-DF68-E998-FA52-BA8B893952D3}
v140
+ 8.1
Application
false
v140
+ 8.1
@@ -30,6 +32,7 @@
false
true
v140
+ 8.1
@@ -40,6 +43,7 @@
v140
+ 8.1
<_ProjectFileVersion>10.0.30319.1
@@ -53,6 +57,7 @@
BlocksDrawing
true
v140
+ 8.1
@@ -140,6 +145,7 @@
+
true
@@ -1924,6 +1930,7 @@
+
diff --git a/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2015/BlocksDrawing_App.vcxproj.filters b/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2015/BlocksDrawing_App.vcxproj.filters
index ee5ef28833..17784c2674 100644
--- a/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2015/BlocksDrawing_App.vcxproj.filters
+++ b/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2015/BlocksDrawing_App.vcxproj.filters
@@ -370,6 +370,9 @@
BlocksDrawing\Source
+
+ BlocksDrawing\Source
+
Juce Modules\juce_audio_basics\buffers
@@ -2679,6 +2682,9 @@
Juce Modules\juce_blocks_basics\blocks
+
+ Juce Modules\juce_blocks_basics\blocks
+
Juce Modules\juce_blocks_basics\blocks
diff --git a/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2017/BlocksDrawing_App.vcxproj b/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2017/BlocksDrawing_App.vcxproj
index 6a4f8e6a2c..488416a964 100644
--- a/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2017/BlocksDrawing_App.vcxproj
+++ b/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2017/BlocksDrawing_App.vcxproj
@@ -16,6 +16,7 @@
{CFD78289-DF68-E998-FA52-BA8B893952D3}
v141
+ 10.0.15063.0
false
v141
v141
+ 10.0.15063.0
@@ -32,6 +34,7 @@
true
v141
v141
+ 10.0.15063.0
@@ -42,6 +45,7 @@
v141
+ 10.0.15063.0
<_ProjectFileVersion>10.0.30319.1
@@ -55,6 +59,7 @@
BlocksDrawing
true
v141
+ 10.0.15063.0
@@ -139,6 +144,7 @@
+
true
@@ -1923,6 +1929,7 @@
+
diff --git a/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2017/BlocksDrawing_App.vcxproj.filters b/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2017/BlocksDrawing_App.vcxproj.filters
index 88b9425990..cdcd7a0c04 100644
--- a/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2017/BlocksDrawing_App.vcxproj.filters
+++ b/examples/BLOCKS/BlocksDrawing/Builds/VisualStudio2017/BlocksDrawing_App.vcxproj.filters
@@ -370,6 +370,9 @@
BlocksDrawing\Source
+
+ BlocksDrawing\Source
+
Juce Modules\juce_audio_basics\buffers
@@ -2679,6 +2682,9 @@
Juce Modules\juce_blocks_basics\blocks
+
+ Juce Modules\juce_blocks_basics\blocks
+
Juce Modules\juce_blocks_basics\blocks
diff --git a/examples/BLOCKS/BlocksDrawing/Builds/iOS/BlocksDrawing.xcodeproj/project.pbxproj b/examples/BLOCKS/BlocksDrawing/Builds/iOS/BlocksDrawing.xcodeproj/project.pbxproj
index 152b1a4a7c..bf741b3a73 100644
--- a/examples/BLOCKS/BlocksDrawing/Builds/iOS/BlocksDrawing.xcodeproj/project.pbxproj
+++ b/examples/BLOCKS/BlocksDrawing/Builds/iOS/BlocksDrawing.xcodeproj/project.pbxproj
@@ -22,6 +22,7 @@
7292839DA84380BAA0F12E31 = {isa = PBXBuildFile; fileRef = 4DCF6F0AB88DA09CE8F97DD4; };
2A5E87443C41335CD944ACB8 = {isa = PBXBuildFile; fileRef = 4FE119D4AAC2809C3D698315; };
F1C1D8F4BDE85067F5E61D08 = {isa = PBXBuildFile; fileRef = 49F51637C89080A76F65E9F7; };
+ D354A0AD7CBDBDD1D8132ECC = {isa = PBXBuildFile; fileRef = 3A534A7474110674C69C1FC9; };
F3102423A2C8D91FE1D9B41E = {isa = PBXBuildFile; fileRef = B0CCD8CF994F3F797BB6D208; };
853E27BAF3F496A77507B0F3 = {isa = PBXBuildFile; fileRef = C80A487F061CBA873D8E3F10; };
8BB421F938D69A28CEC1DE59 = {isa = PBXBuildFile; fileRef = EDC56FC7BB77C81B88EABC68; };
@@ -43,6 +44,7 @@
2AF21CDE4EFD3BBA599DE77E = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "include_juce_gui_extra.mm"; path = "../../JuceLibraryCode/include_juce_gui_extra.mm"; sourceTree = "SOURCE_ROOT"; };
2C5EEC55C1DCC5A3372873C8 = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; };
38BEC0B6AFAFA022B355CC1B = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MainComponent.h; path = ../../Source/MainComponent.h; sourceTree = "SOURCE_ROOT"; };
+ 3A534A7474110674C69C1FC9 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = MainComponent.cpp; path = ../../Source/MainComponent.cpp; sourceTree = "SOURCE_ROOT"; };
485A0E39984AC8CD2F98B50C = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreImage.framework; path = System/Library/Frameworks/CoreImage.framework; sourceTree = SDKROOT; };
49F51637C89080A76F65E9F7 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Main.cpp; path = ../../Source/Main.cpp; sourceTree = "SOURCE_ROOT"; };
4ABD70F1E7F6F48AF857A965 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppConfig.h; path = ../../JuceLibraryCode/AppConfig.h; sourceTree = "SOURCE_ROOT"; };
@@ -84,8 +86,9 @@
F5D89B3EFBF1FF94452EA34D = {isa = PBXFileReference; lastKnownFileType = file; name = "juce_audio_processors"; path = "../../../../../modules/juce_audio_processors"; sourceTree = "SOURCE_ROOT"; };
AA00B6CDF58EE5901BBEF67C = {isa = PBXGroup; children = (
C4BD68C22BCD71B945684B0A,
- 38BEC0B6AFAFA022B355CC1B,
- 49F51637C89080A76F65E9F7, ); name = Source; sourceTree = ""; };
+ 49F51637C89080A76F65E9F7,
+ 3A534A7474110674C69C1FC9,
+ 38BEC0B6AFAFA022B355CC1B, ); name = Source; sourceTree = ""; };
9886851267A0D1BF2E10BA86 = {isa = PBXGroup; children = (
AA00B6CDF58EE5901BBEF67C, ); name = BlocksDrawing; sourceTree = ""; };
ACF438DCCC7951F80306FB81 = {isa = PBXGroup; children = (
@@ -168,8 +171,9 @@
"JucePlugin_Build_AAX=0",
"JucePlugin_Build_Standalone=0", );
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
- HEADER_SEARCH_PATHS = ("../../JuceLibraryCode", "../../../../../modules", "/juce_audio_plugin_client", "$(inherited)");
+ HEADER_SEARCH_PATHS = ("../../JuceLibraryCode", "../../../../../modules", "/Users/ROLIEngineer/Documents/JUCE/modules/juce_audio_plugin_client", "$(inherited)");
INFOPLIST_FILE = Info-App.plist;
+ INFOPLIST_PREPROCESS = NO;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.BlocksDrawing;
USE_HEADERMAP = NO; }; name = Debug; };
@@ -198,8 +202,9 @@
"JucePlugin_Build_Standalone=0", );
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
- HEADER_SEARCH_PATHS = ("../../JuceLibraryCode", "../../../../../modules", "/juce_audio_plugin_client", "$(inherited)");
+ HEADER_SEARCH_PATHS = ("../../JuceLibraryCode", "../../../../../modules", "/Users/ROLIEngineer/Documents/JUCE/modules/juce_audio_plugin_client", "$(inherited)");
INFOPLIST_FILE = Info-App.plist;
+ INFOPLIST_PREPROCESS = NO;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.BlocksDrawing;
USE_HEADERMAP = NO; }; name = Release; };
@@ -254,6 +259,7 @@
2A5E87443C41335CD944ACB8, ); runOnlyForDeploymentPostprocessing = 0; };
6F1EAB6EC19EDAB88EF14DE0 = {isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = (
F1C1D8F4BDE85067F5E61D08,
+ D354A0AD7CBDBDD1D8132ECC,
F3102423A2C8D91FE1D9B41E,
853E27BAF3F496A77507B0F3,
8BB421F938D69A28CEC1DE59,
diff --git a/examples/BLOCKS/BlocksDrawing/JuceLibraryCode/AppConfig.h b/examples/BLOCKS/BlocksDrawing/JuceLibraryCode/AppConfig.h
index 3330c3245c..70ed8851da 100644
--- a/examples/BLOCKS/BlocksDrawing/JuceLibraryCode/AppConfig.h
+++ b/examples/BLOCKS/BlocksDrawing/JuceLibraryCode/AppConfig.h
@@ -62,167 +62,167 @@
// juce_audio_devices flags:
#ifndef JUCE_ASIO
- //#define JUCE_ASIO
+ //#define JUCE_ASIO 1
#endif
#ifndef JUCE_WASAPI
- //#define JUCE_WASAPI
+ //#define JUCE_WASAPI 1
#endif
#ifndef JUCE_WASAPI_EXCLUSIVE
- //#define JUCE_WASAPI_EXCLUSIVE
+ //#define JUCE_WASAPI_EXCLUSIVE 1
#endif
#ifndef JUCE_DIRECTSOUND
- //#define JUCE_DIRECTSOUND
+ //#define JUCE_DIRECTSOUND 1
#endif
#ifndef JUCE_ALSA
- //#define JUCE_ALSA
+ //#define JUCE_ALSA 1
#endif
#ifndef JUCE_JACK
- //#define JUCE_JACK
+ //#define JUCE_JACK 1
#endif
#ifndef JUCE_USE_ANDROID_OPENSLES
- //#define JUCE_USE_ANDROID_OPENSLES
+ //#define JUCE_USE_ANDROID_OPENSLES 1
#endif
#ifndef JUCE_USE_WINRT_MIDI
- //#define JUCE_USE_WINRT_MIDI
+ //#define JUCE_USE_WINRT_MIDI 1
#endif
//==============================================================================
// juce_audio_formats flags:
#ifndef JUCE_USE_FLAC
- //#define JUCE_USE_FLAC
+ //#define JUCE_USE_FLAC 1
#endif
#ifndef JUCE_USE_OGGVORBIS
- //#define JUCE_USE_OGGVORBIS
+ //#define JUCE_USE_OGGVORBIS 1
#endif
#ifndef JUCE_USE_MP3AUDIOFORMAT
- //#define JUCE_USE_MP3AUDIOFORMAT
+ //#define JUCE_USE_MP3AUDIOFORMAT 1
#endif
#ifndef JUCE_USE_LAME_AUDIO_FORMAT
- //#define JUCE_USE_LAME_AUDIO_FORMAT
+ //#define JUCE_USE_LAME_AUDIO_FORMAT 1
#endif
#ifndef JUCE_USE_WINDOWS_MEDIA_FORMAT
- //#define JUCE_USE_WINDOWS_MEDIA_FORMAT
+ //#define JUCE_USE_WINDOWS_MEDIA_FORMAT 1
#endif
//==============================================================================
// juce_audio_processors flags:
#ifndef JUCE_PLUGINHOST_VST
- //#define JUCE_PLUGINHOST_VST
+ //#define JUCE_PLUGINHOST_VST 1
#endif
#ifndef JUCE_PLUGINHOST_VST3
- //#define JUCE_PLUGINHOST_VST3
+ //#define JUCE_PLUGINHOST_VST3 1
#endif
#ifndef JUCE_PLUGINHOST_AU
- //#define JUCE_PLUGINHOST_AU
+ //#define JUCE_PLUGINHOST_AU 1
#endif
//==============================================================================
// juce_audio_utils flags:
#ifndef JUCE_USE_CDREADER
- //#define JUCE_USE_CDREADER
+ //#define JUCE_USE_CDREADER 1
#endif
#ifndef JUCE_USE_CDBURNER
- //#define JUCE_USE_CDBURNER
+ //#define JUCE_USE_CDBURNER 1
#endif
//==============================================================================
// juce_core flags:
#ifndef JUCE_FORCE_DEBUG
- //#define JUCE_FORCE_DEBUG
+ //#define JUCE_FORCE_DEBUG 1
#endif
#ifndef JUCE_LOG_ASSERTIONS
- //#define JUCE_LOG_ASSERTIONS
+ //#define JUCE_LOG_ASSERTIONS 1
#endif
#ifndef JUCE_CHECK_MEMORY_LEAKS
- //#define JUCE_CHECK_MEMORY_LEAKS
+ //#define JUCE_CHECK_MEMORY_LEAKS 1
#endif
#ifndef JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
- //#define JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
+ //#define JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES 1
#endif
#ifndef JUCE_INCLUDE_ZLIB_CODE
- //#define JUCE_INCLUDE_ZLIB_CODE
+ //#define JUCE_INCLUDE_ZLIB_CODE 1
#endif
#ifndef JUCE_USE_CURL
- //#define JUCE_USE_CURL
+ //#define JUCE_USE_CURL 1
#endif
#ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
- //#define JUCE_CATCH_UNHANDLED_EXCEPTIONS
+ //#define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
#endif
#ifndef JUCE_ALLOW_STATIC_NULL_VARIABLES
- //#define JUCE_ALLOW_STATIC_NULL_VARIABLES
+ //#define JUCE_ALLOW_STATIC_NULL_VARIABLES 1
#endif
//==============================================================================
// juce_events flags:
#ifndef JUCE_EXECUTE_APP_SUSPEND_ON_IOS_BACKGROUND_TASK
- //#define JUCE_EXECUTE_APP_SUSPEND_ON_IOS_BACKGROUND_TASK
+ //#define JUCE_EXECUTE_APP_SUSPEND_ON_IOS_BACKGROUND_TASK 1
#endif
//==============================================================================
// juce_graphics flags:
#ifndef JUCE_USE_COREIMAGE_LOADER
- //#define JUCE_USE_COREIMAGE_LOADER
+ //#define JUCE_USE_COREIMAGE_LOADER 1
#endif
#ifndef JUCE_USE_DIRECTWRITE
- //#define JUCE_USE_DIRECTWRITE
+ //#define JUCE_USE_DIRECTWRITE 1
#endif
//==============================================================================
// juce_gui_basics flags:
#ifndef JUCE_ENABLE_REPAINT_DEBUGGING
- //#define JUCE_ENABLE_REPAINT_DEBUGGING
+ //#define JUCE_ENABLE_REPAINT_DEBUGGING 1
#endif
#ifndef JUCE_USE_XSHM
- //#define JUCE_USE_XSHM
+ //#define JUCE_USE_XSHM 1
#endif
#ifndef JUCE_USE_XRENDER
- //#define JUCE_USE_XRENDER
+ //#define JUCE_USE_XRENDER 1
#endif
#ifndef JUCE_USE_XCURSOR
- //#define JUCE_USE_XCURSOR
+ //#define JUCE_USE_XCURSOR 1
#endif
//==============================================================================
// juce_gui_extra flags:
#ifndef JUCE_WEB_BROWSER
- //#define JUCE_WEB_BROWSER
+ //#define JUCE_WEB_BROWSER 1
#endif
#ifndef JUCE_ENABLE_LIVE_CONSTANT_EDITOR
- //#define JUCE_ENABLE_LIVE_CONSTANT_EDITOR
+ //#define JUCE_ENABLE_LIVE_CONSTANT_EDITOR 1
#endif
//==============================================================================
#ifndef JUCE_STANDALONE_APPLICATION
diff --git a/examples/BLOCKS/BlocksDrawing/Source/MainComponent.cpp b/examples/BLOCKS/BlocksDrawing/Source/MainComponent.cpp
new file mode 100644
index 0000000000..214a45c173
--- /dev/null
+++ b/examples/BLOCKS/BlocksDrawing/Source/MainComponent.cpp
@@ -0,0 +1,382 @@
+/*
+ ==============================================================================
+
+ This file is part of the JUCE library.
+ Copyright (c) 2017 - ROLI Ltd.
+
+ JUCE is an open source library subject to commercial or open-source
+ licensing.
+
+ By using JUCE, you agree to the terms of both the JUCE 5 End-User License
+ Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
+ 27th April 2017).
+
+ End User License Agreement: www.juce.com/juce-5-licence
+ Privacy Policy: www.juce.com/juce-5-privacy-policy
+
+ Or: You may also use this code under the terms of the GPL v3 (see
+ www.gnu.org/licenses).
+
+ JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
+ EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
+ DISCLAIMED.
+
+ ==============================================================================
+*/
+
+#include "MainComponent.h"
+
+MainComponent::MainComponent()
+{
+ activeLeds.clear();
+
+ // Register MainContentComponent as a listener to the PhysicalTopologySource object
+ topologySource.addListener (this);
+
+ infoLabel.setText ("Connect a Lightpad Block to draw.", dontSendNotification);
+ infoLabel.setJustificationType (Justification::centred);
+ addAndMakeVisible (infoLabel);
+
+ addAndMakeVisible (lightpadComponent);
+ lightpadComponent.setVisible (false);
+ lightpadComponent.addListener (this);
+
+ clearButton.setButtonText ("Clear");
+ clearButton.addListener (this);
+ clearButton.setAlwaysOnTop (true);
+ addAndMakeVisible (clearButton);
+
+ brightnessSlider.setRange (0.0, 1.0);
+ brightnessSlider.setValue (1.0);
+ brightnessSlider.setAlwaysOnTop (true);
+ brightnessSlider.setTextBoxStyle (Slider::TextEntryBoxPosition::NoTextBox, false, 0, 0);
+ brightnessSlider.addListener (this);
+ addAndMakeVisible (brightnessSlider);
+
+ brightnessLED.setAlwaysOnTop (true);
+ brightnessLED.setColour (layout.currentColour.withBrightness (static_cast (brightnessSlider.getValue())));
+ addAndMakeVisible (brightnessLED);
+
+ #if JUCE_IOS
+ connectButton.setButtonText ("Connect");
+ connectButton.addListener (this);
+ connectButton.setAlwaysOnTop (true);
+ addAndMakeVisible (connectButton);
+ #endif
+
+ setSize (600, 600);
+}
+
+MainComponent::~MainComponent()
+{
+ if (activeBlock != nullptr)
+ detachActiveBlock();
+
+ lightpadComponent.removeListener (this);
+}
+
+void MainComponent::resized()
+{
+ infoLabel.centreWithSize (getWidth(), 100);
+
+ Rectangle bounds = getLocalBounds().reduced (20);
+
+ // top buttons
+ Rectangle topButtonArea = bounds.removeFromTop (getHeight() / 20);
+
+ topButtonArea.removeFromLeft (20);
+ clearButton.setBounds (topButtonArea.removeFromLeft (80));
+
+ #if JUCE_IOS
+ topButtonArea.removeFromRight (20);
+ connectButton.setBounds (topButtonArea.removeFromRight (80));
+ #endif
+
+ bounds.removeFromTop (20);
+
+ // brightness controls
+ Rectangle brightnessControlBounds;
+
+ Desktop::DisplayOrientation orientation = Desktop::getInstance().getCurrentOrientation();
+
+ if (orientation == Desktop::DisplayOrientation::upright
+ || orientation == Desktop::DisplayOrientation::upsideDown)
+ {
+ brightnessControlBounds = bounds.removeFromBottom (getHeight() / 10);
+
+ brightnessSlider.setSliderStyle (Slider::SliderStyle::LinearHorizontal);
+ brightnessLED.setBounds (brightnessControlBounds.removeFromLeft (getHeight() / 10));
+ brightnessSlider.setBounds (brightnessControlBounds);
+ }
+ else
+ {
+ brightnessControlBounds = bounds.removeFromRight (getWidth() / 10);
+
+ brightnessSlider.setSliderStyle (Slider::SliderStyle::LinearVertical);
+ brightnessLED.setBounds (brightnessControlBounds.removeFromTop (getWidth() / 10));
+ brightnessSlider.setBounds (brightnessControlBounds);
+ }
+
+ // lightpad component
+ int sideLength = jmin (bounds.getWidth() - 40, bounds.getHeight() - 40);
+ lightpadComponent.centreWithSize (sideLength, sideLength);
+}
+
+void MainComponent::topologyChanged()
+{
+ lightpadComponent.setVisible (false);
+ infoLabel.setVisible (true);
+
+ // Reset the activeBlock object
+ if (activeBlock != nullptr)
+ detachActiveBlock();
+
+ // Get the array of currently connected Block objects from the PhysicalTopologySource
+ Block::Array blocks = topologySource.getCurrentTopology().blocks;
+
+ // Iterate over the array of Block objects
+ for (auto b : blocks)
+ {
+ // Find the first Lightpad
+ if (b->getType() == Block::Type::lightPadBlock)
+ {
+ activeBlock = b;
+
+ // Register MainContentComponent as a listener to the touch surface
+ if (auto surface = activeBlock->getTouchSurface())
+ surface->addListener (this);
+
+ // Register MainContentComponent as a listener to any buttons
+ for (auto button : activeBlock->getButtons())
+ button->addListener (this);
+
+ // Get the LEDGrid object from the Lightpad and set its program to the program for the current mode
+ if (auto grid = activeBlock->getLEDGrid())
+ {
+ // Work out scale factors to translate X and Y touches to LED indexes
+ scaleX = (float) (grid->getNumColumns()) / activeBlock->getWidth();
+ scaleY = (float) (grid->getNumRows()) / activeBlock->getHeight();
+
+ setLEDProgram (*activeBlock);
+ }
+
+ // Make the on screen Lighpad component visible
+ lightpadComponent.setVisible (true);
+ infoLabel.setVisible (false);
+
+ break;
+ }
+ }
+}
+
+//==============================================================================
+void MainComponent::touchChanged (TouchSurface&, const TouchSurface::Touch& touch)
+{
+ // Translate X and Y touch events to LED indexes
+ int xLed = roundToInt (touch.x * scaleX);
+ int yLed = roundToInt (touch.y * scaleY);
+
+ if (currentMode == colourPalette)
+ {
+ if (layout.setActiveColourForTouch (xLed, yLed))
+ {
+ if (auto* colourPaletteProgram = getPaletteProgram())
+ {
+ colourPaletteProgram->setGridFills (layout.numColumns, layout.numRows, layout.gridFillArray);
+ brightnessLED.setColour (layout.currentColour.withBrightness (layout.currentColour == Colours::black ? 0.0f
+ : static_cast (brightnessSlider.getValue())));
+ }
+ }
+ }
+ else if (currentMode == canvas)
+ {
+ drawLED ((uint32) xLed, (uint32) yLed, touch.z, layout.currentColour);
+ }
+}
+
+void MainComponent::buttonReleased (ControlButton&, Block::Timestamp)
+{
+ if (currentMode == canvas)
+ {
+ // Wait 500ms to see if there is a second press
+ if (! isTimerRunning())
+ startTimer (500);
+ else
+ doublePress = true;
+ }
+ else if (currentMode == colourPalette)
+ {
+ // Switch to canvas mode and set the LEDGrid program
+ currentMode = canvas;
+ setLEDProgram (*activeBlock);
+ }
+}
+
+void MainComponent::buttonClicked (Button* b)
+{
+ #if JUCE_IOS
+ if (b == &connectButton)
+ {
+ BluetoothMidiDevicePairingDialogue::open();
+ return;
+ }
+ #else
+ ignoreUnused (b);
+ #endif
+
+ clearLEDs();
+}
+
+void MainComponent::sliderValueChanged (Slider* s)
+{
+ if (s == &brightnessSlider)
+ brightnessLED.setColour (layout.currentColour.withBrightness (layout.currentColour == Colours::black ? 0.0f
+ : static_cast (brightnessSlider.getValue())));
+}
+
+void MainComponent::timerCallback()
+{
+ if (doublePress)
+ {
+ clearLEDs();
+
+ // Reset the doublePress flag
+ doublePress = false;
+ }
+ else
+ {
+ // Switch to colour palette mode and set the LEDGrid program
+ currentMode = colourPalette;
+ setLEDProgram (*activeBlock);
+ }
+
+ stopTimer();
+}
+
+void MainComponent::ledClicked (int x, int y, float z)
+{
+ drawLED ((uint32) x, (uint32) y,
+ z == 0.0f ? static_cast (brightnessSlider.getValue())
+ : z * static_cast (brightnessSlider.getValue()), layout.currentColour);
+}
+
+void MainComponent::detachActiveBlock()
+{
+ if (auto surface = activeBlock->getTouchSurface())
+ surface->removeListener (this);
+
+ for (auto button : activeBlock->getButtons())
+ button->removeListener (this);
+
+ activeBlock = nullptr;
+}
+
+void MainComponent::setLEDProgram (Block& block)
+{
+ if (currentMode == canvas)
+ {
+ block.setProgram (new BitmapLEDProgram (block));
+
+ // Redraw any previously drawn LEDs
+ redrawLEDs();
+ }
+ else if (currentMode == colourPalette)
+ {
+ block.setProgram (new DrumPadGridProgram (block));
+
+ // Setup the grid layout
+ if (auto* program = getPaletteProgram())
+ program->setGridFills (layout.numColumns, layout.numRows, layout.gridFillArray);
+ }
+}
+
+void MainComponent::clearLEDs()
+{
+ if (auto* canvasProgram = getCanvasProgram())
+ {
+ // Clear the LED grid
+ for (uint32 x = 0; x < 15; ++x)
+ {
+ for (uint32 y = 0; y < 15; ++ y)
+ {
+ canvasProgram->setLED (x, y, Colours::black);
+ lightpadComponent.setLEDColour (x, y, Colours::black);
+ }
+ }
+
+ // Clear the ActiveLED array
+ activeLeds.clear();
+ }
+}
+
+void MainComponent::drawLED (uint32 x0, uint32 y0, float z, Colour drawColour)
+{
+ if (auto* canvasProgram = getCanvasProgram())
+ {
+ // Check if the activeLeds array already contains an ActiveLED object for this LED
+ auto index = getLEDAt (x0, y0);
+
+ // If the colour is black then just set the LED to black and return
+ if (drawColour == Colours::black)
+ {
+ if (index >= 0)
+ {
+ canvasProgram->setLED (x0, y0, Colours::black);
+ lightpadComponent.setLEDColour (x0, y0, Colours::black);
+ activeLeds.remove (index);
+ }
+
+ return;
+ }
+
+ // If there is no ActiveLED obejct for this LED then create one,
+ // add it to the array, set the LED on the Block and return
+ if (index < 0)
+ {
+ ActiveLED led;
+ led.x = x0;
+ led.y = y0;
+ led.colour = drawColour;
+ led.brightness = z;
+
+ activeLeds.add (led);
+ canvasProgram->setLED (led.x, led.y, led.colour.withBrightness (led.brightness));
+
+ lightpadComponent.setLEDColour (led.x, led.y, led.colour.withBrightness (led.brightness));
+
+ return;
+ }
+
+ // Get the ActiveLED object for this LED
+ auto currentLed = activeLeds.getReference (index);
+
+ // If the LED colour is the same as the draw colour, add the brightnesses together.
+ // If it is different, blend the colours
+ if (currentLed.colour == drawColour)
+ currentLed.brightness = jmin (currentLed.brightness + z, 1.0f);
+ else
+ currentLed.colour = currentLed.colour.interpolatedWith (drawColour, z);
+
+
+ // Set the LED on the Block and change the ActiveLED object in the activeLeds array
+ if (canvasProgram != nullptr)
+ canvasProgram->setLED (currentLed.x, currentLed.y, currentLed.colour.withBrightness (currentLed.brightness));
+
+ lightpadComponent.setLEDColour (currentLed.x, currentLed.y, currentLed.colour.withBrightness (currentLed.brightness));
+
+ activeLeds.set (index, currentLed);
+ }
+}
+
+void MainComponent::redrawLEDs()
+{
+ if (auto* canvasProgram = getCanvasProgram())
+ {
+ // Iterate over the activeLeds array and set the LEDs on the Block
+ for (auto led : activeLeds)
+ {
+ canvasProgram->setLED (led.x, led.y, led.colour.withBrightness (led.brightness));
+ lightpadComponent.setLEDColour (led.x, led.y, led.colour.withBrightness (led.brightness));
+ }
+ }
+}
diff --git a/examples/BLOCKS/BlocksDrawing/Source/MainComponent.h b/examples/BLOCKS/BlocksDrawing/Source/MainComponent.h
index 486988e1c8..4bde1d0f0d 100644
--- a/examples/BLOCKS/BlocksDrawing/Source/MainComponent.h
+++ b/examples/BLOCKS/BlocksDrawing/Source/MainComponent.h
@@ -123,380 +123,64 @@ class MainComponent : public Component,
private Timer
{
public:
- MainComponent()
- {
- activeLeds.clear();
+ MainComponent();
+ ~MainComponent();
- // Register MainContentComponent as a listener to the PhysicalTopologySource object
- topologySource.addListener (this);
-
- infoLabel.setText ("Connect a Lightpad Block to draw.", dontSendNotification);
- infoLabel.setJustificationType (Justification::centred);
- addAndMakeVisible (infoLabel);
-
- addAndMakeVisible (lightpadComponent);
- lightpadComponent.setVisible (false);
- lightpadComponent.addListener (this);
-
- clearButton.setButtonText ("Clear");
- clearButton.addListener (this);
- clearButton.setAlwaysOnTop (true);
- addAndMakeVisible (clearButton);
-
- brightnessSlider.setRange (0.0, 1.0);
- brightnessSlider.setValue (1.0);
- brightnessSlider.setAlwaysOnTop (true);
- brightnessSlider.setTextBoxStyle (Slider::TextEntryBoxPosition::NoTextBox, false, 0, 0);
- brightnessSlider.addListener (this);
- addAndMakeVisible (brightnessSlider);
-
- brightnessLED.setAlwaysOnTop (true);
- brightnessLED.setColour (layout.currentColour.withBrightness (static_cast (brightnessSlider.getValue())));
- addAndMakeVisible (brightnessLED);
-
- #if JUCE_IOS
- connectButton.setButtonText ("Connect");
- connectButton.addListener (this);
- connectButton.setAlwaysOnTop (true);
- addAndMakeVisible (connectButton);
- #endif
-
- setSize (600, 600);
- }
-
- ~MainComponent()
- {
- if (activeBlock != nullptr)
- detachActiveBlock();
-
- lightpadComponent.removeListener (this);
- }
-
- void paint (Graphics& g) override
- {
- }
-
- void resized() override
- {
- infoLabel.centreWithSize (getWidth(), 100);
-
- Rectangle bounds = getLocalBounds().reduced (20);
-
- // top buttons
- Rectangle topButtonArea = bounds.removeFromTop (getHeight() / 20);
-
- topButtonArea.removeFromLeft (20);
- clearButton.setBounds (topButtonArea.removeFromLeft (80));
-
- #if JUCE_IOS
- topButtonArea.removeFromRight (20);
- connectButton.setBounds (topButtonArea.removeFromRight (80));
- #endif
-
- bounds.removeFromTop (20);
-
- // brightness controls
- Rectangle brightnessControlBounds;
-
- Desktop::DisplayOrientation orientation = Desktop::getInstance().getCurrentOrientation();
-
- if (orientation == Desktop::DisplayOrientation::upright || orientation == Desktop::DisplayOrientation::upsideDown)
- {
- brightnessControlBounds = bounds.removeFromBottom (getHeight() / 10);
-
- brightnessSlider.setSliderStyle (Slider::SliderStyle::LinearHorizontal);
- brightnessLED.setBounds (brightnessControlBounds.removeFromLeft (getHeight() / 10));
- brightnessSlider.setBounds (brightnessControlBounds);
- }
- else
- {
- brightnessControlBounds = bounds.removeFromRight (getWidth() / 10);
-
- brightnessSlider.setSliderStyle (Slider::SliderStyle::LinearVertical);
- brightnessLED.setBounds (brightnessControlBounds.removeFromTop (getWidth() / 10));
- brightnessSlider.setBounds (brightnessControlBounds);
- }
-
- // lightpad component
- int sideLength = jmin (bounds.getWidth() - 40, bounds.getHeight() - 40);
- lightpadComponent.centreWithSize (sideLength, sideLength);
- }
+ void resized() override;
/** Overridden from TopologySource::Listener. Called when the topology changes */
- void topologyChanged() override
- {
- lightpadComponent.setVisible (false);
- infoLabel.setVisible (true);
-
- // Reset the activeBlock object
- if (activeBlock != nullptr)
- detachActiveBlock();
-
- // Get the array of currently connected Block objects from the PhysicalTopologySource
- Block::Array blocks = topologySource.getCurrentTopology().blocks;
-
- // Iterate over the array of Block objects
- for (auto b : blocks)
- {
- // Find the first Lightpad
- if (b->getType() == Block::Type::lightPadBlock)
- {
- activeBlock = b;
-
- // Register MainContentComponent as a listener to the touch surface
- if (auto surface = activeBlock->getTouchSurface())
- surface->addListener (this);
-
- // Register MainContentComponent as a listener to any buttons
- for (auto button : activeBlock->getButtons())
- button->addListener (this);
-
- // Get the LEDGrid object from the Lightpad and set its program to the program for the current mode
- if (auto grid = activeBlock->getLEDGrid())
- {
- // Work out scale factors to translate X and Y touches to LED indexes
- scaleX = (float) (grid->getNumColumns()) / activeBlock->getWidth();
- scaleY = (float) (grid->getNumRows()) / activeBlock->getHeight();
-
- setLEDProgram (*activeBlock);
- }
-
- // Make the on screen Lighpad component visible
- lightpadComponent.setVisible (true);
- infoLabel.setVisible (false);
-
- break;
- }
- }
- }
+ void topologyChanged() override;
private:
/** Overridden from TouchSurface::Listener. Called when a Touch is received on the Lightpad */
- void touchChanged (TouchSurface&, const TouchSurface::Touch& touch) override
- {
- // Translate X and Y touch events to LED indexes
- int xLed = roundToInt (touch.x * scaleX);
- int yLed = roundToInt (touch.y * scaleY);
-
- if (currentMode == colourPalette)
- {
- if (layout.setActiveColourForTouch (xLed, yLed))
- {
- colourPaletteProgram->setGridFills (layout.numColumns, layout.numRows, layout.gridFillArray);
- brightnessLED.setColour (layout.currentColour.withBrightness (layout.currentColour == Colours::black ? 0.0f
- : static_cast (brightnessSlider.getValue())));
- }
- }
- else if (currentMode == canvas)
- {
- drawLED ((uint32) xLed, (uint32) yLed, touch.z, layout.currentColour);
- }
- }
+ void touchChanged (TouchSurface&, const TouchSurface::Touch&) override;
/** Overridden from ControlButton::Listener. Called when a button on the Lightpad is pressed */
void buttonPressed (ControlButton&, Block::Timestamp) override { }
/** Overridden from ControlButton::Listener. Called when a button on the Lightpad is released */
- void buttonReleased (ControlButton&, Block::Timestamp) override
- {
- if (currentMode == canvas)
- {
- // Wait 500ms to see if there is a second press
- if (! isTimerRunning())
- startTimer (500);
- else
- doublePress = true;
- }
- else if (currentMode == colourPalette)
- {
- // Switch to canvas mode and set the LEDGrid program
- currentMode = canvas;
- setLEDProgram (*activeBlock);
- }
- }
+ void buttonReleased (ControlButton&, Block::Timestamp) override;
- void buttonClicked (Button* b) override
- {
- #if JUCE_IOS
- if (b == &connectButton)
- {
- BluetoothMidiDevicePairingDialogue::open();
- return;
- }
- #else
- ignoreUnused (b);
- #endif
+ void ledClicked (int x, int y, float z) override;
- clearLEDs();
- }
+ void buttonClicked (Button*) override;
- void sliderValueChanged (Slider* s) override
- {
- if (s == &brightnessSlider)
- brightnessLED.setColour (layout.currentColour.withBrightness (layout.currentColour == Colours::black ? 0.0f
- : static_cast (brightnessSlider.getValue())));
- }
+ void sliderValueChanged (Slider*) override;
- void timerCallback() override
- {
- if (doublePress)
- {
- clearLEDs();
-
- // Reset the doublePress flag
- doublePress = false;
- }
- else
- {
- // Switch to colour palette mode and set the LEDGrid program
- currentMode = colourPalette;
- setLEDProgram (*activeBlock);
- }
-
- stopTimer();
- }
-
- void ledClicked (int x, int y, float z) override
- {
- drawLED ((uint32) x, (uint32) y, z == 0.0f ? static_cast (brightnessSlider.getValue())
- : z * static_cast (brightnessSlider.getValue()), layout.currentColour);
- }
+ void timerCallback() override;
/** Removes TouchSurface and ControlButton listeners and sets activeBlock to nullptr */
- void detachActiveBlock()
- {
- if (auto surface = activeBlock->getTouchSurface())
- surface->removeListener (this);
-
- for (auto button : activeBlock->getButtons())
- button->removeListener (this);
-
- activeBlock = nullptr;
- }
+ void detachActiveBlock();
/** Sets the LEDGrid Program for the selected mode */
- void setLEDProgram (Block& block)
- {
- canvasProgram = nullptr;
- colourPaletteProgram = nullptr;
+ void setLEDProgram (Block&);
- if (currentMode == canvas)
- {
- // Create a new BitmapLEDProgram for the LEDGrid
- canvasProgram = new BitmapLEDProgram (block);
-
- // Set the LEDGrid program
- block.setProgram (canvasProgram);
-
- // Redraw any previously drawn LEDs
- redrawLEDs();
- }
- else if (currentMode == colourPalette)
- {
- // Create a new DrumPadGridProgram for the LEDGrid
- colourPaletteProgram = new DrumPadGridProgram (block);
-
- // Set the LEDGrid program
- block.setProgram (colourPaletteProgram);
-
- // Setup the grid layout
- colourPaletteProgram->setGridFills (layout.numColumns,
- layout.numRows,
- layout.gridFillArray);
- }
- }
-
- void clearLEDs()
- {
- // Clear the LED grid
- for (uint32 x = 0; x < 15; ++x)
- {
- for (uint32 y = 0; y < 15; ++ y)
- {
- if (canvasProgram != nullptr)
- canvasProgram->setLED (x, y, Colours::black);
-
- lightpadComponent.setLEDColour (x, y, Colours::black);
- }
- }
-
- // Clear the ActiveLED array
- activeLeds.clear();
- }
+ void clearLEDs();
/** Sets an LED on the Lightpad for a given touch co-ordinate and pressure */
- void drawLED (uint32 x0, uint32 y0, float z, Colour drawColour)
- {
- // Check if the activeLeds array already contains an ActiveLED object for this LED
- auto index = getLEDAt (x0, y0);
-
- // If the colour is black then just set the LED to black and return
- if (drawColour == Colours::black)
- {
- if (index >= 0)
- {
- if (canvasProgram != nullptr)
- canvasProgram->setLED (x0, y0, Colours::black);
-
- lightpadComponent.setLEDColour (x0, y0, Colours::black);
-
- activeLeds.remove (index);
- }
-
- return;
- }
-
- // If there is no ActiveLED obejct for this LED then create one,
- // add it to the array, set the LED on the Block and return
- if (index < 0)
- {
- ActiveLED led;
- led.x = x0;
- led.y = y0;
- led.colour = drawColour;
- led.brightness = z;
-
- activeLeds.add (led);
-
- if (canvasProgram != nullptr)
- canvasProgram->setLED (led.x, led.y, led.colour.withBrightness (led.brightness));
-
- lightpadComponent.setLEDColour (led.x, led.y, led.colour.withBrightness (led.brightness));
-
- return;
- }
-
- // Get the ActiveLED object for this LED
- ActiveLED currentLed = activeLeds.getReference (index);
-
- // If the LED colour is the same as the draw colour, add the brightnesses together.
- // If it is different, blend the colours
- if (currentLed.colour == drawColour)
- currentLed.brightness = jmin (currentLed.brightness + z, 1.0f);
- else
- currentLed.colour = currentLed.colour.interpolatedWith (drawColour, z);
-
-
- // Set the LED on the Block and change the ActiveLED object in the activeLeds array
- if (canvasProgram != nullptr)
- canvasProgram->setLED (currentLed.x, currentLed.y, currentLed.colour.withBrightness (currentLed.brightness));
-
- lightpadComponent.setLEDColour (currentLed.x, currentLed.y, currentLed.colour.withBrightness (currentLed.brightness));
-
- activeLeds.set (index, currentLed);
- }
+ void drawLED (uint32 x0, uint32 y0, float z, Colour drawColour);
/** Redraws the LEDs on the Lightpad from the activeLeds array */
- void redrawLEDs()
+ void redrawLEDs();
+
+ //==============================================================================
+ BitmapLEDProgram* getCanvasProgram()
{
- // Iterate over the activeLeds array and set the LEDs on the Block
- for (auto led : activeLeds)
- {
- canvasProgram->setLED (led.x, led.y, led.colour.withBrightness (led.brightness));
- lightpadComponent.setLEDColour (led.x, led.y, led.colour.withBrightness (led.brightness));
- }
+ if (activeBlock != nullptr)
+ return dynamic_cast (activeBlock->getProgram());
+
+ return nullptr;
}
+ DrumPadGridProgram* getPaletteProgram()
+ {
+ if (activeBlock != nullptr)
+ return dynamic_cast (activeBlock->getProgram());
+
+ return nullptr;
+ }
+
+ //==============================================================================
/**
A struct that represents an active LED on the Lightpad.
Has a position, colour and brightness.
@@ -533,9 +217,6 @@ private:
DisplayMode currentMode = colourPalette;
//==============================================================================
- BitmapLEDProgram* canvasProgram = nullptr;
- DrumPadGridProgram* colourPaletteProgram = nullptr;
-
ColourGrid layout { 3, 3 };
PhysicalTopologySource topologySource;
Block::Ptr activeBlock;
@@ -545,7 +226,6 @@ private:
bool doublePress = false;
- //==============================================================================
Label infoLabel;
LightpadComponent lightpadComponent;
TextButton clearButton;