Commit Graph

193 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 0aa8625cff WaveTrackCache was only used with float; don't support other formats 2021-05-27 11:38:10 -04:00
Paul Licameli 50a26d9caf CopySamples gives more than binary choice of dither algorithm...
... And so a separate function CopySamplesNoDither is not needed
2021-05-27 11:38:10 -04:00
Paul Licameli 6eb5f3ac5b Eliminate CopySamples calls where destination is always float...
.. Call the function SamplesToFloats instead, or in one place, where source
is also always float, just do memcpy.

Dithering never happened in these cases.
2021-05-27 11:38:09 -04: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 9d6dd45973 More use of constSamplePtr instead of samplePtr 2020-11-29 19:45:18 -05:00
Paul Licameli 82e8532ee5 Make one argument non-defaulted 2020-11-29 14:17:04 -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 6dea5434a6 Bug2586: .aup with envelopes in wave tracks should import correctly 2020-11-19 16:48:41 -05: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 7294f7a8e0
Bug2532: should preserve sharing of sample blocks when importing AUP (#651) 2020-08-30 17:18:18 -05: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 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 0c92d1ed74 Better comments in WaveClip.* after commit 1276968 2020-07-06 16:08:36 -04: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
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
Yuri Chornoivan d1ada5f08c Fix minor typos 2020-04-11 10:06:24 +01:00
James Crook a0fd0f506c Revert fix for 2288 - Unintended consequences.
This fix was causing extra clips at the ends of tracks.
2020-03-22 19:23:39 +00:00
James Crook a072e21b77 Bug 2363 - Double-click-selecting a clip partly selects clip before too 2020-03-21 22:54:33 +00:00
James Crook e5dc8928dc Bug 2288 - Audio clips may overlap 2020-03-02 18:07:34 +00:00
Paul Licameli 503ccabdd8 TranslatableString caption & message in MessageBoxException 2019-12-16 10:58:05 -05: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 0832bccc7b DirManager.cpp has fewer dependencies...
... To append files during recording or import, it doesn't depend on the
subclasses of BlockFile, instead taking a factory function to which it gives
the filename; and the choice of factory function is also lifted up through the
level of class Sequence which is just above DirManager.

This frees four files from dependency cycles, including DirManager.cpp but not
yet Sequence.cpp
2019-05-18 20:32:19 -04:00
Paul Licameli 6c57948d8f Remove unnecessary #include-s from .cpp files...
... Unnecessary because transitively included.

But each .cpp file still includes its own .h file near the top to ensure
that it compiles indenendently, even if it is reincluded transitively later.
2019-05-16 17:21:00 -04:00
Paul Licameli c09edbb18a Define and use const version of WaveTrack::GetAllClips 2019-05-16 12:30:27 -04:00
Paul Licameli f6adeed47b Remove some unnecessary #include directives 2019-05-15 14:14:18 -04:00
Paul Licameli 0b733eed3f Remove (or comment) ProgressDialog.h in headers...
... For ImportPlugin, use unique_ptr not Maybe to hold it, and take constructors
out-of-line.
2019-04-04 09:47:57 -04:00
Paul Licameli 71d94c9cb5 wx/listimpl.cpp no longer used anywhere 2019-03-30 13:25:52 -04:00
Paul Licameli 906e55f047 Experimental.h in all .h or .cpp files that directly use EXPERIMENTALs...
... except Audacity.h; and in no others.

Do so even if Experimental.h gets multiply included, as in both the .h and
.cpp files.

This makes it easier to do a text scan to be sure there are no unintended quiet
changes of meaning because of omission of Experimental.h when the flag is
an enabled one.

Also move inclusions of Experimental.h earlier.

Also don't require Experimental.h to be preceded by Audacity.h to define
EXPERIMENTAL_MIDI_OUT correctly.
2019-03-17 22:54:00 -04:00
Paul Licameli a30000cf74 Use type aliases FilePath, FilePaths...
... for wxString and wxArrayStringEx, holding file paths (absolute or relative,
directory or plain file); to be replaced later with different types

(not yet using std::vector, becase of some uses of wxArrayString::Index with
two arguments)
2019-03-15 15:18:11 -04:00
Darrell Walisser 5dfff70f5b Fix OpenMP build 2018-10-14 11:34:37 +01:00
James Crook 7e5a716e65 Fix C4458 Warnings
C4458 is 'Declaration hides class member'
2018-10-10 19:46:25 +01:00
James Crook 657159d542 Fix C4189 and C4100 Warnings
C4189 is 'Local variable initialised but not used'
C4100 is 'Unreferenced parameter'

Fixed some other warnings, e.g. about empty if, too.
2018-10-10 19:46:24 +01:00
James Crook 0022e0c06c Bug 1844 - Nyquist effects move subsequent envelope points by selection's length
Also renamed Envelop::Paste to Envelope::PasteEnvelope, since it was hard to find
just its usages, given the many usages of WaveTrack::Paste.
2018-08-07 10:39:18 +01:00
Paul Licameli b8a8712ba0 make_movable -> std::make_unique 2018-05-10 00:56:36 -04:00
Paul Licameli 52a7f2320d Re-fix some warnings about mixing signed and unsigned better...
... Assuming that large unsigned magnitudes with high order bit set are not
the problem, but signed negatives of small magnitude may be:

1) Always cast the unsigned to signed in comparisons, not the other way.

