Commit Graph

193 Commits

Author SHA1 Message Date
Paul Licameli 6c2c2733f9 More Envelope::GetValueRelative; add point for join only as needed 2017-05-25 08:15:45 -04:00
David Bailes 7900aa51ba Update for commands which interact with clips using the keyboard.
Changed the criterion for deciding when two clips are immediately next to each other, and made it into a function: WaveClip::SharesBoundaryWithNextClip.
2017-05-16 14:23:07 +01:00
Paul Licameli 327e5d8557 Correct envelope update for Join that includes a gap between clips 2017-05-09 09:22:07 -04:00
Paul Licameli aba52bc79e Update envelope properly for TimeTrack and WaveTrack editing...
... Formerly this was done correctly only for cut and delete from WaveTrack,
paste into WaveTrack, and sync-lock adjustment of WaveTrack (either lengthening
or shortening).

Now also properly done for TimeTrack cut and paste, and also for:

Split cut
Split delete
Trim
2017-05-09 09:22:06 -04:00
Paul Licameli d2acf1f3e5 Bug842: rescale clip offsets, envelope times when setting track rate 2017-05-07 11:12:24 -04:00
Paul Licameli 4be19128c0 Better constructors for Envelope 2017-05-07 11:00:55 -04:00
Paul Licameli 55439247ad All the catches are in place for BlockFile and other errors, now throw. 2017-04-03 23:32:40 -04:00
Paul Licameli fc0f093db7 Sequence::Append* give strong guarantee 2017-04-02 21:33:23 -04:00
Paul Licameli 63cf80d244 Sequence::Delete gives strong guarantee 2017-04-02 21:33:23 -04:00
Paul Licameli 06f6953c91 Sequence::SetSamples, ::SetSilence give strong guarantee 2017-04-02 21:33:23 -04:00
Paul Licameli 73e61592aa Sequence::ConvertToSampleFormat gives strong guarantee 2017-04-02 21:33:23 -04:00
Paul Licameli 3c65731f38 Sequence::InsertSilence gives strong guarantee 2017-04-02 21:33:22 -04:00
Paul Licameli 160d846643 Sequence::Paste gives strong guarantee 2017-04-02 21:33:22 -04:00
Paul Licameli 6b0c5c096b WaveClip::Flush returns void, throws on error 2017-04-02 21:33:22 -04:00
Paul Licameli 5963f278f1 void returns from many WaveClip methods, comment safety guarantees 2017-04-02 12:49:47 -04:00
Paul Licameli aa83c4cf29 Implement the more than weak guarantees needed for recording...
... in WaveClip and WaveTrack, to save as much recording as we can,
assuming the strong guarantees that Sequence will give.

Also comment that some other WaveTrack methods can give strong guarantee,
incidentally to making HandleClear give strong.
2017-04-02 12:46:47 -04:00
Paul Licameli 608dcc9b3f Reimplement prohibitions on moving clips by throwing exceptions...
... Also comment some strong and weak guarantees
2017-03-31 17:47:19 -04:00
Paul Licameli d1cbac4181 more finally, more const, remove unused, fix warnings 2017-03-31 17:47:18 -04:00
Paul Licameli 38b8e57e4e Specify whether to throw on bad read in Mixer and WaveTrackCache...
... Do throw when exporting or mixing-and-rendering; don't if playing back or
drawing a spectrogram, but then just use zeroes.
2017-03-21 17:23:35 -04:00
Paul Licameli 39b8d99a56 WaveTrack::Get, WaveClip::GetSamples take a mayThrow=true argument...
... and pass non-default in all needed places.

Don't throw, don't put up error dialogs, in drawing or hit-test code.
2017-03-21 17:23:34 -04:00
Paul Licameli 70d9e4bdc7 GetMinMax, GetRMS functions take a mayThrow argument, return numbers 2017-03-21 14:19:02 -04:00
Paul Licameli b81cdee7e3 Comment where xml writing functions may throw 2017-03-18 11:45:05 -04:00
Paul Licameli 58574f2f78 Redo type HFFT as a smart pointer, remove malloc and free 2017-03-17 17:52:51 -04:00
Paul Licameli 18be1bdad6 Remove naked new[] in: tracks 2017-03-17 17:52:47 -04:00
Paul Licameli bb5dc07c51 Fix one scalar naked new that crept back in 2017-03-17 17:52:41 -04:00
Paul Licameli b4734ff790 Duplicate command copies cutlines 2017-03-17 17:52:40 -04:00
Paul Licameli 934a505e1a Changes in WaveClip construction...
... Eliminate CreateFromCopy, add new one-step constructor instead.
It was wasteful to create a copy only to re-create the Sequence at once.

