Audacity 3.2.0
Public Member Functions | List of all members
ExportPCM Class Referencefinal
Inheritance diagram for ExportPCM:
[legend]
Collaboration diagram for ExportPCM:
[legend]

Public Member Functions

 ExportPCM ()
 
int GetFormatCount () const override
 
FormatInfo GetFormatInfo (int index) const override
 Returns FormatInfo structure for given index if it's valid, or a default one. FormatInfo::format isn't guaranteed to be unique. More...
 
std::vector< std::string > GetMimeTypes (int formatIndex) const override
 
bool ParseConfig (int formatIndex, const rapidjson::Value &, ExportProcessor::Parameters &parameters) const override
 Attempt to parse configuration JSON object and produce a suitable set of parameters. Configuration is format dependent. More...
 
std::unique_ptr< ExportOptionsEditorCreateOptionsEditor (int, ExportOptionsEditor::Listener *) const override
 Creates format-dependent options editor, that is used to create a valid set of parameters to be used in exporting. More...
 
std::unique_ptr< ExportProcessorCreateProcessor (int format) const override
 
- Public Member Functions inherited from ExportPlugin
 ExportPlugin ()
 
virtual ~ExportPlugin ()
 
virtual int GetFormatCount () const =0
 
virtual FormatInfo GetFormatInfo (int index) const =0
 Returns FormatInfo structure for given index if it's valid, or a default one. FormatInfo::format isn't guaranteed to be unique. More...
 
virtual std::unique_ptr< ExportOptionsEditorCreateOptionsEditor (int formatIndex, ExportOptionsEditor::Listener *listener) const =0
 Creates format-dependent options editor, that is used to create a valid set of parameters to be used in exporting. More...
 
virtual std::vector< std::string > GetMimeTypes (int formatIndex) const
 
virtual bool ParseConfig (int formatIndex, const rapidjson::Value &config, ExportProcessor::Parameters &parameters) const
 Attempt to parse configuration JSON object and produce a suitable set of parameters. Configuration is format dependent. More...
 
virtual bool CheckFileName (wxFileName &filename, int format=0) const
 
virtual std::unique_ptr< ExportProcessorCreateProcessor (int format) const =0
 

Detailed Description

Definition at line 435 of file ExportPCM.cpp.

Constructor & Destructor Documentation

◆ ExportPCM()

ExportPCM::ExportPCM ( )
default

Member Function Documentation

◆ CreateOptionsEditor()

std::unique_ptr< ExportOptionsEditor > ExportPCM::CreateOptionsEditor ( int  formatIndex,
ExportOptionsEditor::Listener listener 
) const
overridevirtual

Creates format-dependent options editor, that is used to create a valid set of parameters to be used in exporting.

Parameters
listenerOption listener object that could be used by the editor to report on option changes.

Implements ExportPlugin.

Definition at line 522 of file ExportPCM.cpp.

523{
524 if(format < FMT_OTHER)
525 return std::make_unique<ExportOptionsSFTypedEditor>(
526 kFormats[format].format & SF_FORMAT_TYPEMASK);
527 return std::make_unique<ExportOptionsSFEditor>(listener);
528}
@ FMT_OTHER
struct anonymous_namespace{ExportPCM.cpp}::@181 kFormats[]

References FMT_OTHER, anonymous_namespace{ExportPCM.cpp}::format, and anonymous_namespace{ExportPCM.cpp}::kFormats.

◆ CreateProcessor()

std::unique_ptr< ExportProcessor > ExportPCM::CreateProcessor ( int  format) const
overridevirtual
Parameters
formatControl whether we are doing a "preset" export to a popular file type, or giving the user full control over libsndfile.

Implements ExportPlugin.

Definition at line 530 of file ExportPCM.cpp.

531{
532 return std::make_unique<PCMExportProcessor>(format);
533}

References anonymous_namespace{ExportPCM.cpp}::format.

