mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-22 15:20:15 +02:00
bug 11 followup: DeviceToolbar - don't update preferences for the whole project when device changes. This fixes selection toolbar 'flashing'.
Also corrected a bug where only devices in the first host of the combobox would be selectable.
This commit is contained in:
parent
48899f983d
commit
337695ee19
@ -623,7 +623,7 @@ void DeviceToolBar::FillHostDevices()
|
|||||||
mInput->Append(MakeDeviceSourceString(&mInputDeviceSourceMaps[i]));
|
mInput->Append(MakeDeviceSourceString(&mInputDeviceSourceMaps[i]));
|
||||||
}
|
}
|
||||||
mInput->Enable(mInput->GetCount() ? true : false);
|
mInput->Enable(mInput->GetCount() ? true : false);
|
||||||
// mInput->Layout();
|
|
||||||
mOutput->Clear();
|
mOutput->Clear();
|
||||||
for (i = 0; i < mOutputDeviceSourceMaps.size(); i++) {
|
for (i = 0; i < mOutputDeviceSourceMaps.size(); i++) {
|
||||||
if (foundHostIndex == mOutputDeviceSourceMaps[i].hostIndex)
|
if (foundHostIndex == mOutputDeviceSourceMaps[i].hostIndex)
|
||||||
@ -741,30 +741,30 @@ void DeviceToolBar::OnChoice(wxCommandEvent &event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxString host = gPrefs->Read(wxT("/AudioIO/Host"), wxT(""));
|
wxString host = gPrefs->Read(wxT("/AudioIO/Host"), wxT(""));
|
||||||
wxString oldInput = gPrefs->Read(wxT("/AudioIO/RecordingDevice"), wxT(""));
|
|
||||||
wxString newInput = inputSelectionIndex >= 0 ?
|
|
||||||
MakeDeviceSourceString(&mInputDeviceSourceMaps[inputSelectionIndex]):
|
|
||||||
oldInput;
|
|
||||||
wxString oldOutput = gPrefs->Read(wxT("/AudioIO/PlaybackDevice"), wxT(""));
|
|
||||||
wxString newOutput = outputSelectionIndex >= 0 ?
|
|
||||||
MakeDeviceSourceString(&mOutputDeviceSourceMaps[outputSelectionIndex]):
|
|
||||||
oldOutput;
|
|
||||||
int newInIndex = -1, newOutIndex = -1;
|
int newInIndex = -1, newOutIndex = -1;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
// Find device indices for input and output
|
// Find device indices for input and output
|
||||||
|
if (inputSelectionIndex >= 0 ) {
|
||||||
|
wxString newInput = mInput->GetStringSelection();
|
||||||
for (i = 0; i < mInputDeviceSourceMaps.size(); ++i) {
|
for (i = 0; i < mInputDeviceSourceMaps.size(); ++i) {
|
||||||
wxString name;
|
wxString name;
|
||||||
name = MakeDeviceSourceString(&mInputDeviceSourceMaps[i]);
|
name = MakeDeviceSourceString(&mInputDeviceSourceMaps[i]);
|
||||||
if (name == newInput && mInputDeviceSourceMaps[i].hostString == host)
|
if (name == newInput && mInputDeviceSourceMaps[i].hostString == host) {
|
||||||
newInIndex = i;
|
newInIndex = i;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (outputSelectionIndex >= 0) {
|
||||||
|
wxString newOutput = mOutput->GetStringSelection();
|
||||||
for (i = 0; i < mOutputDeviceSourceMaps.size(); ++i) {
|
for (i = 0; i < mOutputDeviceSourceMaps.size(); ++i) {
|
||||||
wxString name;
|
wxString name;
|
||||||
name = MakeDeviceSourceString(&mOutputDeviceSourceMaps[i]);
|
name = MakeDeviceSourceString(&mOutputDeviceSourceMaps[i]);
|
||||||
if (name == newOutput && mOutputDeviceSourceMaps[i].hostString == host)
|
if (name == newOutput && mOutputDeviceSourceMaps[i].hostString == host)
|
||||||
newOutIndex = i;
|
newOutIndex = i;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This shouldn't happen for new choices (it's OK for old ones)
|
// This shouldn't happen for new choices (it's OK for old ones)
|
||||||
if (newInIndex < 0 || newOutIndex < 0) {
|
if (newInIndex < 0 || newOutIndex < 0) {
|
||||||
@ -772,7 +772,8 @@ void DeviceToolBar::OnChoice(wxCommandEvent &event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetDevices(&mInputDeviceSourceMaps[newInIndex], &mOutputDeviceSourceMaps[newOutIndex]);
|
SetDevices(newInIndex >= 0 ? &mInputDeviceSourceMaps[newInIndex] : NULL,
|
||||||
|
newOutIndex >= 0 ? &mOutputDeviceSourceMaps[newOutIndex] : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gAudioIO) {
|
if (gAudioIO) {
|
||||||
@ -797,17 +798,5 @@ void DeviceToolBar::OnChoice(wxCommandEvent &event)
|
|||||||
}
|
}
|
||||||
gAudioIO->HandleDeviceChange();
|
gAudioIO->HandleDeviceChange();
|
||||||
}
|
}
|
||||||
GetActiveProject()->UpdatePrefs();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
|
|
||||||
// version control system. Please do not modify past this point.
|
|
||||||
//
|
|
||||||
// Local Variables:
|
|
||||||
// c-basic-offset: 3
|
|
||||||
// indent-tabs-mode: nil
|
|
||||||
// End:
|
|
||||||
//
|
|
||||||
// vim: et sts=3 sw=3
|
|
||||||
// arch-tag: 6a50243e-9fc9-4f0f-b344-bd3044dc09ad
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user