Sequence::Copy is a factory returning a unique_ptr.

Some error checks are removed, but there will be exceptions instead later.
2017-03-17 17:52:39 -04:00
Paul Licameli 65c722bfe5 Comment: resample, reformat of WaveClip needs no recursion for cutlines 2017-03-17 17:52:39 -04:00
Paul Licameli 87775d35e0 null pointer checks on all uses of WaveTrackCache::Get 2017-03-17 17:52:35 -04:00
Paul Licameli 8ddbc1d3d3 Assume number of spectrogram bins = 1/2 FFT window in fewer places...
... and that they have equal width on the linear scale
... also simplify the logic involving zero padding factor

This is more preparation for constant-q.
2017-03-17 17:52:28 -04:00
Paul Licameli aa0d55ac83 Use enum class ProgressResult, don't interconvert with int or bool 2017-03-17 17:52:24 -04:00
Paul Licameli 81285ee0c1 More const and override 2017-03-17 17:52:20 -04:00
Paul Licameli a9d33f87c4 Comments and minor off by one fixes for drawing wave clips...
... and rename two shadowing variables
2016-10-01 13:01:19 -04:00
Paul Licameli 921b769b52 Fix the previous fix! ... in copying of wave clip display caches. 2016-10-01 10:24:50 -04:00
Paul Licameli a41eb4422c Fix mistake in partial reuse of caches for drawing wave & spectrum...
... But this mistake probably had no visible consequences, if total width
in pixes was unchanged.
2016-10-01 10:07:29 -04:00
Paul Licameli f993f1eadf Regularize casts as (int), so they are easier to find and review 2016-09-20 08:42:11 -04:00
Paul Licameli ad04187a41 Change sampleCount arguments, variables, return values to size_t...
... whenever they really describe the size of a buffer that fits in memory, or
of a block file (which is never now more than a megabyte and so could be fit in
memory all at once), or a part thereof.
2016-09-15 21:03:17 -04:00
Paul Licameli 078ff056e2 Make many conversions sampleCount->size_t are explicit and checked...
... with run-time assertions.

I examined each place and reasoned that the narrowing was safe, and commented
why so.

Again, there are places where the sampleCount variable will later be changed
to have a different type, and they are not changed here.
2016-09-15 21:02:32 -04:00
Paul Licameli 78be459fa1 Convert sampleCount <-> floating or -> long long explicitly ...
... A non-narrowing conversion out to long long is a necessity, but the
conversions to float and double are simply conveniences.

Conversion from floating is explicit, to avoid unintended consequences with
arithmetic operators, when later sampleCount ceases to be an alias for an
integral type.

Some conversions are not made explicit, where I expect to change the type of
the variable later to have mere size_t width.
2016-09-15 21:02:31 -04:00
Paul Licameli ed21545c80 pixel column counts and sample window sizes use unsigned types 2016-09-11 20:28:13 -04:00
Paul Licameli 43b4d3cc99 travis 2016-09-07 13:38:39 -04:00
Paul Licameli 301fa337d5 Fix bug when expanding a cutline that contains another cutline...
... rare case, indeed.
2016-09-07 12:50:53 -04:00
Paul Licameli 919d77d176 More uses of min and max 2016-09-06 20:46:25 -04:00
Paul Licameli c8e7372886 Rewrite Resample::Process to take and return size_t values 2016-09-06 12:39:58 -04:00
Darrell Walisser 180da5a769 change reserve to resize, clarify what omp atomic is used 2016-08-31 11:25:32 -04:00
Darrell Walisser ce92dce856 improved OpenMP SpecCache::Populate 2016-08-28 13:00:44 -04:00
Paul Licameli 127b2a6acf Fix more narrowings of sampleCount 2016-08-26 12:42:22 -04:00
James Crook 1e0fcbf872 Profiling of spectrogram is opt-in for normal builds. 2016-08-26 12:32:54 +01:00
Darrell Walisser b2d1470062 OpenMP-ized SpecCache::Populate 2016-08-25 13:44:12 -04:00
Paul Licameli 52417c444d Remove unnecessary casts to sampleCount 2016-08-24 14:50:46 -04:00
Paul Licameli fd2b050d6f Type agnosticism for some other variables that were not sampleCount...
... in some cases, this fixes narrowings.
2016-08-24 14:50:45 -04:00
Paul Licameli 79c79f9cd3 Remove many mentions of sampleCount with auto and decltype...
... This makes much code agnostic about how other things (functions and
arguments) are typed.

