1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-05 19:21:59 +01:00
This commit is contained in:
Paul Licameli
2016-02-18 12:57:40 -05:00
parent e3e10f1fc1
commit a8652c5e74
8 changed files with 130 additions and 142 deletions

View File

@@ -80,37 +80,37 @@ int PCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format,
return len;
}
wxLogNull *silence=0;
if(mSilentAliasLog)silence= new wxLogNull();
memset(&info, 0, sizeof(info));
wxFile f; // will be closed when it goes out of scope
SNDFILE *sf = NULL;
{
Maybe<wxLogNull> silence{};
if (mSilentAliasLog)
silence.create();
if (f.Exists(mAliasedFileName.GetFullPath())) { // Don't use Open if file does not exits
if (f.Open(mAliasedFileName.GetFullPath())) {
// Even though there is an sf_open() that takes a filename, use the one that
// takes a file descriptor since wxWidgets can open a file with a Unicode name and
// libsndfile can't (under Windows).
ODManager::LockLibSndFileMutex();
sf = sf_open_fd(f.fd(), SFM_READ, &info, FALSE);
ODManager::UnlockLibSndFileMutex();
memset(&info, 0, sizeof(info));
if (f.Exists(mAliasedFileName.GetFullPath())) { // Don't use Open if file does not exits
if (f.Open(mAliasedFileName.GetFullPath())) {
// Even though there is an sf_open() that takes a filename, use the one that
// takes a file descriptor since wxWidgets can open a file with a Unicode name and
// libsndfile can't (under Windows).
ODManager::LockLibSndFileMutex();
sf = sf_open_fd(f.fd(), SFM_READ, &info, FALSE);
ODManager::UnlockLibSndFileMutex();
}
}
if (!sf){
memset(data, 0, SAMPLE_SIZE(format)*len);
silence.reset();
mSilentAliasLog = TRUE;
// Set a marker to display an error message for the silence
if (!wxGetApp().ShouldShowMissingAliasedFileWarning())
wxGetApp().MarkAliasedFilesMissingWarning(this);
return len;
}
}
if (!sf){
memset(data,0,SAMPLE_SIZE(format)*len);
if(silence) delete silence;
mSilentAliasLog=TRUE;
// Set a marker to display an error message for the silence
if (!wxGetApp().ShouldShowMissingAliasedFileWarning())
wxGetApp().MarkAliasedFilesMissingWarning(this);
return len;
}
if(silence) delete silence;
mSilentAliasLog=FALSE;
ODManager::LockLibSndFileMutex();