Commit Graph

283 Commits

Author SHA1 Message Date
Paul Licameli b81cdee7e3 Comment where xml writing functions may throw 2017-03-18 11:45:05 -04:00
Paul Licameli 18be1bdad6 Remove naked new[] in: tracks 2017-03-17 17:52:47 -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 25619fb46e Don't create placeholder clips in Duplicate command ...
... when there is no clip at the right edge of the selection.
2017-03-17 17:52:39 -04:00
Paul Licameli 31832b21a3 fix WaveTrackCache, again...
... There was still some duplicated loading of block files during normal
forward play, though not more than two loads per file.
2017-03-17 17:52:34 -04:00
Paul Licameli 08b99c533b Remove Effect::mWarper, and stack-allocate warpers instead 2017-03-17 17:52:32 -04:00
Paul Licameli 0af9b46eac Move many fields out of Envelope that are needed only during editing 2017-03-17 17:52:31 -04:00
Paul Licameli 81285ee0c1 More const and override 2017-03-17 17:52:20 -04:00
Paul Licameli 64d163ebcd Make EXPERIMENTAL_OUTPUT_DISPLAY compile 2017-03-17 17:52:18 -04:00
Paul Licameli 51202bffb0 Fix bug reported by Steve, applying Nyquist effects...
... To short selections (under 1/100 second), at the start of the second of
two separated clips, in a project with a high sampling rate of 192000.

Symptom was that the audio moved so it was pasted to the end of the first clip.

Other uses of the constant WAVETRACK_MERGE_POINT_TOLERANCE should be
reviewed too but this is a conservative fix made close to release time.
2016-12-04 14:16:03 -05:00
Paul Licameli 8b66fc4b05 Restore change of Waveform dB scale with change of magnification...
... This is done with Shift+Ctrl+wheel and pointer in the vertical ruler, and
the pointer y coordinate near the bottom of the dB scale.

If y coordinate is far from there, then Shift+Ctrl+wheel changes dB level
without change of magnification (as before this commit).
2016-10-28 12:36:26 -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 d783762737 Remove unnecessary std::move in return statements...
... and comment where it is necessary.
2016-09-15 07:39:46 -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 919d77d176 More uses of min and max 2016-09-06 20:46:25 -04:00
Paul Licameli ed7bfd8835 Small improvements to the logic of WaveTrackCache 2016-09-05 16:28:04 -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 ee5a0db9ff some uses of size_t 2016-08-24 14:50:45 -04:00
Paul Licameli b5e410d987 Fix Windows build differently 2016-08-24 12:13:53 -04:00
James Crook 781de82d02 Workaround build breakers. Needs review.
These changes fix a broken build in Windows.
#include <algorithm> needed for min/max to be in std.
decltype(+name) was declaring a const variable, that could not be incremented.  Changed to auto.
2016-08-23 21:46:12 +01: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 69064edf20 Add explicit cast to sampleCount where negative values are possible 2016-08-22 21:45:54 -04:00
Paul Licameli a6de680cdb use std::min and std::max 2016-08-22 21:45:54 -04:00
Paul Licameli 5cf331ae8c Rewrite WaveTrack::GetEnvelopeValues, taking one less argument...
... In practice this argument was always 1 / rate so it was superfluous.

