Audacity  3.0.3
Classes | Functions | Variables
anonymous_namespace{Contrast.cpp} Namespace Reference

Classes

struct  Handler
 

Functions

TranslatableString FormatRMSMessage (float *pValue)
 
TranslatableString FormatDifference (float diffdB)
 
TranslatableString FormatDifferenceForExport (float diffdB)
 
CommandHandlerObjectfindCommandHandler (AudacityProject &)
 

Variables

AudacityProject::AttachedWindows::RegisteredFactory sContrastDialogKey
 
AttachedItem sAttachment
 

Function Documentation

◆ findCommandHandler()

CommandHandlerObject& anonymous_namespace{Contrast.cpp}::findCommandHandler ( AudacityProject )

Definition at line 686 of file Contrast.cpp.

686  {
687  // Handler is not stateful. Doesn't need a factory registered with
688  // AudacityProject.
689  static Handler instance;
690  return instance;
691 }

◆ FormatDifference()

TranslatableString anonymous_namespace{Contrast.cpp}::FormatDifference ( float  diffdB)

Definition at line 438 of file Contrast.cpp.

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  }

References XO.

Referenced by ContrastDialog::results().

Here is the caller graph for this function:

◆ FormatDifferenceForExport()

TranslatableString anonymous_namespace{Contrast.cpp}::FormatDifferenceForExport ( float  diffdB)

Definition at line 453 of file Contrast.cpp.

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  }

References XO.

Referenced by ContrastDialog::OnExport().

Here is the caller graph for this function:

◆ FormatRMSMessage()

TranslatableString anonymous_namespace{Contrast.cpp}::FormatRMSMessage ( float *  pValue)

Definition at line 413 of file Contrast.cpp.

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  }

References TranslatableString::Format(), and XO.

Referenced by ContrastDialog::OnExport().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ sAttachment

AttachedItem anonymous_namespace{Contrast.cpp}::sAttachment
Initial value:
{ wxT("Analyze/Analyzers/Windows"),
Command( wxT("ContrastAnalyser"), XXO("Contrast..."),
&Handler::OnContrast,
wxT("Ctrl+Shift+T") ) )
}

Definition at line 696 of file Contrast.cpp.

Referenced by DEFINE_VERSION_CHECK::RegisterMenuItems(), and anonymous_namespace{NyqBench.cpp}::RegisterMenuItems().

◆ sContrastDialogKey

AudacityProject::AttachedWindows::RegisteredFactory anonymous_namespace{Contrast.cpp}::sContrastDialogKey
Initial value:
{
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
auto &window = ProjectWindow::Get( parent );
&window, -1, XO("Contrast Analysis (WCAG 2 compliance)"),
wxPoint{ 150, 150 }
);
}
}

Definition at line 660 of file Contrast.cpp.

Referenced by anonymous_namespace{Contrast.cpp}::Handler::OnContrast().

TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
MenuTable::FinderScope
Definition: CommandManager.h:472
anonymous_namespace{Contrast.cpp}::findCommandHandler
CommandHandlerObject & findCommandHandler(AudacityProject &)
Definition: Contrast.cpp:686
AudioIONotBusyFlag
const ReservedCommandFlag & AudioIONotBusyFlag()
Definition: CommonCommandFlags.cpp:127
XO
#define XO(s)
Definition: Internat.h:31
ProjectWindow::Get
static ProjectWindow & Get(AudacityProject &project)
Definition: ProjectWindow.cpp:533
WaveTracksSelectedFlag
const ReservedCommandFlag & WaveTracksSelectedFlag()
Definition: CommonCommandFlags.cpp:164
XXO
#define XXO(s)
Definition: Internat.h:44
ContrastDialog
Definition: Contrast.h:28
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:662
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:113
TimeSelectedFlag
const ReservedCommandFlag & TimeSelectedFlag()
Definition: CommonCommandFlags.cpp:159
TranslatableString::Format
TranslatableString & Format(Args &&...args) &
Capture variadic format arguments (by copy) when there is no plural.
Definition: TranslatableString.h:103
safenew
#define safenew
Definition: MemoryX.h:10