Audacity  2.2.0
FileFormats.cpp File Reference

Works with libsndfile to provide encoding and other file information. More...

#include "Audacity.h"
#include "MemoryX.h"
#include <wx/arrstr.h>
#include <wx/intl.h>
#include "sndfile.h"
#include "FileFormats.h"
#include "Internat.h"
#include <wx/msgdlg.h>

Functions

int sf_num_headers ()
 Get the number of container formats supported by libsndfile. More...
 
wxString sf_header_index_name (int format)
 Get the name of a container format from libsndfile. More...
 
unsigned int sf_header_index_to_type (int i)
 
int sf_num_encodings ()
 Get the number of data encodings libsndfile supports (in any container or none. More...
 
wxString sf_encoding_index_name (int i)
 Get the string name of the data encoding of the requested format. More...
 
unsigned int sf_encoding_index_to_subtype (int i)
 
wxString sf_header_name (int format)
 Get the string name of the specified container format. More...
 
wxString sf_header_shortname (int format)
 Get an abbreviated form of the string name of the specified format. More...
 
wxString sf_header_extension (int format)
 Get the most common file extension for the given format. More...
 
wxString sf_encoding_name (int encoding)
 Get the string name of the specified data encoding. More...
 
int sf_num_simple_formats ()
 
SF_FORMAT_INFO * sf_simple_format (int i)
 
bool sf_subtype_more_than_16_bits (unsigned int format)
 
bool sf_subtype_is_integer (unsigned int format)
 
wxArrayString sf_get_all_extensions ()
 
wxString sf_normalize_name (const char *name)
 

Variables

static SF_FORMAT_INFO g_format_info
 
ODLock libSndFileMutex
 

Detailed Description

Works with libsndfile to provide encoding and other file information.

Function Documentation

wxString sf_encoding_index_name ( int  encoding_num)

Get the string name of the data encoding of the requested format.

uses SFC_GET_FORMAT_SUBTYPE

References sf_normalize_name().

Referenced by ExportPCMOptions::ExportPCMOptions(), ImportRawDialog::ImportRawDialog(), and ExportPCMOptions::OnHeaderChoice().

unsigned int sf_encoding_index_to_subtype ( int  i)
wxString sf_encoding_name ( int  encoding_num)

Get the string name of the specified data encoding.

AND encoding_num with SF_FORMAT_SUBMASK to get only the data encoding and then use SFC_GET_FORMAT_INFO to get the description

Parameters
encoding_numthe libsndfile encoding to get the name for (only the data encoding is used)

References sf_normalize_name().

wxArrayString sf_get_all_extensions ( )
wxString sf_header_extension ( int  format)

Get the most common file extension for the given format.

AND the given format with SF_FORMAT_TYPEMASK to get just the container format, then retreive the most common extension using SFC_GET_FORMAT_INFO.

Parameters
formatthe libsndfile format to get the name for (only the container part is used)

References LAT1CTOWX.

Referenced by ExportPCM::ExportPCM(), and ExportPCM::GetExtension().

wxString sf_header_index_name ( int  format_num)

Get the name of a container format from libsndfile.

Uses SFC_GET_FORMAT_MAJOR in the sf_command() interface. Resulting C string from libsndfile is converted to a wxString

Parameters
format_numThe libsndfile format number for the container format required

References format, and LAT1CTOWX.

Referenced by ExportPCMOptions::ExportPCMOptions().

unsigned int sf_header_index_to_type ( int  i)
wxString sf_header_name ( int  format)

Get the string name of the specified container format.

AND format with SF_FORMAT_TYPEMASK to get only the container format and then use SFC_GET_FORMAT_INFO to get the description

Parameters
formatthe libsndfile format to get the name for (only the container part is used)

References LAT1CTOWX.

Referenced by ExportPCM::Export(), and PCMImportFileHandle::GetFileDescription().

wxString sf_header_shortname ( int  format)

Get an abbreviated form of the string name of the specified format.

Do sf_header_name() then truncate the string at the first space in the name to get just the first word of the format name.

Parameters
formatthe libsndfile format to get the name for (only the container part is used)

References LAT1CTOWX.

wxString sf_normalize_name ( const char *  name)

References LAT1CTOWX.

Referenced by sf_encoding_index_name(), and sf_encoding_name().

int sf_num_encodings ( )

Get the number of data encodings libsndfile supports (in any container or none.

Referenced by ExportPCMOptions::ExportPCMOptions(), ImportRawDialog::ImportRawDialog(), and ExportPCMOptions::OnHeaderChoice().

int sf_num_headers ( )

Get the number of container formats supported by libsndfile.

Uses SFC_GET_FORMAT_MAJOR_COUNT in sf_command interface

Referenced by ExportPCMOptions::ExportPCMOptions().

int sf_num_simple_formats ( )
SF_FORMAT_INFO* sf_simple_format ( int  i)
bool sf_subtype_is_integer ( unsigned int  format)
bool sf_subtype_more_than_16_bits ( unsigned int  format)

Variable Documentation

SF_FORMAT_INFO g_format_info
static

Referenced by sf_simple_format().

ODLock libSndFileMutex