Audacity
3.0.3
|
A BlockFile that reads and writes uncompressed data using libsndfile. More...
#include <SimpleBlockFile.h>
Public Member Functions | |
SimpleBlockFile (wxFileNameWrapper &&baseFileName, samplePtr sampleData, size_t sampleLen, sampleFormat format) | |
Create a disk file and write summary and sample data to it. More... | |
SimpleBlockFile (wxFileNameWrapper &&existingFile, size_t len, float min, float max, float rms) | |
Create the memory structure to refer to the given block file. More... | |
virtual | ~SimpleBlockFile () |
bool | ReadSummary (ArrayOf< char > &data) override |
Read the summary section of the disk file. More... | |
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. More... | |
BlockFilePtr | Copy (wxFileNameWrapper &&newFileName) override |
Create a NEW block file identical to this one. More... | |
void | SaveXML (XMLWriter &xmlFile) override |
Write an XML representation of this file. More... | |
DiskByteCount | GetSpaceUsage () const override |
void | Recover () override |
Static Public Member Functions | |
static BlockFilePtr | BuildFromXML (DirManager &dm, const wxChar **attrs) |
static More... | |
Protected Member Functions | |
bool | WriteSimpleBlockFile (samplePtr sampleData, size_t sampleLen, sampleFormat format, void *summaryData) |
Private Attributes | |
sampleFormat | mFormat |
A BlockFile that reads and writes uncompressed data using libsndfile.
A block file that writes the audio data to an .au file and reads it back using libsndfile.
There are two ways to construct a simple block file. One is to supply data and have the constructor write the file. The other is for when the file already exists and we simply want to create the data structure to refer to it.
Definition at line 34 of file SimpleBlockFile.h.
SimpleBlockFile::SimpleBlockFile | ( | wxFileNameWrapper && | baseFileName, |
samplePtr | sampleData, | ||
size_t | sampleLen, | ||
sampleFormat | format | ||
) |
Create a disk file and write summary and sample data to it.
Constructs a SimpleBlockFile based on sample data and writes it to disk.
baseFileName | The filename to use, but without an extension. This constructor will add the appropriate extension (.au in this case). |
sampleData | The sample data to be written to this block. |
sampleLen | The number of samples to be written to this block. |
format | The format of the given samples. |
allowDeferredWrite | Allow deferred write-caching |
Definition at line 77 of file SimpleBlockFile.cpp.
SimpleBlockFile::SimpleBlockFile | ( | wxFileNameWrapper && | existingFile, |
size_t | len, | ||
float | min, | ||
float | max, | ||
float | rms | ||
) |
Create the memory structure to refer to the given block file.
Construct a SimpleBlockFile memory structure that will point to an existing block file. This file must exist and be a valid block file.
existingFile | The disk file this SimpleBlockFile should use. |
Definition at line 97 of file SimpleBlockFile.cpp.
|
virtual |
Definition at line 109 of file SimpleBlockFile.cpp.
|
static |
static
Definition at line 292 of file SimpleBlockFile.cpp.
References Internat::CompatibleToDouble(), XMLValueChecker::IsGoodFileString(), XMLValueChecker::IsGoodInt(), XMLValueChecker::IsGoodString(), min(), and PLATFORM_MAX_PATH.
|
override |
Create a NEW block file identical to this one.
Create a copy of this BlockFile, but using a different disk file.
newFileName | The name of the NEW file to use. |
Definition at line 339 of file SimpleBlockFile.cpp.
Referenced by ODDecodeBlockFile::Copy().
|
override |
Definition at line 347 of file SimpleBlockFile.cpp.
References AU_SAMPLE_FORMAT_16, AU_SAMPLE_FORMAT_24, auHeader::encoding, floatSample, int16Sample, int24Sample, auHeader::magic, mFormat, SAMPLE_SIZE_DISK, and SwapUintEndianess().
|
override |
Read the data section of the disk file.
Read the data portion of the block file using libsndfile. Convert it to the given format if it is not already.
data | The buffer where the data will be stored |
format | The format the data will be stored in |
start | The offset in this block file |
len | The number of samples to read |
Definition at line 267 of file SimpleBlockFile.cpp.
References format.
Referenced by ODDecodeBlockFile::ReadData().
|
override |
Read the summary section of the disk file.
Read the summary section of the disk file.
*data | The buffer to write the data to. It must be at least mSummaryinfo.totalSummaryBytes long. |
Definition at line 226 of file SimpleBlockFile.cpp.
References Optional< X >::emplace(), and ArrayOf< X >::reinit().
Referenced by ODDecodeBlockFile::ReadSummary().
|
override |
Definition at line 398 of file SimpleBlockFile.cpp.
References AU_SAMPLE_FORMAT_16, auHeader::channels, auHeader::dataOffset, auHeader::dataSize, auHeader::encoding, auHeader::magic, and auHeader::sampleRate.
|
override |
Write an XML representation of this file.
Definition at line 274 of file SimpleBlockFile.cpp.
References XMLWriter::EndTag(), XMLWriter::StartTag(), and XMLWriter::WriteAttr().
Referenced by ODDecodeBlockFile::SaveXML().
|
protected |
Definition at line 113 of file SimpleBlockFile.cpp.
References AU_SAMPLE_FORMAT_16, AU_SAMPLE_FORMAT_24, AU_SAMPLE_FORMAT_FLOAT, auHeader::channels, auHeader::dataOffset, auHeader::dataSize, auHeader::encoding, floatSample, format, int16Sample, int24Sample, auHeader::magic, SAMPLE_SIZE, and auHeader::sampleRate.
Referenced by ODDecodeBlockFile::WriteODDecodeBlockFile().
|
mutableprivate |
Definition at line 73 of file SimpleBlockFile.h.
Referenced by GetSpaceUsage().