1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 14:02:57 +02:00

Extensive changes to improve NoteTrack display and (some) editing, NoteTrack playback via MIDI, and Midi-to-Audio alignment.

This commit is contained in:
rbdannenberg
2010-09-18 21:02:36 +00:00
parent f6327602e8
commit a1f0e5ed5b
96 changed files with 5679 additions and 3566 deletions

View File

@@ -360,6 +360,58 @@ LWSlider::LWSlider(wxWindow * parent,
stepValue, canUseShift, style, heavyweight, popup, 1.0, orientation);
}
void LWSlider::SetStyle(int style)
{
mStyle = style;
mSpeed = 1.0;
switch(style)
{
case PAN_SLIDER:
mMinValue = -1.0f;
mMaxValue = +1.0f;
mStepValue = 0.1f;
mOrientation = wxHORIZONTAL; //v Vertical PAN_SLIDER currently not handled, forced to horizontal.
mName = _("Pan");
break;
case DB_SLIDER:
mMinValue = DB_MIN;
if (mOrientation == wxHORIZONTAL)
mMaxValue = DB_MAX;
else
mMaxValue = DB_MAX; // for MixerBoard //vvv Previously was 6dB for MixerBoard, but identical for now.
mStepValue = 1.0f;
mSpeed = 0.5;
mName = _("Gain");
break;
case FRAC_SLIDER:
mMinValue = FRAC_MIN;
mMaxValue = FRAC_MAX;
mStepValue = STEP_CONTINUOUS;
break;
case SPEED_SLIDER:
mMinValue = SPEED_MIN;
mMaxValue = SPEED_MAX;
mStepValue = STEP_CONTINUOUS;
break;
#ifdef USE_MIDI
case VEL_SLIDER:
mMinValue = VEL_MIN;
mMaxValue = VEL_MAX;
mStepValue = 1.0f;
mSpeed = 0.5;
mName = _("Velocity");
break;
#endif
default:
mMinValue = FRAC_MIN;
mMaxValue = FRAC_MAX;
mStepValue = 0.0f;
wxASSERT(false); // undefined style
}
}
// Construct predefined slider
LWSlider::LWSlider(wxWindow *parent,
wxString name,
@@ -371,46 +423,13 @@ LWSlider::LWSlider(wxWindow *parent,
int orientation /* = wxHORIZONTAL */) // wxHORIZONTAL or wxVERTICAL. wxVERTICAL is currently only for DB_SLIDER.
{
wxString leftLabel, rightLabel;
float minValue, maxValue, stepValue;
float speed = 1.0;
mOrientation = orientation;
mName = name;
switch(style)
{
case PAN_SLIDER:
minValue = -1.0f;
maxValue = +1.0f;
stepValue = 0.1f;
orientation = wxHORIZONTAL; //v Vertical PAN_SLIDER currently not handled, forced to horizontal.
break;
case DB_SLIDER:
minValue = -36.0f;
if (orientation == wxHORIZONTAL)
maxValue = 36.0f;
else
maxValue = 36.0f; // for MixerBoard //vvv Previously was 6dB for MixerBoard, but identical for now.
stepValue = 1.0f;
speed = 0.5;
break;
case FRAC_SLIDER:
minValue = 0.0f;
maxValue = 1.0f;
stepValue = STEP_CONTINUOUS;
break;
case SPEED_SLIDER:
minValue = 0.01f;
maxValue = 3.0f;
stepValue = STEP_CONTINUOUS;
break;
SetStyle(style);
default:
minValue = 0.0f;
maxValue = 1.0f;
stepValue = 0.0f;
wxASSERT(false); // undefined style
}
Init(parent, name, pos, size, minValue, maxValue, stepValue,
true, style, heavyweight, popup, speed, orientation);
Init(parent, mName, pos, size, mMinValue, mMaxValue, mStepValue,
true, style, heavyweight, popup, mSpeed, mOrientation);
}
void LWSlider::Init(wxWindow * parent,
@@ -520,7 +539,11 @@ void LWSlider::CreatePopWin()
wxString maxStr = mName + wxT(": 000000");
if (mStyle == PAN_SLIDER || mStyle == DB_SLIDER || mStyle == SPEED_SLIDER)
if (mStyle == PAN_SLIDER || mStyle == DB_SLIDER || mStyle == SPEED_SLIDER
#ifdef USE_MIDI
|| mStyle == VEL_SLIDER
#endif
)
maxStr += wxT("000");
mPopWin = new TipPanel(GetToolTipParent(), -1, maxStr, wxDefaultPosition);
@@ -886,6 +909,12 @@ void LWSlider::FormatPopWin()
case SPEED_SLIDER:
label.Printf(wxT("%s: %.2fx"), mName.c_str(), mCurrentValue);
break;
#ifdef USE_MIDI
case VEL_SLIDER:
label.Printf(wxT("%s: %s%d"), mName.c_str(),
(mCurrentValue > 0.0f ? _("+") : _("")),
(int) mCurrentValue);
#endif
}
((TipPanel *)mPopWin)->label = label;
@@ -1506,6 +1535,14 @@ void ASlider::Set(float value)
mLWSlider->Set(value);
}
#ifdef USE_MIDI
void ASlider::SetStyle(int style)
{
mStyle = style;
mLWSlider->SetStyle(style);
}
#endif
void ASlider::Increase(float steps)
{
mLWSlider->Increase(steps);
@@ -1740,6 +1777,12 @@ wxAccStatus ASliderAx::GetValue(int childId, wxString* strValue)
case SPEED_SLIDER:
strValue->Printf( wxT("%.0f"), as->mLWSlider->mCurrentValue * 100 );
break;
#ifdef USE_MIDI
case VEL_SLIDER:
strValue->Printf( wxT("%.0f"), as->mLWSlider->mCurrentValue);
break;
#endif
}
return wxACC_OK;

View File

@@ -39,6 +39,18 @@ class Ruler;
#define DB_SLIDER 2 // -36...36 dB
#define PAN_SLIDER 3 // -1.0...1.0
#define SPEED_SLIDER 4 // 0.01 ..3.0
#ifdef USE_MIDI
#define VEL_SLIDER 5 // -50..50
#endif
#define DB_MIN -36.0f
#define DB_MAX 36.0f
#define FRAC_MIN 0.0f
#define FRAC_MAX 1.0f
#define SPEED_MIN 0.01f
#define SPEED_MAX 3.0f
#define VEL_MIN -50.0f
#define VEL_MAX 50.0f
// Customizable slider only: If stepValue is STEP_CONTINUOUS,
// every value on the slider between minValue and maxValue
@@ -111,7 +123,7 @@ class LWSlider
float Get(bool convert = true);
void Set(float value);
void SetStyle(int style);
void Increase(float steps);
void Decrease(float steps);
@@ -245,6 +257,9 @@ class ASlider :public wxPanel
float Get( bool convert = true );
void Set(float value);
#ifdef USE_MIDI
void SetStyle(int style);
#endif
void Increase(float steps);
void Decrease(float steps);