From Pokechu22: Rename gain to velocity on note tracks
"Velocity" is the technical term, and it's the term that's used everywhere. "Gain" was probably only used because "gain" is used on wave tracks; since note tracks aren't wave tracks (and shouldn't be treated as them) the corresponding variables should be named velocity.
This commit is contained in:
parent
c20a3526a6
commit
80984c9f1d
|
@ -3790,7 +3790,7 @@ void AudioIO::OutputEvent()
|
|||
data1 = mNextEvent->get_pitch();
|
||||
if (mNextIsNoteOn) {
|
||||
data2 = mNextEvent->get_loud(); // get velocity
|
||||
int offset = mNextEventTrack->GetGain();
|
||||
int offset = mNextEventTrack->GetVelocity();
|
||||
data2 += offset; // offset comes from per-track slider
|
||||
// clip velocity to insure a legal note-on value
|
||||
data2 = (data2 < 0 ? 1 : (data2 > 127 ? 127 : data2));
|
||||
|
|
|
@ -395,7 +395,7 @@ void MixerTrackCluster::HandleSliderGain(const bool bWantPushState /*= false*/)
|
|||
mLeftTrack->SetGain(fValue);
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
else
|
||||
mNoteTrack->SetGain(fValue);
|
||||
mNoteTrack->SetVelocity(fValue);
|
||||
#endif
|
||||
if (mRightTrack)
|
||||
mRightTrack->SetGain(fValue);
|
||||
|
@ -512,7 +512,7 @@ void MixerTrackCluster::UpdateGain()
|
|||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
if (mNoteTrack) {
|
||||
mSlider_Gain->SetStyle(VEL_SLIDER);
|
||||
mSlider_Gain->Set(mNoteTrack->GetGain());
|
||||
mSlider_Gain->Set(mNoteTrack->GetVelocity());
|
||||
return;
|
||||
}
|
||||
mSlider_Gain->SetStyle(DB_SLIDER);
|
||||
|
|
|
@ -113,7 +113,7 @@ Track(projDirManager)
|
|||
mSerializationLength = 0;
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
mGain = 0;
|
||||
mVelocity = 0;
|
||||
#endif
|
||||
mBottomNote = 24;
|
||||
mPitchHeight = 5;
|
||||
|
@ -160,7 +160,7 @@ Track::Holder NoteTrack::Duplicate() const
|
|||
duplicate->mVisibleChannels = mVisibleChannels;
|
||||
duplicate->SetOffset(GetOffset());
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
duplicate->SetGain(GetGain());
|
||||
duplicate->SetVelocity(GetVelocity());
|
||||
#endif
|
||||
// This std::move is needed to "upcast" the pointer type
|
||||
return std::move(duplicate);
|
||||
|
@ -782,7 +782,7 @@ bool NoteTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||
else if (!wxStrcmp(attr, wxT("velocity")) &&
|
||||
XMLValueChecker::IsGoodString(strValue) &&
|
||||
Internat::CompatibleToDouble(strValue, &dblValue))
|
||||
mGain = (float) dblValue;
|
||||
mVelocity = (float) dblValue;
|
||||
#endif
|
||||
else if (!wxStrcmp(attr, wxT("bottomnote")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
|
@ -838,7 +838,7 @@ void NoteTrack::WriteXML(XMLWriter &xmlFile) const
|
|||
xmlFile.WriteAttr(wxT("isSelected"), this->GetSelected());
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
xmlFile.WriteAttr(wxT("velocity"), (double) saveme->mGain);
|
||||
xmlFile.WriteAttr(wxT("velocity"), (double) saveme->mVelocity);
|
||||
#endif
|
||||
xmlFile.WriteAttr(wxT("bottomnote"), saveme->mBottomNote);
|
||||
xmlFile.WriteAttr(wxT("data"), wxString(data.str().c_str(), wxConvUTF8));
|
||||
|
|
|
@ -98,8 +98,8 @@ class AUDACITY_DLL_API NoteTrack final : public Track {
|
|||
bool Shift(double t) /* not override */;
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
float GetGain() const { return mGain; }
|
||||
void SetGain(float gain) { mGain = gain; }
|
||||
float GetVelocity() const { return mVelocity; }
|
||||
void SetVelocity(float velocity) { mVelocity = velocity; }
|
||||
#endif
|
||||
|
||||
double NearestBeatTime(double time, double *beat) const;
|
||||
|
@ -202,7 +202,7 @@ class AUDACITY_DLL_API NoteTrack final : public Track {
|
|||
long mSerializationLength;
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
float mGain; // velocity offset
|
||||
float mVelocity; // velocity offset
|
||||
#endif
|
||||
|
||||
// mBottom is the Y offset of pitch 0 (normally off screen)
|
||||
|
|
|
@ -4963,7 +4963,7 @@ void TrackPanel::HandleSliders(wxMouseEvent &event, bool pan)
|
|||
// mCapturedTrack is not wave...
|
||||
if (!pan) {
|
||||
// .. so assume it is note
|
||||
static_cast<NoteTrack*>(mCapturedTrack)->SetGain(newValue);
|
||||
static_cast<NoteTrack*>(mCapturedTrack)->SetVelocity(newValue);
|
||||
#ifdef EXPERIMENTAL_MIXER_BOARD
|
||||
if (pMixerBoard)
|
||||
// probably should modify UpdateGain to take a track that is
|
||||
|
@ -9377,7 +9377,7 @@ void TrackInfo::DrawVelocitySlider(wxDC *dc, NoteTrack *t, wxRect rect) const
|
|||
auto &gain = mGain; // mGains[index];
|
||||
gain->SetStyle(VEL_SLIDER);
|
||||
GainSlider(index)->Move(wxPoint(gainRect.x, gainRect.y));
|
||||
GainSlider(index)->Set(t->GetGain());
|
||||
GainSlider(index)->Set(t->GetVelocity());
|
||||
GainSlider(index)->OnPaint(*dc
|
||||
// , t->GetSelected()
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue