Commit Graph

283 Commits

Author SHA1 Message Date
Dmitry Vedenko 690772ccb0 Use ShowExceptionDialog when we want to show ErrorReportDialog 2021-06-08 08:08:26 -07:00
Paul Licameli f369b5109b Change almost all uses of WaveTrack::Get() to GetFloats() ...
... A call graph browser easily shows that the extra generality of fetching
samples in some other format is only used in Benchmark -- where the format is
always the same as what the track is constructed with.

This makes re-verification of the claims in comments two commits ago easier.
2021-05-27 11:38:10 -04:00
Paul Licameli 0aa8625cff WaveTrackCache was only used with float; don't support other formats 2021-05-27 11:38:10 -04:00
Paul Licameli f1de843246 Use Settings for default sample rate and format...
... The first is an example of a Setting with a computed default value.

Also making a new file to hold them, separate from the GUI that changes them
in QualityPrefs; fewer things depend on QualityPrefs
2021-05-17 08:46:08 -04:00
James Crook d0ff48f3bd Bug 2754 - Change Tempo & Pitch and Sliding Stretch with selected audio in negative time crash Audacity on windows (error on Mac) 2021-05-15 11:36:53 +01:00
Paul Licameli e653b4aaf8 Eliminate Experimental.h, configure compile options instead...
... This makes it impossible to forget to include the EXPERIMENTAL definitions
(such as when cutting and pasting code) and so get unintended quiet changes of
behavior.

The EXPERIMENTAL flags are now specified instead in new file Experimental.cmake
2021-04-27 12:40:07 -04:00
Paul Licameli 8f0cec114c Bug2681 -- crash when generating into silence 2021-02-26 08:04:43 -05:00
Paul Licameli 40682f834a Removed some unnecessary #include directives 2021-02-04 10:12:42 -05:00
Paul Licameli 3144f0120a WaveTrack did not need Spectrum.h 2021-02-03 23:06:53 -05:00
Paul Licameli 15313a27f7 Define virtual Track::PasteInto to simplfy Paste...
... Also making EditMenus not dependent on TimeTrack
2021-02-02 15:01:51 -05:00
freddii 2593a84d56 Fix some spelling mistakes. 2021-01-12 09:55:31 +00:00
Paul Licameli d4f4241b57 Bug2607: Wave track sample format setting should persist 2020-12-03 12:08:21 -05:00
Paul Licameli 9d6dd45973 More use of constSamplePtr instead of samplePtr 2020-11-29 19:45:18 -05:00
Paul Licameli 6050edb3ca Bug2598: Envelope edit not dependend on visibility of channels...
... And other rewrites.  Don't use a cache of wave clip X coordinates computed
during drawing.
2020-11-19 22:29:21 -05:00
Paul Licameli 9d6cfcc746 WaveTrackView::BuildSubViews can be simplified...
... The setting of scale type now happens in the default constructor of
WaveformSettings, which calls LoadPrefs.

Since creation of WaveformSettings is always forced, we don't need the
distinction between WaveTrack::GetWaveformSettings and
WaveTrack::GetIndependentWaveformSettings.

