Skip to content

Commit

Permalink
1.0.12b2 fixed alpha mode, transparent block UI and separate fade in/out
Browse files Browse the repository at this point in the history
  • Loading branch information
benkuper committed Jul 22, 2019
1 parent 693a163 commit 90d40b8
Show file tree
Hide file tree
Showing 18 changed files with 160 additions and 47 deletions.
2 changes: 1 addition & 1 deletion BenTo.jucer
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<JUCERPROJECT name="BenTo" projectType="guiapp" jucerVersion="5.4.3" headerPath="../../Source"
id="LP0of5" version="1.0.12b1">
id="LP0of5" version="1.0.12b2">
<MAINGROUP id="zy2ady" name="BenTo">
<GROUP id="{870E4241-9C31-E9AA-906B-7213EC4B54C1}" name="Resources">
<GROUP id="{9DFF626B-2FA9-675B-A3EB-1B7780D709F0}" name="models">
Expand Down
4 changes: 2 additions & 2 deletions Builds/LinuxMakefile/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ifeq ($(CONFIG),Debug)
TARGET_ARCH := -m64
endif

JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DDEBUG=1 -D_DEBUG=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=1.0.12b1 -DJUCE_APP_VERSION_HEX=0x1000c $(shell pkg-config --cflags alsa freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl) -pthread -I../../JuceLibraryCode -I$(HOME)/JUCE/modules -I../../../JUCE\ Modules -I../../External/serial/include -I../../Source $(CPPFLAGS)
JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DDEBUG=1 -D_DEBUG=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=1.0.12b2 -DJUCE_APP_VERSION_HEX=0x1000c $(shell pkg-config --cflags alsa freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl) -pthread -I../../JuceLibraryCode -I$(HOME)/JUCE/modules -I../../../JUCE\ Modules -I../../External/serial/include -I../../Source $(CPPFLAGS)
JUCE_CPPFLAGS_APP := -DJucePlugin_Build_VST=0 -DJucePlugin_Build_VST3=0 -DJucePlugin_Build_AU=0 -DJucePlugin_Build_AUv3=0 -DJucePlugin_Build_RTAS=0 -DJucePlugin_Build_AAX=0 -DJucePlugin_Build_Standalone=0 -DJucePlugin_Build_Unity=0
JUCE_TARGET_APP := BenTo

Expand All @@ -56,7 +56,7 @@ ifeq ($(CONFIG),Release)
TARGET_ARCH := -m64
endif

JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DNDEBUG=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=1.0.12b1 -DJUCE_APP_VERSION_HEX=0x1000c $(shell pkg-config --cflags alsa freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl) -pthread -I../../JuceLibraryCode -I$(HOME)/JUCE/modules -I../../../JUCE\ Modules -I../../External/serial/include -I../../Source $(CPPFLAGS)
JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DNDEBUG=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=1.0.12b2 -DJUCE_APP_VERSION_HEX=0x1000c $(shell pkg-config --cflags alsa freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl) -pthread -I../../JuceLibraryCode -I$(HOME)/JUCE/modules -I../../../JUCE\ Modules -I../../External/serial/include -I../../Source $(CPPFLAGS)
JUCE_CPPFLAGS_APP := -DJucePlugin_Build_VST=0 -DJucePlugin_Build_VST3=0 -DJucePlugin_Build_AU=0 -DJucePlugin_Build_AUv3=0 -DJucePlugin_Build_RTAS=0 -DJucePlugin_Build_AAX=0 -DJucePlugin_Build_Standalone=0 -DJucePlugin_Build_Unity=0
JUCE_TARGET_APP := BenTo

