* Revert "AUP3: Don't delete sample blocks prematurely"
This reverts commit c1884349d5.
* "Don't delete sample blocks prematurely" fixed otherwise...
... and very simply.
Problem was that, only for an interactive effect (like Bass and Treble), the
save point was created, rolled back, created again, then committed.
But (unlike with the non-savepoint commands, even if savepoint is outermost),
rolling back a savepoint really just rewinds it without removing it -- therefore
the second savepoint was inner, but the first (outer) was never committed, so
some changes failed to persist.
Solution: add a commit after rollback of savepoint to implement destructor
of AutoCommitTransaction.
The reversion of c188434 also leaves AutoCommitTransaction as a better RAII
style operation. Rollback changes by default -- keep changes only if
success is explicitly indicated.
* Rename AutoCommitTransaction as TransactionScope...
... More appropriately, since it's now the rollback that is automatic but
the commit that must be explicit
* Don't need TrackFactory to make LabelTrack
* Don't need TrackFactory to make NoteTrack
* Don't need TrackFactory to make TimeTrack, or ZoomInfo in the factory
* Remove some forward declarations
* Rename TrackFactory as WaveTrackFactory, move it out of Track.cpp
The wrong sample blocks would be deleted at close in step 6:
1) New Project
2) Save and name
3) Import one stereo MP3 (about 6 minutes)
4) Save, close and re-open
5) Apply Bass and Treble to the track using real-time preview
6) Save, close and re-open
7) Message Failed to retrieve sample block
* Change usage of AutoCommitTransaction::Rollback...
... It is the more useful pattern (as in many finally blocks) for the failure
path in the destructor (which rolls back) to be the default, but an explicit
call must inform it of success.
This corrects the early return paths in Effect::DoEffect().
Throw inconsistency exception if Commit() is called again after having been
called once, successfully
Also remove a friend declaration
* UndoManager's interface uses consistent 0-based indexing of states...
... Returned by GetCurrentState() and used by SetStateTo(),
GetLongDescription(), GetShortDescription()
* SampleBlock::GetBlockID is const
* Generalized function to visit sample blocks used in a TrackList...
... Eliminating some duplication; put it in WaveTrack, not Track, to avoid
a dependency cycle.
* Eliminate more repetition with BlockSpaceUsageAccumulator
* Function to delete all blocks of/not-of a given set in one command
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.
Problem:
Playback meters do not respond during preview of non-real-time effect.
Commit ba6db6e added the meters into AudioIOStartStreamOptions.
However Effect::Preview(bool) was not modified to set the playback meter.
Fix:
In Effect::Preview(bool), use DefaultPlayOptions, which includes a playback meter.
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.
This removes all of the OnDemand code embedded throughout
the main codebase. Individual files related specifically
to OD have been left in place, but removed from the build.
... Wrong results could happen in effects that don't compute the channels
independently, such as the built-in Reverb.
To fix it, always fetch same position of left & right channels when
computing effects.
... without making undesirable dependency cycles.
Eliminate calls to NewWaveTrack in effects, but in Edit>Copy too, which was
not mentioned in the bug report. (Copying a track, deselecting all, and pasting
preserved CLIP colors, but not the TRACK color setting which applies to newly
generated clips.)
Instead, always use the new function WaveTrack::EmptyCopy from the track to be
later replaced, getting color information.
NewWaveTrack is still used in benchmark test, import, the Track menu
commands that make new tracks, recording to new tracks, and generators without
a selection, where there is no track to copy from.
Also when deserializing tracks from the .aup file, in which case the saved
color is later retrieved from the file.
Also, in mix-and-render, where other logic decides whether to copy colors
afterward.
See commit a9658e6ef7
EffectChangePitch:: Don't use the inputTracks() when building the GUI
in Batch mode.
Repeat and NyquistEffect had the same problem as they could call
FindProject() which used inputTracks() on a closed project. Fixed by a change in Effect::GetSelectionFormat().
... or, what I saw in my Mac builds: there wasn't a hang, but there was
incorrect behavior on alternate attempts to export presets. Sometimes, instead
of (correctly) giving a file overwrite warning, there was instead a message
box about failure to open a non-existent file path, which had the last path
component duplicated.
Big Thanks to Steve for finding this and writing clear steps to reproduce when logging this bug in Bugzilla. Also thanks to Peter for confirming the same bug is present on Windows, i.e. is all platforms, not just Linux.
This is a minimal fix for this bug, and can be improved on in time. There is almost no error checking in the file read and write, so if you use a bad presets file, you won't be told (yet).
It does provide import and export for all effects that have presets.
... you use the prompt, and you enter a complete script with control comments
that are reinterpreted to put up a second dialog.
This simplifies Effect::Delegate() and avoids mutual recursion of ShowInterface
with DoEffect.
... and Track::GetOwner() is publicized, so that now you can find the
the AudacityProject, if any, that owns a given Track; this will help eliminate
some uses of GetActiveProject
... by passing parent as reference, not pointer, and testing in the dialog
factory function.
This is important so that we know the lifetime of an effect dialog, even when
it is non-modal, is bounded by the lifetime of the associated project.