Commit Graph

422 Commits

Author SHA1 Message Date
Paul Licameli 77dab158c3 Make Audacity build in C++17 ...
... Fixing many conditional operators with explicit construction of wxString
instead of simple string literals;

And fixing allocation of more strictly aligned structures on Mac, without need
for 10.14 as the minimum SDK, by means of some class-specific operators new
and delete.
2021-06-18 21:44:55 +03:00
Dmitry Vedenko 690772ccb0 Use ShowExceptionDialog when we want to show ErrorReportDialog 2021-06-08 08:08:26 -07:00
Paul Licameli 6eb5f3ac5b Eliminate CopySamples calls where destination is always float...
.. Call the function SamplesToFloats instead, or in one place, where source
is also always float, just do memcpy.

Dithering never happened in these cases.
2021-05-27 11:38:09 -04:00
Paul Licameli f1de843246 Use Settings for default sample rate and format...
... The first is an example of a Setting with a computed default value.

Also making a new file to hold them, separate from the GUI that changes them
in QualityPrefs; fewer things depend on QualityPrefs
2021-05-17 08:46:08 -04:00
Paul Licameli 8c04ed3990 Settings objects used in AudioIOBase...
... Giving many examples of use of Settings objects.  Many other rewrites like
this should be made to eliminate as many direct uses of gPrefs as we can.

Don't rely on long distance coincidences of literals for paths or defaults.

For each of several paths like /AudioIO/Host, all uses of that path are replaced
with use of a global Settings object defined in one place, in AudioIOBase.  The
object also gives the benefit of caching the last-read or written value.

Other users of those preferences must then include "AudioIOBase.h" to make the
dependency explicit at compile time.

It should be checked that no other mentions of those paths remain in the source,
and that there was no unintended change in default values.

This also inverts dependency of AudioIOBase on RecordingPrefs, which is GUI for
changing some of these settings.
2021-05-17 08:46:08 -04:00
Paul Licameli 9a66255013 Move AudioIOBase::mPlaybackSchedule up into AudioIoCallback 2021-05-14 16:25:41 -04:00
Paul Licameli 85a8d0ac97 Keep !EXPERIMENTAL_MIDI_OUT compilable 2021-05-11 19:32:10 -05:00
Paul Licameli c5ebc396eb Audacity.h has shrunk to nothing, now remove it! 2021-05-10 00:05:23 -05:00
Paul Licameli e653b4aaf8 Eliminate Experimental.h, configure compile options instead...
... This makes it impossible to forget to include the EXPERIMENTAL definitions
(such as when cutting and pasting code) and so get unintended quiet changes of
behavior.

The EXPERIMENTAL flags are now specified instead in new file Experimental.cmake
2021-04-27 12:40:07 -04:00
Paul Licameli e4eea36d0a Remove old duplicate test for end of MIDI playback...
... which, anyway, had errors introduced into it (realTime mistakenly used as a
duration)
2021-02-06 09:20:30 -05:00
Paul Licameli e47245bd8c Fix use of uninitialized data for meter when emulating volume 2021-02-06 09:20:30 -05:00
Paul Licameli 175584cb51 Removed some unnecessary #include directives 2021-02-04 08:26:29 -05:00
Leland Lucius f509d9c0bd Bugs 1592 and 2639
Sound activated record is now decoupled from the input meter.
2021-01-22 23:43:01 -06:00
Paul Licameli cccc7a7c4e Keep !defined(MIDI_THREAD) branch compilable...
... The break was caused by ffa67d2 which split the base class AudioIoCallback
out of AudioIO.

This change only demotes some member declarations from AudioIO into
AudioIoCallback, and changes the qualified names of function definitions.

So now you can eliminate #define MIDI_THREAD in AudioIO.h and rebuild.
2021-01-16 14:34:22 -05:00
Paul Licameli 88f059fcf1 dropQuickly branch always consumes just as many samples as the other 2021-01-12 08:41:36 -05:00
Paul Licameli bf6d94ce57 Remove unused AudioIoCallback::mAudioCallbackClockTime 2021-01-12 08:40:21 -05:00
Paul Licameli 510c5683d9 Increase time queue allocation by one entry...
... guarantee the gap between producer and consumer is more than one grain, so
that the consumed entry is not still being produced.

