Cubase blank screen with latest tip!


#1

Noticed something odd with the latest tip. I’m testing this on the demo audio vst plugin demo.

I’m loading an image file in the DemoEditorComponent and drawing it(This is just out of the juceDemoPlugin demo):

[code]//==============================================================================
DemoEditorComponent::DemoEditorComponent (DemoJuceFilter* const ownerFilter)
: AudioProcessorEditor (ownerFilter)
{
// create our gain slider…
addAndMakeVisible (gainSlider = new Slider (T(“gain”)));
gainSlider->addListener (this);
gainSlider->setRange (0.0, 1.0, 0.01);
gainSlider->setTooltip (T(“changes the volume of the audio that runs through the plugin…”));

// get the gain parameter from the filter and use it to set up our slider
gainSlider->setValue (ownerFilter->getParameter (0), false);

// create and add the midi keyboard component..
addAndMakeVisible (midiKeyboard
    = new MidiKeyboardComponent (ownerFilter->keyboardState,
                                 MidiKeyboardComponent::horizontalKeyboard));

// add a label that will display the current timecode and status..
addAndMakeVisible (infoLabel = new Label (String::empty, String::empty));

// add the triangular resizer component for the bottom-right of the UI
addAndMakeVisible (resizer = new ResizableCornerComponent (this, &resizeLimits));
resizeLimits.setSizeLimits (150, 150, 800, 300);

// set our component's initial size to be the last one that was stored in the filter's settings
setSize (ownerFilter->lastUIWidth,
         ownerFilter->lastUIHeight);

// register ourselves with the filter - it will use its ChangeBroadcaster base
// class to tell us when something has changed, and this will call our changeListenerCallback()
// method.
ownerFilter->addChangeListener (this);


  
//======LOAD ALL IMAGE RESOURCES HERE========

juce::File Imagefile(T("tilewood.png"));
myimage = ImageCache::getFromFile(Imagefile);

   //=====================================

}

DemoEditorComponent::~DemoEditorComponent()
{
getFilter()->removeChangeListener (this);

deleteAllChildren();

}

//==============================================================================
void DemoEditorComponent::paint (Graphics& g)
{
// just clear the window
g.fillAll (Colour::greyLevel (0.9f));
g.drawImageAt(myimage,0,0);
}[/code]

Now the image shows up ok, untill I do something in cubase like save or load a bank, then when I hide the plugin UI in cubase and show it again I get a black screen the image dissapears and have to restart cubase for it to work again! However the sliders and controls are there and no problem with sound, for some strange reason the images get lost.

I have the exact code with older version of juce, and this did not happen.
Not sure if this link is a similar problem:
http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=3990

Cheers.


#2

It sounds like the ImageCache singleton is being deleted, and is taking your image with it. Maybe you release the image somewhere else, or maybe another instance of the plugin is loaded/released and is somehow interfering with it?

I’d like to know why this is happening, but you could always just load the image with Image::loadFromFile rather than letting the cache manage it?


#3

I double, triple checked, only have one instance running. Not doing anything different then the demo, apart from loading the image.

[quote]
I’d like to know why this is happening, but you could always just load the image with Image::loadFromFile rather than letting the cache manage it?[/quote]

Tried Image::loadFromFile as well, and same thing happens. Any ideas will be much appreciated.[/quote]


#4

Well if loadfromimage fails, I can only assume that you’re deleting or overwriting the image somewhere! It’s just a blob of memory, so as long as you leave it alone, there’s nothing that could really go wrong with it!

I guess you need to investigate the state of that image object when it’s not working, and have breakpoints in the image destructor to see if you’re toasting it.


#5

I see what you’re saying but I’m not deleting or overwriting the image anywhere!, its very easy to replicate, I’m curious if anyone else has seen this happen? This is what I’m doing.

1- start with win32 vst JuceDemoPlugin
2- Declare Image* myImage in DemoEditorComponent.h
3- Load The Image, by adding the following lines to DemoEditorComponent.cpp Constructor:

//LOAD THE IMAGE ========================= juce::File Imagefile(T("myimage.png")); myimage = juce::ImageFileFormat::loadFrom (Imagefile) ; //myimage = ImageCache::getFromFile(Imagefile);
4- Now show the image in Paint: if(myimage) g.drawImageAt(myimage,0,0);

5- load up cubase, open vst, now if you hide the UI and show it again the image will still be ok. However,

6- FAILS HERE!, now go to menu Import->Audio File and import anything, now close and reopen the vst UI, image is gone!

Also, This was working with the older versions of juce, something must have changed?


#6

You really need to find out what state the image is in when it fails - has the memory been overwritten?


#7

Were you able to replicate this?

[quote]
You really need to find out what state the image is in when it fails - has the memory been overwritten?[/quote]

what could be overwriting the memory? I have shown you what I’m doing, only 3 lines of code, can you tell me what I’m doing wrong. Can someone else please see if they can replicate this.