1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-18 17:10:05 +02:00

61 Commits

Author SHA1 Message Date
Leland Lucius
d2b4a0e488 AUP3: Put checkpointing in a separate thread
This is highly experimental.  It's defers most checkpointing
to a separate thread to see if we get better throughput and
less choppiness when applying effects.
2020-07-19 03:28:02 -05:00
Leland Lucius
93d9303c3d AUP3: Many corrections and (safe) speed ups
This reenables synchronous mode by default.  However, for processing
where a power cut or crash can be tolerated, synchronous and journaling
are disabled.  Once the processing is complete, they are reenabled.

Types of processing that are like this are "Save As", "Backup Project",
and "Vacuuming". They all write to a separate project file while
running, so the real project file is safe.

Unfortunately, effects are back to be slow and sluggish.

I believe I've address all of the weird file corruption issues and
I'll continue to continue testing for these.
2020-07-17 16:17:42 -05:00
Leland Lucius
6ffced4881 AUP3: Adds connection configuration and ...
Optimizes a couple of sample block copy loops by only preparing
the statement once outside the loop.

The connection configuration ensure that all connections use the same
settings...assuming you remember to configure it after opening. :-)

The possibly controversial setting is the "PRAGMA synchronous = off"
2020-07-16 01:10:54 -05:00
Leland Lucius
5eb9f75150 AUP3: UP-33 History window shows misleading "space used"
Possible fix...will need feedback.
2020-07-15 09:26:23 -05:00
Leland Lucius
176eb49a1e AUP3: Several little fixes
Handle bypassing of timetracks in AUP importer correctly
Add bypassing of timetracks in AUP3 importer
Move/add AUP3 in filter lists.
2020-07-15 07:57:20 -05:00
Leland Lucius
5bc3ae659c AUP3: Added AUP3 importer and improved progress dialogs 2020-07-15 01:32:48 -05:00
Leland Lucius
0fbabb0e3f AUP3: Only vacuum if unused space is more than 20% 2020-07-13 13:01:36 -05:00
Leland Lucius
6f233cbff5 AUP3: Fix build issues 2020-07-13 09:48:37 -05:00
Leland Lucius
6193598b90 AUP3: Ensure that the update hook is removed 2020-07-13 09:08:31 -05:00
Leland Lucius
e75ab6eaad AUP3: Fix last commit
I hate conflicts...I ALWAYS get them wrong.
2020-07-13 00:45:14 -05:00
Leland Lucius
0815344e5d AUP3: Reworked CopyTo() yet again
This time it has the potential to produce much smaller
output files since it ONLY copies the active blocks and
not all of the blocks related to undo history.  This is
done for "Save As" and "Backup Project".  Normal save
can't take advantage of this, but then it really doesn't
need it as it has to depend on vacuuming.

