mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-09 17:07:43 +02:00
Merge branch 'master' of https://github.com/audacity/audacity
This commit is contained in:
commit
78235c9a0e
@ -65,6 +65,10 @@ bool DBConnection::ShouldBypass()
|
|||||||
void DBConnection::SetError(
|
void DBConnection::SetError(
|
||||||
const TranslatableString &msg, const TranslatableString &libraryError)
|
const TranslatableString &msg, const TranslatableString &libraryError)
|
||||||
{
|
{
|
||||||
|
wxLogMessage(wxT("Connection msg: %s"), msg.Debug());
|
||||||
|
if (!libraryError.empty())
|
||||||
|
wxLogMessage(wxT("Connection error: %s"), libraryError.Debug());
|
||||||
|
|
||||||
mpErrors->mLastError = msg;
|
mpErrors->mLastError = msg;
|
||||||
mpErrors->mLibraryError = libraryError;
|
mpErrors->mLibraryError = libraryError;
|
||||||
}
|
}
|
||||||
@ -73,12 +77,12 @@ void DBConnection::SetDBError(
|
|||||||
const TranslatableString &msg, const TranslatableString &libraryError)
|
const TranslatableString &msg, const TranslatableString &libraryError)
|
||||||
{
|
{
|
||||||
mpErrors->mLastError = msg;
|
mpErrors->mLastError = msg;
|
||||||
wxLogDebug(wxT("SQLite error: %s"), mpErrors->mLastError.Debug());
|
wxLogMessage(wxT("SQLite error: %s"), mpErrors->mLastError.Debug());
|
||||||
printf(" Lib error: %s", mpErrors->mLastError.Debug().mb_str().data());
|
printf("SQLite error: %s", mpErrors->mLastError.Debug().mb_str().data());
|
||||||
|
|
||||||
mpErrors->mLibraryError = libraryError.empty()
|
mpErrors->mLibraryError = libraryError.empty()
|
||||||
? Verbatim(sqlite3_errmsg(DB())) : libraryError;
|
? Verbatim(sqlite3_errmsg(DB())) : libraryError;
|
||||||
wxLogDebug(wxT(" Lib error: %s"), mpErrors->mLibraryError.Debug());
|
wxLogMessage(wxT(" Lib error: %s"), mpErrors->mLibraryError.Debug());
|
||||||
printf(" Lib error: %s", mpErrors->mLibraryError.Debug().mb_str().data());
|
printf(" Lib error: %s", mpErrors->mLibraryError.Debug().mb_str().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,7 +275,7 @@ sqlite3_stmt *DBConnection::Prepare(enum StatementID id, const char *sql)
|
|||||||
rc = sqlite3_prepare_v3(mDB, sql, -1, SQLITE_PREPARE_PERSISTENT, &stmt, 0);
|
rc = sqlite3_prepare_v3(mDB, sql, -1, SQLITE_PREPARE_PERSISTENT, &stmt, 0);
|
||||||
if (rc != SQLITE_OK)
|
if (rc != SQLITE_OK)
|
||||||
{
|
{
|
||||||
wxLogDebug("prepare error %s", sqlite3_errmsg(mDB));
|
wxLogMessage("prepare error %s", sqlite3_errmsg(mDB));
|
||||||
THROW_INCONSISTENCY_EXCEPTION;
|
THROW_INCONSISTENCY_EXCEPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,10 +166,13 @@ public:
|
|||||||
{
|
{
|
||||||
// Enable URI filenames for all connections
|
// Enable URI filenames for all connections
|
||||||
mRc = sqlite3_config(SQLITE_CONFIG_URI, 1);
|
mRc = sqlite3_config(SQLITE_CONFIG_URI, 1);
|
||||||
|
|
||||||
if (mRc == SQLITE_OK)
|
if (mRc == SQLITE_OK)
|
||||||
{
|
{
|
||||||
mRc = sqlite3_initialize();
|
mRc = sqlite3_config(SQLITE_CONFIG_LOG, LogCallback, nullptr);
|
||||||
|
if (mRc == SQLITE_OK)
|
||||||
|
{
|
||||||
|
mRc = sqlite3_initialize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NO_SHM
|
#ifdef NO_SHM
|
||||||
@ -193,6 +196,12 @@ public:
|
|||||||
// It returns a value, but there's nothing we can do with it
|
// It returns a value, but there's nothing we can do with it
|
||||||
(void) sqlite3_shutdown();
|
(void) sqlite3_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void LogCallback(void *WXUNUSED(arg), int code, const char *msg)
|
||||||
|
{
|
||||||
|
wxLogMessage("sqlite3 message: (%d) %s", code, msg);
|
||||||
|
}
|
||||||
|
|
||||||
int mRc;
|
int mRc;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -356,6 +365,9 @@ bool ProjectFileIO::OpenConnection(FilePath fileName /* = {} */)
|
|||||||
mProject.shared_from_this(), mpErrors, [this]{ OnCheckpointFailure(); } );
|
mProject.shared_from_this(), mpErrors, [this]{ OnCheckpointFailure(); } );
|
||||||
if (!curConn->Open(fileName))
|
if (!curConn->Open(fileName))
|
||||||
{
|
{
|
||||||
|
SetDBError(
|
||||||
|
XO("Failed to open database file:\n\n%s").Format(fileName)
|
||||||
|
);
|
||||||
curConn.reset();
|
curConn.reset();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -692,43 +704,44 @@ bool ProjectFileIO::DeleteBlocks(const BlockIDs &blockids, bool complement)
|
|||||||
if (rc != SQLITE_OK)
|
if (rc != SQLITE_OK)
|
||||||
{
|
{
|
||||||
/* i18n-hint: An error message. Don't translate inset or blockids.*/
|
/* i18n-hint: An error message. Don't translate inset or blockids.*/
|
||||||
SetError(XO("Unable to add 'inset' function (can't verify blockids)"));
|
SetDBError(XO("Unable to add 'inset' function (can't verify blockids)"));
|
||||||
wxLogWarning(GetLastError().Translation());
|
wxLogWarning(GetLastError().Translation());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete all rows in the set, or not in it
|
// Delete all rows in the set, or not in it
|
||||||
|
// This is the first command that writes to the database, and so we
|
||||||
|
// do more informative error reporting than usual, if it fails.
|
||||||
auto sql = wxString::Format(
|
auto sql = wxString::Format(
|
||||||
"DELETE FROM sampleblocks WHERE %sinset(blockid);",
|
"DELETE FROM sampleblocks WHERE %sinset(blockid);",
|
||||||
complement ? "NOT " : "" );
|
complement ? "NOT " : "" );
|
||||||
rc = sqlite3_exec(db, sql, nullptr, nullptr, nullptr);
|
rc = sqlite3_exec(db, sql, nullptr, nullptr, nullptr);
|
||||||
if (rc != SQLITE_OK)
|
if (rc != SQLITE_OK)
|
||||||
{
|
{
|
||||||
// we give the string 'error' to get the default url for read project errors.
|
|
||||||
if( rc==SQLITE_READONLY)
|
if( rc==SQLITE_READONLY)
|
||||||
/* i18n-hint: An error message. Don't translate orphan or blockfiles.*/
|
/* i18n-hint: An error message. Don't translate blockfiles.*/
|
||||||
SetError(XO("Project is read only\n(can't clean orphan blockfiles)"), XO("error"));
|
SetDBError(XO("Project is read only\n(Unable to work with the blockfiles)"));
|
||||||
else if( rc==SQLITE_LOCKED)
|
else if( rc==SQLITE_LOCKED)
|
||||||
/* i18n-hint: An error message. Don't translate orphan or blockfiles.*/
|
/* i18n-hint: An error message. Don't translate blockfiles.*/
|
||||||
SetError(XO("Project is locked\n(can't clean orphan blockfiles)"), XO("error"));
|
SetDBError(XO("Project is locked\n(Unable to work with the blockfiles)"));
|
||||||
else if( rc==SQLITE_BUSY)
|
else if( rc==SQLITE_BUSY)
|
||||||
/* i18n-hint: An error message. Don't translate orphan or blockfiles.*/
|
/* i18n-hint: An error message. Don't translate blockfiles.*/
|
||||||
SetError(XO("Project is busy\n(can't clean orphan blockfiles)"), XO("error"));
|
SetDBError(XO("Project is busy\n(Unable to work with the blockfiles)"));
|
||||||
else if( rc==SQLITE_CORRUPT)
|
else if( rc==SQLITE_CORRUPT)
|
||||||
/* i18n-hint: An error message. Don't translate orphan or blockfiles.*/
|
/* i18n-hint: An error message. Don't translate blockfiles.*/
|
||||||
SetError(XO("Project is corrupt\n(can't clean orphan blockfiles)"), XO("error"));
|
SetDBError(XO("Project is corrupt\n(Unable to work with the blockfiles)"));
|
||||||
else if( rc==SQLITE_PERM)
|
else if( rc==SQLITE_PERM)
|
||||||
/* i18n-hint: An error message. Don't translate orphan or blockfiles.*/
|
/* i18n-hint: An error message. Don't translate blockfiles.*/
|
||||||
SetError(XO("Some permissions issue\n(can't clean orphan blockfiles)"), XO("error"));
|
SetDBError(XO("Some permissions issue\n(Unable to work with the blockfiles)"));
|
||||||
else if( rc==SQLITE_IOERR)
|
else if( rc==SQLITE_IOERR)
|
||||||
/* i18n-hint: An error message. Don't translate orphan or blockfiles.*/
|
/* i18n-hint: An error message. Don't translate blockfiles.*/
|
||||||
SetError(XO("A disk I/O error\n(can't clean orphan blockfiles)"), XO("error"));
|
SetDBError(XO("A disk I/O error\n(Unable to work with the blockfiles)"));
|
||||||
else if( rc==SQLITE_AUTH)
|
else if( rc==SQLITE_AUTH)
|
||||||
/* i18n-hint: An error message. Don't translate orphan or blockfiles.*/
|
/* i18n-hint: An error message. Don't translate blockfiles.*/
|
||||||
SetError(XO("Not authorized\n(can't clean orphan blockfiles)"), XO("error"));
|
SetDBError(XO("Not authorized\n(Unable to work with the blockfiles)"));
|
||||||
else
|
else
|
||||||
/* i18n-hint: An error message. Don't translate orphan or blockfiles.*/
|
/* i18n-hint: An error message. Don't translate blockfiles.*/
|
||||||
SetError(XO("Cleanup of orphan blocks failed"), XO("error"));
|
SetDBError(XO("Unable to work with the blockfiles"));
|
||||||
|
|
||||||
wxLogWarning(GetLastError().Translation());
|
wxLogWarning(GetLastError().Translation());
|
||||||
return false;
|
return false;
|
||||||
@ -1800,7 +1813,8 @@ bool ProjectFileIO::LoadProject(const FilePath &fileName, bool ignoreAutosave)
|
|||||||
->GetActiveBlockIDs();
|
->GetActiveBlockIDs();
|
||||||
if (blockids.size() > 0)
|
if (blockids.size() > 0)
|
||||||
{
|
{
|
||||||
if (!DeleteBlocks(blockids, true))
|
success = DeleteBlocks(blockids, true);
|
||||||
|
if (!success)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1823,7 +1837,8 @@ bool ProjectFileIO::LoadProject(const FilePath &fileName, bool ignoreAutosave)
|
|||||||
// we use that knowledge to determine if this file is an unsaved/temporary
|
// we use that knowledge to determine if this file is an unsaved/temporary
|
||||||
// file or a permanent project file
|
// file or a permanent project file
|
||||||
wxString result;
|
wxString result;
|
||||||
if (!GetValue("SELECT Count(*) FROM project;", result))
|
success = GetValue("SELECT Count(*) FROM project;", result);
|
||||||
|
if (!success)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ DBConnection *SqliteSampleBlock::Conn() const
|
|||||||
if (!pConnection) {
|
if (!pConnection) {
|
||||||
throw SimpleMessageBoxException
|
throw SimpleMessageBoxException
|
||||||
{
|
{
|
||||||
XO("Failed to open the project's database"),
|
XO("Connection to project file is null"),
|
||||||
XO("Warning"),
|
XO("Warning"),
|
||||||
"Error:_Disk_full_or_not_writable"
|
"Error:_Disk_full_or_not_writable"
|
||||||
};
|
};
|
||||||
|
@ -35,7 +35,8 @@ bool EffectTwoPassSimpleMono::Process()
|
|||||||
const_cast<AudacityProject*>( FindProject() ) );
|
const_cast<AudacityProject*>( FindProject() ) );
|
||||||
for (auto track : mOutputTracks->Selected< WaveTrack >()) {
|
for (auto track : mOutputTracks->Selected< WaveTrack >()) {
|
||||||
mWorkTracks->Add(track->EmptyCopy())->ConvertToSampleFormat(floatSample);
|
mWorkTracks->Add(track->EmptyCopy())->ConvertToSampleFormat(floatSample);
|
||||||
mWorkTracks->back()->InsertSilence(0, mT0);
|
if( mT0 > 0 )
|
||||||
|
mWorkTracks->back()->InsertSilence(0, mT0);
|
||||||
}
|
}
|
||||||
|
|
||||||
mTrackLists[0] = &mOutputTracks;
|
mTrackLists[0] = &mOutputTracks;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user