JUCE_LIVE_CONSTANT in a plugin?


#1

hi jules !

i just tested your JUCE_LIVE_CONSTANT macro with a simple 'GUI Application'
(with basic window) made by introjucer and used your example code for the
paint()-method from the juce_LiveConstantEditor documentation.

void MyComp::paint (Graphics& g) override
{
    g.fillAll (JUCE_LIVE_CONSTANT (Colour (0xffddddff)));
    Colour fontColour = JUCE_LIVE_CONSTANT (Colour (0xff005500));
    float fontSize = JUCE_LIVE_CONSTANT (16.0f);
    g.setColour (fontColour);
    g.setFont (fontSize);
    g.drawFittedText (JUCE_LIVE_CONSTANT ("Hello world!"),
    getLocalBounds(), Justification::centred, 2);
}

everything works as expected and it is VERY nice !!!

 

but i wonder if it's possible to get it working in an audio-plugin as well !?

so, i created (again with introjucer) a new audio-plugin-project and
wrapped the font-size-setting in the paint()-method inside a
JUCE_LIVE_CONSTANT macro.

    g.setFont (JUCE_LIVE_CONSTANT(15.0f));

then i started the debugging.

i got two assertions (in juce_File.h):

    else if (! path.containsChar (':'))
    {
        /*  When you supply a raw string to the File object constructor, it must be an absolute path.
            If you're trying to parse a string that may be either a relative path or an absolute path,
            you MUST provide a context against which the partial path can be evaluated - you can do
            this by simply using File::getChildFile() instead of the File constructor. E.g. saying
            "File::getCurrentWorkingDirectory().getChildFile (myUnknownPath)" would return an absolute
            path if that's what was supplied, or would evaluate a partial path relative to the CWD.
        */
        jassertfalse;

        return File::getCurrentWorkingDirectory().getChildFile (path).getFullPathName();
    }

after continuing the additional 'live constants editor window' shows up as expected.
but unfortunately if i change the font-size value in the "juce live constants window",
it has no effect an the editor window at all.

do you have any idea what i'm doing the wrong way ?

 

by the way:
i'm on windows 7 (64bit) and testing / debugging the plugin inside VSTHost ( Hermann Seib ) v1.5.2

 


#2

Haven't tried it in a plugin TBH. The assertion on its own isn't much help - what's the stack trace for it?


#3

this is the stack-trace:

>    A1PluginTestLiveConstant.dll!juce::File::parseAbsolutePath(const juce::String & p)  Zeile 109 + 0x1d Bytes    C++
     A1PluginTestLiveConstant.dll!juce::File::File(const juce::String & fullPathName)  Zeile 32    C++
     A1PluginTestLiveConstant.dll!juce::LiveConstantEditor::LiveValueBase::LiveValueBase(const char * file, int line)  Zeile 97 + 0x51 Bytes    C++
     A1PluginTestLiveConstant.dll!juce::LiveConstantEditor::LiveValue<float>::LiveValue<float>(const char * file, int line, const float & initialValue)  Zeile 168 + 0x2c Bytes    C++
     A1PluginTestLiveConstant.dll!juce::LiveConstantEditor::ValueList::getValue<float>(const char * file, int line, const float & initialValue)  Zeile 213 + 0x39 Bytes    C++
     A1PluginTestLiveConstant.dll!juce::LiveConstantEditor::getValue<float>(const char * file, int line, const float & initialValue)  Zeile 237    C++
     A1PluginTestLiveConstant.dll!A1pluginTestLiveConstantAudioProcessorEditor::paint(juce::Graphics & g)  Zeile 34 + 0x24 Bytes    C++
     A1PluginTestLiveConstant.dll!juce::Component::paintComponentAndChildren(juce::Graphics & g)  Zeile 1966    C++
     A1PluginTestLiveConstant.dll!juce::Component::paintEntireComponent(juce::Graphics & g, const bool ignoreAlphaLevel)  Zeile 2071    C++
     A1PluginTestLiveConstant.dll!juce::Component::paintWithinParentContext(juce::Graphics & g)  Zeile 1949    C++
     A1PluginTestLiveConstant.dll!juce::Component::paintComponentAndChildren(juce::Graphics & g)  Zeile 2012    C++
     A1PluginTestLiveConstant.dll!juce::Component::paintEntireComponent(juce::Graphics & g, const bool ignoreAlphaLevel)  Zeile 2071    C++
     A1PluginTestLiveConstant.dll!juce::ComponentPeer::handlePaint(juce::LowLevelGraphicsContext & contextToPaintTo)  Zeile 160    C++
     A1PluginTestLiveConstant.dll!juce::HWNDComponentPeer::performPaint(HDC__ * dc, HRGN__ * rgn, int regionType, tagPAINTSTRUCT & paintStruct)  Zeile 1643 + 0x1d Bytes    C++
     A1PluginTestLiveConstant.dll!juce::HWNDComponentPeer::handlePaintMessage()  Zeile 1538 + 0x2c Bytes    C++
     A1PluginTestLiveConstant.dll!juce::HWNDComponentPeer::peerWindowProc(HWND__ * h, unsigned int message, unsigned __int64 wParam, __int64 lParam)  Zeile 2401    C++
     A1PluginTestLiveConstant.dll!juce::HWNDComponentPeer::windowProc(HWND__ * h, unsigned int message, unsigned __int64 wParam, __int64 lParam)  Zeile 2353 + 0x23 Bytes    C++
     user32.dll!00000000773d8971()     
     [Unten angegebene Rahmen sind möglicherweise nicht korrekt und/oder fehlen, keine Symbole geladen für user32.dll]    
     user32.dll!00000000773d72cb()     
     user32.dll!00000000773d6829()     
     ntdll.dll!0000000077511225()     
     user32.dll!00000000773d6e5a()     
     user32.dll!00000000773d6e6c()     
     vsthost.exe!000000014017fa0e()     
     vsthost.exe!000000014017f4cb()     
     vsthost.exe!0000000140210bb3()     
     vsthost.exe!00000001401de653()     
     kernel32.dll!00000000772b652d()     
     ntdll.dll!00000000774ec521()     


#4

Well, you can see what it's trying to do: The macro uses the __FILE__ macro to find out the name of your source file, and the File class is complaining that it's not an absolute path. Not sure why that is, but what's the actual path that it's complaining about?


#5

i guess it has to be the plugin editor source file ... right ?!

in that case the full path is:

d:\coding\_Projects\A1PluginTestLiveConstant\Source\PluginEditor.cpp

 


#6

Yeah.. That's odd, it looks valid to me.


#7

I used the LIVE_CONSTANT in a plugin window a few months ago and everything worked fine (win 7 32 bit).

does the problem occur on the JUCE host? The VSTHost seems a but funky to me sometimes.


#8

yes, unfortunately it occurs in the "juce host" as well ...

 


#9

Who’s the guy who discovered he can use JUCE_LIVE_CONSTANT in plug-ins this week ? :joy:


#10

@IvanC:
how did you get it working ?


#11

No major issue on Windows 8.1, I added the JUCE_LIVE_CONSTANT in a plug-in, I open it on Reaper, and I get the new window allowing me to change some parameters, even if a few things there seemed odd (but not enough to prevent me from doing what I needed to)


#12

ah, ok … thanks for the info !