The vacuuming at close has been adjusted to utilize CopyTo()
so it should produce similarly small files as long as the
vacuuming happens when the project is definitely closing.
2020-07-13 00:04:54 -05:00
Leland Lucius
a0008831e0 Revert "AUP3: Reworked CopyTo() yet again"
A bit more thought needs to do into this.
2020-07-12 10:55:54 -05:00
Leland Lucius
e3c5563d35 AUP3: Reworked CopyTo() yet again
This time it has the potential to produce much smaller
output files since it ONLY copies the active blocks and
not all of the blocks related to undo history.
2020-07-12 10:39:37 -05:00
Paul Licameli
cea658d9eb
Fix the reading of autosave files... (#610)
* Fix the reading of autosave files...

... problem was in recreating strings from buffers, but copying too many because
null terminators were lacking.

* Autosave during recording backs up all tracks correctly...

... whether to new track, or appending; and it doesn't lose the other tracks
besides the recording.

It is also unnecessary when just starting to record, so remove one call.
2020-07-11 00:49:37 -05:00
Leland Lucius
5b41115bd0 AUP3: Mostly rework of CopyTo()
It now uses VACUUM INTO instead of the SQLite backup API
in hopes that the copies will be smaller. And VACUUM INTO
is "supposed" to be faster, but time will tell.  It's easy
to put the backup API usage back in.

This also fixes a bit I missed with redoing the orphan block
handling that was reported by Paul.

And finally, it renames the AutoRecovery.cpp/.h files and AutoSaveFile
class to ProjectSerializer since the AutoSaveFile class is being
used for regular project documents now and it doesn't write to a
file anymore.

If anyone has a better idea for a name other than ProjectSerializer
feel free to change it.  I hate naming things.
2020-07-10 00:50:52 -05:00
Paul Licameli
7ad8849d32 When saving new project, put correct file name into MRU submenu...
... bug was introduced at 590d8c6d09fa2989f1e35ad3125965c801ece506
2020-07-09 19:17:23 -04:00
Leland Lucius
632ad6efcf AUP3: Better orphan block handling
This replaces my previous attempt since it didn't account
for all the situations where orphans blocks could occur.
2020-07-09 13:14:12 -05:00
Leland Lucius
c31a034157 AUP3: Display SQLite errors for now 2020-07-08 01:11:38 -05:00
Leland Lucius
af6a23696b AUP3: Detect and delete orphan blocks at startup 2020-07-08 00:18:05 -05:00
Leland Lucius
f7d9513f8d AUP3: Moving VFS setting to initer 2020-07-07 15:47:23 -05:00
Paul Licameli
590d8c6d09
Fail safe save as (#606)
* ProjectFileIO::SaveProject() won't close original db until done...

... So on the failure path, don't risk closing the original too early, failing
with the new database, and then failing to reopen the original.

Just keep the original open and a new connection open too, until it is
certain that the initial population of the new database is successful.

* Check return value from AutoSaveDelete when saving-as

* Fix the remaining unchecked sqlite3_bind* calls, which are in Autosave...

...similarly to checks in 8b3f9fa

* When saving-as or -copy, open the new database only once

* Check return value from sqlite_initialize
2020-07-07 15:41:33 -05:00
Leland Lucius
163dd719cc AUP3: Use the "unix-excl" VFS on Linux and Mac 2020-07-07 14:12:33 -05:00
Paul Licameli
4206e1ff6d
Sqlite open bugs (#603)
* Docs say: call sqlite3_close even when sqlite3_open returns error

* Be careful of possible failures of AutoSave...

... In ProjectHistory operations, do the AutoSave first and throw if there is
a failure.

Only then change UndoManager's state, confident that it remains consistent with
what was AutoSaved.

* Throw exceptions if lazy opening of project's database fails...

... because the calls to DB() as in Sqlite3SampleBlock may be in deeply nested
places that can't propagate the error codes; and besides, those functions
had been assuming non-null returns from DB(), which might have crashed before,
but now the assumption is correct when the throw didn't happen.

Note that this exception may also happen during attempted Autosave.  Uses of
Autosave were reviewed and some changes made in the previous commit.
2020-07-06 15:42:18 -05:00
Paul Licameli
bf9bad5a6e Fix typo in a message 2020-07-06 01:31:41 -04:00
Leland Lucius
f7db5043c5 AUP3: UP-17 - Projects can be larger on UP-3.0.0
Partial relief only.  This only addresses first symptom and it
will needs to have a progress dialog added.
2020-07-05 23:24:25 -05:00
Leland Lucius
b96b8bccc1 AUP3: UP-18 - Closing Audacity is slower with UP-3.0.0 2020-07-05 15:22:52 -05:00
Leland Lucius
4f129ae0af AUP3: Change database blocksize to 64KB
Preliminary tests show it to be a bit faster than the default
4KB.  For a simple example, generate 2-hour chirp dropped from
11 seconds to 7 seconds.  Not a lot, but...
2020-07-03 20:43:53 -05:00
Leland Lucius
c04ed76b6b AUP3: Fixes a couple of reported issues
Add the missing "File -> Save Project -> Backup Project..." menu item

Allows "File -> Save Project -> Save Project" to save unmodified
projects.
2020-07-03 14:38:57 -05:00
Leland Lucius
337e223754 AUP3: Change journal format to WAL
And remove the deletion of the journal file.
2020-07-03 11:34:53 -05:00
Leland Lucius
48287e9b0d AUP3: Provides relief from slow shutdown
This is a hack to fix the long delay at Audacity shutdown
after editing large files and tossing the results (not
saving).
2020-07-02 22:08:39 -05:00
Paul Licameli
127696879d
Unitary changes (#599)
* Define SampleBlockFactory replacing static members of SampleBlock...

... This will become an abstract base class

* Sequence and WaveTrack only store SampleBlockFactory not Project...

... This adds a dependency from Track to SampleBlock which temporarily enlarges
a cycle in the dependency graph

* Register a global factory of SampleBlockFactory...

... so that later we can make an abstract SampleBlockFactory, separate from the
concrete implementation in terms of sqlite, and inject the dependency at startup
avoiding static dependency

* New concrete classes SqliteSampleBlock, SqliteSampleBlockFactory...

... separated from abstract base classes and put into a new source file,
breaking dependency cycles, and perhaps allowing easy reimplementation for other
databases in the future.

Note that the new file is a header-less plug-in!  Nothing depends on it.  It
uses static initialization to influence the program's behavior.

* Compile dependency on sqlite3.h limited to just two .cpp files...

... these are ProjectFileIO.cpp and SqliteSampleBlock.cpp.

But there is still close cooperation of ProjectFileIO and SqliteSampleBlock.cpp.
This suggests that these files ought to be merged, and perhaps ProjectFileIO
also needs to be split into abstract and concrete classes, and there should be
another injection of a factory function at startup.  That will make the choice
of database implementation even more modular.

Also removed one unnecessary inclusion of ProjectFileIO.h

* Fix crashes cutting and pasting cross-project...

... in case the source project is closed before the paste happens.

This caused destruction of the ProjectFileIO object and a closing of the sqlite
database with the sample data in it, leaving dangling references in the
SqliteSampleBlock objects.

The fix is that the SqliteSampleBlockFactory object holds a shared_ptr to the
ProjectFileIO object.  So the clipboard may own WaveTracks, which own WaveClips,
which own Sequences, which own SqliteSampleBlockFactories, which keep the
ProjectFileIO and the database connection alive until the clipboard is cleared.

The consequence of the fix is delayed closing of the entire database associated
with the source project.

If the source project is reopened before the clipboard is cleared, will there
be correct concurrent access to the same persistent store?  My preliminary
trials suggest this is so (reopening a saved project, deleting from it, closing
it again -- the clipboard contents are still unchanged and available).
2020-07-02 18:11:38 -05:00
Paul Licameli
1fcb77ebce
Unitary fixes (#598)
* Eliminate unneeded back-pointer to project from non-wave Tracks...

... now that DirManager is gone

* Remove unused declarations

* SampleData::mProject was not used

* Correct ProjectFileIO::GetLibraryError

* Remove unnecessary #include directives
2020-07-02 11:42:25 -05:00
Leland Lucius
8ea07572c1 AUP3: Several fixes
These mainly address the bugs that Steve reported and a couple
more I found along the way.

Corrected ProjectFileIO::GetMinMaxRMS() - It was still using the
original method of keep all block data in memory.  I missed it
when I redid everything.  Fixes his Amplify crash.

Temporary filenames should no longer be shown to the user.

Resaves will no longer present a Save As dialog.

Cleaned up duplicate pathname handling in ProjectFileIO.

Returned proper errors when loading a project
2020-07-01 13:26:20 -05:00
James Crook
299710f0a9 Add comments to document the SQL. 2020-07-01 14:55:06 +01:00
James Crook
bc50e21532 .aup3 Tweaks
- SQLite added to libs in readme.txt
- User message 'aup not associated' updated to 'aup3'
- Typos strind -> string, in -> is
- No translation of debug message
2020-07-01 12:59:38 +01:00
Leland Lucius
d39590cf41 AUP3: First round of updates
!!! THERE WILL NO DOUBT BE BUGS !!!

This is a big one and there's still several things to
complete. Just want to get this in the wild to start
receiving feedback.

One big thing right now is that it will NOT load pre-aup3
files.  An importer is on the way for that.
2020-07-01 02:30:18 -05:00
Paul Licameli
db690d94f7 Remove 27 various macro _ ...
... and supply a few missing translations in Dependencies.cpp

And substitute-don't-concatenate in a few places in Internat.cpp
2020-05-23 08:07:24 -04:00
Paul Licameli
2e3c072fd5 Bug1119: Windows menu on Mac should list all project names...
... Reimplemented without making dependency cycles.

Project and ProjectFileManager publish events for change of active project or
change of a project title.

WindowMenus.cpp can listen for those events, so that it can update the menu
appropriately.  So it's all done nonintrusively in the rest of the code.
2020-05-22 10:09:47 -04:00
James Crook
018a8681ef Revert changes for Bug 1119 made by Paul.
These changes were made too close to release and are considered too dangerous for 2.4.0.
We will use the changes Leland provided.  We can review these proposed changes by Paul after 2.4.0 is released.
2020-04-21 17:45:16 +01:00
Paul Licameli
c3d0d0370b Bug1119: Windows menu on Mac should list all project names...
... Reimplemented without making dependency cycles.

Project and ProjectFileManager publish events for change of active project or
change of a project title.

WindowMenus.cpp can listen for those events, so that it can update the menu
appropriately.  So it's all done nonintrusively in the rest of the code.
2020-04-21 12:36:43 -04:00
Paul Licameli
3348e2fecd Revert fix for bug 1119, which made bad dependency cycles
This reverts commit 4475dee373b8c9376153684b8b2a246c53d5b7ed.
This reverts commit 18cbc2e574007a48ee0eb1bd384b3e0f012b0894.
2020-04-21 12:28:39 -04:00
Leland Lucius
18cbc2e574 Bug 1119 - Mac: Window menu's list of open windows not available 2020-04-18 01:49:17 -05:00
James Crook
5f7ca9fffe Missing string for translation 2020-04-14 15:48:08 +01:00
Yuri Chornoivan
d1ada5f08c Fix minor typos 2020-04-11 10:06:24 +01:00
James Crook
2e1267582b Fix untranslated string.
Thanks Paul.
2020-04-05 22:22:43 +01:00
James Crook
9985b8a9b8 Fix Big Time TimerToolBar, Stage III
Fixed issue where format selector could disappear.
Fixed upgrade from 2.3.3.
Remembers time format.
2020-02-14 12:02:21 +00:00
Paul Licameli
dc39f22442 AudacityMessageBox takes TranslatableString message and caption 2019-12-20 21:32:50 -05:00
Paul Licameli
98f322d685 Move writing and reading of common Track fields into functions...
... also now writing selected state of TimeTrack as for other tracks, fixing
an omission, with no harm to forward compatibility
2019-06-18 11:36:50 -04:00
Paul Licameli
705b4b28e7 Register a predicate with each CommandFlag bit 2019-06-14 00:31:15 -04:00
Paul Licameli
bb7964122e Fix windows crash at startup, again...
... The fix done at 2f9322e was undone at 43b1afc because of the unacceptable
file dependencies.  This fixes it by other means.  Make a null check in
SetProjectTitle in case it is invoked before ProjectWindow has been constructed;
also ensure in ProjectManager::New that it is called at least once after that.
2019-06-10 11:49:38 -04:00