Also make the buffer size argument unsigned.
2016-08-21 09:45:53 -04:00
Paul Licameli 46f38708ed Dir manager uses std::shared_ptr 2016-08-13 12:23:05 -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 afc22caf5a WaveClip::GetCutLines() returns a reference 2016-08-12 20:53:37 -04:00
Paul Licameli 77a3647922 Simplify iterations over WaveClips in WaveTrack.cpp; stl idioms 2016-08-12 20:53:37 -04:00
Paul Licameli b548e641ae Simplify iterations over WaveClips outside of WaveTrack/WaveClip; ...
... also add some const qualifiers
2016-08-12 20:53:37 -04:00
Paul Licameli 14c23803ac Various uses of make_unique 2016-08-10 11:05:52 -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
James Crook 68285298ed Bug 1175 - Stereo tracks may have different zoom per channel 2016-07-15 13:06:45 +01:00
Paul Licameli 2e63a0ad37 Bug1434 (the crashing part) mixing and rendering a track with gaps 2016-07-04 16:52:02 -04:00
Steve Daulton 03915b4438 Fixes to Analyze Contrast
Now supports stereo tracks. Several tweaks to error messages,
validation logic, and accuracy improvements.
Includes a fix for summary64K (incorrect rms drawn on zoomed
out waveform).
2016-06-21 22:07:50 +01:00
Paul Licameli 079eb3e98e Bug1375: Fix sync-lock behavior ...
... which was broken by commit 3015a9c8d9
2016-05-21 02:04:12 -04:00
Paul Licameli 1033095696 RAII for locking of WaveTracks 2016-04-12 00:55:59 -04:00
Paul Licameli f94b3b3afa Add some const qualifiers to BlockFile methods 2016-04-10 21:05:20 -04:00
Paul Licameli 3015a9c8d9 Track cut and copy functions return a unique_ptr argument...
... Because they are factory functions.
2016-03-26 11:50:13 -04:00
Paul Licameli 5ef4dd46a5 TrackFactory functions return std::unique_ptr, although some callers...
... release() them for now.
2016-03-26 11:50:12 -04:00
Paul Licameli f42a953752 Track duplication methods return unique_ptr, although some callers...
... simply release() them for now.
2016-03-26 11:50:10 -04:00
Paul Licameli 2157b92b7b Another const argument, another "override" 2016-03-02 12:47:52 -05: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 6f63226291 More const qualifiers and mutable members for drawing of tracks 2016-02-27 13:04:34 -05:00
Paul Licameli d097c7fad4 More const qualifications. The source of a paste is const. 2016-02-27 12:54:57 -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 05f5375e4a Use std::vector for wave track locations 2016-02-27 12:08:03 -05:00
Paul Licameli 60bcd7aea2 Fix warnings for unused variables and functions 2016-02-26 14:56:26 -05:00
Paul Licameli 4a6fd96a97 Commented out some unused functions 2016-02-26 12:35:30 -05:00
Paul Licameli a5b6c9fd8f Add some const qualifiers; define TrackListConstIterator 2016-02-24 19:10:39 -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 507cee7ee5 One less indirection accessing Region 2016-02-02 11:49:53 -05:00
Paul Licameli d70ff3337d Bug501: Improve time-shift of clips between tracks...
... When you click in a stereo clip, move the correct partner clip with it.

When you click in the selection and it spans clips, move all clips containing
any part of the selection.  (As horizontal dragging does.)  Even if these are
not all within the same stereo track.

I implemented this rule:  If any clip moves up (or down) by n audio tracks
(not counting the label tracks), all clips must move the same number, and
all must move from mono to mono or left to left or right to right.  If that
is not possible, no move happens.
2016-01-24 23:08:10 -05:00
Paul Licameli e9479e6c26 Bug671: Really fixed by the fix for bug389, but this is some extra safety. 2016-01-23 20:31:11 -05:00
Steve Daulton 8a6edf3623 Add custom track name defaults to preferences 2016-01-21 02:42:25 +00:00
Paul Licameli b84c1b322e Bug1169: end the separate treatment of lin vs. log display bounds for spectrum...
... also make WaveTrack responsible for storing and validating the bounds
... also let the bounds vary per-track even though other settings are default
... also change some code names to mention "period" not "undertone"
2015-09-06 21:47:14 -04: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 80d7ed36f0 Bug1162: Be careful remapping db scale extremes, when the db limit value changes 2015-08-27 16:06:13 -04:00
Paul Licameli 555aa14e9e Bug1160: Fix scale limits in waveform views 2015-08-26 07:24:20 -04:00
Paul Licameli b11f57a643 Fix bugs in retraction of Waveforms preferences page 2015-08-19 11:52:31 -04:00
Paul Licameli 4a704af03f Restore Waveform (dB) to Tracks preferences for default view mode 2015-08-19 10:21:09 -04:00
Leland Lucius 37168ebbf6 Merge remote-tracking branch 'upstream/master' into wx3 2015-07-28 15:06:25 -05:00
Paul Licameli 51d7b3670c Remove LabelTrack.h from other headers 2015-07-28 10:02:07 -04:00
Paul Licameli d39eaa4e65 Remove WaveTrack.h from other headers 2015-07-28 10:02:05 -04:00
Paul Licameli 5abbd463b2 Waveform dB is not a track type. Logarithmic is a Wavetrack scale type...
... Also removed one line from the track control drop-down, and changed
accelerators to more mnemonic choices.

