Audacity 3.2.0
Typedefs | Functions | Variables
anonymous_namespace{WaveTrackControls.cpp} Namespace Reference

Typedefs

using ValueFinder = std::function< int(WaveTrack &) >
 

Functions

template<typename Table >
PopupMenuTableEntry::InitFunction initFn (const ValueFinder &findValue)
 
void SliderDrawFunction (LWSlider *(*Selector)(const wxRect &sliderRect, const WaveTrack *t, bool captured, wxWindow *), wxDC *dc, const wxRect &rect, const Track *pTrack, wxWindow *pParent, bool captured, bool highlight)
 
void PanSliderDrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
void GainSliderDrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
void StatusDrawFunction (const TranslatableString &string, wxDC *dc, const wxRect &rect)
 
void Status1DrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
void Status2DrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 

Variables

std::unique_ptr< LWSlidergGainCaptured
 
std::unique_ptr< LWSlidergPanCaptured
 
std::unique_ptr< LWSlidergGain
 
std::unique_ptr< LWSlidergPan
 

Typedef Documentation

◆ ValueFinder

using anonymous_namespace{WaveTrackControls.cpp}::ValueFinder = typedef std::function< int( WaveTrack& ) >

Definition at line 144 of file WaveTrackControls.cpp.

Function Documentation

◆ GainSliderDrawFunction()

void anonymous_namespace{WaveTrackControls.cpp}::GainSliderDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)

Definition at line 981 of file WaveTrackControls.cpp.

984{
985 auto target = dynamic_cast<GainSliderHandle*>( context.target.get() );
986 auto dc = &context.dc;
987 bool hit = target && target->GetTrack().get() == pTrack;
988 if( hit )
989 hit=hit;
990 bool captured = hit && target->IsDragging();
991
992 const auto artist = TrackArtist::Get( context );
993 auto pParent = FindProjectFrame( artist->parent->GetProject() );
994
996 &WaveTrackControls::GainSlider, dc, rect, pTrack,
997 pParent, captured, hit);
998}
wxFrame * FindProjectFrame(AudacityProject *project)
Get a pointer to the window associated with a project, or null if the given pointer is null,...
static TrackArtist * Get(TrackPanelDrawingContext &)
Definition: TrackArtist.cpp:69
static LWSlider * GainSlider(CellularPanel &panel, const WaveTrack &wt)
void SliderDrawFunction(LWSlider *(*Selector)(const wxRect &sliderRect, const WaveTrack *t, bool captured, wxWindow *), wxDC *dc, const wxRect &rect, const Track *pTrack, wxWindow *pParent, bool captured, bool highlight)

References TrackPanelDrawingContext::dc, FindProjectFrame(), WaveTrackControls::GainSlider(), TrackArtist::Get(), SliderDrawFunction(), and TrackPanelDrawingContext::target.

Referenced by WaveTrackTCPLines::WaveTrackTCPLines().

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

◆ initFn()

template<typename Table >
PopupMenuTableEntry::InitFunction anonymous_namespace{WaveTrackControls.cpp}::initFn ( const ValueFinder findValue)

Definition at line 149 of file WaveTrackControls.cpp.

150{
151 return [findValue]( PopupMenuHandler &handler, wxMenu &menu, int id ){
152 auto pData = static_cast<Table&>( handler ).mpData;
153 auto &track = static_cast<WaveTrack&>(pData->track);
154 auto &project = pData->project;
155 bool unsafe = ProjectAudioIO::Get( project ).IsAudioActive();
156
157 menu.Check(id, id == findValue(track));
158 menu.Enable( id, !unsafe );
159 };
160};
const auto project
int id
bool IsAudioActive() const
static ProjectAudioIO & Get(AudacityProject &project)
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
static float findValue(const float *spectrum, float bin0, float bin1, unsigned nBins, bool autocorrelation, int gain, int range)

References anonymous_namespace{SpectrumView.cpp}::findValue(), ProjectAudioIO::Get(), audacity::cloud::audiocom::anonymous_namespace{AuthorizationHandler.cpp}::handler, id, ProjectAudioIO::IsAudioActive(), and project.

Referenced by for().

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

◆ PanSliderDrawFunction()

void anonymous_namespace{WaveTrackControls.cpp}::PanSliderDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)

Definition at line 964 of file WaveTrackControls.cpp.

967{
968 auto target = dynamic_cast<PanSliderHandle*>( context.target.get() );
969 auto dc = &context.dc;
970 bool hit = target && target->GetTrack().get() == pTrack;
971 bool captured = hit && target->IsDragging();
972
973 const auto artist = TrackArtist::Get( context );
974 auto pParent = FindProjectFrame( artist->parent->GetProject() );
975
977 &WaveTrackControls::PanSlider, dc, rect, pTrack,
978 pParent, captured, hit);
979}
static LWSlider * PanSlider(CellularPanel &panel, const WaveTrack &wt)

