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

12495 Commits

Author SHA1 Message Date
Paul Licameli
f34b9697c0 Oops, the once_flag must be static! 2020-07-11 23:44:20 -04:00
Paul Licameli
87d82e76c7
Char width info goes in the unique data dictionary only once per run (#613) 2020-07-11 13:10:58 -05:00
Paul Licameli
6eb6aab8f5 Commit autosave blobs during recording only as needed...
... when there really is at least one new sample block committed to the table,
which is typically only once in about every six seconds, with the default rate
and sample format.

Also renamed a callback function more aptly, since blocks are not files any
more.
2020-07-11 05:13:38 -04:00
Paul Licameli
047fa18afd Remove unused TrackPanel::MakeParentModifyState 2020-07-11 05:11:09 -04: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
Paul Licameli
06f22e942b More exception-safety for recording...
... Do not call Autosave (which might fail) when recovering from exceptions in
recording, but rely on the last good Autosave that happened during recording.

If dropout labels are needed, then immediately modify the undo history item, but
we can accept it if that modification fails.

Also, be sure NOT to skip Autosave in all other places that push the undo
history.  Make Autosave the default unless otherwise specified.

Finally removed one unnecessary call to Autosave.
2020-07-10 13:46:21 -04:00
David Bailes
975ee0cc07 Bug 2496 - Label edit typing prepends selected text
Problem:
labelStruct, a copy of the label is initialized before call to RemoveSelectedText() which acts on the real label. So when the label is updated using labelStruct, the selected text has not been removed.

Fix:
Initialize labelStruct after the call to RemoveSelectedText().
2020-07-10 10:37:02 +01:00
Leland Lucius
b12fafbea0 AUP3: Fix stupied build failure 2020-07-10 01:32:56 -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
Paul Licameli
70ab645647 Let ESC key in pencil tool reclaim abandoned sample blocks sooner 2020-07-09 16:30:37 -04:00
Leland Lucius
2ec3adf555 AUP3: Fix build failures 2020-07-09 13:46:38 -05: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
2e4812b148 AUP3: Fix assertions in Benchmark on 64-bit Windows build
Since size_t is different on 64-bit vs 32-bit Windows builds
it was causing assertions when displaying the results.

You can also change the sample format now by adjusting the
defines at the start of the source.
2020-07-09 13:11:27 -05:00
David Bailes
5b4c9b3425 Bug 2498 - Loudness Normalization always displays LUFS on launch
Problem:
On opening, the units were always LUFS, and the "treat stereo as dual-mono" check box was always available.

Fix:
On opening, adjust the controls which depend on the value of the Normalize choice.
2020-07-09 15:48:01 +01:00
Leland Lucius
c31a034157 AUP3: Display SQLite errors for now 2020-07-08 01:11:38 -05:00
Paul Licameli
88ba35f520
Fix exception handling, as when trying to edit read-only database... (#607)
... Problem is that the delayed undo handling (in the lambda in AudacityApp ::
OnExceptionInMainLoop) should itself have only non-throwing steps.

But there was a redundant attempt at autosaving in ProjectHistory ::
RollbackState, which itself requires another data base write.

But when "rolling back" the in-memory structures to whatever the current state
of undo history is, we can assume that any required autosave was completed
before the current state of undo history was set.

So for rollback only, do not autosave again when discarding changes and
restoring the state.  (But do it still, throwing on failure, when moving around
in the undo history, among saved states.  We do want to keep the last autosave
consistent with the in-memory state.)
2020-07-08 00:44:41 -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
875e8e0984
Cross project copy data loss (#604)
* Need only CloseLock now, not old Lock and Unlock...

... which were for cross-project cut and paste, but they no longer work and we
need another solution.  So delete much old code.

* Fix dangling reference to AudacityProject completely! ...

... in SqliteSampleBlockFactory: retain ONLY the shared pointer to
ProjectFileIO, then pass that, not project, to constructors of blocks.

completing the work of 127696879dcc5ca687ec50a4ccef7acbed563926

* Restore part of the Bug2436 fix...

... which needs the non-default arguments to WaveTrack::EmptyCopy that got lost
at d39590cf41e1e1eac02fc52d88a1ad018824f77b

So that pasted WaveTracks refer to the correct SampleBlockFactory and database
for their project

But this is not yet a sufficient re-fix for the bug

* Complete the fix for cross-project copies and 2436...

... by duplicating sample blocks, in Sequence.cpp, when it is wrong just to
share them.

And to determine which case it is, see whether source and destination Sequences
have the same sample block factories when doing Copy or Paste.  Duplicate
when the factories are different.  Otherwise sharing is safe and more space
efficient.

This does the analogous to what DirManager::CopyBlockFile did before commit
d39590c.
2020-07-07 15:41:50 -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
Paul Licameli
ba7ebbb032 Reviewed the ODLocks removed at cbf1bb5, restored just two of them...
... as std::mutex instead.

One is the mutex for the set of all files.

Another is in Profiler.h, which is now back into CMakeLists because the header
is included in one place.  Maybe this utility will find more use again.

Restored one other but commented out, as not necessary now, but need might be
found to put it back again.

The class ODLock was a misnamed thing not specific to the on-demand manager but
used more widely as a thread synchronization utility, functioning as a mutex
object.  It was a mistake to remove all uses of it along with the rest of the
on-demand system.
2020-07-07 16:34:25 -04:00
Leland Lucius
163dd719cc AUP3: Use the "unix-excl" VFS on Linux and Mac 2020-07-07 14:12:33 -05:00
David Bailes
25c1a0b280 Bug 2422 - Append Recording always scrolls vertically to bottom track
Fix:
Move the scrolling to ProjectAudioManager::DoRecord(), where it's known whether the recording is appending to existing tracks or not.
2020-07-07 16:32:33 +01:00
Paul Licameli
fff9e6a2e4 Fix another long long format argument 2020-07-07 02:03:51 -04:00
Paul Licameli
2c0c08f86a Prohibit copy construction of Sequence 2020-07-07 02:01:11 -04:00
Paul Licameli
558d4bbc3d Fix an error message 2020-07-07 01:28:05 -04:00
Paul Licameli
7e85fc9f9f Clear the clipboard when the project from which it was copied closes. 2020-07-07 00:20:25 -04:00
Leland Lucius
1405f3a41e AUP3: Add aup3 to the Info.plist for the Mac 2020-07-06 18:59:22 -05:00
Leland Lucius
0bea15077b AUP3: UP-15 - cannot update a project
At least the project file doesn't get deleted now.
2020-07-06 18:55:53 -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
0c92d1ed74 Better comments in WaveClip.* after commit 1276968 2020-07-06 16:08:36 -04:00
Leland Lucius
6c2cd2057c Maybe fix the Action build for Linux 2020-07-06 02:48:33 -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
2084c39046 Fix build Mac and Linux 2020-07-05 19:25:06 -05:00
Paul Licameli
3d0e86a8f8 Correct substitution of long long values into SQL queries...
... Reviewed all sqlite3_snprintf and only these had problems
2020-07-05 17:25:16 -04:00
Leland Lucius
22e90cbf72 Fix stupid test 2020-07-05 16:05:43 -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
1777afa596 AUP3: UP-23 - Macro commands 2020-07-05 14:32:20 -05:00
Paul Licameli
8b3f9fae58
Sqlite errors (#601)
* Null checks on return from std::make_shared are unnecessary...

... instead std::bad_alloc would be thrown in case of memory exhaustion, which
we don't try to recover from.

* Restore uses of the mayThrow arguments in Sequence...

... that became unused at commit d39590cf41e1e1eac02fc52d88a1ad018824f77b.

It's important to ignore exceptions from SampleBlocks when only displaying, not
editing or playing, and just treat missing data as silence.

Pass the boolean into the SampleBlock routines.  But the throwing of exceptions
is not yet implemented.

* SampleBlockFactory functions guaranteed to return non-null or throw...

... which corrects Sequence.cpp, which was assuming non-null results.

This supplies the throw statements that the previous commit comment says were
still lacking.

This corrects the absence of checks of returns from sql_bind_... function calls
in SqliteSampleBlock.cpp.  (Other calls remain to be checked elsewhere.)

User visible error messages, carried by the exceptions, might be improved.

* Restore the try/catch in AutoSaveFile::Decode...

... which was introduced at 2ba17c78d6758c2f64f2ccfec9af0c537525cea4

but removed at d39590cf41e1e1eac02fc52d88a1ad018824f77b, yet without removing
the throw statement

which left the program vulnerable to abrupt termination instead of graceful
failure, when uninterpretable auto save contents are detected.
2020-07-05 14:13:30 -05:00
Leland Lucius
c1407cdca9 Force use of our wxWidgets and fix RPATH handling 2020-07-05 13:39:57 -05:00
Paul Licameli
33210ec8c7 Add sqlite3.h to CMakeLists.txt for easier browsing in the IDEs 2020-07-04 15:48:32 -04:00
David Bailes
a415c3fe38 Commit 51b3b0f - minor update
Using init capture removes any danger of using the wrong value of MacroReentryCount
2020-07-04 12:56:42 +01:00
David Bailes
51b3b0f19a Bug 2499 - Macros: applying macro to project focus problem
Problem:
Applying macro to project always sets first track as focus.

The problem was introduced by commit 06cddda, which accidentally declared cleanup2 in the wrong scope.
This meant that ProjectHistory::RollBackState() was always called, which eventually causes TrackPanel::OnUndoReset() to be called, which sets the first track to be the focus.

Fix:
Declare cleanup2 in the correct scope.
2020-07-04 09:06:53 +01:00
David Bailes
d966303558 First commit
If any of the commands are cancels, an entry for the macro remains in history.
2020-07-04 08:58:58 +01: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
f3816b30d9 Not ready to commit ImportAUP.cpp just yet 2020-07-03 18:00:56 -05:00
Leland Lucius
015ba548c2 AUP3: Add SaveCopy macro command
To go along with new menu item.

And adjust prompting for filenames in Save dialogs to return
to Save dialog if file can't be overwritten.
2020-07-03 17:12:26 -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