Audacity  2.2.0
LegacyBlockFile.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  LegacyBlockFile.h
6 
7  Dominic Mazzoni
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_LEGACY_BLOCKFILE__
12 #define __AUDACITY_LEGACY_BLOCKFILE__
13 
14 #include <wx/string.h>
15 #include <wx/filename.h>
16 
17 #include "../BlockFile.h"
18 
19 void ComputeLegacySummaryInfo(const wxFileName &fileName,
20  size_t summaryLen,
21  sampleFormat format,
22  SummaryInfo *info,
23  bool noRMS,bool Silent,
24  float *min, float *max, float *rms);
25 
26 
27 //
28 // This class supports loading BlockFiles in one of the old
29 // Audacity BlockFile formats (versions 0.98 through 1.0, or
30 // versions 1.1.0 through 1.1.2). You can load a BlockFile
31 // in this format, and you can save information about it
32 // back to disk, but you can't create a NEW one from NEW
33 // sample data.
34 //
35 class LegacyBlockFile final : public BlockFile {
36  public:
37 
38  // Constructor / Destructor
39 
41  LegacyBlockFile(wxFileNameWrapper &&existingFile,
42  sampleFormat format,
43  size_t summaryLen,
44  size_t len,
45  bool noRMS);
46  virtual ~LegacyBlockFile();
47 
48  // Reading
49 
51  bool ReadSummary(ArrayOf<char> &data) override;
53  size_t ReadData(samplePtr data, sampleFormat format,
54  size_t start, size_t len, bool mayThrow) const override;
55 
57  BlockFilePtr Copy(wxFileNameWrapper &&newFileName) override;
59  void SaveXML(XMLWriter &xmlFile) override;
60  DiskByteCount GetSpaceUsage() const override;
61  void Recover() override;
62 
63  static BlockFilePtr BuildFromXML(const wxString &dir, const wxChar **attrs,
64  size_t len,
65  sampleFormat format);
66 
67  protected:
68  sampleFormat mFormat;
69 };
70 
71 #endif // __AUDACITY_LEGACY_BLOCKFILE__
Audacity 1.1.0 block file format:
Definition: LegacyBlockFile.h:35
A BlockFile is a chunk of immutable audio data.
Definition: BlockFile.h:56
LegacyBlockFile(wxFileNameWrapper &&existingFile, sampleFormat format, size_t summaryLen, size_t len, bool noRMS)
Create the memory structure to refer to the given block file.
Definition: LegacyBlockFile.cpp:127
sampleFormat mFormat
Definition: LegacyBlockFile.h:68
static BlockFilePtr BuildFromXML(const wxString &dir, const wxChar **attrs, size_t len, sampleFormat format)
static
Definition: LegacyBlockFile.cpp:224
void ComputeLegacySummaryInfo(const wxFileName &fileName, size_t summaryLen, sampleFormat format, SummaryInfo *info, bool noRMS, bool Silent, float *min, float *max, float *rms)
Definition: LegacyBlockFile.cpp:39
Definition: wxFileNameWrapper.h:16
unsigned long long DiskByteCount
Definition: BlockFile.h:152
std::shared_ptr< BlockFile > BlockFilePtr
Definition: BlockFile.h:48
int format
Definition: ExportPCM.cpp:56
Works with BlockFile to hold info about max and min and RMS over multiple samples, which in turn allows rapid drawing when zoomed out.
Definition: BlockFile.h:30
size_t ReadData(samplePtr data, sampleFormat format, size_t start, size_t len, bool mayThrow) const override
Read the data section of the disk file.
Definition: LegacyBlockFile.cpp:196
int min(int a, int b)
Definition: CompareAudioCommand.cpp:80
void Recover() override
if the on-disk state disappeared, either recover it (if it was
Definition: LegacyBlockFile.cpp:280
DiskByteCount GetSpaceUsage() const override
Definition: LegacyBlockFile.cpp:274
bool ReadSummary(ArrayOf< char > &data) override
Read the summary section of the disk file.
Definition: LegacyBlockFile.cpp:158
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Definition: XMLWriter.h:22
BlockFilePtr Copy(wxFileNameWrapper &&newFileName) override
Create a NEW block file identical to this one.
Definition: LegacyBlockFile.cpp:266
void SaveXML(XMLWriter &xmlFile) override
Write an XML representation of this file.
Definition: LegacyBlockFile.cpp:206
virtual ~LegacyBlockFile()
Definition: LegacyBlockFile.cpp:149