Expand Down
4 changes: 2 additions & 2 deletions Builds/MacOSX/BenTo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3443,7 +3443,7 @@
"_DEBUG=1",
"DEBUG=1",
"JUCER_XCODE_MAC_F6D2F4CF=1",
"JUCE_APP_VERSION=1.0.12b1",
"JUCE_APP_VERSION=1.0.12b2",
"JUCE_APP_VERSION_HEX=0x1000c",
"JucePlugin_Build_VST=0",
"JucePlugin_Build_VST3=0",
Expand Down Expand Up @@ -3488,7 +3488,7 @@
"_NDEBUG=1",
"NDEBUG=1",
"JUCER_XCODE_MAC_F6D2F4CF=1",
"JUCE_APP_VERSION=1.0.12b1",
"JUCE_APP_VERSION=1.0.12b2",
"JUCE_APP_VERSION_HEX=0x1000c",
"JucePlugin_Build_VST=0",
"JucePlugin_Build_VST3=0",
Expand Down
4 changes: 2 additions & 2 deletions Builds/MacOSX/Info-App.plist
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0.12b1</string>
<string>1.0.12b2</string>
<key>CFBundleVersion</key>
<string>1.0.12b1</string>
<string>1.0.12b2</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
Expand Down
4 changes: 2 additions & 2 deletions Builds/MacOSX_CI/BenTo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3443,7 +3443,7 @@
"_DEBUG=1",
"DEBUG=1",
"JUCER_XCODE_MAC_2F3811D6=1",
"JUCE_APP_VERSION=1.0.12b1",
"JUCE_APP_VERSION=1.0.12b2",
"JUCE_APP_VERSION_HEX=0x1000c",
"JucePlugin_Build_VST=0",
"JucePlugin_Build_VST3=0",
Expand Down Expand Up @@ -3488,7 +3488,7 @@
"_NDEBUG=1",
"NDEBUG=1",
"JUCER_XCODE_MAC_2F3811D6=1",
"JUCE_APP_VERSION=1.0.12b1",
"JUCE_APP_VERSION=1.0.12b2",
"JUCE_APP_VERSION_HEX=0x1000c",
"JucePlugin_Build_VST=0",
"JucePlugin_Build_VST3=0",
Expand Down
4 changes: 2 additions & 2 deletions Builds/MacOSX_CI/Info-App.plist
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0.12b1</string>
<string>1.0.12b2</string>
<key>CFBundleVersion</key>
<string>1.0.12b1</string>
<string>1.0.12b2</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
Expand Down
2 changes: 1 addition & 1 deletion Builds/VS2017_CI/BenTo_App.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<ClCompile>
<Optimization>Full</Optimization>
<AdditionalIncludeDirectories>..\..\JuceLibraryCode;..\..\..\JUCE\modules;..\..\..\JUCE Modules;../../External/asio;../../External/serial/include;../../Source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCER_VS2017_6069D29A=1;JUCE_APP_VERSION=1.0.12b1;JUCE_APP_VERSION_HEX=0x1000c;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_RTAS=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;JUCER_VS2017_6069D29A=1;JUCE_APP_VERSION=1.0.12b2;JUCE_APP_VERSION_HEX=0x1000c;JucePlugin_Build_VST=0;JucePlugin_Build_VST3=0;JucePlugin_Build_AU=0;JucePlugin_Build_AUv3=0;JucePlugin_Build_RTAS=0;JucePlugin_Build_AAX=0;JucePlugin_Build_Standalone=0;JucePlugin_Build_Unity=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
Expand Down
6 changes: 3 additions & 3 deletions Builds/VS2017_CI/resources.rc
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
#include <windows.h>

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,12b1,0
FILEVERSION 1,0,12b2,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "FileDescription", "BenTo\0"
VALUE "FileVersion", "1.0.12b1\0"
VALUE "FileVersion", "1.0.12b2\0"
VALUE "ProductName", "BenTo\0"
VALUE "ProductVersion", "1.0.12b1\0"
VALUE "ProductVersion", "1.0.12b2\0"
END
END

