Ejemplo n.º 1
0
void EffectChangePitch::PopulateOrExchange(ShuttleGui & S)
{
   DeduceFrequencies(); // Set frequency-related control values based on sample.

   wxArrayString pitch;
   pitch.Add(wxT("C"));
   pitch.Add(wxT("C#/Db"));
   pitch.Add(wxT("D"));
   pitch.Add(wxT("D#/Eb"));
   pitch.Add(wxT("E"));
   pitch.Add(wxT("F"));
   pitch.Add(wxT("F#/Gb"));
   pitch.Add(wxT("G"));
   pitch.Add(wxT("G#/Ab"));
   pitch.Add(wxT("A"));
   pitch.Add(wxT("A#/Bb"));
   pitch.Add(wxT("B"));

   S.SetBorder(5);

   S.StartVerticalLay(0);
   {
      S.StartVerticalLay();
      {
         S.AddTitle(_("Change Pitch without Changing Tempo"));
         S.AddTitle(
            wxString::Format(_("Estimated Start Pitch: %s%d (%.3f Hz)"),
                              pitch[m_nFromPitch].c_str(), m_nFromOctave, m_FromFrequency));
      }
      S.EndVerticalLay();

      /* i18n-hint: (noun) Musical pitch.*/
      S.StartStatic(_("Pitch"));
      {
         S.StartMultiColumn(6, wxALIGN_CENTER); // 6 controls, because each AddChoice adds a wxStaticText and a wxChoice.
         {
            m_pChoice_FromPitch = S.Id(ID_FromPitch).AddChoice(_("from"), wxT(""), &pitch);
            m_pChoice_FromPitch->SetName(_("from"));
            m_pChoice_FromPitch->SetSizeHints(80, -1);

            m_pSpin_FromOctave = S.Id(ID_FromOctave).AddSpinCtrl(wxT(""), m_nFromOctave, INT_MAX, INT_MIN);
            m_pSpin_FromOctave->SetName(_("from Octave"));
            m_pSpin_FromOctave->SetSizeHints(50, -1);

            m_pChoice_ToPitch = S.Id(ID_ToPitch).AddChoice(_("to"), wxT(""), &pitch);
            m_pChoice_ToPitch->SetName(_("to"));
            m_pChoice_ToPitch->SetSizeHints(80, -1);

            m_pSpin_ToOctave =
               S.Id(ID_ToOctave).AddSpinCtrl(wxT(""), m_nToOctave, INT_MAX, INT_MIN);
            m_pSpin_ToOctave->SetName(_("to Octave"));
            m_pSpin_ToOctave->SetSizeHints(50, -1);
         }
         S.EndMultiColumn();

         S.StartHorizontalLay(wxALIGN_CENTER);
         {
            FloatingPointValidator<double> vldSemitones(2, &m_dSemitonesChange, NUM_VAL_TWO_TRAILING_ZEROES);
            m_pTextCtrl_SemitonesChange =
               S.Id(ID_SemitonesChange).AddTextBox(_("Semitones (half-steps):"), wxT(""), 12);
            m_pTextCtrl_SemitonesChange->SetName(_("Semitones (half-steps)"));
            m_pTextCtrl_SemitonesChange->SetValidator(vldSemitones);
         }
         S.EndHorizontalLay();
      }
      S.EndStatic();

      S.StartStatic(_("Frequency"));
      {
         S.StartMultiColumn(5, wxALIGN_CENTER); // 5, because AddTextBox adds a wxStaticText and a wxTextCtrl.
         {
            FloatingPointValidator<double> vldFromFrequency(3, &m_FromFrequency, NUM_VAL_THREE_TRAILING_ZEROES);
            vldFromFrequency.SetMin(0.0);
            m_pTextCtrl_FromFrequency = S.Id(ID_FromFrequency).AddTextBox(_("from"), wxT(""), 12);
            m_pTextCtrl_FromFrequency->SetName(_("from (Hz)"));
            m_pTextCtrl_FromFrequency->SetValidator(vldFromFrequency);

            FloatingPointValidator<double> vldToFrequency(3, &m_ToFrequency, NUM_VAL_THREE_TRAILING_ZEROES);
            vldToFrequency.SetMin(0.0);
            m_pTextCtrl_ToFrequency = S.Id(ID_ToFrequency).AddTextBox(_("to"), wxT(""), 12);
            m_pTextCtrl_ToFrequency->SetName(_("to (Hz)"));
            m_pTextCtrl_ToFrequency->SetValidator(vldToFrequency);

            S.AddUnits(_("Hz"));
         }
         S.EndMultiColumn();

         S.StartHorizontalLay(wxALIGN_CENTER);
         {
            FloatingPointValidator<double> vldPercentage(3, &m_dPercentChange, NUM_VAL_THREE_TRAILING_ZEROES);
            vldPercentage.SetRange(MIN_Percentage, MAX_Percentage);
            m_pTextCtrl_PercentChange = S.Id(ID_PercentChange).AddTextBox(_("Percent Change:"), wxT(""), 12);
            m_pTextCtrl_PercentChange->SetValidator(vldPercentage);
         }
         S.EndHorizontalLay();

         S.StartHorizontalLay(wxEXPAND);
         {
            S.SetStyle(wxSL_HORIZONTAL);
            m_pSlider_PercentChange = S.Id(ID_PercentChange)
               .AddSlider(wxT(""), 0, (int)kSliderMax, (int)MIN_Percentage);
            m_pSlider_PercentChange->SetName(_("Percent Change"));
         }
         S.EndHorizontalLay();
      }
      S.EndStatic();
   }
   S.EndVerticalLay();

   return;
}
Ejemplo n.º 2
0
void EffectChangePitch::PopulateOrExchange(ShuttleGui & S)
{
   DeduceFrequencies(); // Set frequency-related control values based on sample.

   wxArrayString pitch;
   for (int ii = 0; ii < 12; ++ii)
      pitch.Add( PitchName( ii, PitchNameChoice::Both ) );

   S.SetBorder(5);

   S.StartVerticalLay(0);
   {
      S.StartVerticalLay();
      {
         S.AddTitle(_("Change Pitch without Changing Tempo"));
         S.AddTitle(
            wxString::Format(_("Estimated Start Pitch: %s%d (%.3f Hz)"),
                              pitch[m_nFromPitch], m_nFromOctave, m_FromFrequency));
      }
      S.EndVerticalLay();

      /* i18n-hint: (noun) Musical pitch.*/
      S.StartStatic(_("Pitch"));
      {
         S.StartMultiColumn(6, wxALIGN_CENTER); // 6 controls, because each AddChoice adds a wxStaticText and a wxChoice.
         {
            m_pChoice_FromPitch = S.Id(ID_FromPitch).AddChoice(_("from"), wxT(""), &pitch);
            m_pChoice_FromPitch->SetName(_("from"));
            m_pChoice_FromPitch->SetSizeHints(80, -1);

            m_pSpin_FromOctave = S.Id(ID_FromOctave).AddSpinCtrl( {}, m_nFromOctave, INT_MAX, INT_MIN);
            m_pSpin_FromOctave->SetName(_("from Octave"));
            m_pSpin_FromOctave->SetSizeHints(50, -1);

            m_pChoice_ToPitch = S.Id(ID_ToPitch).AddChoice(_("to"), wxT(""), &pitch);
            m_pChoice_ToPitch->SetName(_("to"));
            m_pChoice_ToPitch->SetSizeHints(80, -1);

            m_pSpin_ToOctave =
               S.Id(ID_ToOctave).AddSpinCtrl( {}, m_nToOctave, INT_MAX, INT_MIN);
            m_pSpin_ToOctave->SetName(_("to Octave"));
            m_pSpin_ToOctave->SetSizeHints(50, -1);
         }
         S.EndMultiColumn();

         S.StartHorizontalLay(wxALIGN_CENTER);
         {
            FloatingPointValidator<double> vldSemitones(2, &m_dSemitonesChange, NumValidatorStyle::TWO_TRAILING_ZEROES);
            m_pTextCtrl_SemitonesChange =
               S.Id(ID_SemitonesChange).AddTextBox(_("Semitones (half-steps):"), wxT(""), 12);
            m_pTextCtrl_SemitonesChange->SetName(_("Semitones (half-steps)"));
            m_pTextCtrl_SemitonesChange->SetValidator(vldSemitones);
         }
         S.EndHorizontalLay();
      }
      S.EndStatic();

      S.StartStatic(_("Frequency"));
      {
         S.StartMultiColumn(5, wxALIGN_CENTER); // 5, because AddTextBox adds a wxStaticText and a wxTextCtrl.
         {
            FloatingPointValidator<double> vldFromFrequency(3, &m_FromFrequency, NumValidatorStyle::THREE_TRAILING_ZEROES);
            vldFromFrequency.SetMin(0.0);
            m_pTextCtrl_FromFrequency = S.Id(ID_FromFrequency).AddTextBox(_("from"), wxT(""), 12);
            m_pTextCtrl_FromFrequency->SetName(_("from (Hz)"));
            m_pTextCtrl_FromFrequency->SetValidator(vldFromFrequency);

            FloatingPointValidator<double> vldToFrequency(3, &m_ToFrequency, NumValidatorStyle::THREE_TRAILING_ZEROES);
            vldToFrequency.SetMin(0.0);
            m_pTextCtrl_ToFrequency = S.Id(ID_ToFrequency).AddTextBox(_("to"), wxT(""), 12);
            m_pTextCtrl_ToFrequency->SetName(_("to (Hz)"));
            m_pTextCtrl_ToFrequency->SetValidator(vldToFrequency);

            S.AddUnits(_("Hz"));
         }
         S.EndMultiColumn();

         S.StartHorizontalLay(wxALIGN_CENTER);
         {
            FloatingPointValidator<double> vldPercentage(3, &m_dPercentChange, NumValidatorStyle::THREE_TRAILING_ZEROES);
            vldPercentage.SetRange(MIN_Percentage, MAX_Percentage);
            m_pTextCtrl_PercentChange = S.Id(ID_PercentChange).AddTextBox(_("Percent Change:"), wxT(""), 12);
            m_pTextCtrl_PercentChange->SetValidator(vldPercentage);
         }
         S.EndHorizontalLay();

         S.StartHorizontalLay(wxEXPAND);
         {
            S.SetStyle(wxSL_HORIZONTAL);
            m_pSlider_PercentChange = S.Id(ID_PercentChange)
               .AddSlider( {}, 0, (int)kSliderMax, (int)MIN_Percentage);
            m_pSlider_PercentChange->SetName(_("Percent Change"));
         }
         S.EndHorizontalLay();
      }
      S.EndStatic();

#if USE_SBSMS
      S.StartMultiColumn(2);
      {
         mUseSBSMSCheckBox = S.AddCheckBox(_("Use high quality stretching (slow)"),
                                             mUseSBSMS? wxT("true") : wxT("false"));
         mUseSBSMSCheckBox->SetValidator(wxGenericValidator(&mUseSBSMS));
      }
      S.EndMultiColumn();
#endif

   }
   S.EndVerticalLay();

   return;
}
Ejemplo n.º 3
0
void EffectChangeSpeed::PopulateOrExchange(ShuttleGui & S)
{
   GetPrivateConfig(GetCurrentSettingsGroup(), wxT("TimeFormat"), mFormat, mFormat);
   GetPrivateConfig(GetCurrentSettingsGroup(), wxT("VinylChoice"), mFromVinyl, mFromVinyl);

   S.SetBorder(5);

   S.StartVerticalLay(0);
   {
      S.AddSpace(0, 5);
      S.AddTitle(_("Change Speed, affecting both Tempo and Pitch"));
      S.AddSpace(0, 10);

      // Speed multiplier and percent change controls.
      S.StartMultiColumn(4, wxCENTER);
      {
         FloatingPointValidator<double> vldMultiplier(3, &mMultiplier, NUM_VAL_THREE_TRAILING_ZEROES);
         vldMultiplier.SetRange(MIN_Percentage / 100.0, ((MAX_Percentage / 100.0) + 1));
         mpTextCtrl_Multiplier =
            S.Id(ID_Multiplier).AddTextBox(_("Speed Multiplier:"), wxT(""), 12);
         mpTextCtrl_Multiplier->SetValidator(vldMultiplier);

         FloatingPointValidator<double> vldPercentage(3, &m_PercentChange, NUM_VAL_THREE_TRAILING_ZEROES);
         vldPercentage.SetRange(MIN_Percentage, MAX_Percentage);
         mpTextCtrl_PercentChange =
            S.Id(ID_PercentChange).AddTextBox(_("Percent Change:"), wxT(""), 12);
         mpTextCtrl_PercentChange->SetValidator(vldPercentage);
      }
      S.EndMultiColumn();

      // Percent change slider.
      S.StartHorizontalLay(wxEXPAND);
      {
         S.SetStyle(wxSL_HORIZONTAL);
         mpSlider_PercentChange =
            S.Id(ID_PercentChange).AddSlider(wxT(""), 0, (int)kSliderMax, (int)MIN_Percentage);
         mpSlider_PercentChange->SetName(_("Percent Change"));
      }
      S.EndHorizontalLay();

      // Vinyl rpm controls.
      S.StartMultiColumn(5, wxCENTER);
      {
         /* i18n-hint: "rpm" is an English abbreviation meaning "revolutions per minute". */
         S.AddUnits(_("Standard Vinyl rpm:"));

         wxASSERT(kNumVinyl == WXSIZEOF(kVinylStrings));

         wxArrayString vinylChoices;
         for (int i = 0; i < kNumVinyl; i++)
         {
            if (i == kVinyl_NA)
            {
               vinylChoices.Add(wxGetTranslation(kVinylStrings[i]));
            }
            else
            {
               vinylChoices.Add(kVinylStrings[i]);
            }
         }

         mpChoice_FromVinyl =
            S.Id(ID_FromVinyl).AddChoice(_("from"), wxT(""), &vinylChoices);
         mpChoice_FromVinyl->SetName(_("From rpm"));
         mpChoice_FromVinyl->SetSizeHints(100, -1);

         mpChoice_ToVinyl =
            S.Id(ID_ToVinyl).AddChoice(_("to"), wxT(""), &vinylChoices);
         mpChoice_ToVinyl->SetName(_("To rpm"));
         mpChoice_ToVinyl->SetSizeHints(100, -1);
      }
      S.EndMultiColumn();

      // From/To time controls.
      S.StartStatic(_("Selection Length"), 0);
      {
         S.StartMultiColumn(2, wxALIGN_LEFT);
         {
            S.AddPrompt(_("Current Length:"));

            mpFromLengthCtrl = safenew
                  NumericTextCtrl(NumericConverter::TIME,
                                 S.GetParent(),
                                 wxID_ANY,
                                 mFormat,
                                 mFromLength,
                                 mProjectRate);

            mpFromLengthCtrl->SetName(_("from"));
            mpFromLengthCtrl->SetToolTip(_("Current length of selection."));
            mpFromLengthCtrl->SetReadOnly(true);
            mpFromLengthCtrl->EnableMenu(false);
            S.AddWindow(mpFromLengthCtrl, wxALIGN_LEFT);

            S.AddPrompt(_("New Length:"));

            mpToLengthCtrl = safenew
                  NumericTextCtrl(NumericConverter::TIME,
                                 S.GetParent(),
                                 ID_ToLength,
                                 mFormat,
                                 mToLength,
                                 mProjectRate);

            mpToLengthCtrl->SetName(_("to"));
            mpToLengthCtrl->EnableMenu();
            S.AddWindow(mpToLengthCtrl, wxALIGN_LEFT);
         }
         S.EndMultiColumn();
      }
      S.EndStatic();
   }
   S.EndVerticalLay();
}
Ejemplo n.º 4
0
void EffectChangeTempo::PopulateOrExchange(ShuttleGui & S)
{
   S.StartVerticalLay(0);
   {
      S.AddSpace(0, 5);
      S.AddTitle(_("Change Tempo without Changing Pitch"));
      S.SetBorder(5);

      //
      S.StartMultiColumn(2, wxCENTER);
      {
         FloatingPointValidator<double> vldPercentage(3, &m_PercentChange, NUM_VAL_THREE_TRAILING_ZEROES);
         vldPercentage.SetRange(MIN_Percentage, MAX_Percentage);
         m_pTextCtrl_PercentChange = S.Id(ID_PercentChange)
            .AddTextBox(_("Percent Change:"), wxT(""), 12);
         m_pTextCtrl_PercentChange->SetValidator(vldPercentage);
      }
      S.EndMultiColumn();

      //
      S.StartHorizontalLay(wxEXPAND);
      {
         S.SetStyle(wxSL_HORIZONTAL);
         m_pSlider_PercentChange = S.Id(ID_PercentChange)
            .AddSlider(wxT(""), 0, (int)kSliderMax, (int)MIN_Percentage);
         m_pSlider_PercentChange->SetName(_("Percent Change"));
      }
      S.EndHorizontalLay();

      //
      S.StartMultiColumn(5, wxCENTER);
      {
         //
         S.AddUnits(_("Beats per minute:"));

         FloatingPointValidator<double> vldFromBPM(3, &m_FromBPM, NUM_VAL_THREE_TRAILING_ZEROES | NUM_VAL_ZERO_AS_BLANK);
         m_pTextCtrl_FromBPM = S.Id(ID_FromBPM)
            .AddTextBox(_("from"), wxT(""), 12);
         m_pTextCtrl_FromBPM->SetName(_("From beats per minute"));
         m_pTextCtrl_FromBPM->SetValidator(vldFromBPM);

         FloatingPointValidator<double> vldToBPM(3, &m_ToBPM, NUM_VAL_THREE_TRAILING_ZEROES | NUM_VAL_ZERO_AS_BLANK);
         m_pTextCtrl_ToBPM = S.Id(ID_ToBPM)
            .AddTextBox(_("to"), wxT(""), 12);
         m_pTextCtrl_ToBPM->SetName(_("To beats per minute"));
         m_pTextCtrl_ToBPM->SetValidator(vldToBPM);

         //
         S.AddUnits(_("Length (seconds):"));

         int precission = 2;
         FloatingPointValidator<double> vldFromLength(precission, &m_FromLength, NUM_VAL_TWO_TRAILING_ZEROES);
         m_pTextCtrl_FromLength = S.Id(ID_FromLength)
            .AddTextBox(_("from"), wxT(""), 12);
         m_pTextCtrl_FromLength->SetName(_("From length in seconds"));
         m_pTextCtrl_FromLength->SetValidator(vldFromLength);
         m_pTextCtrl_FromLength->Enable(false); // Disable because the value comes from the user selection.

         FloatingPointValidator<double> vldToLength(2, &m_ToLength, NUM_VAL_TWO_TRAILING_ZEROES);

         // min and max need same precision as what we're validating (bug 963)
         double minLength = (m_FromLength * 100.0) / (100.0 + MAX_Percentage);
         double maxLength = (m_FromLength * 100.0) / (100.0 + MIN_Percentage);
         minLength = Internat::CompatibleToDouble(Internat::ToString(minLength, precission));
         maxLength = Internat::CompatibleToDouble(Internat::ToString(maxLength, precission));

         vldToLength.SetRange(minLength, maxLength);
         m_pTextCtrl_ToLength = S.Id(ID_ToLength)
            .AddTextBox(_("to"), wxT(""), 12);
         m_pTextCtrl_ToLength->SetName(_("To length in seconds"));
         m_pTextCtrl_ToLength->SetValidator(vldToLength);
      }
      S.EndMultiColumn();
   }
   S.EndVerticalLay();

   return;
}