That distinction was more analogy with the handling of SpectrogramSettings that
we don't need now.
2020-10-10 11:27:06 -04:00
Paul Licameli c98285c544 New method of TrackShifter, simplify ClipMoveState::DoSlideHorizontal...
... Also the clips to shift within a WaveTrack are tested all at once, more
simply
2020-09-20 00:26:47 -04:00
Paul Licameli 32c0d462b7 Another method of TrackShifter to test before attachment of intervals 2020-09-20 00:26:47 -04:00
Paul Licameli d3ab8b7f76 Compatibility sanity check for inserting clips into a WaveTrack...
... And don't move from the shared pointer argument
2020-09-19 19:16:47 -04:00
Paul Licameli 6510b859f3 Define new virtual functions Track::GetIntervals (const and non-const) 2020-09-19 13:23:45 -04:00
James Crook caf4eadb97 Help button for many warning messages; Restored warning icon.
The error icon was gone because we are now using the ErrorDialog, which didn't have it.  So added back explicitly.  I decided to go with wxART_WARNING rather than wxART_ERROR because nearly all of these present as warnings.
2020-09-14 17:43:28 +01:00
binarywisdom a10a1b81aa fixed bug/enh 266 2020-09-04 11:39:11 -04:00
Paul Licameli 372393f49e Rewrite comments about exception safety guarantees with Doxygen...
... Defining a new macro, which generates a special paragraph with links to a
new page describing the principles.
2020-08-22 23:07:28 -04:00
Paul Licameli 0e10a27172 Fix comments for WaveTrackFactory, remove friend 2020-08-22 21:20:00 -04:00
Paul Licameli 4ca3e7096f
Track factory cleanup (#646)
* 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
2020-08-22 18:44:49 -05:00
Leland Lucius c13a074cb2 Bug 208 - Some effects (including equalization effects) delete Envelope Control Points, or do not move them when timeline change 2020-08-08 19:40:02 -05:00
Paul Licameli a8fd6c6ce8
Preliminaries for grouped block deletion (#628)
* 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
2020-07-23 11:17:29 -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 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 127696879d

* Restore part of the Bug2436 fix...

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

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 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 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
Leland Lucius cbf1bb558e AUP3: Removes OD code related to project file handling
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.
2020-07-01 01:14:05 -05:00
Paul Licameli ecb65f8c2b Bug2436: Cross-project paste should duplicate block files...
... to avoid data loss!

Bug caused by commit c2feee6
2020-05-18 10:57:23 -04:00
Yuri Chornoivan d1ada5f08c Fix minor typos 2020-04-11 10:06:24 +01:00
Paul Licameli 7aa2667c33 Some comments to avoid further confusions using WaveTrack::Get(). 2020-03-21 15:48:58 -04:00
Paul Licameli c2feee6cea Bug2346: Complete fix...
... 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
2020-03-10 22:32:23 -04:00
Paul Licameli 046ee21e72 Move GetEditClipsCanMove to global function in TracksBehaviorsPrefs.cpp 2020-03-09 11:23:08 -04:00
Paul Licameli cbe4a46af2 Bug2265: Should save and restore track heights...
... Regression happened at 3f1fd8ced0

The heights were written to file, but not read back again.

This fix was done carefully to avoid making dependency cycles.  We don't want
Track to depend on TrackView or TrackControls.

It's not great that LabelTrack, NoteTrack, TimeTrack, and WaveTrack now have
those dependencies, but at least they don't make cycles.

It would be better to figure out how to attach the view and controls to the
track with ClientData, then just invoke BuildAll to repopulate the view and
controls, so that they are non-null when you reach
Track::HandleCommonXMLAttribute.
2020-01-14 20:04:32 -05:00
Paul Licameli 314ede2137 Don't store default sample format in ProjectSettings...
... it's a global preference.
2020-01-07 18:36:34 -05:00
Paul Licameli 7532677781 Revert "Don't store default sample format in ProjectSettings..."
This reverts commit 44d9916f85.
2020-01-07 18:36:28 -05:00
Paul Licameli 44d9916f85 Don't store default sample format in ProjectSettings...
... it's a global preference.
2020-01-07 18:22:38 -05:00
Paul Licameli 852c07bc58 Eliminate GetActiveProject from WaveTrack.cpp 2020-01-07 16:16:18 -05:00
Paul Licameli e2539be53b WaveTrack::SyncLockAdjust doesn't need a factory to make a temp track 2020-01-02 13:40:06 -05:00
Paul Licameli 503ccabdd8 TranslatableString caption & message in MessageBoxException 2019-12-16 10:58:05 -05:00
Paul Licameli 6ccca16a75 Move display type from WaveTrack to WaveTrackView 2019-07-09 20:09:59 -04:00
Paul Licameli 86320838de WaveTrack.cpp does not depend on ODManager.cpp ...
... Breaking up an s.c.c. of 6 into 3 components:
ODManager, ODTask, ODWaveTrackTaskQueue
UndoManager
WaveClip, WaveTrack

Rewrite the OD tasks and queues to hold weak pointers to tracks, so the
track destructor need not notify them.
2019-06-22 21:46:35 -04:00
Paul Licameli 71250b1dc3 WaveTrack.cpp does not depend on ODDecodeBlockFile.cpp...
... cutting off ODDecodeBlockFile and ODDecodeTask into a small cycle of 2
2019-06-22 21:46:34 -04:00
Paul Licameli f1b04c79d8 WaveClip does not depend on ondemand files besides ODTaskThread...
... Lifting the specification of factory function arguments for Sequence even
higher

This frees ODPCMAliasBlockFile from cycles
2019-06-22 21:46:34 -04:00
Paul Licameli a6e2ca0aa8 Move some enums into new files WaveTrackViewConstants.* ...
... freeing TracksPrefs from the second largest s.c.c. which is now only 20
2019-06-22 21:46:32 -04:00
Paul Licameli aa1ce03100 WaveTrack does not depend directly on ProjectHistory...
... because  we undo the move,
"Demote vertical zooming code into WaveTrack.cpp ..." done at 1f4bf26

That was done so that WaveTrack would not depend on WaveTrackVZoomHandle, but
made it instead depend on ProjectHistory, which is undesirable.

But since then, commit 3797a52 moved the special minimizing code for WaveTrack
into WaveTrackView.
2019-06-22 21:46:32 -04:00