Expand Down
2 changes: 1 addition & 1 deletion JuceLibraryCode/JuceHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace ProjectInfo
{
const char* const projectName = "BenTo";
const char* const companyName = "";
const char* const versionString = "1.0.12b1";
const char* const versionString = "1.0.12b2";
const int versionNumber = 0x1000c;
}
#endif
2 changes: 1 addition & 1 deletion Source/Prop/ui/PropViz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void PropViz::paint(Graphics & g)
for (int i = 0; i < numLeds; i++)
{
Rectangle<float> ledR = lr.removeFromTop(ledSize).reduced(1).toFloat();
g.setColour(Colours::white.withAlpha(.15f));
g.setColour(Colours::white.withAlpha(.2f));
g.drawEllipse(ledR, .5f);
g.setColour(prop->colors[i]);
g.fillEllipse(ledR);
Expand Down
18 changes: 12 additions & 6 deletions Source/Timeline/TimelineBlockSequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,15 @@ Array<Colour> TimelineBlockSequence::getColors(Prop * p, double time, var params
for (auto &l : layers)
{
if (l == nullptr) continue;
String s = l->niceName;

params.getDynamicObject()->setProperty("forceID", l->filterManager->getTargetIDForProp(p));
colors.add(l->getColors(p, t, params)); //use sequence's time instead of prop time
Array<Colour> cols = l->getColors(p, t, params); //use sequence's time instead of prop time

if (cols.isEmpty()) continue;

colors.add(cols);
blendModes.add(l->blendMode->getValueDataAsEnum<LightBlockLayer::BlendMode>());

numActiveLayers++;
}

Expand All @@ -102,10 +107,11 @@ Array<Colour> TimelineBlockSequence::getColors(Prop * p, double time, var params

case LightBlockLayer::ALPHA:
{
r = r + (colors[j][i].getFloatRed() - r) * a;
g = g + (colors[j][i].getFloatGreen() - g) * a;
b = b + (colors[j][i].getFloatBlue() - b) * a;
a += colors[j][i].getFloatAlpha();
float ca = colors[j][i].getFloatAlpha();
r = r + (colors[j][i].getFloatRed() - r) * ca;
g = g + (colors[j][i].getFloatGreen() - g) * ca;
b = b + (colors[j][i].getFloatBlue() - b) * ca;
a += ca;
}
break;

Expand Down
40 changes: 34 additions & 6 deletions Source/Timeline/layers/Block/LightBlockClip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,21 @@

LightBlockClip::LightBlockClip(LightBlockLayer * layer, float _time) :
LayerBlock("LightBlockClip", _time),
layer(layer)
layer(layer),
clipNotifier(10)
{
itemDataType = "LightBlockClip";

activeProvider = addTargetParameter("Active Block", "The current active block for this prop");
activeProvider->targetType = TargetParameter::CONTAINER;
activeProvider->customGetTargetContainerFunc = &LightBlockModelLibrary::showProvidersAndGet;

autoFade = addBoolParameter("Auto Fade", "If checked, when clips are overlapping, fade will be adjusted automatically", true);
fadeIn = addFloatParameter("Fade In", "Fade in time", 0, 0, getTotalLength());
fadeOut = addFloatParameter("Fade Out", "Fade out time", 0, 0, getTotalLength());
fadeIn->setControllableFeedbackOnly(autoFade->boolValue());
fadeOut->setControllableFeedbackOnly(autoFade->boolValue());
//autoFade = addBoolParameter("Auto Fade", "If checked, when clips are overlapping, fade will be adjusted automatically", true);

fadeIn = addFloatParameter("Fade In", "Fade in time", 0, 0, getTotalLength(), false);
fadeIn->canBeDisabledByUser = true;
fadeOut = addFloatParameter("Fade Out", "Fade out time", 0, 0, getTotalLength(), false);
fadeOut->canBeDisabledByUser = true;
}

LightBlockClip::~LightBlockClip()
Expand Down Expand Up @@ -132,10 +134,21 @@ void LightBlockClip::onContainerParameterChangedInternal(Parameter * p)
fadeIn->setRange(0, getTotalLength());
fadeOut->setRange(0, getTotalLength());
}
/*
else if (p == autoFade)
{
fadeIn->setControllableFeedbackOnly(autoFade->boolValue());
fadeOut->setControllableFeedbackOnly(autoFade->boolValue());
}*/
}

void LightBlockClip::controllableStateChanged(Controllable* c)
{
LayerBlock::controllableStateChanged(c);
if (c == fadeIn || c == fadeOut)
{
clipListeners.call(&ClipListener::clipFadesChanged, this);
clipNotifier.addMessage(new ClipEvent(ClipEvent::FADES_CHANGED, this));
}
}

Expand All @@ -162,4 +175,19 @@ void LightBlockClip::loadJSONDataInternal(var data)
}
}

//Retro compatibility, to remove after
var params = data.getProperty("parameters",var());
for (int i = 0; i < params.size(); i++)
{
if (params[i].getProperty("controlAddress", "") == "/autoFade")
{
bool val = params[i].getProperty("value", false);
fadeIn->setEnabled(!val);
fadeOut->setEnabled(!val);
break;
}
}



}
40 changes: 39 additions & 1 deletion Source/Timeline/layers/Block/LightBlockClip.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class LightBlockClip :

TargetParameter * activeProvider;

BoolParameter * autoFade;
//BoolParameter * autoFade;
FloatParameter * fadeIn;
FloatParameter * fadeOut;

Expand All @@ -40,10 +40,48 @@ class LightBlockClip :

void setCoreLength(float value, bool stretch = false, bool stickToCoreEnd = false) override;


void onContainerParameterChangedInternal(Parameter * p) override;
virtual void controllableStateChanged(Controllable* c) override;

var getJSONData() override;
void loadJSONDataInternal(var data) override;

String getTypeString() const override { return "LightBlockClip"; }


//Listener
//Listener
class ClipListener
{
public:
/** Destructor. */
virtual ~ClipListener() {}
virtual void clipFadesChanged (LightBlockClip *) {}
};

