Audacity  3.0.3
ODPCMAliasBlockFile.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  ODPCMAliasBlockFile.cpp
6 
7  Created by Michael Chinen (mchinen)
8  Audacity(R) is copyright (c) 1999-2008 Audacity Team.
9  License: GPL v2. See License.txt.
10 
11 ******************************************************************//*******************************************************************/
18 
19 #include "../Audacity.h"
20 #include "ODPCMAliasBlockFile.h"
21 
22 #include <float.h>
23 
24 #include <wx/file.h>
25 #include <wx/utils.h>
26 #include <wx/wxcrtvararg.h>
27 #include <wx/log.h>
28 #include <wx/thread.h>
29 #include <sndfile.h>
30 
31 #include "../DirManager.h"
32 #include "../FileFormats.h"
33 
34 #include "../ondemand/ODManager.h"
35 
37 
38 //#include <errno.h>
39 
40 const int aheaderTagLen = 20;
41 char aheaderTag[aheaderTagLen + 1] = "AudacityBlockFile112";
42 
43 
45  wxFileNameWrapper &&fileName,
46  wxFileNameWrapper &&aliasedFileName,
47  sampleCount aliasStart,
48  size_t aliasLen, int aliasChannel)
49 : PCMAliasBlockFile { std::move(fileName), std::move(aliasedFileName),
50  aliasStart, aliasLen, aliasChannel, false }
51 {
52  mSummaryAvailable = mSummaryBeingComputed = mHasBeenSaved = false;
53 }
54 
57  wxFileNameWrapper &&existingSummaryFileName,
58  wxFileNameWrapper &&aliasedFileName,
59  sampleCount aliasStart,
60  size_t aliasLen, int aliasChannel,
61  float min, float max, float rms, bool summaryAvailable)
62 : PCMAliasBlockFile(std::move(existingSummaryFileName), std::move(aliasedFileName),
63  aliasStart, aliasLen,
64  aliasChannel, min, max, rms)
65 {
66  mSummaryAvailable=summaryAvailable;
68  }
69 
71 {
72 }
73 
74 
75 
76 //Check to see if we have the file for these calls.
77 auto ODPCMAliasBlockFile::GetSpaceUsage() const -> DiskByteCount
78 {
79  if(IsSummaryAvailable())
80  {
81  DiskByteCount ret;
82  mFileNameMutex.Lock();
83  wxFFile summaryFile(mFileName.GetFullPath());
84  ret= summaryFile.Length();
85  mFileNameMutex.Unlock();
86  return ret;
87  }
88  else
89  {
90  return 0;
91  }
92 }
93 
97 {
99  PCMAliasBlockFile::Lock();
100 }
101 
102 //when the file closes, it locks the blockfiles, but only conditionally.
103 // It calls this so we can check if it has been saved before.
105 {
106  if(mHasBeenSaved)
107  PCMAliasBlockFile::Lock();
108 }
109 
110 
114 {
115  if(IsSummaryAvailable() && IsLocked())
116  PCMAliasBlockFile::Unlock();
117 }
118 
119 
122  size_t start, size_t len, bool mayThrow) const -> MinMaxRMS
123 {
124  if(IsSummaryAvailable())
125  {
126  return PCMAliasBlockFile::GetMinMaxRMS(start, len, mayThrow);
127  }
128  else
129  {
130  if (mayThrow)
131  throw NotYetAvailableException{ GetAliasedFileName() };
132 
133  //fake values. These values are used usually for normalization and amplifying, so we want
134  //the max to be maximal and the min to be minimal
135  return {
136  -JUST_BELOW_MAX_AUDIO,
137  JUST_BELOW_MAX_AUDIO,
138  0.707f //sin with amp of 1 rms
139  };
140  }
141 }
142 
144 auto ODPCMAliasBlockFile::GetMinMaxRMS(bool mayThrow) const -> MinMaxRMS
145 {
146  if(IsSummaryAvailable())
147  {
148  return PCMAliasBlockFile::GetMinMaxRMS(mayThrow);
149  }
150  else
151  {
152  if (mayThrow)
153  throw NotYetAvailableException{ GetAliasedFileName() };
154 
155  //fake values. These values are used usually for normalization and amplifying, so we want
156  //the max to be maximal and the min to be minimal
157  return {
158  -JUST_BELOW_MAX_AUDIO,
159  JUST_BELOW_MAX_AUDIO,
160  0.707f //sin with amp of 1 rms
161  };
162  }
163 }
164 
167 bool ODPCMAliasBlockFile::Read256(float *buffer, size_t start, size_t len)
168 {
169  if(IsSummaryAvailable())
170  {
171  return PCMAliasBlockFile::Read256(buffer,start,len);
172  }
173  else
174  {
175  //return nothing.
176  ClearSamples((samplePtr)buffer, floatSample, 0, len);
177  return false;
178  }
179 }
180 
183 bool ODPCMAliasBlockFile::Read64K(float *buffer, size_t start, size_t len)
184 {
185  if(IsSummaryAvailable())
186  {
187  return PCMAliasBlockFile::Read64K(buffer,start,len);
188  }
189  else
190  {
191  //return nothing - it hasn't been calculated yet
192  ClearSamples((samplePtr)buffer, floatSample, 0, len);
193  return false;
194  }
195 }
196 
201 BlockFilePtr ODPCMAliasBlockFile::Copy(wxFileNameWrapper &&newFileName)
202 {
203  BlockFilePtr newBlockFile;
204 
205  //mAliasedFile can change so we lock readdatamutex, which is responsible for it.
206  auto locker = LockForRead();
207  //If the file has been written AND it has been saved, we create a PCM alias blockfile because for
208  //all intents and purposes, it is the same.
209  //However, if it hasn't been saved yet, we shouldn't create one because the default behavior of the
210  //PCMAliasBlockFile is to lock on exit, and this will cause orphaned blockfiles..
212  {
213  newBlockFile = make_blockfile<PCMAliasBlockFile>
214  (std::move(newFileName), wxFileNameWrapper{mAliasedFileName},
215  mAliasStart, mLen, mAliasChannel, mMin, mMax, mRMS);
216 
217  }
218  else
219  {
220  //Summary File might exist in this case, but it might not.
221  newBlockFile = make_blockfile<ODPCMAliasBlockFile>
222  (std::move(newFileName), wxFileNameWrapper{mAliasedFileName},
223  mAliasStart, mLen, mAliasChannel, mMin, mMax, mRMS,
225  //The client code will need to schedule this blockfile for OD summarizing if it is going to a NEW track.
226  }
227 
228  return newBlockFile;
229 }
230 
231 
237 // may throw
238 {
239  //we lock this so that mAliasedFileName doesn't change.
240  auto locker = LockForRead();
241  if(IsSummaryAvailable())
242  {
244  mHasBeenSaved = true;
245  }
246  else
247  {
248  xmlFile.StartTag(wxT("odpcmaliasblockfile"));
249 
250  //unlock to prevent deadlock and resume lock after.
251  {
252  auto suspension = locker.Suspend();
253  ODLocker locker2 { &mFileNameMutex };
254  xmlFile.WriteAttr(wxT("summaryfile"), mFileName.GetFullName());
255  }
256 
257  xmlFile.WriteAttr(wxT("aliasfile"), mAliasedFileName.GetFullPath());
258  xmlFile.WriteAttr(wxT("aliasstart"),
259  mAliasStart.as_long_long());
260  xmlFile.WriteAttr(wxT("aliaslen"), mLen);
261  xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
262 
263  xmlFile.EndTag(wxT("odpcmaliasblockfile"));
264  }
265 }
266 
269 // BuildFromXML methods should always return a BlockFile, not NULL,
270 // even if the result is flawed (e.g., refers to nonexistent file),
271 // as testing will be done in ProjectFSCK().
272 BlockFilePtr ODPCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs)
273 {
274  wxFileNameWrapper summaryFileName;
275  wxFileNameWrapper aliasFileName;
276  sampleCount aliasStart = 0;
277  size_t aliasLen = 0;
278  int aliasChannel=0;
279  long nValue;
280  long long nnValue;
281 
282  while(*attrs)
283  {
284  const wxChar *attr = *attrs++;
285  const wxChar *value = *attrs++;
286  if (!value)
287  break;
288 
289  const wxString strValue = value;
290  if (!wxStricmp(attr, wxT("summaryfile")) &&
291  // Can't use XMLValueChecker::IsGoodFileName here, but do part of its test.
293  (strValue.length() + 1 + dm.GetProjectDataDir().length() <= PLATFORM_MAX_PATH))
294  {
295  if (!dm.AssignFile(summaryFileName, strValue, false))
296  // Make sure summaryFileName is back to uninitialized state so we can detect problem later.
297  summaryFileName.Clear();
298  }
299  else if( !wxStricmp(attr, wxT("aliasfile")) )
300  {
301  if (XMLValueChecker::IsGoodPathName(strValue))
302  aliasFileName.Assign(strValue);
303  else if (XMLValueChecker::IsGoodFileName(strValue, dm.GetProjectDataDir()))
304  // Allow fallback of looking for the file name, located in the data directory.
305  aliasFileName.Assign(dm.GetProjectDataDir(), strValue);
306  else if (XMLValueChecker::IsGoodPathString(strValue))
307  // If the aliased file is missing, we failed XMLValueChecker::IsGoodPathName()
308  // and XMLValueChecker::IsGoodFileName, because both do existence tests,
309  // but we want to keep the reference to the missing file because it's a good path string.
310  aliasFileName.Assign(strValue);
311  }
312  else if ( !wxStricmp(attr, wxT("aliasstart")) )
313  {
314  if (XMLValueChecker::IsGoodInt64(strValue) &&
315  strValue.ToLongLong(&nnValue) && (nnValue >= 0))
316  aliasStart = nnValue;
317  }
318  else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
319  { // integer parameters
320  if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
321  aliasLen = nValue;
322  else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
323  aliasChannel = nValue;
324  }
325  }
326 
327  return make_blockfile<ODPCMAliasBlockFile>
328  (std::move(summaryFileName), std::move(aliasFileName),
329  aliasStart, aliasLen, aliasChannel, 0, 0, 0, false);
330 }
331 
332 
333 
335 {
336  if(IsSummaryAvailable())
337  {
338  WriteSummary();
339  }
340 }
341 
343 {
344  bool retval;
345  mSummaryAvailableMutex.Lock();
346  retval= mSummaryAvailable;
347  mSummaryAvailableMutex.Unlock();
348  return retval;
349 }
350 
353 {
354  ODLocker locker { &mWriteSummaryMutex };
355  if(!IsSummaryAvailable())
356  WriteSummary();
357 }
358 
361 {
362  mFileNameMutex.Lock();
363  mFileName = std::move(name);
364  mFileNameMutex.Unlock();
365 }
366 
368 auto ODPCMAliasBlockFile::GetFileName() const -> GetFileNameResult
369 {
370  return { mFileName, ODLocker{ &mFileNameMutex } };
371 }
372 
375 {
376  // To build the summary data, call ReadData (implemented by the
377  // derived classes) to get the sample data
378  // Call this first, so that in case of exceptions from ReadData, there is
379  // no NEW output file
380  SampleBuffer sampleData(mLen, floatSample);
381  this->ReadData(sampleData.ptr(), floatSample, 0, mLen, true);
382 
383  ArrayOf< char > fileNameChar;
384  FILE *summaryFile{};
385  {
386  //the mFileName path may change, for example, when the project is saved.
387  //(it moves from /tmp/ to wherever it is saved to.
388  ODLocker locker { &mFileNameMutex };
389 
390  //wxFFile is not thread-safe - if any error occurs in opening the file,
391  // it posts a wxlog message which WILL crash
392  // Audacity because it goes into the wx GUI.
393  // For this reason I left the wxFFile method commented out. (mchinen)
394  // wxFFile summaryFile(mFileName.GetFullPath(), wxT("wb"));
395 
396  // ...and we use fopen instead.
397  wxString sFullPath = mFileName.GetFullPath();
398  fileNameChar.reinit( strlen(sFullPath.mb_str(wxConvFile)) + 1 );
399  strcpy(fileNameChar.get(), sFullPath.mb_str(wxConvFile));
400  summaryFile = fopen(fileNameChar.get(), "wb");
401  }
402 
403  // JKC ANSWER-ME: Whay is IsOpened() commented out?
404  if (!summaryFile){//.IsOpened() ){
405 
406  // Never silence the Log w.r.t write errors; they always count
407  //however, this is going to be called from a non-main thread,
408  //and wxLog calls are not thread safe.
409  wxPrintf("Unable to write summary data to file: %s", fileNameChar.get());
410 
411  throw FileException{
412  FileException::Cause::Open, wxFileName{ fileNameChar.get() } };
413  }
414 
415  ArrayOf<char> cleanup;
416  void *summaryData = CalcSummary(sampleData.ptr(), mLen,
417  floatSample, cleanup);
418 
419  //summaryFile.Write(summaryData, mSummaryInfo.totalSummaryBytes);
420  fwrite(summaryData, 1, mSummaryInfo.totalSummaryBytes, summaryFile);
421  fclose(summaryFile);
422 
423 
424  // wxPrintf("write successful. filename: %s\n", fileNameChar);
425 
426  mSummaryAvailableMutex.Lock();
427  mSummaryAvailable=true;
428  mSummaryAvailableMutex.Unlock();
429 }
430 
431 
432 
452 {
453  cleanup.reinit(mSummaryInfo.totalSummaryBytes);
454  char* localFullSummary = cleanup.get();
455 
456  memcpy(localFullSummary, aheaderTag, aheaderTagLen);
457 
458  float *summary64K = (float *)(localFullSummary + mSummaryInfo.offset64K);
459  float *summary256 = (float *)(localFullSummary + mSummaryInfo.offset256);
460 
461  Floats floats;
462  float *fbuffer;
463 
464  //mchinen: think we can hack this - don't allocate and copy if we don't need to.,
465  if(format==floatSample)
466  {
467  fbuffer = (float*)buffer;
468  }
469  else
470  {
471  floats.reinit(len);
472  fbuffer = floats.get();
473  CopySamples(buffer, format,
474  (samplePtr)fbuffer, floatSample, len);
475  }
476 
477  BlockFile::CalcSummaryFromBuffer(fbuffer, len, summary256, summary64K);
478 
479  return localFullSummary;
480 }
481 
482 
483 
484 
494  size_t start, size_t len, bool mayThrow) const
495 {
496 
497  auto locker = LockForRead();
498 
499  if(!mAliasedFileName.IsOk()){ // intentionally silenced
500  memset(data,0,SAMPLE_SIZE(format)*len);
501  return len;
502  }
503 
504  return CommonReadData( mayThrow,
505  mAliasedFileName, mSilentAliasLog, this, mAliasStart, mAliasChannel,
506  data, format, start, len);
507 }
508 
516 {
517  data.reinit( mSummaryInfo.totalSummaryBytes );
518 
519  ODLocker locker{ &mFileNameMutex };
520  wxFFile summaryFile(mFileName.GetFullPath(), wxT("rb"));
521 
522  if( !summaryFile.IsOpened() ) {
523 
524  // NEW model; we need to return valid data
525  memset(data.get(), 0, mSummaryInfo.totalSummaryBytes);
526 
527  // we silence the logging for this operation in this object
528  // after first occurrence of error; it's already reported and
529  // spewing at the user will complicate the user's ability to
530  // deal
531  mSilentLog = TRUE;
532 
533  return false;
534  }
535  else
536  mSilentLog = FALSE; // worked properly, any future error is NEW
537 
538  auto read = summaryFile.Read(data.get(), mSummaryInfo.totalSummaryBytes);
539 
540  if (read != mSummaryInfo.totalSummaryBytes) {
541  memset(data.get(), 0, mSummaryInfo.totalSummaryBytes);
542  return false;
543  }
544 
545  FixSummary(data.get());
546 
547  return true;
548 }
549 
552 {
553  mReadDataMutex.Lock();
554 }
557 {
558  mReadDataMutex.Unlock();
559 }
560 
561 static DirManager::RegisteredBlockFileDeserializer sRegistration {
562  "odpcmaliasblockfile",
563  []( DirManager &dm, const wxChar **attrs ){
564  auto result = ODPCMAliasBlockFile::BuildFromXML( dm, attrs );
565  //in the case of loading an OD file, we need to schedule the ODManager to begin OD computing of summary
566  //However, because we don't have access to the track or even the Sequence from this call, we mark a flag
567  //in the ODMan and check it later.
569  return result;
570  }
571 };
572 
XMLWriter
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Definition: XMLWriter.h:23
XMLWriter::EndTag
virtual void EndTag(const wxString &name)
Definition: XMLWriter.cpp:99
ClearSamples
void ClearSamples(samplePtr dst, sampleFormat format, size_t start, size_t len)
Definition: SampleFormat.cpp:77
aheaderTag
char aheaderTag[aheaderTagLen+1]
Definition: ODPCMAliasBlockFile.cpp:41
ODPCMAliasBlockFile::mReadDataMutex
ODLock mReadDataMutex
Definition: ODPCMAliasBlockFile.h:152
aheaderTagLen
const int aheaderTagLen
Definition: ODPCMAliasBlockFile.cpp:40
wxFileNameWrapper
Definition: wxFileNameWrapper.h:21
XMLValueChecker::IsGoodInt
static bool IsGoodInt(const wxString &strInt)
Check that the supplied string can be converted to a long (32bit) integer.
Definition: XMLTagHandler.cpp:157
ODPCMAliasBlockFile::Copy
BlockFilePtr Copy(wxFileNameWrapper &&fileName) override
Makes NEW ODPCMAliasBlockFile or PCMAliasBlockFile depending on summary availability.
Definition: ODPCMAliasBlockFile.cpp:201
XMLValueChecker::IsGoodPathName
static bool IsGoodPathName(const FilePath &strPathName)
Definition: XMLTagHandler.cpp:98
NotYetAvailableException
Definition: NotYetAvailableException.h:17
ODPCMAliasBlockFile::ReadData
size_t ReadData(samplePtr data, sampleFormat format, size_t start, size_t len, bool mayThrow) const override
Reads the specified data from the aliased file using libsndfile.
Definition: ODPCMAliasBlockFile.cpp:493
ODPCMAliasBlockFile::GetSpaceUsage
DiskByteCount GetSpaceUsage() const override
Definition: ODPCMAliasBlockFile.cpp:77
ODPCMAliasBlockFile::IsSummaryAvailable
bool IsSummaryAvailable() const override
Definition: ODPCMAliasBlockFile.cpp:342
PCMAliasBlockFile
An AliasBlockFile that references uncompressed data in an existing file.
Definition: PCMAliasBlockFile.h:20
ODPCMAliasBlockFile::ODPCMAliasBlockFile
ODPCMAliasBlockFile(wxFileNameWrapper &&baseFileName, wxFileNameWrapper &&aliasedFileName, sampleCount aliasStart, size_t aliasLen, int aliasChannel)
Constructs a PCMAliasBlockFile, writing the summary to disk.
Definition: ODPCMAliasBlockFile.cpp:44
ArrayOf::reinit
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:57
FileException
Thrown for failure of file or database operations in deeply nested places.
Definition: FileException.h:19
ODPCMAliasBlockFile::mSummaryBeingComputed
bool mSummaryBeingComputed
Definition: ODPCMAliasBlockFile.h:156
XMLValueChecker::IsGoodInt64
static bool IsGoodInt64(const wxString &strInt)
Check that the supplied string can be converted to a 64bit integer.
Definition: XMLTagHandler.cpp:163
SAMPLE_SIZE
#define SAMPLE_SIZE(SampleFormat)
Definition: SampleFormat.h:44
MinMaxRMS
Definition: SampleBlock.h:32
ODPCMAliasBlockFile::DoWriteSummary
void DoWriteSummary()
A public interface to WriteSummary.
Definition: ODPCMAliasBlockFile.cpp:352
ODPCMAliasBlockFile::mHasBeenSaved
bool mHasBeenSaved
Definition: ODPCMAliasBlockFile.h:157
ODPCMAliasBlockFile::mFileNameMutex
ODLock mFileNameMutex
Definition: ODPCMAliasBlockFile.h:146
floatSample
@ floatSample
Definition: SampleFormat.h:34
ODManager::MarkLoadedODFlag
static void MarkLoadedODFlag()
sets a flag that is set if we have loaded some OD blockfiles from PCM.
Definition: ODManager.cpp:598
ODPCMAliasBlockFile.h
ODPCMAliasBlockFile::mSummaryAvailableMutex
ODLock mSummaryAvailableMutex
Definition: ODPCMAliasBlockFile.h:154
PCMAliasBlockFile::SaveXML
void SaveXML(XMLWriter &xmlFile) override
Definition: PCMAliasBlockFile.cpp:97
CopySamples
void CopySamples(constSamplePtr src, sampleFormat srcFormat, samplePtr dst, sampleFormat dstFormat, size_t len, DitherType ditherType, unsigned int srcStride, unsigned int dstStride)
Copy samples from any format to any other format; apply dithering only if narrowing the format.
Definition: SampleFormat.cpp:111
ODPCMAliasBlockFile::Read64K
bool Read64K(float *buffer, size_t start, size_t len) override
Returns the 64K summary data block.
Definition: ODPCMAliasBlockFile.cpp:183
ODPCMAliasBlockFile::BuildFromXML
static BlockFilePtr BuildFromXML(DirManager &dm, const wxChar **attrs)
Reconstructs from XML a ODPCMAliasBlockFile and reschedules it for OD loading.
Definition: ODPCMAliasBlockFile.cpp:272
name
const TranslatableString name
Definition: Distortion.cpp:98
ODPCMAliasBlockFile::GetFileName
GetFileNameResult GetFileName() const override
sets the file name the summary info will be saved in. threadsafe.
Definition: ODPCMAliasBlockFile.cpp:368
XMLValueChecker::IsGoodFileName
static bool IsGoodFileName(const FilePath &strFileName, const FilePath &strDirName={})
Definition: XMLTagHandler.cpp:58
FileException::Cause::Open
@ Open
ODPCMAliasBlockFile::CalcSummary
void * CalcSummary(samplePtr buffer, size_t len, sampleFormat format, ArrayOf< char > &cleanup) override
Definition: ODPCMAliasBlockFile.cpp:450
format
int format
Definition: ExportPCM.cpp:56
NotYetAvailableException.h
ODLocker
Definition: ODTaskThread.h:120
sRegistration
static DirManager::RegisteredBlockFileDeserializer sRegistration
Definition: ODPCMAliasBlockFile.cpp:561
XMLValueChecker::IsGoodFileString
static bool IsGoodFileString(const FilePath &str)
Definition: XMLTagHandler.cpp:70
ODPCMAliasBlockFile::GetMinMaxRMS
MinMaxRMS GetMinMaxRMS(size_t start, size_t len, bool mayThrow) const override
Gets extreme values for the specified region.
Definition: ODPCMAliasBlockFile.cpp:121
ODPCMAliasBlockFile::CloseLock
void CloseLock() override
Definition: ODPCMAliasBlockFile.cpp:104
SampleBuffer
Definition: SampleFormat.h:69
sampleFormat
sampleFormat
Definition: SampleFormat.h:29
samplePtr
char * samplePtr
Definition: SampleFormat.h:49
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
ODPCMAliasBlockFile::SetFileName
void SetFileName(wxFileNameWrapper &&name) override
sets the file name the summary info will be saved in. threadsafe.
Definition: ODPCMAliasBlockFile.cpp:360
ODPCMAliasBlockFile::UnlockRead
void UnlockRead() const override
Allows reading on other threads.
Definition: ODPCMAliasBlockFile.cpp:556
anonymous_namespace{WaveTrack.cpp}::IsValidChannel
bool IsValidChannel(const int nValue)
Definition: WaveTrack.cpp:1706
sampleCount
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18
ODPCMAliasBlockFile::mSummaryAvailable
bool mSummaryAvailable
Definition: ODPCMAliasBlockFile.h:155
XMLWriter::WriteAttr
void WriteAttr(const wxString &name, const Identifier &value)
Definition: XMLWriter.h:34
ODPCMAliasBlockFile::Read256
bool Read256(float *buffer, size_t start, size_t len) override
Returns the 256 byte summary data block.
Definition: ODPCMAliasBlockFile.cpp:167
PLATFORM_MAX_PATH
#define PLATFORM_MAX_PATH
Definition: FileNames.h:22
ODPCMAliasBlockFile::Unlock
void Unlock() override
Unlocks the blockfile only if it has a file that exists.
Definition: ODPCMAliasBlockFile.cpp:113
ODPCMAliasBlockFile::Recover
void Recover(void) override
Writes the summary file if summary data is available.
Definition: ODPCMAliasBlockFile.cpp:334
ODPCMAliasBlockFile::ReadSummary
bool ReadSummary(ArrayOf< char > &data) override
Read the summary into a buffer.
Definition: ODPCMAliasBlockFile.cpp:515
XMLValueChecker::IsGoodPathString
static bool IsGoodPathString(const FilePath &str)
Definition: XMLTagHandler.cpp:105
ODPCMAliasBlockFile::Lock
void Lock() override
Locks the blockfile only if it has a file that exists.
Definition: ODPCMAliasBlockFile.cpp:96
ODPCMAliasBlockFile::mWriteSummaryMutex
ODLock mWriteSummaryMutex
Definition: ODPCMAliasBlockFile.h:143
ODPCMAliasBlockFile::WriteSummary
void WriteSummary() override
Write the summary to disk, using the derived ReadData() to get the data.
Definition: ODPCMAliasBlockFile.cpp:374
ODPCMAliasBlockFile::SaveXML
void SaveXML(XMLWriter &xmlFile) override
Saves as xml ODPCMAliasBlockFile or PCMAliasBlockFile depending on summary availability.
Definition: ODPCMAliasBlockFile.cpp:236
ArrayOf< char >
XMLWriter::StartTag
virtual void StartTag(const wxString &name)
Definition: XMLWriter.cpp:76
ODPCMAliasBlockFile::~ODPCMAliasBlockFile
virtual ~ODPCMAliasBlockFile()
Definition: ODPCMAliasBlockFile.cpp:70
ODPCMAliasBlockFile::LockRead
void LockRead() const override
Prevents a read on other threads.
Definition: ODPCMAliasBlockFile.cpp:551
SampleBuffer::ptr
samplePtr ptr() const
Definition: SampleFormat.h:98