mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-17 08:01:12 +02:00
bug 11: fix bad index typo. may fix bug 11 issues on win 7.
This commit is contained in:
@@ -88,14 +88,14 @@ DeviceSourceMap* DeviceManager::GetDefaultDevice(int hostIndex, int isInput)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DeviceSourceMap* DeviceManager::GetDefaultOutputDevice(int hostIndex)
|
||||
{
|
||||
return GetDefaultDevice(hostIndex, 0);
|
||||
}
|
||||
DeviceSourceMap* DeviceManager::GetDefaultInputDevice(int hostIndex)
|
||||
{
|
||||
return GetDefaultDevice(hostIndex, 1);
|
||||
}
|
||||
DeviceSourceMap* DeviceManager::GetDefaultOutputDevice(int hostIndex)
|
||||
{
|
||||
return GetDefaultDevice(hostIndex, 0);
|
||||
}
|
||||
DeviceSourceMap* DeviceManager::GetDefaultInputDevice(int hostIndex)
|
||||
{
|
||||
return GetDefaultDevice(hostIndex, 1);
|
||||
}
|
||||
|
||||
//--------------- Device Enumeration --------------------------
|
||||
|
||||
|
@@ -1,75 +1,75 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
DeviceManager.h
|
||||
|
||||
Created by Michael Chinen (mchinen) on 2/12/11
|
||||
Audacity(R) is copyright (c) 1999-2011 Audacity Team.
|
||||
License: GPL v2. See License.txt.
|
||||
|
||||
******************************************************************//**
|
||||
|
||||
\class DeviceManager
|
||||
\brief A singleton that manages the audio devices known to Audacity
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_DEVICEMANAGER__
|
||||
#define __AUDACITY_DEVICEMANAGER__
|
||||
|
||||
#include <vector>
|
||||
#include "wx/wx.h"
|
||||
|
||||
typedef struct DeviceSourceMap {
|
||||
int deviceIndex;
|
||||
int sourceIndex;
|
||||
int hostIndex;
|
||||
int totalSources;
|
||||
int numChannels;
|
||||
wxString sourceString;
|
||||
wxString deviceString;
|
||||
wxString hostString;
|
||||
} DeviceSourceMap;
|
||||
|
||||
wxString MakeDeviceSourceString(DeviceSourceMap *map);
|
||||
|
||||
class DeviceManager
|
||||
{
|
||||
public:
|
||||
/// Gets the singleton instance
|
||||
static DeviceManager* Instance();
|
||||
|
||||
/// Releases memory assosiated with the singleton
|
||||
static void Destroy();
|
||||
|
||||
/// Gets a new list of devices by terminating and restarting portaudio
|
||||
/// Assumes that DeviceManager is only used on the main thread.
|
||||
void Rescan();
|
||||
|
||||
DeviceSourceMap* GetDefaultOutputDevice(int hostIndex);
|
||||
DeviceSourceMap* GetDefaultInputDevice(int hostIndex);
|
||||
|
||||
std::vector<DeviceSourceMap> &GetInputDeviceMaps();
|
||||
std::vector<DeviceSourceMap> &GetOutputDeviceMaps();
|
||||
|
||||
protected:
|
||||
//private constructor - Singleton.
|
||||
DeviceManager();
|
||||
virtual ~DeviceManager();
|
||||
/// Does an initial scan.
|
||||
/// Called by GetInputDeviceMaps and GetOutputDeviceMaps when needed.
|
||||
void Init();
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
DeviceManager.h
|
||||
|
||||
Created by Michael Chinen (mchinen) on 2/12/11
|
||||
Audacity(R) is copyright (c) 1999-2011 Audacity Team.
|
||||
License: GPL v2. See License.txt.
|
||||
|
||||
******************************************************************//**
|
||||
|
||||
\class DeviceManager
|
||||
\brief A singleton that manages the audio devices known to Audacity
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_DEVICEMANAGER__
|
||||
#define __AUDACITY_DEVICEMANAGER__
|
||||
|
||||
#include <vector>
|
||||
#include "wx/wx.h"
|
||||
|
||||
typedef struct DeviceSourceMap {
|
||||
int deviceIndex;
|
||||
int sourceIndex;
|
||||
int hostIndex;
|
||||
int totalSources;
|
||||
int numChannels;
|
||||
wxString sourceString;
|
||||
wxString deviceString;
|
||||
wxString hostString;
|
||||
} DeviceSourceMap;
|
||||
|
||||
wxString MakeDeviceSourceString(DeviceSourceMap *map);
|
||||
|
||||
class DeviceManager
|
||||
{
|
||||
public:
|
||||
/// Gets the singleton instance
|
||||
static DeviceManager* Instance();
|
||||
|
||||
/// Releases memory assosiated with the singleton
|
||||
static void Destroy();
|
||||
|
||||
/// Gets a new list of devices by terminating and restarting portaudio
|
||||
/// Assumes that DeviceManager is only used on the main thread.
|
||||
void Rescan();
|
||||
|
||||
DeviceSourceMap* GetDefaultOutputDevice(int hostIndex);
|
||||
DeviceSourceMap* GetDefaultInputDevice(int hostIndex);
|
||||
|
||||
std::vector<DeviceSourceMap> &GetInputDeviceMaps();
|
||||
std::vector<DeviceSourceMap> &GetOutputDeviceMaps();
|
||||
|
||||
protected:
|
||||
//private constructor - Singleton.
|
||||
DeviceManager();
|
||||
virtual ~DeviceManager();
|
||||
/// Does an initial scan.
|
||||
/// Called by GetInputDeviceMaps and GetOutputDeviceMaps when needed.
|
||||
void Init();
|
||||
|
||||
DeviceSourceMap* GetDefaultDevice(int hostIndex, int isInput);
|
||||
|
||||
bool m_inited;
|
||||
|
||||
std::vector<DeviceSourceMap> mInputDeviceSourceMaps;
|
||||
std::vector<DeviceSourceMap> mOutputDeviceSourceMaps;
|
||||
|
||||
static DeviceManager dm;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
DeviceSourceMap* GetDefaultDevice(int hostIndex, int isInput);
|
||||
|
||||
bool m_inited;
|
||||
|
||||
std::vector<DeviceSourceMap> mInputDeviceSourceMaps;
|
||||
std::vector<DeviceSourceMap> mOutputDeviceSourceMaps;
|
||||
|
||||
static DeviceManager dm;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -286,7 +286,7 @@ void DeviceToolBar::UpdatePrefs()
|
||||
if (outMaps[i].hostString == hostName &&
|
||||
MakeDeviceSourceString(&outMaps[i]) == mOutput->GetString(0)) {
|
||||
// use the default. It should exist but check just in case, falling back on the 0 index.
|
||||
DeviceSourceMap *defaultMap = DeviceManager::Instance()->GetDefaultOutputDevice(inMaps[i].hostIndex);
|
||||
DeviceSourceMap *defaultMap = DeviceManager::Instance()->GetDefaultOutputDevice(outMaps[i].hostIndex);
|
||||
if (defaultMap) {
|
||||
mOutput->SetStringSelection(MakeDeviceSourceString(defaultMap));
|
||||
SetDevices(NULL, defaultMap);
|
||||
|
Reference in New Issue
Block a user