Commit Graph

89 Commits

Author SHA1 Message Date
Paul Licameli 0aa8625cff WaveTrackCache was only used with float; don't support other formats 2021-05-27 11:38:10 -04:00
Paul Licameli 50a26d9caf CopySamples gives more than binary choice of dither algorithm...
... And so a separate function CopySamplesNoDither is not needed
2021-05-27 11:38:10 -04:00
Paul Licameli c5ebc396eb Audacity.h has shrunk to nothing, now remove it! 2021-05-10 00:05:23 -05:00
Paul Licameli 264f133964 An i18n-hint comment 2020-12-24 19:11:23 -05:00
Paul Licameli 55ad1b43b8 More members of Mixer are const 2020-11-30 19:03:55 -05:00
Paul Licameli 4871584cb3 Mixer::WarpOptions constructor for common case 2020-11-30 13:42:35 -05:00
Paul Licameli 0945b6b734 Bug2536: crash on Mac sometimes playing back with resampling...
... Intermittent crash, depending on some accidents of memory page allocations,
known to happen sometimes when playing a 44100 Hz track at 32000 Hz; the
strange story is in the code comments
2020-11-19 18:23:15 -05:00
Paul Licameli 4ca3e7096f
Track factory cleanup (#646)
* Don't need TrackFactory to make LabelTrack

* Don't need TrackFactory to make NoteTrack

* Don't need TrackFactory to make TimeTrack, or ZoomInfo in the factory

* Remove some forward declarations

* Rename TrackFactory as WaveTrackFactory, move it out of Track.cpp
2020-08-22 18:44:49 -05:00
Paul Licameli c941647db6 Replace last wxProgressDialog with ProgressDialog; remove all wx/progdlg.h 2020-05-22 20:44:08 -04:00
David Bailes d531e8a2f8 Fix Linux build.
Problem caused by my commit: 64079c3. DBL_MAX was not declared.
2020-01-17 10:06:27 +00:00
David Bailes 64079c3f55 Keyboard scrubbing: faster change of direction
If one of the keyboard scrubbing keys is being held down, and the other keyboard scrubbing key is pressed:
1. With current behaviour, scrubbing in the other direction only starts when the original key is released - scrubbing stops and then starts in the other direction.
2. With the new behaviour, scrubbing immediately changes direction, and does not stop when the original key is released - scrubbing does not stop and then start again.

New behaviour:
If one of the keyboard scrubbing keys is being held down,
2020-01-17 09:32:17 +00:00
David Bailes 6b9c8e79cc Bug 1954: Clicks may occur starting/pausing play-at-speed or Scrub
Problem:
On Windows, after 50ms, there is a short period of roughly zero introduced into the output. On Linux, there is also a spike which sounds like a crackle.

In AudioIO::FillBuffers(), Mixer::SetTimesAndSpeed() is called, which sets mT0 and mT1 to a small interval.
In Mixer::MixVariableRates(), all the samples in the interval are used, which means the Resample::Process() is called with last equal to true.
So when Mixer::MixVariableRates() is called again, the resampler is being reused after a call to Process() in which last is true.
It is not stated in the soxr documentation if the resampler will produce valid results in this case, and it's only the scrubbing code which does this.
I think this is the problem, and so the partial fix below avoids this happening.

Partial fix for play-at-speed and keyboard scrubbing:
For these, there is no need to reset the values of mT0 and mT1. (There is no need to allow for the sample position being used to potentially jump around.)
So for these cases, Mixer::SetSpeed() is called, rather than Mixer::SetTimesAndSpeed().
2020-01-15 11:12:40 +00:00
Paul Licameli 9a609fe1fe TranslatableString in ProgressDialog 2019-12-14 01:48:15 -05:00
Paul Licameli 291bd7258f Track.cpp does not depend directly on its subclasses 2019-06-12 11:14:19 -04:00
Paul Licameli 46bf5a82fc Don't pass whole TimeTrack to Ruler or Mixer...
... they need only the information in a (Bounded)Envelope.
2019-06-10 20:48:38 -04:00
Paul Licameli 6c57948d8f Remove unnecessary #include-s from .cpp files...
... 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.
2019-05-16 17:21:00 -04:00
Paul Licameli f6adeed47b Remove some unnecessary #include directives 2019-05-15 14:14:18 -04:00
Paul Licameli 0b733eed3f Remove (or comment) ProgressDialog.h in headers...
... For ImportPlugin, use unique_ptr not Maybe to hold it, and take constructors
out-of-line.
2019-04-04 09:47:57 -04:00
Paul Licameli 41175e94cd Simplify by removing many std::move of shared_ptr to tracks...
... Don't need them, as we did with std::unique_ptr
2019-03-16 13:11:33 -04:00
Paul Licameli 6f89c48873 Reimplement Track::Pointer using std::enable_shared_from_this...
... now the Track need not be owned yet by a TrackList
2019-03-16 13:11:32 -04:00
James Crook 0eb778631b Bug 2045 - Clicky playback with Play-at-Speed and Scrubbing/Seeking 2018-12-03 21:04:50 +00:00
David Bailes 03b0d3f89a Bug 2025: Windows: Wasapi: seek commands can cause crash
Problem: With host set to WASAPI: if the playback position is less that about ten seconds before the end of any of the tracks and the user presses one of the left/arrow keys to seek, then a bug alert appears, and it's seems like it's impossible to recover from this.

libsoxr 0.1.3, first used in Audacity 2.3.0, crashes with constant rate resampling if you try to reuse the resampler after it has flushed.

Fix: work around which is the same as used for bug 1887 - recreate resamplers, rather than reusing them.
2018-11-07 14:58:12 +00:00
Darrell Walisser 5dfff70f5b Fix OpenMP build 2018-10-14 11:34:37 +01:00
James Crook 657159d542 Fix C4189 and C4100 Warnings
C4189 is 'Local variable initialised but not used'
C4100 is 'Unreferenced parameter'

Fixed some other warnings, e.g. about empty if, too.
2018-10-10 19:46:24 +01:00
Paul Licameli beebe648fb Remove more uses of Track::SetLinked() and Track::SetChannel() 2018-10-01 13:42:36 -04:00
Paul Licameli 4aa990e835 Remove GetLink(ed) in various other places 2018-10-01 13:42:33 -04:00
Paul Licameli 072b711353 Revert cc08cfc, it's unimportant to other work and it made scrub clicky 2018-08-09 19:34:33 -04:00
Paul Licameli cc08cfc9fd Restart of Mixer is same as Reposition at t0 2018-08-08 14:16:17 -04:00
Paul Licameli 14051f04cf Bug1887: crash or hang loop-playing with WASAPI; libsoxr 0.1.3 to blame...
... probably?  This is a workaround to prevent crashes in libsoxr that did
not happen with the previous version.
2018-06-11 14:05:00 -04: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
Paul Licameli ccb4bbac33 Translate "Message" as default title of message box...
... This required a sweeping change of all calls to wxMessageBox!  But it seems
safe to me, despite the great number of touched files.
2018-01-01 17:50:02 -05:00
Paul Licameli 4d978bcefb Use wxPrintf not printf 2017-12-16 11:54:32 -05:00
James Crook f463eda36c Clean up some dead code and MSVC warnings.
- 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.
2017-12-08 15:20:39 +00:00
Paul Licameli fcd175183f Bug1632: correct length of non-WAV exports >= 2^32 samples long...
... WAV format simply can't do that, others (FLAC, ogg, mp3) can and should

Some history:

This got broken very badly for an interim starting at
919d77d176.
Exported files were only tens of bytes!

This was broken differently after
ad04187a41 with symptoms as in the bug report.
2017-07-18 12:25:32 -04:00
Paul Licameli 1a86819b4b Fixes for clang build with 64 bit unsigned long 2017-03-30 10:46:44 -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 ea05fac870 Remove naked new[] in: mixer 2017-03-17 17:52:45 -04:00
Paul Licameli 7b073cd63c Fix naming of right channel of mix-and-render results 2017-03-17 17:52:35 -04:00
Paul Licameli 87775d35e0 null pointer checks on all uses of WaveTrackCache::Get 2017-03-17 17:52:35 -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 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 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 39d514b183 Some more const, some stl idioms, remove unused declaration 2016-09-13 22:03:58 -04:00
Paul Licameli 67cec5ad83 Make many counts of tracks and channels unsigned...
... And in some places where a library uses signed types, assert that
the reported number is not negative.

What led me to this, is that there are many places where a size_t value for
an allocation is the product of a number of channels and some other number.
2016-09-07 10:11:41 -04:00
Paul Licameli 2a2013cb4b More decltype and auto, mostly for loop index variables 2016-09-06 20:46:25 -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
Paul Licameli b093a8e406 SAMPLE_SIZE macro returns size_t 2016-09-06 12:39:58 -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