ListenerList<ClipListener> clipListeners;
void addClipListener(ClipListener* newListener) { clipListeners.add(newListener); }
void removeClipListener(ClipListener* listener) { clipListeners.remove(listener); }

// ASYNC
class ClipEvent
{
public:
enum Type { FADES_CHANGED };

ClipEvent(Type t, LightBlockClip* p, var v = var()) :
type(t), clip(p), value(v) {}

Type type;
LightBlockClip* clip;
var value;
};

QueuedNotifier<ClipEvent> clipNotifier;
typedef QueuedNotifier<ClipEvent>::Listener AsyncListener;

void addAsyncClipListener(AsyncListener* newListener) { clipNotifier.addListener(newListener); }
void addAsyncCoalescedClipListener(AsyncListener* newListener) { clipNotifier.addAsyncCoalescedListener(newListener); }
void removeAsyncClipListener(AsyncListener* listener) { clipNotifier.removeListener(listener); }
};
28 changes: 25 additions & 3 deletions Source/Timeline/layers/Block/LightBlockClipManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ LayerBlock * LightBlockClipManager::createItem()
return new LightBlockClip(lightBlockLayer);
}

void LightBlockClipManager::addItemInternal(LayerBlock* block, var data)
{
LayerBlockManager::addItemInternal(block, data);
LightBlockClip* clip = dynamic_cast<LightBlockClip*>(block);
clip->addClipListener(this);
}

void LightBlockClipManager::removeItemInternal(LayerBlock* block)
{
LayerBlockManager::removeItemInternal(block);
LightBlockClip* clip = dynamic_cast<LightBlockClip*>(block);
clip->removeClipListener(this);
}

void LightBlockClipManager::onControllableFeedbackUpdate(ControllableContainer * cc, Controllable * c)
{
LightBlockClip * b = c->getParentAs<LightBlockClip>();
Expand All @@ -42,6 +56,11 @@ void LightBlockClipManager::onControllableFeedbackUpdate(ControllableContainer *
}
}

void LightBlockClipManager::clipFadesChanged(LightBlockClip* clip)
{
computeFadesForClip(clip, false);
}

void LightBlockClipManager::computeFadesForClip(LightBlockClip * clip, bool propagate)
{
int bIndex = items.indexOf(clip);
Expand All @@ -63,12 +82,15 @@ void LightBlockClipManager::computeFadesForClip(LightBlockClip * clip, bool prop
return;
}

if (clip->autoFade->boolValue())
if (!clip->fadeIn->enabled)
{
float fadeIn = prevBlock == nullptr ? 0 : jmax(prevBlock->getEndTime() - clip->time->floatValue(), 0.f);
float fadeOut = nextBlock == nullptr ? 0 : jmax(clip->getEndTime() - nextBlock->time->floatValue(), 0.f);

clip->fadeIn->setValue(fadeIn);
}

if (!clip->fadeOut->enabled)
{
float fadeOut = nextBlock == nullptr ? 0 : jmax(clip->getEndTime() - nextBlock->time->floatValue(), 0.f);
clip->fadeOut->setValue(fadeOut);
}

Expand Down
7 changes: 6 additions & 1 deletion Source/Timeline/layers/Block/LightBlockClipManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
class LightBlockLayer;

class LightBlockClipManager :
public LayerBlockManager
public LayerBlockManager,
public LightBlockClip::ClipListener
{
public:
LightBlockClipManager(LightBlockLayer * layer);
Expand All @@ -24,7 +25,11 @@ class LightBlockClipManager :
LightBlockLayer * lightBlockLayer;
LayerBlock * createItem() override;

void addItemInternal(LayerBlock* clip, var) override;
void removeItemInternal(LayerBlock* clip) override;

void onControllableFeedbackUpdate(ControllableContainer * cc, Controllable *c) override;

void clipFadesChanged(LightBlockClip* clip) override;
void computeFadesForClip(LightBlockClip * clip, bool propagate);
};
3 changes: 1 addition & 2 deletions Source/Timeline/layers/Block/LightBlockLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,13 @@ Array<Colour> LightBlockLayer::getColors(Prop * p, double time, var params)
int resolution = p->resolution->intValue();

Array<Colour> result;
result.resize(resolution);

if (blocks.size() == 0)
{
result.fill(Colours::transparentBlack);
return result;
}

result.resize(resolution);
Array<Array<Colour>> clipColors;

for (auto &b : blocks)
Expand Down
Loading

0 comments on commit 90d40b8

Please sign in to comment.