18#include "../ui/SelectHandle.h"
20#include "../../ProjectSettings.h"
22#include "../../TrackArtist.h"
23#include "../../TrackPanelDrawingContext.h"
24#include "../../TrackPanelMouseEvent.h"
27#include <wx/graphics.h>
35 std::vector<UIHandlePtr> results;
37 const auto currentTool =
settings.GetTool();
38 const bool isMultiTool = ( currentTool ==
multiTool );
48 if ( !isMultiTool && currentTool == slideTool ) {
52 results.push_back(result);
62 results.push_back(result);
66 if ( isMultiTool || currentTool ==
selectTool ) {
70 results.push_back(result);
86 auto nChannels = channels.size();
87 auto begin = channels.begin();
89 std::distance(
begin, std::find(
begin, channels.end(), pTrack.get()));
90 return (height * (index + 1) / nChannels) - (height * index / nChannels);
96 double alignedTime,
double sampleDur,
97 double *buffer,
int bufferLen,
int leftOffset,
103 double prevDiscreteTime=0.0, prevSampleVal=0.0, nextSampleVal=0.0;
104 for (
int xx = 0; xx < bufferLen; ++xx ) {
106 if ( sampleDur <= 0 )
115 auto leftDiscreteTime = alignedTime +
116 sampleDur * floor( ( time - alignedTime ) / sampleDur );
117 if ( xx == 0 || leftDiscreteTime != prevDiscreteTime ) {
118 prevDiscreteTime = leftDiscreteTime;
120 env.
GetValue( prevDiscreteTime, sampleDur );
122 env.
GetValue( prevDiscreteTime + sampleDur, sampleDur );
124 auto ratio = ( time - leftDiscreteTime ) / sampleDur;
127 ( 1.0 - ratio ) * log( prevSampleVal )
128 + ratio * log( nextSampleVal ) );
131 ( 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
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 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)
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
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()
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.