Audacity  2.2.0
FileFormats.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  FileFormats.h
6 
7  Dominic Mazzoni
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_FILE_FORMATS__
12 #define __AUDACITY_FILE_FORMATS__
13 
14 #include <wx/list.h>
15 #include <wx/arrstr.h>
16 #include <wx/string.h>
17 
18 #include "Audacity.h"
19 
20 #include "sndfile.h"
21 
22 //
23 // enumerating headers
24 //
25 
29 int sf_num_headers();
30 
38 wxString sf_header_index_name(int format_num);
39 
40 unsigned int sf_header_index_to_type(int format_num);
41 
42 //
43 // enumerating encodings
44 //
47 int sf_num_encodings();
51 wxString sf_encoding_index_name(int encoding_num);
52 unsigned int sf_encoding_index_to_subtype(int encoding_num);
53 
54 //
55 // getting info about an actual SF format
56 //
63 wxString sf_header_name(int format);
70 wxString sf_header_shortname(int format);
77 wxString sf_header_extension(int format);
84 wxString sf_encoding_name(int encoding_num);
85 
86 //
87 // simple formats
88 //
89 
91 SF_FORMAT_INFO *sf_simple_format(int i);
92 
93 //
94 // other utility functions
95 //
96 
97 bool sf_subtype_more_than_16_bits(unsigned int format);
98 bool sf_subtype_is_integer(unsigned int format);
99 
100 wxArrayString sf_get_all_extensions();
101 
102 wxString sf_normalize_name(const char *name);
103 
104 //
105 // Mac OS 4-char type
106 //
107 
108 #ifdef __WXMAC__
109 # ifdef __UNIX__
110 # include <CoreServices/CoreServices.h>
111 # else
112 # include <Types.h>
113 # endif
114 
115 OSType sf_header_mactype(int format);
116 #endif
117 
118 // This function wrapper uses a mutex to serialize calls to the SndFile library.
119 #include "MemoryX.h"
120 #include "ondemand/ODTaskThread.h"
121 extern ODLock libSndFileMutex;
122 template<typename R, typename F, typename... Args>
123 inline R SFCall(F fun, Args&&... args)
124 {
125  ODLocker locker{ &libSndFileMutex };
126  return fun(std::forward<Args>(args)...);
127 }
128 
129 //RAII for SNDFILE*
130 struct SFFileCloser { void operator () (SNDFILE*) const; };
131 using SFFile = std::unique_ptr<SNDFILE, SFFileCloser>;
132 
133 #endif
unsigned int sf_encoding_index_to_subtype(int encoding_num)
Definition: FileFormats.cpp:94
wxString sf_header_extension(int format)
Get the most common file extension for the given format.
Definition: FileFormats.cpp:145
wxString sf_normalize_name(const char *name)
Definition: FileFormats.cpp:238
wxArrayString sf_get_all_extensions()
Definition: FileFormats.cpp:206
R SFCall(F fun, Args &&...args)
Definition: FileFormats.h:123
int sf_num_headers()
Get the number of container formats supported by libsndfile.
Definition: FileFormats.cpp:36
void operator()(SNDFILE *) const
Definition: FileFormats.cpp:291
int format
Definition: ExportPCM.cpp:56
int sf_num_simple_formats()
Definition: FileFormats.cpp:167
int sf_num_encodings()
Get the number of data encodings libsndfile supports (in any container or none.
Definition: FileFormats.cpp:74
wxString sf_header_name(int format)
Get the string name of the specified container format.
Definition: FileFormats.cpp:110
Definition: ODTaskThread.h:182
wxString sf_header_index_name(int format_num)
Get the name of a container format from libsndfile.
Definition: FileFormats.cpp:46
std::unique_ptr< SNDFILE, SFFileCloser > SFFile
Definition: FileFormats.h:131
wxString sf_encoding_name(int encoding_num)
Get the string name of the specified data encoding.
Definition: FileFormats.cpp:156
SF_FORMAT_INFO * sf_simple_format(int i)
Definition: FileFormats.cpp:178
bool sf_subtype_more_than_16_bits(unsigned int format)
Definition: FileFormats.cpp:189
ODLock libSndFileMutex
Definition: FileFormats.cpp:289
Definition: ODTaskThread.h:150
const wxChar * name
Definition: Distortion.cpp:94
Definition: FileFormats.h:130
unsigned int sf_header_index_to_type(int format_num)
Definition: FileFormats.cpp:58
wxString sf_header_shortname(int format)
Get an abbreviated form of the string name of the specified format.
Definition: FileFormats.cpp:121
wxString sf_encoding_index_name(int encoding_num)
Get the string name of the data encoding of the requested format.
Definition: FileFormats.cpp:83
bool sf_subtype_is_integer(unsigned int format)
Definition: FileFormats.cpp:198