1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-28 22:28:44 +02:00

164 Commits

Author SHA1 Message Date
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
Paul Licameli
85b2f80545 Correct mMidiOutputComplete, though it doesn't matter...
... Used to be, it became true too soon when play started after time 0, so
AudioIO::IsStreamActive() might become false too soon -- except that now there
is always a portaudio stream when there is a midi stream, so that didn't happen.

Mistake was to add mT0 to MidiTime(), which already has mT0 for its origin.

This error would affect nothing if you just let play to the end without trying
a keystroke command.  The error might have been enabling the wrong commands.
2017-08-24 19:47:08 -04:00
Paul Licameli
47eaf526a6 Bug1714, more: better calculation of MidiTime...
... after I reflected more on the explanation of it in the long comment at top.

Brings back the use of PaUtil_GetTime() but now calls it also in the audio IO
callback, so we can correct the unspecified origin of times supplied to the
audio IO callback to agree with the PaUtilGetTime() clock.

Thus the Midi time calculation is again based on the clock time of the other
thread that calls MidiTime, making it a few milliseconds more accurate, while
avoiding subtraction of two times based on widely different origins, which
made the big numbers that overlowed and caused Bug1714 to happen.
2017-08-17 23:25:01 -04:00
Paul Licameli
f2ee945da0 Bug1714, partial fix for silent, freezing Midi play on ALSA...
Don't assume Pa_GetStreamTimePaStreamCallbackTimeInfo origin is time-of-day.

portaudio.h says you should not, and in fact it was not.

The report is that this gets us some play, but there are still freezes.
2017-08-13 15:12:48 -04:00
Paul Licameli
07ea0ae03f Workaround for GarageBand as synth not respecting notes-off message 2017-07-25 14:56:02 -04:00
Pokechu22
4d3d32ca4d Remove MIDI-only playback (without portaudio) logic
Instead, always start a portaudio stream (if there is either a note track or a wave track).  This ensures that playback is always in sync (eg when recording), and gets rid of a lot of duplicate logic throughout.

Scrubbing (currently) still doesn't work with only note tracks, but it should be easier to fix that now than trying to reimplement all of the scrubbing time logic.

Conflicts:
	src/AudioIO.cpp
2017-07-16 18:10:48 -04:00
Pokechu22
c50567e1db Time track properly warps the MIDI event times (but not pitches)
mMidiPlaySpeed doesn't handle all of the options provided by time tracks,
and in fact doesn't even use time tracks.  Using the time track
instead allows note tracks to remain synchronized with the rest of the audio.

mMidiPlaySpeed _did_ work where it was used in the transcription tool
bar, but that already updates a time track so no special handling is
needed.
2017-07-16 14:28:58 -04:00
Pokechu22
62ebb2f95d Remove unused and unneeded MIDI methods and variables
The fields in AudioIO are simply unneeded (commented out, declared but never implemented, or otherwise unused).

mLastMidiPosition (in NoteTrack) looks like the vestiges of a far older attempt at MIDI playback; the field itself is completely unused though so it is safe to remove it.
2017-07-16 11:07:28 -04:00
Pokechu22
437de15098 Add more method and field documentation
Mostly for MIDI-specific areas, and general AudioIO fields.
2017-07-16 11:07:28 -04:00
Pokechu22
681161f60b Add MIDI device diagnostics
* MIDI Device Info menu item, like Audio Device Info

 * MIDI device info in crash reports

 * Only enabled with EXPERIMENTAL_MIDI_OUT, but tracks info related to the (unimplemented) EXPERIMENTAL_MIDI_IN
2017-07-16 10:58:53 -04:00
Pokechu22
724091eb15 Fix missing include for allegro
Allegro, for some reason, does not include <cstring>, which causes compile errors when including the header.
2017-07-04 07:50:15 -04:00
James Crook
7f98672e22 MIDI_OUT on by default on windows.
The idea is to get SOME use and test of MIDI_OUT even though it does not compile on Linux yet.
2017-04-27 12:56:39 +01:00
James Crook
419b790235 Make monitoring work after a theme change 2017-04-05 17:29:24 +01:00
Paul Licameli
eeb301e50d Gracefully handle disk exhaustion exceptions during recording 2017-03-17 17:53:00 -04:00