~ubuntu-branches/ubuntu/gutsy/audacity/gutsy-backports

« back to all changes in this revision

Viewing changes to src/effects/ChangePitch.cpp

  • Committer: Bazaar Package Importer
  • Author(s): John Dong
  • Date: 2008-02-18 21:58:19 UTC
  • mfrom: (13.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080218215819-tmbcf1rx238r8gdv
Tags: 1.3.4-1.1ubuntu1~gutsy1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
#include "ChangePitch.h"
19
19
 
 
20
#include "../ShuttleGui.h"
20
21
#include "../PitchName.h"
21
22
#include "../Spectrum.h"
22
23
#include "../WaveTrack.h"
145
146
bool EffectChangePitch::TransferParameters( Shuttle & shuttle )
146
147
{  
147
148
   shuttle.TransferDouble(wxT("Percentage"),m_PercentChange,0.0);
 
149
   m_SemitonesChange = (12.0 * log((100.0 + m_PercentChange) / 100.0)) / log(2.0);
148
150
   return true;
149
151
}
150
152
 
171
173
   ID_CHOICE_TOPITCH,
172
174
   ID_TEXT_SEMITONESCHANGE,
173
175
   ID_TEXT_FROMFREQUENCY,
174
 
   ID_TEXT_TOFREQUENCY,
175
 
        ID_BUTTON_PREVIEW
 
176
   ID_TEXT_TOFREQUENCY
176
177
};
177
178
 
178
179
// event table for ChangePitchDialog
193
194
        EVT_TEXT(ID_TEXT_PERCENTCHANGE, ChangePitchDialog::OnText_PercentChange)
194
195
        EVT_SLIDER(ID_SLIDER_PERCENTCHANGE, ChangePitchDialog::OnSlider_PercentChange)
195
196
 
196
 
        EVT_BUTTON(ID_BUTTON_PREVIEW, ChangePitchDialog::OnPreview)
 
197
        EVT_BUTTON(ID_EFFECT_PREVIEW, ChangePitchDialog::OnPreview)
197
198
END_EVENT_TABLE()
198
199
 
199
200
 
248
249
   pBoxSizer_Dialog->Add(pStaticText, 0, wxALIGN_CENTER | wxALL, 8);
249
250
 
250
251
   pStaticText = new wxStaticText(this, -1, 
 
252
         /* i18n-hint: && in here is an escape character to get a single & on
 
253
          * screen, so keep it as is */
251
254
                                                                                                _("by Vaughan Johnson && Dominic Mazzoni"),
252
255
                                                                                                wxDefaultPosition, wxDefaultSize, 0);
253
256
   pBoxSizer_Dialog->Add(pStaticText, 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 8);
273
276
       wxT("F#/Gb"), wxT("G"), wxT("G#/Ab"), wxT("A"), wxT("A#/Bb"), wxT("B")};
274
277
        const int numChoicesPitchNames = 12;
275
278
   m_pChoice_FromPitch = 
276
 
                new wxChoice(this, ID_CHOICE_FROMPITCH, wxDefaultPosition, wxSize(64, -1), 
 
279
                new wxChoice(this, ID_CHOICE_FROMPITCH, wxDefaultPosition, wxDefaultSize, 
277
280
                                                        numChoicesPitchNames, strArray_PitchNames);
278
281
   pBoxSizer_Pitch->Add(m_pChoice_FromPitch, 0, 
279
282
                                                                wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, 4);
290
293
                                                                wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 4);
291
294
 
292
295
   m_pChoice_ToPitch = 
293
 
                new wxChoice(this, ID_CHOICE_TOPITCH, wxDefaultPosition, wxSize(64, -1), 
 
296
                new wxChoice(this, ID_CHOICE_TOPITCH, wxDefaultPosition, wxDefaultSize, 
294
297
                                                        numChoicesPitchNames, strArray_PitchNames);
295
298
   pBoxSizer_Pitch->Add(m_pChoice_ToPitch, 0, 
296
299
                                                                wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, 4);
362
365
        //v Override wxTextValidator to disallow negative values < -100.0?
363
366
   m_pTextCtrl_PercentChange = 
364
367
                new wxTextCtrl(this, ID_TEXT_PERCENTCHANGE, wxT("0.0"), 
365
 
                                                        wxDefaultPosition, wxSize(40, -1), 0,
 
368
                                                        wxDefaultPosition, wxSize(60, -1), 0,
366
369
                                                        wxTextValidator(wxFILTER_NUMERIC));
367
370
   pBoxSizer_PercentChange->Add(m_pTextCtrl_PercentChange, 0, 
368
371
                                                                                        wxALIGN_CENTER_VERTICAL | wxALL, 4);
378
381
 
379
382
   pBoxSizer_Dialog->Add(0, 8, 0); // spacer
380
383
 
381
 
 
382
 
        // Preview, OK, & Cancel buttons
383
 
   pBoxSizer_Dialog->Add(0, 8, 0); // spacer
384
 
 
385
 
   wxBoxSizer * pBoxSizer_OK = new wxBoxSizer(wxHORIZONTAL);
386
 
 
387
 
   wxButton * pButton_Preview = 
388
 
                new wxButton(this, ID_BUTTON_PREVIEW, m_pEffect->GetPreviewName());
389
 
   pBoxSizer_OK->Add(pButton_Preview, 0, wxALIGN_CENTER | wxALL, 4);
390
 
   pBoxSizer_OK->Add(32, 8); // horizontal spacer
391
 
 
392
 
   wxButton * pButton_Cancel =
393
 
       new wxButton(this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0);
394
 
   pBoxSizer_OK->Add(pButton_Cancel, 0, wxALIGN_CENTER | wxALL, 4);
395
 
 
396
 
   wxButton * pButton_OK =
397
 
       new wxButton(this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0);
398
 
   pButton_OK->SetDefault();
399
 
   pBoxSizer_OK->Add(pButton_OK, 0, wxALIGN_CENTER | wxALL, 4);
400
 
 
401
 
   pBoxSizer_Dialog->Add(pBoxSizer_OK, 0, wxALIGN_CENTER | wxALL, 8);
402
 
 
 
384
   // Preview, OK, & Cancel buttons
 
385
   pBoxSizer_Dialog->Add(CreateStdButtonSizer(this, ePreviewButton|eCancelButton|eOkButton), 0, wxEXPAND);
403
386
 
404
387
   this->SetAutoLayout(true);
405
388
   this->SetSizer(pBoxSizer_Dialog);