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