1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-24 16:20:05 +02:00

127 Commits

Author SHA1 Message Date
Paul Licameli
81a3a7d339 Use the TimeQueue to communicate play head position updates for scrubbing...
... from the Audio thread to the PortAudio thread;  the old
ScrubQueue::Consumer() function keeps only a vestigial purpose to prevent the
scrub queue from blocking.
2018-08-25 20:08:09 -04:00
Paul Licameli
389ab0c8d0 Fewer calls to RingBuffer::Put in case of trailing zeroes...
... so there is only one update per track of the atomics in RingBuffer in each
pass of the loop in FillBuffers, which will be needed to synchronize RingBuffer
and TimeQueue correctly.
2018-08-25 20:08:09 -04:00
Paul Licameli
b2df5e0673 Declare and allocate time value queue 2018-08-25 20:08:08 -04:00
Paul Licameli
67a9823434 split out function AdvancedTrackTime; more caution about termination 2018-08-25 20:08:08 -04:00
Paul Licameli
111d2c8673 Can specify a minimum to maintain in the playback RingBuffer...
... this may be more than the batch size used in ongoing playback.

It is expected that this larger batch size is used only once when priming
the queue before starting play.  But then FillBuffers() may attempt to
refill up to the minimum in case demand is outpacing supply.

Thus the new number defines a "yellow zone" for the queue.
2018-08-25 20:08:07 -04:00
Paul Licameli
45231b8f6a Consume equal amounts from play ring buffers in each callback pass...
... which should be the whole framesPerBuffer normally.

Also rename another function used in producing the samples.
2018-08-25 20:08:07 -04:00
Paul Licameli
8e151aba8d Split out AudioIO::AllocateBuffers 2018-08-25 20:08:05 -04: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
3bb48a21df Bug 1932 - (Residual) Fix stopping behavior with Play-At-Speed.
1. The rate actually used by the sound card now sets the stopping sample number.
2. The tolerance in the 'stop position' is additionally trimmed to 20 samples.
2018-08-19 10:37:43 +01:00
Steve Daulton
1d22ca5789 Improve error message when capture stream fails
Rather than just guessing at the cause of the error, include the actual
error string from PortAudio.
2018-08-12 19:14:56 +01:00
Paul Licameli
d55ca06db0 Remove unused member 2018-08-12 08:25:50 -04:00
Paul Licameli
ce1ce688ff Try to clarify real time / track time distinction in comments...
... Rather than the confusing old terminology of "warped" time, meaning the
real time after accounting for time track, though that persists mostly in the
names of variables now mostly used only within PlaybackSchedule.

"Track" time refers to a position in a wave track, as indexed by the time
ruler.

"Real" time is indexed by the other scale of numbers drawn in the time track,
which is drawn on the screen with nonuniform spacing (so "warped" in that
sense), but it corresponds to uniform actual time.
2018-08-11 15:14:18 -04:00
Paul Licameli
0d9972b3e0 Some member functions of AudioIO can be const 2018-08-10 22:58:33 -04:00
Paul Licameli
f036700b09 Make PlaybackSchedule::mTime atomic and rename some functions...
... The variable ought to be atomic because it is read and written by different
threads.