Also:

2) Cast unsigned TERM to signed by itself, before subtracting.  Don't cast
the result.

3) Rewrite some comparisons by moving subtracted term to other side.

See commits
d2fe7b1757
f463eda36c
2018-01-23 18:51:53 -05:00
Paul Licameli ebc1092c4c One of the compilation warning patches in f463eda36c made a bug...
... the variable bin may indeed be sometimes negative:  see the test that
follows.
2018-01-06 18:33:06 -05:00
James Crook d2fe7b1757 Clean up most remaining MSVC warnings. 2018-01-06 13:03:48 +00:00
James Crook f463eda36c Clean up some dead code and MSVC warnings.
- Dead code from experiments in SelectionBar removed.
- Many warnings about unused parameters fixed with WXUNUSED()
- Many warnings about signed / unsigned comparisons cleaned up.
- Several 'local variable declared but not used' warnings fixed.
2017-12-08 15:20:39 +00:00
Paul Licameli f136b5c530 Reviewed uses of InconsistencyException outside Sequence.cpp 2017-11-19 01:48:41 -05:00
James Crook b48c6b0fd6 Clip (and track) colours now persists in .aup file. 2017-11-04 17:47:22 +00:00
James Crook 42c52de7f1 Coloured clips basics
These basics add a colour index to each clip and track, and allow for a choice of four colours to be set from the track menu drop down.  The additional wave colours (red, green and black) are not currently configurable, and the colour index is not currently saved.
2017-11-04 17:47:02 +00:00
Paul Licameli 44a081c7a0 Fix pasting of envelope from expanded cutline 2017-06-26 10:23:34 -04:00
Darrell Walisser 29df7e1ce3 Speccache performance improvments
Resolve #191 issues

- Disable reassignment cache
- Free memory when reasonable
- Add assertion
- Remove unused variables
- Add some comments
2017-05-30 20:39:00 -04:00
Paul Licameli 4c80a074d3 Bug835(cut-then-paste should be no-op): Rewrite Envelope::Paste...
... Simplify.  Don't assume e->mOffset is zero.  Check consistency afterward.

Do not leave responsibility for simplification of discontinuities to higher
level code.

Allow real discontinuities at the end of the insertion; no more readjustment of
times of points.
2017-05-29 13:53:25 -04:00
Paul Licameli 58e7a94264 Envelope::Paste takes a time tolerance argument 2017-05-29 13:53:25 -04:00
Paul Licameli bcc0bed29a Envelope::SetTrackLen adds a point only when none was present...
... And if points were present, keeps only the leftmost.
2017-05-25 08:15:45 -04:00