Many of these neeed to become size_t instead of sampleCount.
2016-08-24 14:50:45 -04:00
Paul Licameli 1281f1b14b Common function limits buffer size to sampleCount known to be small 2016-08-23 12:46:10 -04:00
Paul Licameli 46f38708ed Dir manager uses std::shared_ptr 2016-08-13 12:23:05 -04:00
Paul Licameli 2917fe5087 One more make_unique for WaveClip, and comment changes 2016-08-13 10:37:52 -04:00
Paul Licameli dcceaca13c Envelope bug 2016-08-12 20:53:38 -04:00
Paul Licameli cb48ca2b91 Use arrays of smart pointers to WaveClip 2016-08-12 20:53:38 -04:00
Paul Licameli a400a7408c Distinguish whether clip ptr arrays own; vector; const-correctness 2016-08-12 20:53:38 -04:00
Paul Licameli 4cbca5d75c Use std::vector to hold WaveClips 2016-08-12 20:53:38 -04:00
Paul Licameli bd57f6392f Simplify iterations over cutlines in WaveClip.cpp; stl idioms 2016-08-12 20:53:37 -04:00
Paul Licameli 6e4e710d3b Remove seeming naked new and deletes in comments and uncompiled code 2016-08-10 11:05:51 -04:00
Paul Licameli 20bee00115 Remove some naked new amd delete in: tracks and clips 2016-08-08 07:30:44 -04:00
Raphaël Marinier 6ac68db5be Code cleanup: removed the old real FFT code not used since at least 2009.
I confirmed that the currently used real FFT code in RealFFTf.cpp is faster
than the old one with a quick benchmark that calls PowerSpectrum() on 4-minute
audio file, with different sizes of computation windows:

Window_size: 256 method: new FFT time_s: 0.393
Window_size: 256 method: old FFT time_s: 1.065
Window_size: 1024 method: new FFT time_s: 0.38
Window_size: 1024 method: old FFT time_s: 0.958
Window_size: 4096 method: new FFT time_s: 0.413
Window_size: 4096 method: old FFT time_s: 1.084
Window_size: 16384 method: new FFT time_s: 0.518
Window_size: 16384 method: old FFT time_s: 1.338
Window_size: 65536 method: new FFT time_s: 0.655
Window_size: 65536 method: old FFT time_s: 1.524
Window_size: 262144 method: new FFT time_s: 0.735
Window_size: 262144 method: old FFT time_s: 1.873
2016-06-25 20:40:16 +02:00
Paul Licameli 94cf94718e Redefine ODLocker as movable, and it may try-lock only. 2016-04-17 13:58:21 -04:00
Paul Licameli f94b3b3afa Add some const qualifiers to BlockFile methods 2016-04-10 21:05:20 -04:00
Paul Licameli daf92c43f8 Sequence::Copy is a factory returning smart pointer. WaveClip stores it. 2016-04-10 20:47:45 -04:00
Paul Licameli 0c9deb398c Fix mac build. No standard headers in Audacity.h. 2016-03-01 12:22:37 -05:00
Paul Licameli 48a5f55179 More const qualifiers, for copying of tracks, and replacing in lists of tracks
... (the tracks may be const, not the list, when replacing)
2016-02-27 17:30:30 -05:00
Paul Licameli 70c1d57591 More const qualifications, and mutables, for functions that draw tracks...
... The display related  members that had to become mutable are probably
ones that don't belong in the track classes, ultimately.
2016-02-27 12:35:17 -05:00
Paul Licameli 9bf098c7d9 Sweep unnecessary wxString copies: rest 2016-02-23 02:15:56 -05:00
Paul Licameli dbaa811577 Stack-allocate where possible! ...
... Removed many unnecessary naked news and deletes.
2016-02-17 18:15:57 -05:00
Paul Licameli 7c4c45a0d5 "new"->"NEW" in comments, easier to find remaining naked operator new 2016-02-14 18:52:41 -05:00
Paul Licameli 56e7653343 "delete"->"DELETE" in comments, easier to find remaining naked operator delete 2016-02-14 18:50:45 -05:00
Paul Licameli daa7617e88 auto_ptr (deprecated) -> unique_ptr (preferred in C++11) 2016-02-13 12:00:28 -05:00
Paul Licameli ca56876aaf Various minor fixes in Sequence 2016-02-04 01:06:51 -05:00
Paul Licameli 51fbc697cf One less indirection accessing Sequence::mBlock 2016-02-03 22:17:08 -05:00
Paul Licameli 5de27ac36f One less indirection accessing InvalidRegion 2016-02-02 11:49:54 -05:00
Paul Licameli 321d5259a2 More uses of SampleBuffer, eliminating explicit DeleteSamples calls 2016-02-01 10:16:00 -05:00
Paul Licameli 9c483e2e86 Add (redundant) #include "Experimental.h" in all .cpp files using the symbols 2015-08-31 17:56:10 -04:00
Paul Licameli 7544a35a6e Improve calculation of reassigned spectrogram at screen boundaries 2015-08-17 10:03:45 -04:00
Paul Licameli 9505278c44 Disable caching for reassigned spectrogram 2015-08-17 10:03:21 -04:00
Paul Licameli 84ee685ee9 reassignment, internals, implementing time correction, but -- ...
... it does not yet interact correctly with caching, so results may be
slightly wrong if you scroll the view by less than a screen.
2015-08-17 09:17:46 -04:00
Paul Licameli 7113d533fb reassignment, internals, implementing frequency correction only 2015-08-17 09:17:45 -04:00
Paul Licameli e4fe449021 more simplification of arguments 2015-08-16 21:14:41 -04:00
Paul Licameli 5aba06a8a2 simplify argument passing for drawing pitch views 2015-08-16 19:45:09 -04:00
Paul Licameli f81231efae Remove Sequence.h from other headers 2015-07-28 10:02:08 -04:00
Paul Licameli d39eaa4e65 Remove WaveTrack.h from other headers 2015-07-28 10:02:05 -04:00
Paul Licameli adb4a534e8 Pitch is no longer a special view type... && bug fixes 1040, 1041
... It is a choice of algorithm in spectrogram settings, and any frequency
scale may be chosen with it.  Spectral selection works in it.
2015-07-27 23:01:20 -04:00
Paul Licameli 1dffeace93 Access SpectrogramSettings via WaveTrack, which may be nondefault (no UI yet)...
... and add accessors to SpectrogramSettings, and remove TrackArtist functions
for getting and setting the globals.
2015-07-26 21:10:16 -04:00
Paul Licameli 786c1da645 Move class SpectrogramSettings to its own file 2015-07-26 21:10:13 -04:00
Paul Licameli 8664c877ba WaveDisplay may or may not manage its own memory. 2015-07-19 11:44:16 -04:00
Paul Licameli c14b326913 Publicize class SpecCache. TrackArtist will re-use it. 2015-07-19 11:44:15 -04:00
Paul Licameli 35e0897bf7 Avoid needless mix/max/rms calculation when showing individual samples. 2015-07-19 11:43:55 -04:00
Paul Licameli b25994a82d Throw away EXPERIMENTAL_FFT_SKIP_POINTS...
... with James' consent.
2015-07-18 23:21:27 -04:00
Paul Licameli 97f06ec09c Less shimmer and maybe less CPU in display updates for scroll-scrub, because...
... tolerant comparison of pps values allows more cache reuse and avoids the
changing alignment of pixels to samples that causes the "shimmery" update.
2015-06-11 10:26:38 -04:00
Paul Licameli e8d676c961 fix compilation warning 2015-06-09 14:22:13 -04:00
Paul Licameli bb42f6e7c0 More minor spectrogram drawing changes...
... Removed an unnecessary zero-filling, added comments, removed a duplication
with a loop.
2015-06-07 17:37:52 -04:00
Paul Licameli 976eb6164f More reorganization of wave and spectrum caches, and performance...
Simplify the partial copying of wave and spectrum caches.  Use memcpy for speed.

Don't memcpy out of the caches into temporary buffers for TrackArtist,
just pass
pointers.

More vectors in the cache classes, fewer deletes.

Pulled big loop, and its body, out of the spectrogram routine into functions.
2015-06-06 11:43:10 -04:00
Paul Licameli 1916bc3142 Fix compilation of some disabled experimental branches for spectrograms ...
... Not promising that they work, just compilation.
2015-06-04 11:30:08 -04:00
Paul Licameli afa2fe9fb4 Keep FFT windows for Spectrograms in one place in SpectrogramSettings...
... not redundantly in each WaveClip.
2015-06-04 11:29:18 -04:00