References TrackPanelDrawingContext::dc, FindProjectFrame(), TrackArtist::Get(), WaveTrackControls::PanSlider(), SliderDrawFunction(), and TrackPanelDrawingContext::target.

Referenced by WaveTrackTCPLines::WaveTrackTCPLines().

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

◆ SliderDrawFunction()

void anonymous_namespace{WaveTrackControls.cpp}::SliderDrawFunction ( LWSlider *(*)(const wxRect &sliderRect, const WaveTrack *t, bool captured, wxWindow *)  Selector,
wxDC *  dc,
const wxRect &  rect,
const Track pTrack,
wxWindow *  pParent,
bool  captured,
bool  highlight 
)

Definition at line 951 of file WaveTrackControls.cpp.

957{
958 wxRect sliderRect = rect;
959 CommonTrackInfo::GetSliderHorizontalBounds( rect.GetTopLeft(), sliderRect );
960 auto wt = static_cast<const WaveTrack*>( pTrack );
961 Selector( sliderRect, wt, captured, pParent )->OnPaint(*dc, highlight);
962}
void OnPaint(wxDC &dc, bool highlighted)
Definition: ASlider.cpp:717
AUDACITY_DLL_API void GetSliderHorizontalBounds(const wxPoint &topleft, wxRect &dest)

References CommonTrackInfo::GetSliderHorizontalBounds().

Referenced by GainSliderDrawFunction(), and PanSliderDrawFunction().

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

◆ Status1DrawFunction()

void anonymous_namespace{WaveTrackControls.cpp}::Status1DrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)

Returns the string to be displayed in the track label indicating whether the track is mono, left, right, or stereo and what sample rate it's using.

Definition at line 1007 of file WaveTrackControls.cpp.

1010{
1011 auto dc = &context.dc;
1012 auto wt = static_cast<const WaveTrack*>(pTrack);
1013
1017 auto rate = wt ? wt->GetRate() : 44100.0;
1019 if (!pTrack || pTrack->NChannels() > 1)
1020 // TODO: more-than-two-channels-message
1021 // more appropriate strings
1022 s = XO("Stereo, %dHz");
1023 else
1024 s = XO("Mono, %dHz");
1025 s.Format( (int) (rate + 0.5) );
1026
1027 StatusDrawFunction( s, dc, rect );
1028}
XO("Cut/Copy/Paste")
virtual size_t NChannels() const =0
Report the number of channels.
Holds a msgid for the translation catalog; may also bind format arguments.
TranslatableString & Format(Args &&...args) &
Capture variadic format arguments (by copy) when there is no plural.
double GetRate() const override
Definition: WaveTrack.cpp:798
void StatusDrawFunction(const TranslatableString &string, wxDC *dc, const wxRect &rect)

References TrackPanelDrawingContext::dc, TranslatableString::Format(), WaveTrack::GetRate(), ChannelGroup::NChannels(), StatusDrawFunction(), and XO().

Referenced by WaveTrackTCPLines::WaveTrackTCPLines().

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

◆ Status2DrawFunction()

void anonymous_namespace{WaveTrackControls.cpp}::Status2DrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)

Definition at line 1030 of file WaveTrackControls.cpp.

1033{
1034 auto dc = &context.dc;
1035 auto wt = static_cast<const WaveTrack*>(pTrack);
1036 auto format = wt ? wt->GetSampleFormat() : floatSample;
1037 auto s = GetSampleFormatStr(format);
1038 StatusDrawFunction( s, dc, rect );
1039}
TranslatableString GetSampleFormatStr(sampleFormat format)
constexpr sampleFormat floatSample
Definition: SampleFormat.h:45

References TrackPanelDrawingContext::dc, floatSample, anonymous_namespace{ExportPCM.cpp}::format, GetSampleFormatStr(), and StatusDrawFunction().

Referenced by WaveTrackTCPLines::WaveTrackTCPLines().

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

◆ StatusDrawFunction()

void anonymous_namespace{WaveTrackControls.cpp}::StatusDrawFunction ( const TranslatableString string,
wxDC *  dc,
const wxRect &  rect 
)

Definition at line 1000 of file WaveTrackControls.cpp.

1002{
1003 static const int offset = 3;
1004 dc->DrawText(string.Translation(), rect.x + offset, rect.y);
1005}

Referenced by Status1DrawFunction(), and Status2DrawFunction().

Here is the caller graph for this function:

Variable Documentation

◆ gGain

std::unique_ptr<LWSlider> anonymous_namespace{WaveTrackControls.cpp}::gGain

◆ gGainCaptured

std::unique_ptr<LWSlider> anonymous_namespace{WaveTrackControls.cpp}::gGainCaptured

◆ gPan

std::unique_ptr<LWSlider> anonymous_namespace{WaveTrackControls.cpp}::gPan

◆ gPanCaptured

std::unique_ptr<LWSlider> anonymous_namespace{WaveTrackControls.cpp}::gPanCaptured