Use local variables to avoid repeated reads of the atomic.
2018-08-10 21:30:14 -04:00
Paul Licameli
8a78ae280c Factor out a piece of the big callback 2018-08-10 17:33:18 -04:00
Paul Licameli
197122c7d5 Collect initialization of playback schedule into a function 2018-08-08 16:36:42 -04:00
Paul Licameli
46d7804cdf Group some of the fields of AudioIO into PlaybackSchedule 2018-08-08 14:10:21 -04:00
Paul Licameli
fc8783bc74 Put callback in a member function, remove many more gAudioIO-> 2018-08-08 12:30:10 -04:00
James Crook
f0637eeb85 Bug 1906 - Issues with dynamic Play-at-Speed (Play doesn't pop up)
Fixed issue 1, i.e. the play button does not pop up after play at speed completes.
2018-07-21 21:14:30 +01:00
Paul Licameli
2c7ca97095 Reimplement change of color of playhead after pre-roll, more simply 2018-06-11 18:27:18 -04:00
Paul Licameli
77779395c7 Revert "Play head is green during pre-roll, then turns red for real recording"
This reverts commit 8e51391b98ad7a98f49c98929a10322dd551391f.
2018-06-11 18:23:56 -04:00
Paul Licameli
8e51391b98 Play head is green during pre-roll, then turns red for real recording 2018-06-09 14:40:09 -04:00
Paul Licameli
de230254bd Add to recording preferences for pre-roll and crossfade 2018-06-01 04:29:00 -04:00
Paul Licameli
a0256e935c Recording options allow crossfade data for start of recording 2018-06-01 04:28:58 -04:00
Paul Licameli
f9cd5595d5 Stop playback of pre-rolled tracks at the right time 2018-06-01 04:28:57 -04:00
Paul Licameli
35c60ac96d Allow for preRoll in start-stream options 2018-06-01 04:28:55 -04:00
Paul Licameli
35a97e09e7 Group arguments to StartStream, and a bit less of #ifdef for MIDI play...
... And pull choice of tracks and options out of DoRecord
2018-05-29 00:22:12 -04:00
Paul Licameli
a3abacd55d Adjust for latency as you record, don't wait till after stopping...
... Adjust whenever recording, regardless whether there is any overdub
playback too.

May adjust by discarding samples when the Track Shift after Record preference
is negative (as by default); or, by inserting silence into the start of the
recording, when that preference is positive, though that may be less useful.

Perhaps the preference control should no longer be called "Track Shift after
Record."
2018-05-25 07:21:46 -04:00
Paul Licameli
0887d6d01e When recording into region selection, stop it precisely 2018-05-24 17:05:44 -04:00
Paul Licameli
8be1e8fdad Remove wxArray(Int|Long|Double) except where wxWidgets fns need it 2018-02-21 19:33:31 -05:00
Paul Licameli
2fbe04eda0 Replace more Connect with Bind; needed redeclaration of custom events 2018-02-21 19:30:40 -05:00
Paul Licameli
12983e1685 Use wxWeakRef to avoid dangling pointer 2018-02-21 19:25:04 -05:00
Paul Licameli
57ce726a25 Rename Meter as MeterPanel, and some DOxygen 2018-02-21 17:50:28 -05:00
Paul Licameli
22605c089f Enable upstream dropout detection 2018-01-24 17:46:57 -05:00
Paul Licameli
f78a418df8 An alpha-only toggle command for extra dropout detection; default off 2018-01-17 20:35:56 -05:00
Paul Licameli
81b22a2b2b Reimplement the insertion of zeroes at drop-outs...
... and correct for latency only when there is at least one playback track
2018-01-17 12:56:35 -05:00
Paul Licameli
d2749068f1 Allow reporting of drop-outs to be turned off by Recording prefs...
... Just in case it turns out to make some false positives.
2018-01-15 18:48:44 -05:00
Paul Licameli
9777d3e880 Alert user to drop-outs during recording...
1) When the program detects this, insert zeroes into the recording to keep the
other good parts synchronized.

2) When recording stops, a message box alerts the user, and a label track is
added showing the lost parts, labelled with consecutive numbers.

3) A menu item visible in alpha builds only is added to Tools, to simulate
recording errors at random times and test the reporting feature.
2018-01-15 14:48:39 -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
d2fe7b1757 Clean up most remaining MSVC warnings. 2018-01-06 13:03:48 +00:00
Paul Licameli
ce649cf851 Re-enabling the separate MIDI thread, and comments about that 2017-09-24 02:29:02 -04:00
Paul Licameli
51296237da Roger's timing correction for Alsa; I unified with non-Alsa case...
... Write only one variable in audacityAudioCallback, to be read (maybe in
another thread) by AudioIO::MidiTime().

The non-Alsa case behaves essentially as before:  it wasn't broken, so it
isn't fixed, though it is rearranged.
2017-09-24 02:29:02 -04:00
Paul Licameli
7c67133ff7 Roger's changed FillMidiBuffers loop test (seems harmless, all OSs) 2017-09-24 02:29:01 -04:00
Paul Licameli
b38bacfafa Remove my USE_TIME_INFO conditional compilation... will fix otherwise 2017-09-24 02:29:01 -04:00
Paul Licameli
857a7ca737 Roger Dannenberg's fix for MIDI notes-off, applied to Linux only...
... but then, always:  It's a problem in portmidi which uses ALSA always, no
matter what the chosen portaudio host is.
2017-09-24 02:29:01 -04:00
Paul Licameli
a971dd5bb4 Detect whether ALSA is the portaudio host (possible only on Linux) 2017-09-24 02:29:01 -04:00
Paul Licameli
c11e3d1511 Make effects of 582e574 conditionally compiled...
... It was only "mostly harmless" on Windows and Mac.

Now where is my towel?
2017-08-29 18:42:18 -04:00
Paul Licameli
75bdde3003 To synch better, just don't use a separate thread for MIDI! ...
... I am not sure that this will solve all problems of jittery play, but I do
think this will solve the problem of a rush of slightly late notes at start of
play.
2017-08-27 10:53:05 -04:00
Paul Licameli
582e574ab8 A not-harmful change to MIDI timing for Windows and Mac...
... and hoping it is positively helpful for Linux.

In AudioIO::MidiTime(), compute one of the terms by different means.

Use PaStreamInfo::outputLatency.

Do not use the difference of PaStreamCallbackTimeInfo::outputBufferDacTime
and PaStreamCallbackTimeInfo::currentTime.

Which debugging shows is very nearly the same value for Windows and Mac.

But we suspect the PaStreamCallbackTimeInfo fields are not correctly reported
on Linux.
2017-08-27 03:26:44 -04:00
Paul Licameli
4a0a7efd84 Fix MIDI timestamp calculations when you loop AND have time track...
... At least it fixes the gross problem; but there seems to be a small
accumulation of error still each time around the loop, that I don't understand
yet.
2017-08-24 19:48:45 -04:00