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

Public Member Functions

 ExportWavPack ()
 
int GetFormatCount () const override
 
FormatInfo GetFormatInfo (int) 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) const override
 
bool ParseConfig (int formatIndex, const rapidjson::Value &document, 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 280 of file ExportWavPack.cpp.

Constructor & Destructor Documentation

◆ ExportWavPack()

ExportWavPack::ExportWavPack ( )
default

Member Function Documentation

◆ CreateOptionsEditor()

std::unique_ptr< ExportOptionsEditor > ExportWavPack::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 362 of file ExportWavPack.cpp.

363{
364 return std::make_unique<ExportOptionsWavPackEditor>(listener);
365}

◆ CreateProcessor()

std::unique_ptr< ExportProcessor > ExportWavPack::CreateProcessor ( int  format) const
overridevirtual
Parameters
formatControl which of the multiple formats this exporter is capable of exporting should be used. Used where a single export plug-in handles a number of related formats, but they have separate entries in the Format drop-down list box. For example, the options to export to "Other PCM", "AIFF 16 Bit" and "WAV 16 Bit" are all the same libsndfile export plug-in, but with subformat set to 0, 1, and 2 respectively.

Implements ExportPlugin.

Definition at line 367 of file ExportWavPack.cpp.

368{
369 return std::make_unique<WavPackExportProcessor>();
370}

◆ GetFormatCount()

int ExportWavPack::GetFormatCount ( ) const
overridevirtual

Implements ExportPlugin.

Definition at line 301 of file ExportWavPack.cpp.

302{
303 return 1;
304}

◆ GetFormatInfo()

FormatInfo ExportWavPack::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 306 of file ExportWavPack.cpp.

307{
308 return {
309 wxT("WavPack"), XO("WavPack Files"), { wxT("wv") }, 255, true
310 };
311}
wxT("CloseDown"))
XO("Cut/Copy/Paste")

References wxT(), and XO().

Here is the call graph for this function:

◆ GetMimeTypes()

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

Reimplemented from ExportPlugin.

Definition at line 313 of file ExportWavPack.cpp.

314{
315 return { "audio/x-wavpack" };
316}

◆ ParseConfig()

bool ExportWavPack::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 318 of file ExportWavPack.cpp.

319{
320 if(!config.IsObject() ||
321 !config.HasMember("quality") || !config["quality"].IsNumber() ||
322 !config.HasMember("bit_rate") || !config["bit_rate"].IsNumber() ||
323 !config.HasMember("bit_depth") || !config["bit_depth"].IsNumber() ||
324 !config.HasMember("hybrid_mode") || !config["hybrid_mode"].IsBool())
325 return false;
326
327 const auto quality = ExportValue(config["quality"].GetInt());
328 const auto bitRate = ExportValue(config["bit_rate"].GetInt());
329 const auto bitDepth = ExportValue(config["bit_depth"].GetInt());
330 const auto hybridMode = ExportValue(config["hybrid_mode"].GetBool());
331
332 for(const auto& option : ExportWavPackOptions)
333 {
334 if((option.id == OptionIDQuality &&
335 std::find(option.values.begin(),
336 option.values.end(),
337 quality) == option.values.end())
338 ||
339 (option.id == OptionIDBitRate &&
340 std::find(option.values.begin(),
341 option.values.end(),
342 bitRate) == option.values.end())
343 ||
344 (option.id == OptionIDBitDepth &&
345 std::find(option.values.begin(),
346 option.values.end(),
347 bitDepth) == option.values.end()))
348 return false;
349 }
351 { OptionIDQuality, quality },
352 { OptionIDBitRate, bitRate },
353 { OptionIDBitDepth, bitDepth },
354 { OptionIDHybridMode, hybridMode },
355 { OptionIDCreateCorrection, false }
356 };
357 std::swap(parameters, result);
358 return true;
359}
std::variant< bool, int, double, std::string > ExportValue
A type of option values (parameters) used by exporting plugins.
Definition: ExportTypes.h:38
std::vector< std::tuple< ExportOptionID, ExportValue > > Parameters
Definition: ExportPlugin.h:93
const std::initializer_list< ExportOption > ExportWavPackOptions
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
Definition: NoteTrack.cpp:628

References anonymous_namespace{ExportWavPack.cpp}::ExportWavPackOptions, anonymous_namespace{ExportWavPack.cpp}::OptionIDBitDepth, anonymous_namespace{ExportWavPack.cpp}::OptionIDBitRate, anonymous_namespace{ExportWavPack.cpp}::OptionIDCreateCorrection, anonymous_namespace{ExportWavPack.cpp}::OptionIDHybridMode, anonymous_namespace{ExportWavPack.cpp}::OptionIDQuality, and anonymous_namespace{NoteTrack.cpp}::swap().

Here is the call graph for this function:

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