◆ GetFormatCount()

int ExportPCM::GetFormatCount ( ) const
overridevirtual

Implements ExportPlugin.

Definition at line 461 of file ExportPCM.cpp.

462{
463 return WXSIZEOF(kFormats) + 1;// + FMT_OTHER
464}

References anonymous_namespace{ExportPCM.cpp}::kFormats.

◆ GetFormatInfo()

FormatInfo ExportPCM::GetFormatInfo ( int  index) const
overridevirtual

Returns FormatInfo structure for given index if it's valid, or a default one. FormatInfo::format isn't guaranteed to be unique.

Parameters
indexShould not exceed the number of formats provided by GetFormatCount()

Implements ExportPlugin.

Definition at line 466 of file ExportPCM.cpp.

467{
468 if(index == FMT_OTHER)
469 {
470 SF_INFO si = {};
471 //VS: returned format info depends on the format that was used last time.
472 //That could be a source of unexpected behavior
473 si.format = LoadOtherFormat(*gPrefs, kFormats[0].format & SF_FORMAT_TYPEMASK);
474 si.format |= LoadEncoding(*gPrefs, si.format, kFormats[0].format);
475
476 for (si.channels = 1; sf_format_check(&si); si.channels++)
477 {
478 // just counting
479 }
480 --si.channels;
481
482 return {
483 sf_header_shortname(si.format),
484 XO("Other uncompressed files"),
485 { sf_header_extension(si.format) },
486 static_cast<unsigned>(si.channels),
487 true
488 };
489 }
490
491 if(!(index >= 0 && index < FMT_OTHER))
492 index = 0;
493
494 return {
495 kFormats[index].name,
496 kFormats[index].desc,
498 255,
499 true
500 };
501}
wxString sf_header_extension(int format)
Get the most common file extension for the given format.
wxString sf_header_shortname(int format)
Get an abbreviated form of the string name of the specified format.
XO("Cut/Copy/Paste")
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
int LoadEncoding(const audacity::BasicSettings &config, int type, int def)
Definition: ExportPCM.cpp:80
int LoadOtherFormat(const audacity::BasicSettings &config, int def)
Definition: ExportPCM.cpp:70

References FMT_OTHER, FormatInfo::format, anonymous_namespace{ExportPCM.cpp}::format, gPrefs, anonymous_namespace{ExportPCM.cpp}::kFormats, anonymous_namespace{ExportPCM.cpp}::LoadEncoding(), anonymous_namespace{ExportPCM.cpp}::LoadOtherFormat(), sf_header_extension(), sf_header_shortname(), and XO().

Here is the call graph for this function:

◆ GetMimeTypes()

std::vector< std::string > ExportPCM::GetMimeTypes ( int  formatIndex) const
overridevirtual
Returns
Mime type(s) supported by the format.

Reimplemented from ExportPlugin.

Definition at line 503 of file ExportPCM.cpp.

504{
505 if(formatIndex == FMT_WAV)
506 return { "audio/x-wav" };
507 return {};
508}

References anonymous_namespace{ExportPCM.cpp}::FMT_WAV.

◆ ParseConfig()

bool ExportPCM::ParseConfig ( int  formatIndex,
const rapidjson::Value &  config,
ExportProcessor::Parameters parameters 
) const
overridevirtual

Attempt to parse configuration JSON object and produce a suitable set of parameters. Configuration is format dependent.

Parameters
formatIndexInternal format index
configConfiguration JSON object
parametersWhere to put parameters
Returns
Whether the parsing was successful

Reimplemented from ExportPlugin.

Definition at line 510 of file ExportPCM.cpp.

511{
512 if(formatIndex == FMT_WAV)
513 {
514 //no parameters available...
515 parameters = {};
516 return true;
517 }
518 return false;
519}

References anonymous_namespace{ExportPCM.cpp}::FMT_WAV.


The documentation for this class was generated from the following file: