Hi everyone
I have been struggling with this for a minute now, below is an example of what I’m trying to do. I get ‘editViewState is null’ on the console. How do I fix this so that track is not nullptr?
FooComponent::FooComponent(te::SelectionManager& sm, EditViewState& evs) : editViewState(evs), selectionManager(sm)
{
// Some code
}
void FooComponent::sliderValueChanged (Slider* slider)
{
// if (slider == &volume)
// {
// editViewState.selectionManager.selectOnly (selectedTrack.get());
//
// if (selectedTrack != nullptr)
// {
// if (auto at = dynamic_cast<te::AudioTrack*> (selectedTrack.get()))
// {
// if (auto* volumePlugin = at->getVolumePlugin())
// {
// volumePlugin->setVolumeDb((float)volume.getValue());
// }
// }
// }
//
// }
if (&editViewState != nullptr)
{
DBG(editViewState.selectionManager.getNumObjectsSelected() << "track selected");
}
else
{
DBG("editViewState is null");
}
}
I have track and editViewState instantiated as below on the header file
private:
EditViewState& editViewState;
// te::Edit& edit;
te::SelectionManager& selectionManager;
// EditViewState editViewState { edit, selectionManager };
te::Track::Ptr selectedTrack;
I am trying to be able to access the volume plugin of the selected track and be able to adjust it with the slider on my FooComponent, what am I doing wrong?
When I uncomment the commented code on the sliderValueChanged I get a breaking point on this line:
editViewState.selectionManager.selectOnly (selectedTrack.get());
and when I hover a mouse over editViewState I get
‘(EditViewState &) editViewState = 0x0000000000000000’