Commit Graph

171 Commits

Author SHA1 Message Date
Paul Licameli a0aa69a248 All tracks allocated with make_shared, no more make_unique...
... so that we can use Track::SharedPointer without undefined behavior even on
tracks that don't yet belong to any TrackList.

Also fix the return type of function template TrackList::Add and remove some
casts.
2019-03-16 13:11:33 -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
Paul Licameli b2ea8ab6e9 Move AudacityProject::EditByLabel and EditClipboardByLabel 2018-10-28 16:30:39 -04:00
Darrell Walisser 5dfff70f5b Fix OpenMP build 2018-10-14 11:34:37 +01:00
Paul Licameli b36c3efec1 Track::GetKind is private 2018-10-01 13:42:34 -04:00
Paul Licameli 6930b63192 Redo track kind as an enum class defined at global scope 2018-09-29 21:41:47 -04:00
Paul Licameli 35f5555216 Track::mChannel has an enum type 2018-09-29 12:42:46 -04:00
James Crook b91300caf0 Bug 1947 - Clicky play when dynamically changing number of playing channels
Rather than 'cut' (i.e. drop, not cut as in 'cut preview') channels immediately, we now only do so
if their last gain was already 0.0.  Instead they micro-fade out.  Later when the channels come back,
their last gain will be 0.0, so they will micro-fade in.

A comment explains that the code would be cleaner if we just computed gains, and not whether to
drop channels.
2018-08-25 13:07:45 +01:00
James Crook 0ce83abbfb Bug 1940 - Clicky play when adjusting Pan or Volume TCP controls 2018-08-24 22:30:20 +01:00
James Crook b60fae4470 Fix some warnings on mac
These are mostly missing 'overrides'
2018-04-07 20:28:27 +01:00
Paul Licameli 83a01e255f Redo view mode choice in Tracks preferences 2018-03-25 14:35:12 -04:00
James Crook de53f64757 Bug 499 - Normalize includes white space in offset calculation 2018-03-25 15:58:34 +01:00
James Crook 2da227a714 Make zoom toggle finer grained
- Upgraders using zoom toggle will need to reselect the zoom levels they want.
2018-03-16 10:27:04 +00:00
andheh 87eaaa6f45 fixing strict-aliasing rule violations by passing enum types as int references 2018-03-06 21:30:39 +00:00
James Crook 4724c6a131 Fix spectral preferences extra caching issue. 2018-02-24 14:20:29 -05:00
Paul Licameli b2c69cb0f6 Define WaveTrack::Reinit() 2018-02-21 19:21:00 -05:00
Paul Licameli 3f05063681 Split "Do" functions out of the "Set" functions for some Track settings 2018-02-21 19:20:55 -05:00
Paul Licameli 4ef8da8f16 Revert "Preliminaries to support better interaction of undo and recording"
This reverts commit 6e75ae58ac, reversing
changes made to 714d53e00f.
2018-01-14 21:36:33 -05:00
Paul Licameli 950898dcb9 Revert "Bug 1823: Better interaction of undo and record..."
This reverts commit 1e8aba968d, reversing
changes made to 6e75ae58ac.
2018-01-14 21:27:41 -05:00
Paul Licameli 89d8fe18b1 Define WaveTrack::Reinit() 2018-01-14 19:33:39 -05:00
Paul Licameli 8b60e7f02d Split "Do" functions out of the "Set" functions for some Track settings 2018-01-14 19:03:52 -05:00
Paul Licameli 5407079c62 Remove EXPERIMENTAL_OUTPUT_DISPLAY...
... Maybe a good feature idea, but the implementation pollutes the code in
too many places.

It's a special case of the more general idea of many-to-one associations
between screen rectangles and track objects.  More generalized ways to
accommodate that should be sought.
2018-01-12 12:08:09 -05:00
Paul Licameli c975de8c5e More use of shared_ptr to Track, for safety...
... This even makes it possible to remove the prohibition of undo and redo
during transport, not that we want to though.  Playback and recording will
continue, using track objects that might not be in the current project.
2018-01-10 20:05:11 -05:00
James Crook 0cc9c6bc3b Zoom Toggle
Added preferences for Zoom-Toggle and put into menus.
New helper functions for determining zoom scaling.

