# Transparent colour bug in AudioVisualiserComponent

**URL:** <https://forum.juce.com/t/transparent-colour-bug-in-audiovisualisercomponent/60236>\
**Category:** Audio Plugins\
**Created:** [March 1, 2024, 9:22am UTC](https://forum.juce.com/t/transparent-colour-bug-in-audiovisualisercomponent/60236 "2024-03-01T09:22:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![TCleton](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@TCleton](https://forum.juce.com/u/TCleton)\
**Post date:** [March 1, 2024, 9:22am UTC](https://forum.juce.com/t/transparent-colour-bug-in-audiovisualisercomponent/60236/1 "2024-03-01T09:22:43Z")

</div>

Hello, I am doing a plugin with sliders and next to it there is a visualiser (in the red rectangle). I set the visualiser background colour to be transparent like so :

```auto
addAndMakeVisible(audioProcessor.waveVisualiser);
Colour transparent(0.0f, 0.0f, 0.0f, 0.0f);
audioProcessor.waveVisualiser.setColours(transparent, Colours::green);

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/5/f/5f6ee7ad4ce4e58037ef04437944bb68d35cc1e8.png)  
The green traces are recorded audio from the standalone app.

The alpha value is 0 so it should be transparent. But it appear to be duplicating the left side instead. Any ideas on how to fix this ?

Other code that I don’t think is related but just in case :

```auto
void MyPluginAudioProcessorEditor::resized()
{
    float h = getHeight();
    float w = getWidth()/2;
    float m = (w+h)/50;

    float L2 = (w - 3 * m)/2;
    float L1 = (L2-2*m)/3;
    
    // slider and check box positioning

    audioProcessor.waveVisualiser.setBounds(w+m, m, w-2*m, h-2*m);
}

```

```auto
void MyPluginAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
{
        waveVisualiser.clear();
}

```

```auto
void MyPluginAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages)
{
    waveVisualiser.pushBuffer(buffer);
}

```

---

<div class="post-metadata">

**Author:** ![anon48770766](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@anon48770766](https://forum.juce.com/u/anon48770766)\
**Post date:** [March 1, 2024, 10:56am UTC](https://forum.juce.com/t/transparent-colour-bug-in-audiovisualisercomponent/60236/3 "2024-03-01T10:56:27Z")

</div>

Neat bug. Got OPENGL enabled? This looks like a texture pipeline issue …

---

<div class="post-metadata">

**Author:** ![TCleton](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@TCleton](https://forum.juce.com/u/TCleton)\
**Post date:** [March 1, 2024, 11:02am UTC](https://forum.juce.com/t/transparent-colour-bug-in-audiovisualisercomponent/60236/4 "2024-03-01T11:02:22Z")

</div>

I don’t know how to see if openGL is enabled. Is it something I have to to in projucer ?

Also when built the vst3 plugin and run it in reaper, the background colour is black, it is not even the same as the standalone plugin.

---

<div class="post-metadata">

**Author:** ![TCleton](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@TCleton](https://forum.juce.com/u/TCleton)\
**Post date:** [March 1, 2024, 11:10am UTC](https://forum.juce.com/t/transparent-colour-bug-in-audiovisualisercomponent/60236/5 "2024-03-01T11:10:26Z")

</div>

The goal of making the background transparent is to superimpose several AudioVisualiserComponent so I can plot several traces on top of each others.

But if you know another way to plot several curves with AudioVisualiserComponent, it can be as helpful as solving the transparent issue.

---

<div class="post-metadata">

**Author:** ![TCleton](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@TCleton](https://forum.juce.com/u/TCleton)\
**Post date:** [March 1, 2024, 4:53pm UTC](https://forum.juce.com/t/transparent-colour-bug-in-audiovisualisercomponent/60236/6 "2024-03-01T16:53:01Z")

</div>

So I updated juce to the last version and it still produce the same. Also I looked under the paint function of the AudioVisualiserComponent and commented the

```auto
g.fillAll (backgroundColour);

```

```auto
void AudioVisualiserComponent::paint (Graphics& g)
{
    //g.fillAll (backgroundColour);

    auto r = getLocalBounds().toFloat();
    auto channelHeight = r.getHeight() / (float) channels.size();

    g.setColour (waveformColour);

    for (auto* c : channels)
        paintChannel (g, r.removeFromTop (channelHeight),
                      c->levels.begin(), c->levels.size(), c->nextSample);
}

```

So normally it should not display any background. But still the error persits.

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [March 1, 2024, 5:00pm UTC](https://forum.juce.com/t/transparent-colour-bug-in-audiovisualisercomponent/60236/7 "2024-03-01T17:00:20Z")

</div>

call setOpaque (false) on the widget

It’s on by default in this class

---

<div class="post-metadata">

**Author:** ![TCleton](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@TCleton](https://forum.juce.com/u/TCleton)\
**Post date:** [March 1, 2024, 5:36pm UTC](https://forum.juce.com/t/transparent-colour-bug-in-audiovisualisercomponent/60236/8 "2024-03-01T17:36:23Z")

</div>

Oh thanks a lot ! It works fine now. I thought this parameter would have all the component transparent but I understand now.