Also the open page of View Settings... determines track view type after OK
2015-07-28 08:08:13 -04:00
Paul Licameli 0c4418af22 Boilerplate for empty waveform preferences, analogous to Spectra 2015-07-28 08:08:10 -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 f74713f020 WaveTrack::WaveTrackDisplay does not encode scale or spectral selection...
... SpectrogramSettings does that instead, and Preferences or View Settings
are the user interface for changing it.

Handle invalidation of spectrogram pixel cache for scale type changes,
just as for other changes of settings.  No more
TrackArtist::InvalidateSpectrumCache().

View type of track now switches to Spectrum when applying or OKing the
View Settings... dialog and the Spectrogram page is open (and for now
it is still the only page)
2015-07-27 23:01:04 -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
Leland Lucius 9b9c8cc073 Round 5 of wx3 changes
FileDialog now complete on Linux.  Needs some fine tuning on
Windows and OSX.
Builds with wx3 and gtk2 or gtk3.
Still more effect work to do.
2015-07-14 23:33:53 -05:00
Paul Licameli ccebaf9d95 Bugs 1043, 1044 -- Be careful with new display modes in preferences
Write a new key so version 2.1.0 isn't confused by the reordered values

Add some future proofing against similar to 2.1.1 code
2015-06-23 13:12:07 -04:00
Leland Lucius de1fe0ae37 Fix for bug #1034 2015-06-15 23:38:02 -05:00
Paul-Licameli 1992b0c7e3 Fix a compilation warning, make some member functions const 2015-05-29 00:35:00 -04:00
Paul-Licameli bdc2839112 Preliminaries for bug 900
Create WaveTrackCache as a utility class but don't use it anywhere yet.

The possible minor performance problem with effects is fixed by changes
in WaveTrack::GetBestBlockSize().
2015-05-26 20:02:37 -04:00
Leland Lucius 3e1fbcd5ec Additional autosave speed improvement and 1 fix
This changes the autosave XML file to a binary representation
during writing to speed up autosave processing.  A lot of the
time used during autosave is a result of having to convert and
print all of the values to the XML file.

Writing the same information, but in binary format, reduces
all of that to just the bare essentials and the actual write
I/O.

During recovery, the binary file is read and converted to
the real xML representation and processing happens as it
did before.

It is a noticeable difference with very long or many tracks.

The included fix has to do with append recording.

Say you have 3 tracks and you want to append recorded audio
to the middle track.  Sometime later Audacity crashes and
upon recovery, the recorded audio is actually appended to
the third track, not the second one.

This fixes that by adding an "autosaveid" to each track as
it is written to the autosave file.  The same ID is written
to the recording recovery appends to the autosave file.

Then, during recovery, the IDs are matched up and the audio
gets appended to the proper track.

