mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-11 15:16:27 +01:00
Fix for bug #949
This removes the TrackInfo's slider "cache". Originally, the cache would build to the maximum number of tracks you had created in an Audacity session. So, if you created 128 tracks and then reduced that to 1, you'd still have 256 sliders, 1 gain and 1 pan per track. But, the only real thing the cache did was prevent continuous allocations of sliders since the allocated sliders position and values wer still being updated nearly with ever interaction since they were redrawn each time. In April 2010, the slider cache was changed to reduce its size by creating a sort of ring buffer based on how many tracks were displayed and how many tracks were in the project (I guess). Unfortunately, it didn't really handle large number of tracks and this bug was born. While trying to find the proper fix for this, I realized that the cache really wasn't saving anything. Maybe a little when dragging the thumb, but during normal track redraws and interaction, it really didn't serve a purpose, other than use additional memory. So, I've removed the cache and have allocated a single gain and a single pan slider. As before, their position and value are changed as needed when drawn and manipulated.
This commit is contained in:
61
src/TrackPanel.h
Normal file → Executable file
61
src/TrackPanel.h
Normal file → Executable file
@@ -62,19 +62,6 @@ WX_DECLARE_OBJARRAY(TrackClip, TrackClipArray);
|
||||
// Declared elsewhere, to reduce compilation dependencies
|
||||
class TrackPanelListener;
|
||||
|
||||
//
|
||||
// TrackInfo sliders: we keep a pool of sliders, and attach them to tracks as
|
||||
// they come on screen (this helps deal with very large numbers of tracks, esp.
|
||||
// on MSW).
|
||||
//
|
||||
// With the initial set of sliders smaller than the page size, a new slider is
|
||||
// created at track-creation time for tracks between 16 and when 80 goes past
|
||||
// the top of the screen. After that, existing sliders are re-used for new
|
||||
// tracks.
|
||||
//
|
||||
const unsigned int kInitialSliders = 16;
|
||||
const unsigned int kSliderPageFlip = 80;
|
||||
|
||||
// JKC Nov 2011: Disabled warning C4251 which is to do with DLL linkage
|
||||
// and only a worry when there are DLLs using the structures.
|
||||
// LWSliderArray and TrackClipArray are private in TrackInfo, so we will not
|
||||
@@ -91,31 +78,26 @@ const unsigned int kSliderPageFlip = 80;
|
||||
class AUDACITY_DLL_API TrackInfo
|
||||
{
|
||||
public:
|
||||
TrackInfo(wxWindow * pParentIn);
|
||||
TrackInfo(TrackPanel * pParentIn);
|
||||
~TrackInfo();
|
||||
|
||||
int GetTrackInfoWidth() const;
|
||||
|
||||
void UpdateSliderOffset(Track *t);
|
||||
|
||||
private:
|
||||
void MakeMoreSliders();
|
||||
void EnsureSufficientSliders(int index);
|
||||
int GetTrackInfoWidth() const;
|
||||
void SetTrackInfoFont(wxDC *dc) const;
|
||||
|
||||
void SetTrackInfoFont(wxDC *dc);
|
||||
void DrawBackground(wxDC * dc, const wxRect & r, bool bSelected, bool bHasMuteSolo, const int labelw, const int vrul);
|
||||
void DrawBordersWithin(wxDC * dc, const wxRect & r, bool bHasMuteSolo );
|
||||
void DrawCloseBox(wxDC * dc, const wxRect & r, bool down);
|
||||
void DrawTitleBar(wxDC * dc, const wxRect & r, Track * t, bool down);
|
||||
void DrawMuteSolo(wxDC * dc, const wxRect & r, Track * t, bool down, bool solo, bool bHasSoloButton);
|
||||
void DrawVRuler(wxDC * dc, const wxRect & r, Track * t);
|
||||
void DrawBackground(wxDC * dc, const wxRect & r, bool bSelected, bool bHasMuteSolo, const int labelw, const int vrul) const;
|
||||
void DrawBordersWithin(wxDC * dc, const wxRect & r, bool bHasMuteSolo ) const;
|
||||
void DrawCloseBox(wxDC * dc, const wxRect & r, bool down) const;
|
||||
void DrawTitleBar(wxDC * dc, const wxRect & r, Track * t, bool down) const;
|
||||
void DrawMuteSolo(wxDC * dc, const wxRect & r, Track * t, bool down, bool solo, bool bHasSoloButton) const;
|
||||
void DrawVRuler(wxDC * dc, const wxRect & r, Track * t) const;
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
void DrawVelocitySlider(wxDC * dc, NoteTrack *t, wxRect r);
|
||||
void DrawVelocitySlider(wxDC * dc, NoteTrack *t, wxRect r) const ;
|
||||
#endif
|
||||
void DrawSliders(wxDC * dc, WaveTrack *t, wxRect r);
|
||||
void DrawSliders(wxDC * dc, WaveTrack *t, wxRect r) const;
|
||||
|
||||
// Draw the minimize button *and* the sync-lock track icon, if necessary.
|
||||
void DrawMinimize(wxDC * dc, const wxRect & r, Track * t, bool down);
|
||||
void DrawMinimize(wxDC * dc, const wxRect & r, Track * t, bool down) const;
|
||||
|
||||
void GetTrackControlsRect(const wxRect & r, wxRect &dest) const;
|
||||
void GetCloseBoxRect(const wxRect & r, wxRect &dest) const;
|
||||
@@ -126,21 +108,14 @@ private:
|
||||
void GetMinimizeRect(const wxRect & r, wxRect &dest) const;
|
||||
void GetSyncLockIconRect(const wxRect & r, wxRect &dest) const;
|
||||
|
||||
// These arrays are always kept the same size.
|
||||
LWSliderArray mGains;
|
||||
LWSliderArray mPans;
|
||||
LWSlider * GainSlider(WaveTrack *t) const;
|
||||
LWSlider * PanSlider(WaveTrack *t) const;
|
||||
|
||||
// index of track whose pan/gain sliders are at index 0 in the above arrays
|
||||
unsigned int mSliderOffset;
|
||||
|
||||
public:
|
||||
|
||||
// Slider access by track index
|
||||
LWSlider * GainSlider(int trackIndex);
|
||||
LWSlider * PanSlider(int trackIndex);
|
||||
|
||||
wxWindow * pParent;
|
||||
private:
|
||||
TrackPanel * pParent;
|
||||
wxFont mFont;
|
||||
LWSlider *mGain;
|
||||
LWSlider *mPan;
|
||||
|
||||
friend class TrackPanel;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user