Audacity  3.0.3
Contrast.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  Contrast.cpp
6 
7 \class ContrastDialog
8 \brief Dialog used for Contrast menu item
9 
10 *//*******************************************************************/
11 
12 
13 #include "Contrast.h"
14 
15 #include "../CommonCommandFlags.h"
16 #include "../WaveTrack.h"
17 #include "Prefs.h"
18 #include "Project.h"
19 #include "../ProjectFileIO.h"
20 #include "ProjectRate.h"
21 #include "../ProjectWindow.h"
22 #include "../SelectFile.h"
23 #include "../ShuttleGui.h"
24 #include "FileNames.h"
25 #include "ViewInfo.h"
26 #include "../widgets/HelpSystem.h"
27 #include "../widgets/NumericTextCtrl.h"
28 #include "../widgets/AudacityMessageBox.h"
29 
30 #include <cmath>
31 #include <limits>
32 
33 #if defined(__WXMSW__) && !defined(__CYGWIN__)
34 #include <float.h>
35 #define finite(x) _finite(x)
36 #endif
37 
38 #include <wx/button.h>
39 #include <wx/valtext.h>
40 #include <wx/log.h>
41 #include <wx/wfstream.h>
42 #include <wx/txtstrm.h>
43 #include <wx/textctrl.h>
44 
45 #include "PlatformCompatibility.h"
46 
47 #define DB_MAX_LIMIT 0.0 // Audio is massively distorted.
48 #define WCAG2_PASS 20.0 // dB difference required to pass WCAG2 test.
49 
50 
51 bool ContrastDialog::GetDB(float &dB)
52 {
53  float rms = float(0.0);
54 
55  // For stereo tracks: sqrt((mean(L)+mean(R))/2)
56  double meanSq = 0.0;
57 
58  auto p = FindProjectFromWindow( this );
59  auto range =
60  TrackList::Get( *p ).SelectedLeaders< const WaveTrack >();
61  auto numberSelectedTracks = range.size();
62  if (numberSelectedTracks > 1) {
64  nullptr,
65  XO("You can only measure one track at a time."),
66  XO("Error"),
67  wxOK);
68  m.ShowModal();
69  return false;
70  }
71  if(numberSelectedTracks == 0) {
73  nullptr,
74  XO("Please select an audio track."),
75  XO("Error"),
76  wxOK);
77  m.ShowModal();
78  return false;
79  }
80 
81  const auto channels = TrackList::Channels( *range.begin() );
82  for ( auto t : channels ) {
83  wxASSERT(mT0 <= mT1);
84 
85  // Ignore whitespace beyond ends of track.
86  if(mT0 < t->GetStartTime())
87  mT0 = t->GetStartTime();
88  if(mT1 > t->GetEndTime())
89  mT1 = t->GetEndTime();
90 
91  auto SelT0 = t->TimeToLongSamples(mT0);
92  auto SelT1 = t->TimeToLongSamples(mT1);
93 
94  if(SelT0 > SelT1)
95  {
97  nullptr,
98  XO("Invalid audio selection.\nPlease ensure that audio is selected."),
99  XO("Error"),
100  wxOK);
101  m.ShowModal();
102  return false;
103  }
104 
105  if(SelT0 == SelT1)
106  {
108  nullptr,
109  XO("Nothing to measure.\nPlease select a section of a track."),
110  XO("Error"),
111  wxOK);
112  m.ShowModal();
113  return false;
114  }
115 
116  // Don't throw in this analysis dialog
117  rms = t->GetRMS(mT0, mT1, false);
118  meanSq += rms * rms;
119  }
120  // TODO: This works for stereo, provided the audio clips are in both channels.
121  // We should really count gaps between clips as silence.
122  rms = (meanSq > 0.0)
123  ? sqrt( meanSq/static_cast<double>( channels.size() ) )
124  : 0.0;
125 
126  // Gives warning C4056, Overflow in floating-point constant arithmetic
127  // -INFINITY is intentional here.
128  // Looks like we are stuck with this warning, as
129  // #pragma warning( disable : 4056)
130  // even around the whole function does not disable it successfully.
131 
132  dB = (rms == 0.0)? -INFINITY : LINEAR_TO_DB(rms);
133  return true;
134 }
135 
137 {
138  auto p = FindProjectFromWindow( this );
139  auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
140  mT0 = selectedRegion.t0();
141  mT1 = selectedRegion.t1();
142 }
143 
144 
145 // WDR: class implementations
146 
147 //----------------------------------------------------------------------------
148 // ContrastDialog
149 //----------------------------------------------------------------------------
150 
151 // WDR: event table for ContrastDialog
152 
153 enum {
156  //ID_BUTTON_GETURL,
159  //ID_BUTTON_CLOSE,
168 };
169 
170 BEGIN_EVENT_TABLE(ContrastDialog,wxDialogWrapper)
176  EVT_BUTTON(wxID_CANCEL, ContrastDialog::OnClose)
178 
179 void ContrastDialog::OnChar(wxKeyEvent &event)
180 {
181  // Is this still required?
182  if (event.GetKeyCode() == WXK_TAB) {
183  // pass to next handler
184  event.Skip();
185  return;
186  }
187 
188  // ignore any other key
189  event.Skip(false);
190  return;
191 }
192 
193 ContrastDialog::ContrastDialog(wxWindow * parent, wxWindowID id,
194  const TranslatableString & title,
195  const wxPoint & pos):
196  wxDialogWrapper(parent, id, title, pos, wxDefaultSize,
197  wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX )
198 {
199  SetName();
200 
201  mT0 = 0.0;
202  mT1 = 0.0;
203  foregrounddB = 0.0;
204  backgrounddB = 0.0;
205  mForegroundIsDefined = false;
206  mBackgroundIsDefined = false;
207 
208  // NULL out the control members until the controls are created.
209  mForegroundStartT = NULL;
210  mForegroundEndT = NULL;
211  mBackgroundStartT = NULL;
212  mBackgroundEndT = NULL;
213  wxString number;
214 
215  auto p = FindProjectFromWindow( this );
217 
218  const auto options = NumericTextCtrl::Options{}
219  .AutoPos(true)
220  .MenuEnabled(false)
221  .ReadOnly(true);
222 
223  ShuttleGui S(this, eIsCreating);
224 
225  S.SetBorder(5);
226  S.StartHorizontalLay(wxCENTER, false);
227  {
228  S.AddTitle(
229  /* i18n-hint: RMS abbreviates root mean square, a certain averaging method */
230  XO("Contrast Analyzer, for measuring RMS volume differences between two selections of audio."));
231  }
232  S.EndHorizontalLay();
233  S.StartStatic( XO("Parameters") );
234  {
235  S.StartMultiColumn(5, wxEXPAND);
236  {
237 
238  // Headings
239  S.AddFixedText( {} ); // spacer
240  S.AddFixedText(XO("Start"));
241  S.AddFixedText(XO("End"));
242  S.AddFixedText( {} ); // spacer
243  S.AddFixedText(XO("Volume "));
244 
245  //Foreground
246  S.AddFixedText(XO("&Foreground:"), false);
247  if (S.GetMode() == eIsCreating)
248  {
253  0.0,
254  mProjectRate,
255  options);
256  }
257  S.Name(XO("Foreground start time"))
259 
260  if (S.GetMode() == eIsCreating)
261  {
266  0.0,
267  mProjectRate,
268  options);
269  }
270  S.Name(XO("Foreground end time"))
272 
273  m_pButton_UseCurrentF = S.Id(ID_BUTTON_USECURRENTF).AddButton(XXO("&Measure selection"));
275  .ConnectRoot(wxEVT_KEY_DOWN,
277  .AddTextBox( {}, wxT(""), 17);
278 
279  //Background
280  S.AddFixedText(XO("&Background:"));
281  if (S.GetMode() == eIsCreating)
282  {
287  0.0,
288  mProjectRate,
289  options);
290  }
291  S.Name(XO("Background start time"))
293 
294  if (S.GetMode() == eIsCreating)
295  {
300  0.0,
301  mProjectRate,
302  options);
303  }
304  S.Name(XO("Background end time"))
306 
307  m_pButton_UseCurrentB = S.Id(ID_BUTTON_USECURRENTB).AddButton(XXO("Mea&sure selection"));
309  .ConnectRoot(wxEVT_KEY_DOWN,
311  .AddTextBox( {}, wxT(""), 17);
312  }
313  S.EndMultiColumn();
314  }
315  S.EndStatic();
316 
317  //Result
318  S.StartStatic( XO("Result") );
319  {
320  S.StartMultiColumn(3, wxCENTER);
321  {
322  auto label = XO("Co&ntrast Result:");
323  S.AddFixedText(label);
325  .Name(label)
326  .ConnectRoot(wxEVT_KEY_DOWN,
328  .AddTextBox( {}, wxT(""), 50);
330 
331  label = XO("&Difference:");
332  S.AddFixedText(label);
334  .Name(label)
335  .ConnectRoot(wxEVT_KEY_DOWN,
337  .AddTextBox( {}, wxT(""), 50);
338  m_pButton_Export = S.Id(ID_BUTTON_EXPORT).AddButton(XXO("E&xport..."));
339  }
340  S.EndMultiColumn();
341  }
342  S.EndStatic();
344 #if 0
345  S.StartMultiColumn(3, wxEXPAND);
346  {
347  S.SetStretchyCol(1);
348  m_pButton_GetURL = S.Id(ID_BUTTON_GETURL).AddButton(XO("&Help"));
349  S.AddFixedText({}); // spacer
350  m_pButton_Close = S.Id(ID_BUTTON_CLOSE).AddButton(XO("&Close"));
351  }
352  S.EndMultiColumn();
353 #endif
354  Layout();
355  Fit();
356  SetMinSize(GetSize());
357  Center();
358 }
359 
360 void ContrastDialog::OnGetURL(wxCommandEvent & WXUNUSED(event))
361 {
362  // Original help page is back on-line (March 2016), but the manual should be more reliable.
363  // http://www.eramp.com/WCAG_2_audio_contrast_tool_help.htm
364  HelpSystem::ShowHelp(this, L"Contrast");
365 }
366 
367 void ContrastDialog::OnClose(wxCommandEvent & WXUNUSED(event))
368 {
369  wxCommandEvent dummyEvent;
370  OnReset(dummyEvent);
371 
372  Show(false);
373 }
374 
375 void ContrastDialog::OnGetForeground(wxCommandEvent & /*event*/)
376 {
377  auto p = FindProjectFromWindow( this );
378  auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
379 
380  if( TrackList::Get( *p ).Selected< const WaveTrack >() ) {
381  mForegroundStartT->SetValue(selectedRegion.t0());
382  mForegroundEndT->SetValue(selectedRegion.t1());
383  }
384 
387  m_pButton_UseCurrentF->SetFocus();
388  results();
389 }
390 
391 void ContrastDialog::OnGetBackground(wxCommandEvent & /*event*/)
392 {
393  auto p = FindProjectFromWindow( this );
394  auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
395 
396  if( TrackList::Get( *p ).Selected< const WaveTrack >() ) {
397  mBackgroundStartT->SetValue(selectedRegion.t0());
398  mBackgroundEndT->SetValue(selectedRegion.t1());
399  }
400 
403  m_pButton_UseCurrentB->SetFocus();
404  results();
405 }
406 
407 namespace {
408  // PRL: I gathered formatting into these functions, and eliminated some
409  // repetitions, and removed the redundant word "Average" as applied to RMS.
410  // Should these variations in formats be collapsed further?
411 
412  // Pass nullptr when value is not yet defined
414  {
415 
416  /* i18n-hint: RMS abbreviates root mean square, a certain averaging method */
417  auto format0 = XO("RMS = %s.");
418 
419  /* i18n-hint: dB abbreviates decibels */
420  auto format1 = XO("%s dB");
421 
422  TranslatableString value;
423 
424  if ( pValue ) {
425  if( fabs( *pValue ) != std::numeric_limits<float>::infinity() ) {
426  auto number = wxString::Format( wxT("%.2f"), *pValue );
427  value = format1.Format( number );
428  }
429  else
430  value = XO("zero");
431  }
432  else
433  value = format1.Format( "" );
434 
435  return format0.Format( value );
436  }
437 
439  {
440  if( diffdB != diffdB ) // test for NaN, reliant on IEEE implementation
441  return XO("indeterminate");
442  else {
443  if( diffdB != std::numeric_limits<float>::infinity() )
444  /* i18n-hint: dB abbreviates decibels
445  * RMS abbreviates root mean square, a certain averaging method */
446  return XO("%.2f dB RMS").Format( diffdB );
447  else
448  /* i18n-hint: dB abbreviates decibels */
449  return XO("Infinite dB difference");
450  }
451  }
452 
454  {
455  if( diffdB != diffdB ) //test for NaN, reliant on IEEE implementation
456  return XO("Difference is indeterminate.");
457  else
458  if( fabs(diffdB) != std::numeric_limits<float>::infinity() )
459  /* i18n-hint: dB abbreviates decibels
460  RMS abbreviates root mean square, a certain averaging method */
461  return XO("Difference = %.2f RMS dB.").Format( diffdB );
462  else
463  /* i18n-hint: dB abbreviates decibels
464  RMS abbreviates root mean square, a certain averaging method */
465  return XO("Difference = infinite RMS dB.");
466  }
467 }
468 
470 {
471  mPassFailText->SetName(wxT(""));
472  mPassFailText->ChangeValue(wxT(""));
473  mDiffText->ChangeValue(wxT(""));
474 
475  // foreground and background defined.
477  float diffdB = std::fabs(foregrounddB - backgrounddB);
478  if(foregrounddB > DB_MAX_LIMIT) {
479  mPassFailText->ChangeValue(_("Foreground level too high"));
480  }
481  else if (backgrounddB > DB_MAX_LIMIT) {
482  mPassFailText->ChangeValue(_("Background level too high"));
483  }
484  else if (backgrounddB > foregrounddB) {
485  mPassFailText->ChangeValue(_("Background higher than foreground"));
486  }
487  else if(diffdB > WCAG2_PASS) {
488  /* i18n-hint: WCAG2 is the 'Web Content Accessibility Guidelines (WCAG) 2.0', see http://www.w3.org/TR/WCAG20/ */
489  mPassFailText->ChangeValue(_("WCAG2 Pass"));
490  }
491  else {
492  /* i18n-hint: WCAG abbreviates Web Content Accessibility Guidelines */
493  mPassFailText->ChangeValue(_("WCAG2 Fail"));
494  }
495 
496  /* i18n-hint: i.e. difference in loudness at the moment. */
497  mDiffText->SetName(_("Current difference"));
498  mDiffText->ChangeValue( FormatDifference( diffdB ).Translation() );
499  }
500 
501  if (mForegroundIsDefined) {
502  mForegroundRMSText->SetName(_("Measured foreground level")); // Read by screen-readers
503  if(std::isinf(- foregrounddB))
504  mForegroundRMSText->ChangeValue(_("zero"));
505  else
506  // i18n-hint: short form of 'decibels'
507  mForegroundRMSText->ChangeValue(wxString::Format(_("%.2f dB"), foregrounddB));
508  }
509  else {
510  mForegroundRMSText->SetName(_("No foreground measured")); // Read by screen-readers
511  mForegroundRMSText->ChangeValue(wxT(""));
512  mPassFailText->ChangeValue(_("Foreground not yet measured"));
513  }
514 
515  if (mBackgroundIsDefined) {
516  mBackgroundRMSText->SetName(_("Measured background level"));
517  if(std::isinf(- backgrounddB))
518  mBackgroundRMSText->ChangeValue(_("zero"));
519  else
520  mBackgroundRMSText->ChangeValue(wxString::Format(_("%.2f dB"), backgrounddB));
521  }
522  else {
523  mBackgroundRMSText->SetName(_("No background measured"));
524  mBackgroundRMSText->ChangeValue(wxT(""));
525  mPassFailText->ChangeValue(_("Background not yet measured"));
526  }
527 }
528 
529 void ContrastDialog::OnExport(wxCommandEvent & WXUNUSED(event))
530 {
531  // TODO: Handle silence checks better (-infinity dB)
532  auto project = FindProjectFromWindow( this );
533  wxString fName = wxT("contrast.txt");
534 
535  fName = SelectFile(FileNames::Operation::Export,
536  XO("Export Contrast Result As:"),
537  wxEmptyString,
538  fName,
539  wxT("txt"),
541  wxFD_SAVE | wxRESIZE_BORDER,
542  this);
543 
544  if (fName.empty())
545  return;
546 
547  wxFFileOutputStream ffStream{ fName };
548 
549  if (!ffStream.IsOk()) {
550  AudacityMessageBox( XO("Couldn't write to file: %s").Format( fName ) );
551  return;
552  }
553 
554  wxTextOutputStream ss(ffStream);
555 
556  ss
557  << wxT("===================================") << '\n'
558  /* i18n-hint: WCAG abbreviates Web Content Accessibility Guidelines */
559  << XO("WCAG 2.0 Success Criteria 1.4.7 Contrast Results") << '\n'
560  << '\n'
561  << XO("Filename = %s.").Format( ProjectFileIO::Get(*project).GetFileName() ) << '\n'
562  << '\n'
563  << XO("Foreground") << '\n';
564 
565  float t = (float)mForegroundStartT->GetValue();
566  int h = (int)(t/3600); // there must be a standard function for this!
567  int m = (int)((t - h*3600)/60);
568  float s = t - h*3600.0 - m*60.0;
569 
570  ss
571  << XO("Time started = %2d hour(s), %2d minute(s), %.2f seconds.")
572  .Format( h, m, s ) << '\n';
573 
574  t = (float)mForegroundEndT->GetValue();
575  h = (int)(t/3600);
576  m = (int)((t - h*3600)/60);
577  s = t - h*3600.0 - m*60.0;
578 
579  ss
580  << XO("Time ended = %2d hour(s), %2d minute(s), %.2f seconds.")
581  .Format( h, m, s ) << '\n'
582  << FormatRMSMessage( mForegroundIsDefined ? &foregrounddB : nullptr ) << '\n'
583  << '\n'
584  << XO("Background") << '\n';
585 
586  t = (float)mBackgroundStartT->GetValue();
587  h = (int)(t/3600);
588  m = (int)((t - h*3600)/60);
589  s = t - h*3600.0 - m*60.0;
590 
591  ss
592  << XO("Time started = %2d hour(s), %2d minute(s), %.2f seconds.")
593  .Format( h, m, s ) << '\n';
594 
595  t = (float)mBackgroundEndT->GetValue();
596  h = (int)(t/3600);
597  m = (int)((t - h*3600)/60);
598  s = t - h*3600.0 - m*60.0;
599 
600  ss
601  << XO("Time ended = %2d hour(s), %2d minute(s), %.2f seconds.")
602  .Format( h, m, s ) << '\n'
603  << FormatRMSMessage( mBackgroundIsDefined ? &backgrounddB : nullptr ) << '\n'
604  << '\n'
605  << XO("Results") << '\n';
606 
607  float diffdB = foregrounddB - backgrounddB;
608 
609  ss
610  << FormatDifferenceForExport( diffdB ) << '\n'
611  << (( diffdB > 20. )
612  ? XO("Success Criteria 1.4.7 of WCAG 2.0: Pass")
613  : XO("Success Criteria 1.4.7 of WCAG 2.0: Fail")) << '\n'
614  << '\n'
615  << XO("Data gathered") << '\n';
616 
617  wxDateTime now = wxDateTime::Now();
618  int year = now.GetYear();
619  wxDateTime::Month month = now.GetMonth();
620  wxString monthName = now.GetMonthName(month);
621  int dom = now.GetDay();
622  int hour = now.GetHour();
623  int minute = now.GetMinute();
624  int second = now.GetSecond();
625  /* i18n-hint: day of month, month, year, hour, minute, second */
626  auto sNow = XO("%d %s %02d %02dh %02dm %02ds")
627  .Format( dom, monthName, year, hour, minute, second );
628 
629  ss <<
630  sNow << '\n'
631  << wxT("===================================") << '\n'
632  << '\n';
633 }
634 
635 void ContrastDialog::OnReset(wxCommandEvent & /*event*/)
636 {
641  mForegroundIsDefined = false;
642  mBackgroundIsDefined = false;
643 
644  mForegroundRMSText->SetName(_("No foreground measured")); // Read by screen-readers
645  mBackgroundRMSText->SetName(_("No background measured"));
646  mForegroundRMSText->ChangeValue(wxT("")); // Displayed value
647  mBackgroundRMSText->ChangeValue(wxT(""));
648  mPassFailText->ChangeValue(wxT(""));
649  mDiffText->ChangeValue(wxT(""));
650 }
651 
652 // Remaining code hooks this add-on into the application
653 #include "commands/CommandContext.h"
654 #include "commands/CommandManager.h"
655 #include "ProjectWindows.h"
656 #include "../commands/ScreenshotCommand.h"
657 
658 namespace {
659 
660 // Contrast window attached to each project is built on demand by:
661 AttachedWindows::RegisteredFactory sContrastDialogKey{
662  []( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
663  auto &window = ProjectWindow::Get( parent );
664  return safenew ContrastDialog(
665  &window, -1, XO("Contrast Analysis (WCAG 2 compliance)"),
666  wxPoint{ 150, 150 }
667  );
668  }
669 };
670 
671 // Define our extra menu item that invokes that factory
673  void OnContrast(const CommandContext &context)
674  {
675  auto &project = context.project;
676  CommandManager::Get(project).RegisterLastAnalyzer(context); //Register Contrast as Last Analyzer
677  auto contrastDialog = &GetAttachedWindows(project)
679 
680  contrastDialog->CentreOnParent();
681  if( ScreenshotCommand::MayCapture( contrastDialog ) )
682  return;
683  contrastDialog->Show();
684  }
685 };
686 
688  // Handler is not stateful. Doesn't need a factory registered with
689  // AudacityProject.
690  static Handler instance;
691  return instance;
692 }
693 
694 // Register that menu item
695 
696 using namespace MenuTable;
697 AttachedItem sAttachment{ wxT("Analyze/Analyzers/Windows"),
699  Command( wxT("ContrastAnalyser"), XXO("Contrast..."),
700  &Handler::OnContrast,
702  wxT("Ctrl+Shift+T") ) )
703 };
704 
705 }
ID_BACKGROUNDDB_TEXT
@ ID_BACKGROUNDDB_TEXT
Definition: Contrast.cpp:165
EVT_BUTTON
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
ContrastDialog::mProjectRate
double mProjectRate
Definition: Contrast.h:48
ContrastDialog::OnGetBackground
void OnGetBackground(wxCommandEvent &event)
Definition: Contrast.cpp:391
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
ViewInfo::Get
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:241
ContrastDialog::mBackgroundEndT
NumericTextCtrl * mBackgroundEndT
Definition: Contrast.h:44
eIsCreating
@ eIsCreating
Definition: ShuttleGui.h:38
ContrastDialog::mDiffText
wxTextCtrl * mDiffText
Definition: Contrast.h:68
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
ContrastDialog::m_pButton_UseCurrentF
wxButton * m_pButton_UseCurrentF
Definition: Contrast.h:34
ProjectFileIO::GetFileName
const FilePath & GetFileName() const
Definition: ProjectFileIO.cpp:1502
ContrastDialog::mBackgroundIsDefined
bool mBackgroundIsDefined
Definition: Contrast.h:73
AudacityMessageBox
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
Definition: AudacityMessageBox.cpp:17
NumericTextCtrl::Options::AutoPos
Options & AutoPos(bool enable)
Definition: NumericTextCtrl.h:190
MenuTable::FinderScope
Definition: CommandManager.h:485
ShuttleGuiBase::AddTitle
void AddTitle(const TranslatableString &Prompt, int wrapWidth=0)
Centred text string.
Definition: ShuttleGui.cpp:281
anonymous_namespace{Contrast.cpp}::findCommandHandler
CommandHandlerObject & findCommandHandler(AudacityProject &)
Definition: Contrast.cpp:687
eHelpButton
@ eHelpButton
Definition: ShuttleGui.h:604
Project.h
ProjectRate::Get
static ProjectRate & Get(AudacityProject &project)
Definition: ProjectRate.cpp:42
ClientData::Site::Get
Subclass & Get(const RegisteredFactory &key)
Get reference to an attachment, creating on demand if not present, down-cast it to Subclass.
Definition: ClientData.h:309
SelectFile
FilePath SelectFile(FileNames::Operation op, const TranslatableString &message, const FilePath &default_path, const FilePath &default_filename, const FileExtension &default_extension, const FileTypes &fileTypes, int flags, wxWindow *parent)
Definition: SelectFile.cpp:17
ContrastDialog::m_pButton_Export
wxButton * m_pButton_Export
Definition: Contrast.h:37
AudioIONotBusyFlag
const ReservedCommandFlag & AudioIONotBusyFlag()
Definition: CommonCommandFlags.cpp:127
TrackList::Channels
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1484
Format
Abstract base class used in importing a file.
NumericConverter::HundredthsFormat
static NumericFormatSymbol HundredthsFormat()
Definition: NumericTextCtrl.cpp:698
ContrastDialog::OnGetURL
void OnGetURL(wxCommandEvent &event)
Definition: Contrast.cpp:360
CommandManager.h
ContrastDialog::mPassFailText
wxTextCtrl * mPassFailText
Definition: Contrast.h:67
XO
#define XO(s)
Definition: Internat.h:31
ProjectFileIO::Get
static ProjectFileIO & Get(AudacityProject &project)
Definition: ProjectFileIO.cpp:266
ID_BUTTON_RESET
@ ID_BUTTON_RESET
Definition: Contrast.cpp:158
ClientData::Site::size
size_t size() const
How many attachment pointers are in the Site.
Definition: ClientData.h:251
INFINITY
#define INFINITY
Definition: ffmpeg-2.3.6-single-header.h:572
ContrastDialog::backgrounddB
float backgrounddB
Definition: Contrast.h:71
ShuttleGuiBase::EndMultiColumn
void EndMultiColumn()
Definition: ShuttleGui.cpp:1238
ProjectWindow::Get
static ProjectWindow & Get(AudacityProject &project)
Definition: ProjectWindow.cpp:535
FindProjectFromWindow
AudacityProject * FindProjectFromWindow(wxWindow *pWindow)
Definition: ProjectWindowBase.cpp:44
MenuTable::AttachedItem
Definition: CommandManager.h:708
ContrastDialog::m_pButton_UseCurrentB
wxButton * m_pButton_UseCurrentB
Definition: Contrast.h:35
FileNames::AllFiles
FILES_API const FileType AllFiles
Definition: FileNames.h:71
NumericTextCtrl
Definition: NumericTextCtrl.h:172
WCAG2_PASS
#define WCAG2_PASS
Definition: Contrast.cpp:48
HelpSystem::ShowHelp
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:237
NumericTextCtrl::SetValue
void SetValue(double newValue)
Definition: NumericTextCtrl.cpp:1474
TrackList::SelectedLeaders
auto SelectedLeaders() -> TrackIterRange< TrackType >
Definition: Track.h:1422
AudacityMessageDialog
Wrap wxMessageDialog so that caption IS translatable.
Definition: wxPanelWrapper.h:215
WaveTracksSelectedFlag
const ReservedCommandFlag & WaveTracksSelectedFlag()
Definition: CommonCommandFlags.cpp:164
ContrastDialog::mT0
double mT0
Definition: Contrast.h:46
NumericTextCtrl::Options
Definition: NumericTextCtrl.h:178
ShuttleGui::Id
ShuttleGui & Id(int id)
Definition: ShuttleGui.cpp:2274
ContrastDialog::mForegroundRMSText
wxTextCtrl * mForegroundRMSText
Definition: Contrast.h:65
ContrastDialog::ContrastDialog
ContrastDialog(wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos)
Definition: Contrast.cpp:193
DB_MAX_LIMIT
#define DB_MAX_LIMIT
Definition: Contrast.cpp:47
ContrastDialog::OnClose
void OnClose(wxCommandEvent &event)
Definition: Contrast.cpp:367
ContrastDialog::OnGetForeground
void OnGetForeground(wxCommandEvent &event)
Definition: Contrast.cpp:375
anonymous_namespace{Contrast.cpp}::Handler::OnContrast
void OnContrast(const CommandContext &context)
Definition: Contrast.cpp:673
Contrast.h
ID_BACKGROUNDEND_T
@ ID_BACKGROUNDEND_T
Definition: Contrast.cpp:163
CommandContext.h
ViewInfo::selectedRegion
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:229
XXO
#define XXO(s)
Definition: Internat.h:44
ShuttleGuiBase::EndHorizontalLay
void EndHorizontalLay()
Definition: ShuttleGui.cpp:1177
CommandContext
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
Definition: CommandContext.h:34
label
TranslatableString label
Definition: Tags.cpp:756
ShuttleGuiBase::StartHorizontalLay
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
Definition: ShuttleGui.cpp:1167
ContrastDialog
Definition: Contrast.h:28
FileNames::TextFiles
FILES_API const FileType TextFiles
Definition: FileNames.h:74
ShuttleGuiBase::StartMultiColumn
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
Definition: ShuttleGui.cpp:1229
ContrastDialog::GetDB
bool GetDB(float &dB)
Definition: Contrast.cpp:51
ID_BUTTON_USECURRENTF
@ ID_BUTTON_USECURRENTF
Definition: Contrast.cpp:154
anonymous_namespace{Contrast.cpp}::sAttachment
AttachedItem sAttachment
Definition: Contrast.cpp:697
anonymous_namespace{Contrast.cpp}::sContrastDialogKey
AttachedWindows::RegisteredFactory sContrastDialogKey
Definition: Contrast.cpp:661
GetAttachedWindows
AUDACITY_DLL_API AttachedWindows & GetAttachedWindows(AudacityProject &project)
Definition: ProjectWindows.cpp:114
ShuttleGuiBase::AddFixedText
void AddFixedText(const TranslatableString &Str, bool bCenter=false, int wrapWidth=0)
Definition: ShuttleGui.cpp:440
ContrastDialog::SetStartAndEndTime
void SetStartAndEndTime()
Definition: Contrast.cpp:136
ID_BUTTON_EXPORT
@ ID_BUTTON_EXPORT
Definition: Contrast.cpp:157
CommandManager::RegisterLastAnalyzer
void RegisterLastAnalyzer(const CommandContext &context)
Definition: CommandManager.cpp:1288
NumericConverter::TIME
@ TIME
Definition: NumericTextCtrl.h:52
ShuttleGuiBase::GetParent
wxWindow * GetParent()
Definition: ShuttleGui.h:496
ShuttleGuiBase::AddWindow
wxWindow * AddWindow(wxWindow *pWindow, int PositionFlags=wxALIGN_CENTRE)
Definition: ShuttleGui.cpp:299
NumericTextCtrl::Options::MenuEnabled
Options & MenuEnabled(bool enable)
Definition: NumericTextCtrl.h:192
ProjectRate::GetRate
double GetRate() const
Definition: ProjectRate.cpp:68
anonymous_namespace{Contrast.cpp}::FormatDifference
TranslatableString FormatDifference(float diffdB)
Definition: Contrast.cpp:438
ContrastDialog::results
void results()
Definition: Contrast.cpp:469
ContrastDialog::OnReset
void OnReset(wxCommandEvent &event)
Definition: Contrast.cpp:635
ViewInfo.h
anonymous_namespace{Contrast.cpp}::FormatDifferenceForExport
TranslatableString FormatDifferenceForExport(float diffdB)
Definition: Contrast.cpp:453
ContrastDialog::mBackgroundRMSText
wxTextCtrl * mBackgroundRMSText
Definition: Contrast.h:66
ScreenshotCommand::MayCapture
static bool MayCapture(wxDialog *pDlg)
Definition: ScreenshotCommand.cpp:345
anonymous_namespace{Contrast.cpp}::FormatRMSMessage
TranslatableString FormatRMSMessage(float *pValue)
Definition: Contrast.cpp:413
ProjectWindows.h
accessors for certain important windows associated with each project
ShuttleGuiBase::AddButton
wxButton * AddButton(const TranslatableString &Text, int PositionFlags=wxALIGN_CENTRE, bool setDefault=false)
Definition: ShuttleGui.cpp:360
ShuttleGuiBase::StartStatic
wxStaticBox * StartStatic(const TranslatableString &Str, int iProp=0)
Definition: ShuttleGui.cpp:893
ContrastDialog::OnExport
void OnExport(wxCommandEvent &event)
Definition: Contrast.cpp:529
id
int id
Definition: WaveTrackControls.cpp:577
ShuttleGui::Name
ShuttleGui & Name(const TranslatableString &name)
Definition: ShuttleGui.h:663
wxDialogWrapper
Definition: wxPanelWrapper.h:81
ContrastDialog::m_pButton_GetURL
wxButton * m_pButton_GetURL
Definition: Contrast.h:36
title
static const auto title
Definition: NoUpdatesAvailableDialog.cpp:22
PlatformCompatibility.h
TrackList::Get
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:506
ContrastDialog::m_pButton_Close
wxButton * m_pButton_Close
Definition: Contrast.h:39
_
#define _(s)
Definition: Internat.h:75
ID_BUTTON_USECURRENTB
@ ID_BUTTON_USECURRENTB
Definition: Contrast.cpp:155
MenuTable::Command
std::unique_ptr< CommandItem > Command(const CommandID &name, const TranslatableString &label_in, void(Handler::*pmf)(const CommandContext &), CommandFlag flags, const CommandManager::Options &options={}, CommandHandlerFinder finder=FinderScope::DefaultFinder())
Definition: CommandManager.h:675
ShuttleGui::ConnectRoot
auto ConnectRoot(wxEventTypeTag< Tag > eventType, void(Handler::*func)(Argument &)) -> typename std::enable_if< std::is_base_of< Argument, Tag >::value, ShuttleGui & >::type
Definition: ShuttleGui.h:699
ContrastDialog::OnChar
void OnChar(wxKeyEvent &event)
Definition: Contrast.cpp:179
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
eCloseButton
@ eCloseButton
Definition: ShuttleGui.h:610
anonymous_namespace{Contrast.cpp}::Handler
Definition: Contrast.cpp:672
FileNames.h
TimeSelectedFlag
const ReservedCommandFlag & TimeSelectedFlag()
Definition: CommonCommandFlags.cpp:159
ID_FOREGROUNDDB_TEXT
@ ID_FOREGROUNDDB_TEXT
Definition: Contrast.cpp:164
NumericTextCtrl::Options::ReadOnly
Options & ReadOnly(bool enable)
Definition: NumericTextCtrl.h:191
ContrastDialog::mT1
double mT1
Definition: Contrast.h:47
CommandHandlerObject
wxEvtHandler CommandHandlerObject
Definition: CommandFunctors.h:28
ID_RESULTSDB_TEXT
@ ID_RESULTSDB_TEXT
Definition: Contrast.cpp:167
ProjectRate.h
an object holding per-project preferred sample rate
ContrastDialog::foregrounddB
float foregrounddB
Definition: Contrast.h:70
LINEAR_TO_DB
#define LINEAR_TO_DB(x)
Definition: MemoryX.h:631
ShuttleGui::AddStandardButtons
void AddStandardButtons(long buttons=eOkButton|eCancelButton, wxWindow *extra=NULL)
Definition: ShuttleGui.cpp:2444
ID_FOREGROUNDEND_T
@ ID_FOREGROUNDEND_T
Definition: Contrast.cpp:161
ShuttleGui::GetMode
teShuttleMode GetMode()
Definition: ShuttleGui.h:752
ContrastDialog::mForegroundStartT
NumericTextCtrl * mForegroundStartT
Definition: Contrast.h:41
Prefs.h
ShuttleGuiBase::SetBorder
void SetBorder(int Border)
Definition: ShuttleGui.h:489
MenuTable
Definition: CommandManager.h:416
wxDialogWrapper::SetName
void SetName()
Definition: wxPanelWrapper.cpp:81
ContrastDialog::mBackgroundStartT
NumericTextCtrl * mBackgroundStartT
Definition: Contrast.h:43
TranslatableString::Format
TranslatableString & Format(Args &&...args) &
Capture variadic format arguments (by copy) when there is no plural.
Definition: TranslatableString.h:103
CommandManager::Get
static CommandManager & Get(AudacityProject &project)
Definition: CommandManager.cpp:207
ShuttleGuiBase::EndStatic
void EndStatic()
Definition: ShuttleGui.cpp:922
safenew
#define safenew
Definition: MemoryX.h:10
ShuttleGuiBase::SetStretchyCol
void SetStretchyCol(int i)
Used to modify an already placed FlexGridSizer to make a column stretchy.
Definition: ShuttleGui.cpp:202
ID_FOREGROUNDSTART_T
@ ID_FOREGROUNDSTART_T
Definition: Contrast.cpp:160
NumericConverter::GetValue
double GetValue()
Definition: NumericTextCtrl.cpp:1174
ContrastDialog::mForegroundEndT
NumericTextCtrl * mForegroundEndT
Definition: Contrast.h:42
CommandContext::project
AudacityProject & project
Definition: CommandContext.h:64
TrackList::Selected
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:1388
ID_RESULTS_TEXT
@ ID_RESULTS_TEXT
Definition: Contrast.cpp:166
END_EVENT_TABLE
END_EVENT_TABLE()
ID_BACKGROUNDSTART_T
@ ID_BACKGROUNDSTART_T
Definition: Contrast.cpp:162
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
ContrastDialog::m_pButton_Reset
wxButton * m_pButton_Reset
Definition: Contrast.h:38
ContrastDialog::mForegroundIsDefined
bool mForegroundIsDefined
Definition: Contrast.h:72