Fixes small errors in positioning of the green play head line.
2021-01-12 08:36:05 -05:00
Paul Licameli 20d72ee745 fix a comment 2021-01-12 08:08:14 -05:00
freddii 534359de6c
Fix minor typos (#720)
Co-authored-by: freddii <https://freddii@github.com>
2021-01-12 11:56:09 +00:00
Paul Licameli c410228cfb Debug build shouldn't hang when MIDI play fails to start 2020-12-24 14:28:17 -05:00
Paul Licameli 55ad1b43b8 More members of Mixer are const 2020-11-30 19:03:55 -05:00
Paul Licameli f5fd860430 Bug2591, more mitigation: TransactionScopes mean fewer checkpoints...
... and probably less contention with the checkpoint thread during recording,
and probably less total drop-out time when stress-testing recording with high
sample rates or slow external devices or both.

And another transaction scope for the post-processing of dropouts may reduce the
total time spent there.
2020-11-25 13:50:09 -05:00
Paul Licameli 262dbabbf5 Bug2591 mitigation, maybe: coalesce touching dropout intervals...
... The post-processing of an excessive number of small, touching intervals
was one cause of apparent hangs when stopping recording to a slow external
device and using a high recording sample rate, in my own trials.
2020-11-24 22:28:49 -05:00
Paul Licameli 372393f49e Rewrite comments about exception safety guarantees with Doxygen...
... Defining a new macro, which generates a special paragraph with links to a
new page describing the principles.
2020-08-22 23:07:28 -04:00
Paul Licameli bd6536f3c4 Remove obsolete mentions of blockfiles in comments & incomplete types 2020-07-20 19:03:31 -04:00
Paul Licameli 6eb6aab8f5 Commit autosave blobs during recording only as needed...
... when there really is at least one new sample block committed to the table,
which is typically only once in about every six seconds, with the default rate
and sample format.

Also renamed a callback function more aptly, since blocks are not files any
more.
2020-07-11 05:13:38 -04:00
Leland Lucius b12fafbea0 AUP3: Fix stupied build failure 2020-07-10 01:32:56 -05:00
Leland Lucius d39590cf41 AUP3: First round of updates
!!! THERE WILL NO DOUBT BE BUGS !!!

This is a big one and there's still several things to
complete. Just want to get this in the wild to start
receiving feedback.

One big thing right now is that it will NOT load pre-aup3
files.  An importer is on the way for that.
2020-07-01 02:30:18 -05:00
Paul Licameli 37714a0db7 Remove portmidi and porttime from other headers 2020-06-14 12:32:28 -04:00
Paul Licameli 3869a8f460 Remove allegro.h from other headers 2020-06-14 10:32:16 -04:00
Paul Licameli c84a2d295d Remove portaudio.h and portmixer.h from AudioIOBase.h 2020-06-12 11:39:18 -04:00
Yuri Chornoivan d1ada5f08c Fix minor typos 2020-04-11 10:06:24 +01:00
Carlo Bramini 9eaa2f28f7
Allow use of wxPowerResource if wxWidgets is 3.1.x (#474)
I got an error when compiling with wxWidgets 3.0.4, because wxPowerResource is undefined.
It seems to me that wxPowerResource has been introduced with wxWidgets 3.1.x branch:

51d715e46d (diff-93a9bace734a8065b203ebd2f670cbe8)

so, it would be worth to check if the feature is supported at compile time.
2020-04-01 21:23:45 -05:00
Leland Lucius d8dd9a0cc8 Prevent random activations of the Pause button
I don't know how this hasn't been seen before, but Cliff found that
opening Audacity via Commander One would, more often than not, cause
the pause button to enable when you started monitoring.

Seems it was picking up uninitialized memory values, but near as I can
tell, this has been this way for a very long time (like forever).  So,
it's possible that I've not completely identified the culprit.

Even so, this should be initialized anyway and Cliff reports that it
does resolve the problem for him.
2020-03-18 11:59:41 -05:00
David Bailes e0302257c5 Keyboard scrubbing and Play-at-speed: remove initial silence
Currently AudioIoCallback::ScrubState::Get(), inserts a period of silence the first time it's called because at this time Scrubber::ContinueScrubbingPoll() has not been called, and so message.end has not been set to an appropriate value.
In the case of keyboard scrubbing and play-at-speed, the initial speed is already known, so message.end can be set to this value, removing the need for an initial silence.
The start of keyboard scrubbing and play-at-speed are now faster (the latter very much faster).
2020-02-11 15:56:12 +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
Leland Lucius 036efda65e Prevent system sleep at a different point
Instead of only when recording (it broke monitoring), now Audacity
will prevent the system from sleeping while any audio I/O is active.

This might be a little strong-handed though and maybe should be a
preference option.
2019-12-24 00:33:54 -06:00
Paul Licameli 287f9689f2 Keep EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT compilable 2019-12-21 00:14:09 -05:00
Paul Licameli 2007346551 Pass TranslatableString to help, warning, and error dialogs 2019-12-20 21:48:21 -05:00
Paul Licameli dc39f22442 AudacityMessageBox takes TranslatableString message and caption 2019-12-20 21:32:50 -05:00
Paul Licameli 53ee9c9800 TranslatableString for titles, names, labels of wxDialogWrappers...
... Found one missed translation in CommandTargets.cpp
2019-12-16 10:58:05 -05:00
Paul Licameli 9bcd09a8a1 Bug2164: Quick play should work after recording...
... bug began at 7969b5a9e9
2019-07-31 12:35:54 -04:00
Paul Licameli 7969b5a9e9 Bug2159: Ruler play region should update when play/record stops 2019-07-15 23:28:25 -04:00
Paul Licameli 2f3b119caa Bug2129 residual: click effect Preview button make Linux assert failure 2019-07-14 12:00:33 -04:00
Paul Licameli e2362bc25a Move project status string management to new attached object class 2019-07-02 21:01:34 -04:00
Paul Licameli 0b7a4d07b9 Fix wrong arguments to wxClip in AudioIO...
... the bug began at commit 494ab4eafe

Now, a sine wave with the gain turned up really sounds like a square wave
2019-06-29 23:44:11 -04:00
Paul Licameli e08a942ab8 Fix other cause of intermittent timing-dependent crash at shutdown...
... AudioIO holds a weak pointer to its listener so there is no dangling
pointer
2019-06-24 13:32:08 -04:00
Paul Licameli 5627620b78 Remove dependency of AudioIO on Scrubbing.cpp ...
... though the demotion of the constant into AudioIO.h isn't wholly satisfactory
and there is still the scrubbing queue in AudioIO
2019-06-24 12:52:54 -04:00
Paul Licameli d9b780b067 AudioIO does not depend directly on ControlToolBar ...
... use one more callback in the listener to change the ControlToolBar pause
state.
2019-06-24 12:43:08 -04:00