1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-25 15:53:52 +02:00

(bug 29, P3: Input and/or output sliders operate incorrectly for any device when an external device is connected.)

If the Meter Toolbar was monitoring input, PrefsDialog can be opened, but then PrefsDialog::OnOK() needs to StopStream() or AudioIO::HandleDeviceChange() will no-op. We could instead disable the Preferences command while monitoring, i.e., set AudioIONotBusyFlag/AudioIOBusyFlag according to monitoring, as well as gAudioIO->IsAudioTokenActive(). Instead allow it because unlike recording, for example, monitoring is not clearly something that should prohibit opening prefs. 

This may have been some of the occasions of bug 29, where user changed device while monitoring, but the AudioIO::HandleDeviceChange() code did not actually change the device, so it look like the user had specificied the motherboard/sound card default device, but Audacity was still using the USB device.

      // TO-DO: We *could* be smarter in this method and call HandleDeviceChange()  
      // only when the device choices actually changed. True of lots of prefs!
      // As is, we always stop monitoring and handle the device change.

In AudacityProject::GetUpdateFlags(), don't need to check (GetAudioIOToken() == 0) alternative because gAudioIO->IsAudioTokenActive() checks that it's greater than zero.

In AudioIO.cpp, cleaned up some logic and encapsulation of boolean methods.
This commit is contained in:
v.audacity
2010-10-09 00:50:52 +00:00
parent a9a0d51454
commit d562770d70
3 changed files with 24 additions and 7 deletions

View File

@@ -209,6 +209,25 @@ void PrefsDialog::OnOK(wxCommandEvent & event)
#if USE_PORTMIXER
if (gAudioIO) {
// We cannot have opened this dialog if gAudioIO->IsAudioTokenActive(),
// per the setting of AudioIONotBusyFlag and AudioIOBusyFlag in
// AudacityProject::GetUpdateFlags().
// However, we can have an invalid audio token (so IsAudioTokenActive()
// is false), but be monitoring.
// If monitoring, have to stop the stream, so HandleDeviceChange() can work.
// We could disable the Preferences command while monitoring, i.e.,
// set AudioIONotBusyFlag/AudioIOBusyFlag according to monitoring, as well.
// Instead allow it because unlike recording, for example, monitoring
// is not clearly something that should prohibit opening prefs.
// TO-DO: We *could* be smarter in this method and call HandleDeviceChange()
// only when the device choices actually changed. True of lots of prefs!
// As is, we always stop monitoring before handling the device change.
if (gAudioIO->IsMonitoring())
{
gAudioIO->StopStream();
while (gAudioIO->IsBusy())
wxMilliSleep(100);
}
gAudioIO->HandleDeviceChange();
}
#endif