18#include "../ui/SelectHandle.h"
21#include "../../ProjectSettings.h"
23#include "../../TrackArtist.h"
24#include "../../TrackPanelDrawingContext.h"
25#include "../../TrackPanelMouseEvent.h"
28#include <wx/graphics.h>
36 std::vector<UIHandlePtr> results;
38 const auto currentTool =
settings.GetTool();
39 const bool isMultiTool = ( currentTool ==
multiTool );
49 if ( !isMultiTool && currentTool == slideTool ) {
53 results.push_back(result);
63 results.push_back(result);
67 if ( isMultiTool || currentTool ==
selectTool ) {
71 results.push_back(result);
92 dynamic_cast<const Track *
>(&pChannel->GetChannelGroup());
95 if (
const auto pList = pTrack->GetOwner())
96 if (
const auto p = pList->GetOwner())
102 const auto nChannels = pChannel->GetChannelGroup().Channels().size();
103 return (height * (index + 1) / nChannels) - (height * index / nChannels);
109 double alignedTime,
double sampleDur,
110 double *buffer,
int bufferLen,
int leftOffset,
116 double prevDiscreteTime=0.0, prevSampleVal=0.0, nextSampleVal=0.0;
117 for (
int xx = 0; xx < bufferLen; ++xx ) {
119 if ( sampleDur <= 0 )
128 auto leftDiscreteTime = alignedTime +
129 sampleDur * floor( ( time - alignedTime ) / sampleDur );
130 if ( xx == 0 || leftDiscreteTime != prevDiscreteTime ) {
131 prevDiscreteTime = leftDiscreteTime;
133 env.
GetValue( prevDiscreteTime, sampleDur );
135 env.
GetValue( prevDiscreteTime + sampleDur, sampleDur );
137 auto ratio = ( time - leftDiscreteTime ) / sampleDur;
140 ( 1.0 - ratio ) * log( prevSampleVal )
141 + ratio * log( nextSampleVal ) );
144 ( 1.0 - ratio ) * prevSampleVal + ratio * nextSampleVal;
std::shared_ptr< UIHandle > UIHandlePtr
declares abstract base class Track, TrackList, and iterators over TrackList
static Settings & settings()
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
static BackgroundCell & Get(AudacityProject &project)
std::weak_ptr< ZoomHandle > mZoomHandle
size_t GetChannelIndex() const
auto FindChannel() -> std::shared_ptr< Subtype >
May return null.
std::weak_ptr< SelectHandle > mSelectHandle
std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &, const AudacityProject *pProject) final
std::weak_ptr< TimeShiftHandle > mTimeShiftHandle
virtual int GetMinimizedHeight() const override
static void GetEnvelopeValues(const Envelope &env, double aligned_time, double sampleDur, double *buffer, int bufferLen, int leftOffset, const ZoomInfo &zoomInfo)
Get many envelope points for pixel columns at once, but don't assume uniform time per pixel.
std::shared_ptr< TrackPanelCell > ContextMenuDelegate() override
virtual std::vector< UIHandlePtr > DetailedHitTest(const TrackPanelMouseState &, const AudacityProject *pProject, int currentTool, bool bMultiTool)=0
std::shared_ptr< Track > FindTrack()
Piecewise linear or piecewise exponential function from double to double.
double GetValue(double t, double sampleDur=0) const
Get envelope value at time t.
bool GetExponential() const
static PendingTracks & Get(AudacityProject &project)
const Channel & SubstituteOriginalChannel(const Channel &channel) const
static ProjectSettings & Get(AudacityProject &project)
static UIHandlePtr HitTest(std::weak_ptr< SelectHandle > &holder, const TrackPanelMouseState &state, const AudacityProject *pProject, const std::shared_ptr< ChannelView > &pChannelView)
static UIHandlePtr HitAnywhere(std::weak_ptr< TimeShiftHandle > &holder, const std::shared_ptr< Track > &pTrack, bool gripHit)
static TrackControls & Get(Track &track)
Abstract base class for an object holding data associated with points on a time axis.
static UIHandlePtr HitTest(std::weak_ptr< ZoomHandle > &holder, const wxMouseState &state)
double PositionToTime(int64 position, int64 origin=0, bool ignoreFisheye=false) const
AUDACITY_DLL_API unsigned MinimumTrackHeight()