Audacity 3.2.0
Classes | Functions
anonymous_namespace{RealtimeEffectPanel.cpp} Namespace Reference

Classes

class  DropHintLine
 
class  HyperLinkCtrlWrapper
 
class  ListNavigationEnabled
 Changes default arrow navigation to behave more list- or table-like. Instead of searching focusable items among children first, list navigation searches for siblings when arrow key is pressed. Tab behaviour stays same. Requires wxWANT_CHARS style flag to be set. More...
 
class  ListNavigationPanel
 
class  MovableControl
 
class  MovableControlEvent
 
class  RealtimeEffectControl
 

Functions

template<typename Visitor >
void VisitRealtimeEffectStateUIs (Track &track, Visitor &&visitor)
 
void UpdateRealtimeEffectUIData (Track &track)
 
void ReopenRealtimeEffectUIData (AudacityProject &project, Track &track)
 
PluginID ShowSelectEffectMenu (wxWindow *parent, RealtimeEffectControl *currentEffectControl=nullptr)
 
 wxDEFINE_EVENT (EVT_MOVABLE_CONTROL_DRAG_STARTED, MovableControlEvent)
 
 wxDEFINE_EVENT (EVT_MOVABLE_CONTROL_DRAG_POSITION, MovableControlEvent)
 
 wxDEFINE_EVENT (EVT_MOVABLE_CONTROL_DRAG_FINISHED, MovableControlEvent)
 
static wxString GetSafeVendor (const PluginDescriptor &descriptor)
 

Function Documentation

◆ GetSafeVendor()

static wxString anonymous_namespace{RealtimeEffectPanel.cpp}::GetSafeVendor ( const PluginDescriptor descriptor)
static

Definition at line 858 of file RealtimeEffectPanel.cpp.

859 {
860 if (descriptor.GetVendor().empty())
861 return XO("Unknown").Translation();
862
863 return descriptor.GetVendor();
864 }
#define XO(s)
Definition: Internat.h:31
const wxString & GetVendor() const

References PluginDescriptor::GetVendor(), and XO.

Referenced by ShowSelectEffectMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReopenRealtimeEffectUIData()

void anonymous_namespace{RealtimeEffectPanel.cpp}::ReopenRealtimeEffectUIData ( AudacityProject project,
Track track 
)

Definition at line 68 of file RealtimeEffectPanel.cpp.

69 {
71 track,
72 [&](auto& ui)
73 {
74 if (ui.IsShown())
75 {
76 ui.Hide(&project);
77 ui.Show(project);
78 }
79 });
80 }
void VisitRealtimeEffectStateUIs(Track &track, Visitor &&visitor)

References VisitRealtimeEffectStateUIs().

Referenced by RealtimeEffectPanel::PrefsListenerHelper::UpdatePrefs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowSelectEffectMenu()

PluginID anonymous_namespace{RealtimeEffectPanel.cpp}::ShowSelectEffectMenu ( wxWindow *  parent,
RealtimeEffectControl currentEffectControl = nullptr 
)

Definition at line 866 of file RealtimeEffectPanel.cpp.

