mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-09 17:07:43 +02:00
Changing NoteTrack height, keep # of piano keys (roughly) constant...
This fix is imperfect, but quick and easy
This commit is contained in:
parent
c45adf6fc1
commit
8279adc797
@ -210,6 +210,18 @@ double NoteTrack::GetEndTime() const
|
|||||||
return GetStartTime() + GetSeq().get_real_dur();
|
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,
|
void NoteTrack::WarpAndTransposeNotes(double t0, double t1,
|
||||||
const TimeWarper &warper,
|
const TimeWarper &warper,
|
||||||
|
@ -84,6 +84,8 @@ class AUDACITY_DLL_API NoteTrack final
|
|||||||
double GetStartTime() const override;
|
double GetStartTime() const override;
|
||||||
double GetEndTime() const override;
|
double GetEndTime() const override;
|
||||||
|
|
||||||
|
void SetHeight(int h) override;
|
||||||
|
|
||||||
Alg_seq &GetSeq() const;
|
Alg_seq &GetSeq() const;
|
||||||
|
|
||||||
void WarpAndTransposeNotes(double t0, double t1,
|
void WarpAndTransposeNotes(double t0, double t1,
|
||||||
|
@ -184,7 +184,7 @@ class AUDACITY_DLL_API Track /* not final */
|
|||||||
int GetY() const;
|
int GetY() const;
|
||||||
void SetY(int y);
|
void SetY(int y);
|
||||||
int GetHeight() const;
|
int GetHeight() const;
|
||||||
void SetHeight(int h);
|
virtual void SetHeight(int h);
|
||||||
#endif
|
#endif
|
||||||
bool GetMinimized() const;
|
bool GetMinimized() const;
|
||||||
void SetMinimized(bool isMinimized);
|
void SetMinimized(bool isMinimized);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user