.. Call the function SamplesToFloats instead, or in one place, where source
is also always float, just do memcpy.
Dithering never happened in these cases.
... 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
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.
... 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.
* 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.
* 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).
!!! 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.
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.
... 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
... 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.
... 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.
... 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)
... 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
d2fe7b1757f463eda36c
- 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.
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.
... 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.