Function calling troubles... (shared AudioDeviceManager)


#1

I'm trying to create a DocumentWindow component that will display an AudioDeviceSelectorComponent.
I've created an AudioDeviceManager in my MainContentComponent's constructor, and I've created a public function "getSharedAudioDeviceManager" in MainContentComponent that returns a reference to the AudioDeviceManager.

I'm having trouble calling the getSharedAudioDeviceManager function from within the DocumentWindow's constructor. I'm getting the error: "use of undeclared identifier MainContentComponent" when I try to use "MainContentComponent::getSharedAudioDeviceManager" to call the function. Can anybody tell me why I can't call this function? I'm a new programmer so I might be missing something basic.

// MainComponent.h

#ifndef MAINCOMPONENT_H_INCLUDED
#define MAINCOMPONENT_H_INCLUDED

#include "../JuceLibraryCode/JuceHeader.h"
#include "AudSetWin.h"

class MainContentComponent   : public Component
{
public:
    MainContentComponent();
    ~MainContentComponent();
    
    AudioDeviceManager& getSharedAudioDeviceManager();
    
    ScopedPointer<AudioDeviceManager> audDevMan;

    void paint (Graphics&);
    void resized();
    
private:
    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent)
};


#endif  // MAINCOMPONENT_H_INCLUDED
// MainComponent.cpp

#include "MainComponent.h"
#include "AudSetWin.h"

MainContentComponent::MainContentComponent()
{
    setSize (1200, 675);
    audDevMan = new AudioDeviceManager;
}

MainContentComponent::~MainContentComponent()
{
    audDevMan = nullptr;
}

AudioDeviceManager& MainContentComponent::getSharedAudioDeviceManager()
{
    return *audDevMan;
}

void MainContentComponent::paint (Graphics& g)
{
    g.fillAll (Colour (0xffeeddff));

}

void MainContentComponent::resized()
{
}
//  AudSetWin.h

#ifndef aVL_AudSetWin_h
#define aVL_AudSetWin_h

#include "MainComponent.h"

class AudSetWin : public DocumentWindow
{
private:
    
    ScopedPointer<AudioDeviceSelectorComponent> audDevSelCom;
    
public:
	
    AudSetWin () : DocumentWindow ("AudioSettingsWindow",
                                   Colours::lightgrey,
                                   DocumentWindow::allButtons)
    {
	audDevSelCom = new AudioDeviceSelectorComponent(
            MainContentComponent::getSharedAudioDeviceManager(),
                0, 256, 0, 256, true, true, true, false);

        addAndMakeVisible(audDevSelCom);
        audDevSelCom->setBounds(0,0,300,300);

    }
    
    ~AudSetWin()
    {
        audDevSelCom = nullptr;
    }
    
    void resized()
    {
		
    }
    
    void paint(Graphics& g)
    {
        g.fillAll (Colours::white);
    }
	
};

#endif