These autosaveid attributes are only present in the autosave
file and not in saved project files.
2015-04-17 16:58:26 -05:00
Paul-Licameli e26ab98e0e Bug 828 (partial) - Don't divide by zero in Contrast dialog 2015-04-09 19:21:39 -04:00
Paul-Licameli 0a69283a7e Fix linux compilation 2015-04-08 12:15:30 -04:00
Paul-Licameli d37a730f56 Bug822 - memory leak and orphans when paste eliminates cutlines 2015-04-08 09:37:46 -04:00
v.audacity@gmail.com 7e96305991 Get rid of an unused var to avoid compiler warning. 2015-02-19 11:17:40 +00:00
v.audacity 5f1ce03e32 PRL's fix for bug 827 2015-02-19 11:08:58 +00:00
lllucius b9647586af Committing patch from bug #794 2015-01-04 19:44:54 +00:00
lllucius 65088dc4d2 Make sure the envelope buffer is completely set
This should correct at least one of the situations where
folks have complained about crackling when the first clip
of the first track does not start at zero.
2014-12-22 05:03:08 +00:00
v.audacity 72b6de9edf Removed some debugging cruft. 2014-11-22 03:56:21 +00:00
benjamin.drung@gmail.com 277932dccb Remove trailing spaces. 2014-06-03 20:30:19 +00:00
lllucius@gmail.com d50f893864 Fixes some minor issues reported by valgrind. 2014-05-27 02:02:59 +00:00
martynshaw99 3d64971e90 Steve 'the Fiddle' Daulton's fix for a little bug I wrote about 6 years ago. Thanks Steve! 2014-05-13 23:36:39 +00:00
martynshaw99 3acbb825a0 Andrew Hallendorff's changes to make the vertical ruler follow the zoom level in both linear and dB modes. 2014-02-19 01:00:32 +00:00
v.audacity 945b27fea0 Remove unnecessary wxASSERT because the condition is checked for, in Release build as well. 2013-10-17 23:18:04 +00:00
martynshaw99 4ce2643d5f Remove the
// Indentation settings for Vim and Emacs
etc. lines from all files, as Campbell's patch (except for other changes to Languages.cpp)
2013-09-24 00:14:37 +00:00
james.k.crook@gmail.com fe3e0b7699 Fixed bug (ASSERT) when adding a click track after adding a chirp (and unselecting) when sync-lock is enabled. 2013-09-18 20:55:04 +00:00
james.k.crook@gmail.com dba81b3f1c Cleanup: Fixed lots of trivial MSVC warnings. 2013-08-25 21:51:26 +00:00
v.audacity c7daafede2 In off-list discussion, Steve mentioned that kdevelop / kate highlighting recognizes "FIXME", but not "FIX-ME", which has been the Audacity convention. This commit changes Audacity code to use the "FIXME" convention (though I've never known it as convention and MSVC doesn't recognize it).
Also, minor change in WaveTrack.cpp in the effort on bug 641. Should have no functional difference.
2013-08-24 20:30:47 +00:00
v.audacity 019ec26ddf updated comment 2013-07-22 03:47:24 +00:00
v.audacity 0726da24f2 fix for P2 http://bugzilla.audacityteam.org/show_bug.cgi?id=641, I hope 2013-07-18 04:18:59 +00:00
martynshaw99 f209391d59 John (Thales) code to make the waveform display look like the output of the gain and pan sliders, rather than the input. Added as EXPERIMENTAL_OUTPUT_DISPLAY since there is work to do, but I think this deserves wider input/views. 2013-05-30 23:14:25 +00:00
richardash1981 4fc80dd526 When merging tracks, copy the gain and pan as well as the display format, and all are common to both tracks 2013-03-10 16:57:27 +00:00
v.audacity 29f1325c75 Fix bug 331 (P3). 2012-08-03 22:59:25 +00:00
v.audacity 94cc0f19ff Fix bug 559 (P1), http://bugzilla.audacityteam.org/show_bug.cgi?id=559. 2012-07-24 22:21:46 +00:00
v.audacity 644d0b5355 more detail in comment 2012-07-22 02:39:54 +00:00
v.audacity a7a6c2b557 See http://bugzilla.audacityteam.org/show_bug.cgi?id=528#c11 (P2). 2012-07-20 03:31:10 +00:00
v.audacity 002b25991d bug 528 (http://bugzilla.audacityteam.org/show_bug.cgi?id=528, P2)
modified version of Martyn's patch
2012-07-11 04:09:45 +00:00
martynshaw99 68e2d00f9b Restore default behaviour if no clips found to pre-r11704 status, whilst still get proper max and min for severely-offset waveforms. 2012-05-02 21:37:45 +00:00
martynshaw99 09b003c056 Missing header, sorry. 2012-04-24 22:44:55 +00:00
martynshaw99 ffea5a2273 Addressing one of the problems reported with 'Normalise' if the offset is greater than the signal. Comments on other possible problems. 2012-04-23 23:39:36 +00:00
james.k.crook@gmail.com 2f0323c8fd Fix Bug 183: Zero crossing detection previously could/would select samples that were in the spaces between audio. This led to selection of audio before time zero. It also led to poor behaviour where clips did not end at zero. Now spaces between audio are strongly discouraged (treated as samples of value 2.0) for zero detection. 2012-03-25 16:19:08 +00:00
v.audacity e47349a6f4 Further fix for P2 bug described by Bill Wharrie in "Problem dragging clips between tracks with different sample rates" thread on audacity-quality. Moved the resampling of dragged clips to (left-)mouse-up, rather than upon drag into the destination, but still dragging. 2012-03-03 20:20:06 +00:00
v.audacity 111278c61b In WaveTrack.*:
* Fix P2 bug described by Bill Wharrie in "Problem dragging clips between tracks with different sample rates" thread on audacity-quality. Made sure the clips get resampled to the destination WaveTrack rate, and marked changed.

* Comment out unused override of WaveTrack::MoveClipToTrack().

* Added an ANSWER-ME about what appears to be a useless declaration and assignment.


In WaveClip.cpp, remove wxASSERT that Michael was trying to convince me to do yesterday. In debugging this, found a case when it's not a bad call. Thanks, Michael! :-)

In TrackPanel.cpp, removed some cruft.
2012-03-03 01:34:14 +00:00
james.k.crook@gmail.com 21d55e77e6 Dealt with (and tested) some FIX-MEs and ANSWER-MEs. 2011-11-25 21:26:01 +00:00
v.audacity 458152070e Fix some problems with asserts in 11308. Further wording corrections. 2011-11-18 03:47:43 +00:00
v.audacity e275189f1e Fix memory leak I introduced in r11308. 2011-11-18 01:04:57 +00:00
v.audacity 59db8d4ad4 See http://bugzilla.audacityteam.org/show_bug.cgi?id=451#c31 and http://bugzilla.audacityteam.org/show_bug.cgi?id=451#c32. 2011-11-16 05:59:48 +00:00
mchinen 927c34e5e2 Bug 390 (P4) - fix for detaching at silences when silence is a clip creates spurious single-sample clip 2011-06-01 17:11:42 +00:00
mchinen 9321b1634e Bug 377 (P2) - fix case where the R channel of a stereo clip wouldn't be dragged if it was off-screen and sync-lock was off 2011-04-25 18:10:32 +00:00
lllucius 4ef4adb6eb Fix build when wxWidgets is built to use STL as it is on openSUSE. 2011-04-17 03:42:35 +00:00
v.audacity 0bd3f11f41 Make "FIXME" comments be "FIX-ME" for consistency with themselves and "ANSWER-ME" comments, in case somebody ever wants to search for these things... ;-) 2011-03-26 01:11:51 +00:00
v.audacity 209a2b193d Consolidate multiple names for the same feature: sticky/linked/sync/synchro/grouped -> sync-lock. 2010-08-11 22:47:26 +00:00
v.audacity c7826bcdf9 Correct some comments.
Rename method for consistency.
2010-08-08 00:26:07 +00:00
BusinessmanProgrammerSteve fad5cd7f96 Fix problem generating over beginning of clips with "editClipsCanMove" mode
off; make WaveTrack::IsEmpty() use the clip boundary routines; hopefully make
warping more correct.
2010-04-15 21:01:50 +00:00
businessmanprogrammersteve e35e019e17 Change lots of code that uses linking to use the new
scheme.
2010-02-16 20:50:38 +00:00
james.k.crook 8fbe4f7185 Do not fill buffer if bufferLen is zero. This avoids a false +ve assert downstream when checking for non-existent buffers. 2010-02-12 16:10:22 +00:00
businessmanprogrammersteve 8704db3f63 Avoid rounding problem in HandleClear() 2010-02-10 18:55:45 +00:00
ra e74978ba77 Locate and position the current Audacity source code, and clear a variety of old junk out of the way into junk-branches 2010-01-23 19:44:49 +00:00