mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-04 15:50:10 +01:00
bug 11 - Use const references when returning the map vector to ensure the device maps are not modified. I don't expect this to fix the bug behavior, but am committing because some testers see bad behavior that suggests the maps are modified between scans.
This commit is contained in:
@@ -223,8 +223,8 @@ void DeviceToolBar::UpdatePrefs()
|
||||
wxString devName;
|
||||
wxString sourceName;
|
||||
wxString desc;
|
||||
std::vector<DeviceSourceMap> &inMaps = DeviceManager::Instance()->GetInputDeviceMaps();
|
||||
std::vector<DeviceSourceMap> &outMaps = DeviceManager::Instance()->GetOutputDeviceMaps();
|
||||
const std::vector<DeviceSourceMap> &inMaps = DeviceManager::Instance()->GetInputDeviceMaps();
|
||||
const std::vector<DeviceSourceMap> &outMaps = DeviceManager::Instance()->GetOutputDeviceMaps();
|
||||
|
||||
|
||||
int hostSelectionIndex = mHost->GetSelection();
|
||||
@@ -465,8 +465,8 @@ void DeviceToolBar::FillHosts()
|
||||
wxArrayString hosts;
|
||||
size_t i;
|
||||
|
||||
std::vector<DeviceSourceMap> &inMaps = DeviceManager::Instance()->GetInputDeviceMaps();
|
||||
std::vector<DeviceSourceMap> &outMaps = DeviceManager::Instance()->GetOutputDeviceMaps();
|
||||
const std::vector<DeviceSourceMap> &inMaps = DeviceManager::Instance()->GetInputDeviceMaps();
|
||||
const std::vector<DeviceSourceMap> &outMaps = DeviceManager::Instance()->GetOutputDeviceMaps();
|
||||
// go over our lists add the host to the list if it isn't there yet
|
||||
for (i = 0; i < inMaps.size(); i++)
|
||||
if (hosts.Index(inMaps[i].hostString) == wxNOT_FOUND)
|
||||
@@ -484,8 +484,8 @@ void DeviceToolBar::FillHosts()
|
||||
|
||||
void DeviceToolBar::FillHostDevices()
|
||||
{
|
||||
std::vector<DeviceSourceMap> &inMaps = DeviceManager::Instance()->GetInputDeviceMaps();
|
||||
std::vector<DeviceSourceMap> &outMaps = DeviceManager::Instance()->GetOutputDeviceMaps();
|
||||
const std::vector<DeviceSourceMap> &inMaps = DeviceManager::Instance()->GetInputDeviceMaps();
|
||||
const std::vector<DeviceSourceMap> &outMaps = DeviceManager::Instance()->GetOutputDeviceMaps();
|
||||
|
||||
//read what is in the prefs
|
||||
wxString host = gPrefs->Read(wxT("/AudioIO/Host"), wxT(""));
|
||||
@@ -578,7 +578,7 @@ int DeviceToolBar::ChangeHost()
|
||||
|
||||
void DeviceToolBar::FillInputChannels()
|
||||
{
|
||||
std::vector<DeviceSourceMap> &inMaps = DeviceManager::Instance()->GetInputDeviceMaps();
|
||||
const std::vector<DeviceSourceMap> &inMaps = DeviceManager::Instance()->GetInputDeviceMaps();
|
||||
wxString host = gPrefs->Read(wxT("/AudioIO/Host"), wxT(""));
|
||||
wxString device = gPrefs->Read(wxT("/AudioIO/RecordingDevice"), wxT(""));
|
||||
wxString source = gPrefs->Read(wxT("/AudioIO/RecordingSource"), wxT(""));
|
||||
@@ -622,7 +622,7 @@ void DeviceToolBar::FillInputChannels()
|
||||
if (index == -1)
|
||||
mInputChannels->Enable(false);
|
||||
}
|
||||
void DeviceToolBar::SetDevices(DeviceSourceMap *in, DeviceSourceMap *out)
|
||||
void DeviceToolBar::SetDevices(const DeviceSourceMap *in, const DeviceSourceMap *out)
|
||||
{
|
||||
if (in) {
|
||||
gPrefs->Write(wxT("/AudioIO/RecordingDevice"), in->deviceString);
|
||||
@@ -652,10 +652,10 @@ void DeviceToolBar::ChangeDevice(bool isInput)
|
||||
size_t i;
|
||||
|
||||
int selectionIndex = mInput->GetSelection();
|
||||
std::vector<DeviceSourceMap> &maps = isInput ? DeviceManager::Instance()->GetInputDeviceMaps()
|
||||
: DeviceManager::Instance()->GetOutputDeviceMaps();
|
||||
wxString host = gPrefs->Read(wxT("/AudioIO/Host"), wxT(""));
|
||||
const std::vector<DeviceSourceMap> &maps = isInput ? DeviceManager::Instance()->GetInputDeviceMaps()
|
||||
: DeviceManager::Instance()->GetOutputDeviceMaps();
|
||||
|
||||
wxString host = gPrefs->Read(wxT("/AudioIO/Host"), wxT(""));
|
||||
// Find device indices for input and output
|
||||
if (selectionIndex >= 0 ) {
|
||||
wxString newDevice = combo->GetStringSelection();
|
||||
|
||||
@@ -61,7 +61,7 @@ class DeviceToolBar:public ToolBar {
|
||||
void FillHosts();
|
||||
void FillHostDevices();
|
||||
void FillInputChannels();
|
||||
void SetDevices(DeviceSourceMap *in, DeviceSourceMap *out);
|
||||
void SetDevices(const DeviceSourceMap *in, const DeviceSourceMap *out);
|
||||
void RepositionCombos();
|
||||
void RegenerateTooltips();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user