867 {
868 wxMenu menu;
869
870 if(currentEffectControl != nullptr)
871 {
872 //no need to handle language change since menu creates it's own event loop
873 menu.Append(wxID_REMOVE, _("No Effect"));
874 menu.AppendSeparator();
875 }
876
877 auto& pluginManager = PluginManager::Get();
878
879 std::vector<const PluginDescriptor*> effects;
880 int selectedEffectIndex = -1;
881
882 auto compareEffects = [](const PluginDescriptor* a, const PluginDescriptor* b)
883 {
884 const auto vendorA = GetSafeVendor(*a);
885 const auto vendorB = GetSafeVendor(*b);
886
887 return vendorA < vendorB ||
888 (vendorA == vendorB &&
889 a->GetSymbol().Translation() < b->GetSymbol().Translation());
890 };
891
892 for(auto& effect : pluginManager.EffectsOfType(EffectTypeProcess))
893 {
894 if(!effect.IsEffectRealtime() || !effect.IsEnabled())
895 continue;
896 effects.push_back(&effect);
897 }
898
899 std::sort(effects.begin(), effects.end(), compareEffects);
900
901 wxString currentSubMenuName;
902 std::unique_ptr<wxMenu> currentSubMenu;
903
904 auto submenuEventHandler = [&](wxCommandEvent& event)
905 {
906 selectedEffectIndex = event.GetId() - wxID_HIGHEST;
907 };
908
909 for(int i = 0, count = effects.size(); i < count; ++i)
910 {
911 auto& effect = *effects[i];
912
913 const wxString vendor = GetSafeVendor(effect);
914
915 if(currentSubMenuName != vendor)
916 {
917 if(currentSubMenu)
918 {
919 currentSubMenu->Bind(wxEVT_MENU, submenuEventHandler);
920 menu.AppendSubMenu(currentSubMenu.release(), currentSubMenuName);
921 }
922 currentSubMenuName = vendor;
923 currentSubMenu = std::make_unique<wxMenu>();
924 }
925
926 const auto ID = wxID_HIGHEST + i;
927 currentSubMenu->Append(ID, effect.GetSymbol().Translation());
928 }
929 if(currentSubMenu)
930 {
931 currentSubMenu->Bind(wxEVT_MENU, submenuEventHandler);
932 menu.AppendSubMenu(currentSubMenu.release(), currentSubMenuName);
933 menu.AppendSeparator();
934 }
935 menu.Append(wxID_MORE, _("Get more effects..."));
936
937 menu.Bind(wxEVT_MENU, [&](wxCommandEvent& event)
938 {
939 if(event.GetId() == wxID_REMOVE)
940 currentEffectControl->RemoveFromList();
941 else if(event.GetId() == wxID_MORE)
942 OpenInDefaultBrowser("https://plugins.audacityteam.org/");
943 });
944
945 if(parent->PopupMenu(&menu, parent->GetClientRect().GetLeftBottom()) && selectedEffectIndex != -1)
946 return effects[selectedEffectIndex]->GetID();
947
948 return {};
949 }
@ EffectTypeProcess
void OpenInDefaultBrowser(const URLString &link)
Definition: HelpSystem.cpp:532
#define _(s)
Definition: Internat.h:75
const wxString Translation() const
const ComponentInterfaceSymbol & GetSymbol() const
static PluginManager & Get()
static wxString GetSafeVendor(const PluginDescriptor &descriptor)

References _, EffectTypeProcess, PluginManager::Get(), GetSafeVendor(), PluginDescriptor::GetSymbol(), OpenInDefaultBrowser(), anonymous_namespace{RealtimeEffectPanel.cpp}::RealtimeEffectControl::RemoveFromList(), and ComponentInterfaceSymbol::Translation().

Referenced by RealtimeEffectListWindow::OnAddEffectClicked(), and anonymous_namespace{RealtimeEffectPanel.cpp}::RealtimeEffectControl::OnChangeButtonClicked().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateRealtimeEffectUIData()

void anonymous_namespace{RealtimeEffectPanel.cpp}::UpdateRealtimeEffectUIData ( Track track)

Definition at line 62 of file RealtimeEffectPanel.cpp.

63 {
65 track, [&](auto& ui) { ui.UpdateTrackData(track); });
66 }

References VisitRealtimeEffectStateUIs().

Referenced by RealtimeEffectPanel::RealtimeEffectPanel(), and RealtimeEffectListWindow::SetTrack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VisitRealtimeEffectStateUIs()

template<typename Visitor >
void anonymous_namespace{RealtimeEffectPanel.cpp}::VisitRealtimeEffectStateUIs ( Track track,
Visitor &&  visitor 
)

Definition at line 51 of file RealtimeEffectPanel.cpp.

52 {
53 auto& effects = RealtimeEffectList::Get(track);
54 effects.Visit(
55 [visitor](auto& effectState, bool)
56 {
57 auto& ui = RealtimeEffectStateUI::Get(effectState);
58 visitor(ui);
59 });
60 }
static RealtimeEffectList & Get(AudacityProject &project)
static RealtimeEffectStateUI & Get(RealtimeEffectState &state)

References RealtimeEffectList::Get(), and RealtimeEffectStateUI::Get().

Referenced by RealtimeEffectPanel::RealtimeEffectPanel(), ReopenRealtimeEffectUIData(), and UpdateRealtimeEffectUIData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wxDEFINE_EVENT() [1/3]

anonymous_namespace{RealtimeEffectPanel.cpp}::wxDEFINE_EVENT ( EVT_MOVABLE_CONTROL_DRAG_FINISHED  ,
MovableControlEvent   
)

◆ wxDEFINE_EVENT() [2/3]

anonymous_namespace{RealtimeEffectPanel.cpp}::wxDEFINE_EVENT ( EVT_MOVABLE_CONTROL_DRAG_POSITION  ,
MovableControlEvent   
)

◆ wxDEFINE_EVENT() [3/3]

anonymous_namespace{RealtimeEffectPanel.cpp}::wxDEFINE_EVENT ( EVT_MOVABLE_CONTROL_DRAG_STARTED  ,
MovableControlEvent   
)