1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-08 15:52:53 +02:00

109 Commits

Author SHA1 Message Date
Paul Licameli
6b84dc1c1d Factory methods will return non-NULL or throw 2017-03-31 18:14:29 -04:00
Paul Licameli
d1cbac4181 more finally, more const, remove unused, fix warnings 2017-03-31 17:47:18 -04:00
Paul Licameli
23dc35a18c Bug1614: fix crash duplicating a clip 2017-03-30 16:48:52 -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
52fd607b42 Sequence::AppendBlock and Sequence::Blockify are static 2017-03-20 17:49:03 -04:00
Paul Licameli
2677796b0c Zero and return false for all failures to read block file summary...
... Though in the only place where these summaries are used, which is
Sequence::GetWaveDisplay, we ignore the correctly reported error code anyway.

Also RAII in management of relevant memory buffers and mutexes.
2017-03-20 17:49:03 -04:00
Paul Licameli
7b7ad75a49 Remove Sequence::CopyWrite and needless file reads in Sequence::Set 2017-03-20 17:49:03 -04:00
Paul Licameli
b81cdee7e3 Comment where xml writing functions may throw 2017-03-18 11:45:05 -04:00
Paul Licameli
692a033968 Remove naked new[] in: various 2017-03-17 17:52:47 -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
81285ee0c1 More const and override 2017-03-17 17:52:20 -04:00
Paul Licameli
8f28382525 Fix inability to convert sample format from 16 to 32 bits 2016-12-11 01:34:09 -05: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
26b5e77050 Define sampleCount as a class, not a type alias...
... Define lots of operators for disambiguation, but they will go away after
all conversions from sampleCount to built-in numerical types are forced
to be explicit.
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
2a2013cb4b More decltype and auto, mostly for loop index variables 2016-09-06 20:46:25 -04:00
Paul Licameli
b093a8e406 SAMPLE_SIZE macro returns size_t 2016-09-06 12:39:58 -04:00
Paul Licameli
c9a9ad6220 Fix incorrect comment, use auto 2016-09-06 12:39:57 -04:00
Paul Licameli
6043638e31 Another std::min, more auto & decltype, remove more casts 2016-08-29 20:07:43 -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
bf66e4410a Use long long for argument passed to wxString::ToLongLong 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
39df8d0b51 Don't use conversion of sampleCount to bool 2016-08-22 21:45:54 -04:00
Paul Licameli
a1d930322c Rewrite Sequence::FindBlock using size_t variables for indices 2016-08-21 09:16:20 -04:00
Paul Licameli
8b72bd2f92 Manage block files with std::shared_ptr, BlockHash stores weak_ptr 2016-08-16 12:29:59 -04:00
Paul Licameli
e7b4d935a5 Hide the use of new in factory functions for BlockFiles 2016-08-16 12:29:59 -04:00
Paul Licameli
2ede67be96 Use type alias for pointer to BlockFile, which is still a dumb pointer 2016-08-16 12:29:59 -04:00
Paul Licameli
46f38708ed Dir manager uses std::shared_ptr 2016-08-13 12:23:05 -04:00
James Crook
763485b0dc Add error check comments.
These are places where we don't properly handle error returns.
2016-07-10 21:40:48 +01:00
Gale Andrews
7848042339 More friendly warning about overlong Block File
Agreed several years ago on http://wiki.audacityteam.org/wiki/Wording .
2016-04-20 17:13:08 +01:00
Paul Licameli
3d102a3390 Access BlockFile::mFileName without copying, with proper multithreading cautions 2016-04-17 13:58:21 -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
dfc84d030c Fix warnings for out-of-order initializers, with in-class member initializers 2016-02-26 14:56:30 -05:00
Paul Licameli
60bcd7aea2 Fix warnings for unused variables and functions 2016-02-26 14:56:26 -05:00
Paul Licameli
9bf098c7d9 Sweep unnecessary wxString copies: rest 2016-02-23 02:15:56 -05:00
Paul Licameli
143e3b0ce1 Fix bug in Track > Resample 2016-02-18 08:23:15 -05:00
Paul Licameli
30f161f5c4 Fix bug when Split New with selection that extends past end of track...
... but I think there may be some other off-by-one bugs (that existed before my
changes) in treatment of the last sample of a selected range.  Need to
look more closely.
2016-02-17 21:45:42 -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
c4657a7b0e Use [] not at() -- avoid array bounds checking in release build! 2016-02-11 12:36:27 -05:00
Paul Licameli
dd3df60a83 Avoid repeated FindBlock call in Sequence::Get when we can 2016-02-04 09:31:39 -05:00
Paul Licameli
dc599116f7 Use SampleBuffer in Sequence, reuse so there are fewer allocations of buffers 2016-02-04 09:31:38 -05:00
Paul Licameli
ca56876aaf Various minor fixes in Sequence 2016-02-04 01:06:51 -05:00
Paul Licameli
e6987284e3 Rewrote Sequence::FindBlock, without recursion, and with dictionary search 2016-02-04 00:53:55 -05:00
Paul Licameli
6c28276daf Use RAII idiom for lock and locking mutex in Sequence 2016-02-04 00:53:54 -05:00
Paul Licameli
13f7d0a81b Added consistency checks for Sequence, hoisted out of inner loops. 2016-02-04 00:53:27 -05:00