1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 00:29:41 +02:00

Changing NoteTrack height, keep # of piano keys (roughly) constant...

This fix is imperfect, but quick and easy
This commit is contained in:
Paul Licameli 2017-07-19 14:44:42 -04:00
parent c45adf6fc1
commit 8279adc797
3 changed files with 15 additions and 1 deletions

View File

@ -210,6 +210,18 @@ double NoteTrack::GetEndTime() const
return GetStartTime() + GetSeq().get_real_dur();
}
void NoteTrack::SetHeight(int h)
{
auto oldHeight = GetHeight();
Track::SetHeight(h);
Zoom(
wxRect{ 0, 0, 1, h }, // only height matters
h - 1, // preserve bottom note
(float)h / std::max(1, oldHeight),
false
);
}
void NoteTrack::WarpAndTransposeNotes(double t0, double t1,
const TimeWarper &warper,

View File

@ -84,6 +84,8 @@ class AUDACITY_DLL_API NoteTrack final
double GetStartTime() const override;
double GetEndTime() const override;
void SetHeight(int h) override;
Alg_seq &GetSeq() const;
void WarpAndTransposeNotes(double t0, double t1,

View File

@ -184,7 +184,7 @@ class AUDACITY_DLL_API Track /* not final */
int GetY() const;
void SetY(int y);
int GetHeight() const;
void SetHeight(int h);
virtual void SetHeight(int h);
#endif
bool GetMinimized() const;
void SetMinimized(bool isMinimized);