The bug:
1. Set Audio host to WASAPI
2. choose recording and playback devices which have different default sample rates in shared mode.
3. Set overdub, and playthrough to off.
4. make a short recording.
5. playback. Fails with error dialog.
Cause of bug:
In AudioIO::GetBestRate, the last returned sample rate is cached. If the function is called again, with the same requested sample rate, then the cached value is returned. So in the above steps, when GetBestRate is called for playback, the sample rate of the recording device is returned.
Fix:
Include in the conditions for returning the cached rate that the values of playing and capturing as the same as in the previous call.
... more use of standard library style alternatives instead.
Other types may then more easily replace them in future: std::vector of
wxString or of other string-like classes.
... Remove all uses of the three-valued Cmp comparison member function, which
returns 0 for equality, except in one place. Use operators == and != instead.
(C++20's spaceship operator hasn't landed here yet!)
... Replacing:
Insert => insert
RemoveAt => erase
Remove => erase
IsSameAs => operator == or operator !=
(but only when second argument was true or default)
... instead use the utility make_iterator_range and its index() or contains()
method. This generic utility works with any container defining begin() and
end().
This further lessens dependency on wxWidgets container idioms.
... which will make it easier to change the types of those containers to
std::vectors of other string-like classes
for wxString,
IsEmpty => empty
Clear => clear
Alloc => reserve
for wxArrayString,
Count => size
GetCount => size
IsEmpty => empty
Add => push_back
Clear => clear
Empty => clear
Sort => std::sort (only with default comparator)
SetCount => resize
Last => back
Item => operator []
Alloc => reserve
... Cross platform differences in Focus handling are confusing, and we don't
know yet how to abort drags and also put focus back where we want it on Linux.
So don't take focus even temporarily in the time ruler. Sorry, ESC key won't
work.
Problem:
1. Set no access to microphone in Privacy category of Settings app.
2. Try to record in a new track. (not append to an existing track.)
3. Audacity crashes.
Cause of crash:
TrackPanel::OnTrackListResizing is called with a track after a call to
TrackList::ClearPendingTracks, which has removed its owner.
TrackPanel::OnTrackListResizing ends up calling TrackPanel::UpdateTrackVRuler,
and this function calls TrackList::Channels(t)), which assumes the track has an owner.
Crash.
Fix: in TrackPanel::OnTrackListResizing, check that the track has an owner.
This is needed to allow path names in the bundle to be rewritten by install_name_tool so that they are relative to the bundle rather than absolute paths. The problem previously was that the new relative path names could be too long.
... Fixed as suggested by David Bailes.
Confirmed on Mac and Windows that the intended ESC key handling to abort drag
in the ruler also now works. (It didn't on Windows in 2.3.0.)