Optional EXPERIMENTAL_ZOOM_TOGGLE_BUTTON added, and Light theme updated.
Not enabled for 2.2.2.
2018-01-07 17:14:33 +00:00
James Crook 13c6fdf663 VZooming Changes
1: Guard zone 8 pixels wide in VRuler to reduce risk of accidental use.
2: VerticalZooming preference, for VRuler zooming, off by default,
3: Enabled Paul's right-click menu in VRuler with some extra
presets (x2 and x0.5)
4: Rearranged some messy code with lots of ifs to use a switch.

Also, with EXPERIMENTAL_HALF_WAVE defined we now get a
'half wave' option in the VRuler menu, that shows the wave top half.
We also use it in collapsed waves (and collapsing and restoring
a WaveTrack will get you back to normal zoom.
2017-12-11 18:41:48 +00:00
Paul Licameli f136b5c530 Reviewed uses of InconsistencyException outside Sequence.cpp 2017-11-19 01:48:41 -05: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
James Crook e984211cce Bug 1290 - "Split New" clips cannot be dragged back into the track they came from.
Fixed by giving some tolerance in how the dragged clip(s) are placed.
The tolerance is 1px, so it depends on the zoom.  Therefore if zoomed in your positioning is more precise.
2017-08-19 22:46:33 +01:00
James Crook 4d43d2273b Bug 1516 - Clips: Can't drag vertically if starting position of clip overlaps clip in target track 2017-08-19 17:53:50 +01:00
Paul Licameli cb9d37f362 build fix 2017-07-09 14:09:33 -04:00
Paul Licameli 8e44827980 TrackPanelCell hit tests can return multiple results...
.. though only the first is used yet
2017-07-09 08:17:40 -04:00
Paul Licameli b3d62e2ab6 Simplify by removing class HitTestResult...
... Because all hit tests returned all fields blank, or else, returned a
UIHandle object whose Preview method gives the rest of the information; so
the other fields were redundant.
2017-07-09 07:57:34 -04:00
Paul Licameli 2c1a16f593 Changed lifetime management of UIHandle objects, no singletons...
... Rather, construct them during hit tests (also capturing more state sooner
rather than at Click time, and adding some accessors for later use)

This also fixes bug 1677 by other means and avoids similar problems.

A cell may be implemented to re-use a previously hit handle object, not yet
clicked, in a later hit test, by remembering a weak pointer, but TrackPanel
holds the strong pointers that determine when the object is destroyed.

And the objects will surely be destroyed after drag-release, or ESC key.

For now they are also destroyed whenever not dragging, and hit-testing is
re-invoked; that will be changed later, so that the re-use mentioned above
becomes effective, but still they will be destroyed when the pointer moves
from one cell to another.
2017-07-09 07:23:28 -04:00
Paul Licameli 3a8280c562 Distinguish TrackPanelMouseState from TrackPanelMouseEvent...
... Let cell hit tests, and handle preview, know states only, not transitions.

Cell hit tests are passed a mouse state that does not always match the current,
but anticipates the button click to come; usually left, but if the Control
[sic] key on Mac is down, then right.

Thus, pressing and releasing Mac Control in multi-tool switches in and out of
the magnifier cursor.
2017-07-09 06:38:55 -04:00
Paul Licameli bce3571372 Redo hit test priorities in TrackPanel...
Zoom tool takes precedence;

Otherwise do special hits appropriate to the track subclass -- and only
WaveTrack here uses Tools toolbar state, and now disallows clicks on things
when they are not drawn because the view is spectrogram;

Finally, default to right button zooming in Multi tool, or to time shift in
that tool, or to selection adjustment in Multi or in Select tool.
2017-06-27 08:26:07 -04:00
Paul Licameli 35ce499ce1 Manage TrackControls and TrackVRulerControls by shared_ptr; ...
... they are not singletons; and the back-pointers to their Tracks are weak.
2017-06-26 16:34:10 -04:00
Paul Licameli 14d45eda33 Define and use the UIHandle and TrackPanelCell protocols, but...
...no actions reimplemented to them yet.

Later commits will move special cases one at a time from TrackPanel, preserving
all click and drag capabilities at each step.  With a few exceptions, but those
lost abilities are restored in yet later commits.  (Ctrl+Click on the Label
track being one.)
2017-06-15 08:20:56 -04:00
Paul Licameli 537ccfbc4f Change evaluation of envelope near discontinuities...
... So that even if the time is "slightly" (less than 1/2 sample interval) left
of the discontinuity, the right-hand limit is always used.

Thus this compensates for some roundoff errors when pasting one clip with
an envelope into another.

This overcomes the objections that were in a comment in Envelope::Paste
to making control points with exactly equal times.

And therefore Paste can be rewritten to do so, but that has not happened yet.

Envelope points at exactly equal time coordinates can already be made by
dragging points in the envelope editor.
2017-05-26 14:50:43 -04:00
Steve Daulton 53a64757e7 Stem Plot option when displaying samples
Initial commit.
2017-04-27 15:16:05 +01:00
David Bailes a7a4a70e5f Two commands added, neither on a menu:
Clip Left
Clip Right

If the cursor lies within a clip, the clip and the cursor is moved 1 pixel left/right.
If the cursor position is at both a clip end and a clip start, the second of these clips is moved.

The movement currently ignores the snap to setting on the selection bar, and there is no snapping to the clip boundaries of other clips.
Following the behaviour or shifting with the mouse, the distance moved is rounded to an integral number of samples, and the minimum distance moved is one sample.
2017-04-03 13:53:48 +01:00
James Crook 028ed19d90 Sync with DarkAudacity 2017-04-02 23:07:13 +01:00
Paul Licameli 0d7250578d Other methods of WaveTrack return void, will throw on failure instead 2017-03-31 18:26:52 -04:00
Paul Licameli e1473dfe76 void return, not boolean success, from some Track virtual functions...
... The return codes were mostly ignored anyway, and exceptions will be thrown
instead.

It seems there was also confusion whether the return values of Track::Paste
and Track::SyncLockAdjust were to indicate success or indicate whether there
was any change.  No matter now.
2017-03-31 18:26:52 -04:00
Paul Licameli c391a8f884 Define AudioTrack and PlayableTrack as common bases for Wave and Note 2017-03-29 13:27:22 -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 18be1bdad6 Remove naked new[] in: tracks 2017-03-17 17:52:47 -04:00
Paul Licameli ea05fac870 Remove naked new[] in: mixer 2017-03-17 17:52:45 -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 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 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 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 84a6456788 Iterate over all clips of a track, including cutlines, where needed 2016-08-13 20:17:55 -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 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 20bee00115 Remove some naked new amd delete in: tracks and clips 2016-08-08 07:30:44 -04:00
Paul Licameli def73e80ef Revert "Simplify WaveTrack::Locker"
This reverts commit 02a2bdc92b.
2016-04-13 18:11:45 -04:00
Paul Licameli 02a2bdc92b Simplify WaveTrack::Locker 2016-04-12 12:03:01 -04:00
Paul Licameli 1033095696 RAII for locking of WaveTracks 2016-04-12 00:55:59 -04:00
Paul Licameli f7780adbf5 Comments about CloseLock() functions 2016-04-12 00:54:55 -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 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 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 990080ae7d Replace virtual with override wherever possible; eliminate needless virtual...
... for functions in final classes.

override is like const -- it's not necessary, but it helps the compiler to
catch mistakes.

There may be some overriding functions not explicitly declared virtual and I did
not identify such cases, in which I might also add override.
2016-02-26 12:35:38 -05:00
Paul Licameli 4a6fd96a97 Commented out some unused functions 2016-02-26 12:35:30 -05:00
Paul Licameli 7824e94030 Harmlessly qualify classes as final (or explicitly comment not)...
... Should have no effect on generated code, except perhaps some slight faster
virtual function calls.  Mostly useful as documentation of design intent.

Tried to mark every one of our classes that inherits from another, or is a
base for others, or has abstract virtual functions, and a few others besides.
2016-02-24 20:58: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 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 321d5259a2 More uses of SampleBuffer, eliminating explicit DeleteSamples calls 2016-02-01 10:16:00 -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 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 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 4a704af03f Restore Waveform (dB) to Tracks preferences for default view mode 2015-08-19 10:21: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 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
Paul Licameli 508abda309 Bugs 1043, 1044 -- Even better fix...
... With a careful sweep of uses of WaveTrack::GetDisplay() to remove
assumptions about the ordering of the values.

Using < and <= on enum values is mostly a bad idea.
2015-07-18 23:56:30 -04:00