mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-30 23:49:28 +02:00
Applying patch from bug #766
This patch fixes the corrupted device names as documented by the bug report.
This commit is contained in:
parent
71d8b0d8ec
commit
9317bbb3f7
@ -494,14 +494,14 @@ void DeinitAudioIO()
|
||||
|
||||
wxString DeviceName(const PaDeviceInfo* info)
|
||||
{
|
||||
wxString infoName(info->name, wxConvLocal);
|
||||
wxString infoName = wxSafeConvertMB2WX(info->name);
|
||||
|
||||
return infoName;
|
||||
}
|
||||
|
||||
wxString HostName(const PaDeviceInfo* info)
|
||||
{
|
||||
wxString hostapiName(Pa_GetHostApiInfo(info->hostApi)->name, wxConvLocal);
|
||||
wxString hostapiName = wxSafeConvertMB2WX(Pa_GetHostApiInfo(info->hostApi)->name);
|
||||
|
||||
return hostapiName;
|
||||
}
|
||||
@ -727,7 +727,7 @@ wxArrayString AudioIO::GetInputSourceNames()
|
||||
{
|
||||
int numSources = Px_GetNumInputSources(mPortMixer);
|
||||
for( int source = 0; source < numSources; source++ )
|
||||
deviceNames.Add(wxString(Px_GetInputSourceName(mPortMixer, source), wxConvLocal));
|
||||
deviceNames.Add(wxString(wxSafeConvertMB2WX(Px_GetInputSourceName(mPortMixer, source))));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1568,10 +1568,10 @@ bool AudioIO::StartPortMidiStream()
|
||||
const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
|
||||
if (!info) continue;
|
||||
if (!info->output) continue;
|
||||
wxString interf(info->interf, wxConvLocal);
|
||||
wxString name(info->name, wxConvLocal);
|
||||
wxString interf = wxSafeConvertMB2WX((info->interf);
|
||||
wxString name = wxSafeConvertMB2WX(info->name);
|
||||
interf.Append(wxT(": ")).Append(name);
|
||||
if (wxStrcmp(interf, playbackDeviceName) == 0) {
|
||||
if (wxStrcmp(interf, playbackDeviceName) == 0) {
|
||||
playbackDevice = i;
|
||||
}
|
||||
}
|
||||
@ -2379,7 +2379,7 @@ int AudioIO::getRecordSourceIndex(PxMixer *portMixer)
|
||||
wxString sourceName = gPrefs->Read(wxT("/AudioIO/RecordingSource"), wxT(""));
|
||||
int numSources = Px_GetNumInputSources(portMixer);
|
||||
for (i = 0; i < numSources; i++) {
|
||||
if (sourceName == wxString(Px_GetInputSourceName(portMixer, i), wxConvLocal))
|
||||
if (sourceName == wxString(wxSafeConvertMB2WX(Px_GetInputSourceName(portMixer, i))))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
@ -2400,7 +2400,7 @@ int AudioIO::getPlayDevIndex(wxString devName)
|
||||
for (hostNum = 0; hostNum < hostCnt; hostNum++)
|
||||
{
|
||||
const PaHostApiInfo *hinfo = Pa_GetHostApiInfo(hostNum);
|
||||
if (hinfo && wxString(hinfo->name, wxConvLocal) == hostName)
|
||||
if (hinfo && wxString(wxSafeConvertMB2WX(hinfo->name)) == hostName)
|
||||
{
|
||||
for (PaDeviceIndex hostDevice = 0; hostDevice < hinfo->deviceCount; hostDevice++)
|
||||
{
|
||||
@ -2453,7 +2453,7 @@ int AudioIO::getRecordDevIndex(wxString devName)
|
||||
for (hostNum = 0; hostNum < hostCnt; hostNum++)
|
||||
{
|
||||
const PaHostApiInfo *hinfo = Pa_GetHostApiInfo(hostNum);
|
||||
if (hinfo && wxString(hinfo->name, wxConvLocal) == hostName)
|
||||
if (hinfo && wxString(wxSafeConvertMB2WX(hinfo->name)) == hostName)
|
||||
{
|
||||
for (PaDeviceIndex hostDevice = 0; hostDevice < hinfo->deviceCount; hostDevice++)
|
||||
{
|
||||
@ -2673,7 +2673,7 @@ wxString AudioIO::GetDeviceInfo()
|
||||
|
||||
cnt = Px_GetNumMixers(stream);
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
wxString name(Px_GetMixerName(stream, i), wxConvLocal);
|
||||
wxString name = wxSafeConvertMB2WX(Px_GetMixerName(stream, i));
|
||||
s << i << wxT(" - ") << name << e;
|
||||
}
|
||||
|
||||
@ -2681,7 +2681,7 @@ wxString AudioIO::GetDeviceInfo()
|
||||
s << wxT("Available recording sources:") << e;
|
||||
cnt = Px_GetNumInputSources(PortMixer);
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
wxString name(Px_GetInputSourceName(PortMixer, i), wxConvLocal);
|
||||
wxString name = wxSafeConvertMB2WX(Px_GetInputSourceName(PortMixer, i));
|
||||
s << i << wxT(" - ") << name << e;
|
||||
}
|
||||
|
||||
@ -2689,7 +2689,7 @@ wxString AudioIO::GetDeviceInfo()
|
||||
s << wxT("Available playback volumes:") << e;
|
||||
cnt = Px_GetNumOutputVolumes(PortMixer);
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
wxString name(Px_GetOutputVolumeName(PortMixer, i), wxConvLocal);
|
||||
wxString name = wxSafeConvertMB2WX(Px_GetOutputVolumeName(PortMixer, i));
|
||||
s << i << wxT(" - ") << name << e;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ wxString MakeDeviceSourceString(const DeviceSourceMap *map)
|
||||
wxString ret;
|
||||
ret = map->deviceString;
|
||||
if (map->totalSources > 1)
|
||||
ret += wxString(": ", wxConvLocal) + map->sourceString;
|
||||
ret += wxT(": ") + map->sourceString;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -120,8 +120,8 @@ static int DummyPaStreamCallback(
|
||||
|
||||
static void FillHostDeviceInfo(DeviceSourceMap *map, const PaDeviceInfo *info, int deviceIndex, int isInput)
|
||||
{
|
||||
wxString hostapiName(Pa_GetHostApiInfo(info->hostApi)->name, wxConvLocal);
|
||||
wxString infoName(info->name, wxConvLocal);
|
||||
wxString hostapiName = wxSafeConvertMB2WX(Pa_GetHostApiInfo(info->hostApi)->name);
|
||||
wxString infoName = wxSafeConvertMB2WX(info->name);
|
||||
|
||||
map->deviceIndex = deviceIndex;
|
||||
map->hostIndex = info->hostApi;
|
||||
@ -166,7 +166,7 @@ static void AddSourcesFromStream(int deviceIndex, const PaDeviceInfo *info, std:
|
||||
//open up a stream with the device so portmixer can get the info out of it.
|
||||
for (i = 0; i < map.totalSources; i++) {
|
||||
map.sourceIndex = i;
|
||||
map.sourceString = wxString(Px_GetInputSourceName(portMixer, i), wxConvLocal);
|
||||
map.sourceString = wxString(wxSafeConvertMB2WX(Px_GetInputSourceName(portMixer, i)));
|
||||
maps->push_back(map);
|
||||
}
|
||||
}
|
||||
@ -245,7 +245,7 @@ static void AddSources(int deviceIndex, int rate, std::vector<DeviceSourceMap> *
|
||||
if(error) {
|
||||
wxLogDebug(wxT("PortAudio stream error creating device list: ") +
|
||||
map.hostString + wxT(":") + map.deviceString + wxT(": ") +
|
||||
wxString(Pa_GetErrorText( (PaError)error), wxConvLocal));
|
||||
wxString(wxSafeConvertMB2WX(Pa_GetErrorText((PaError)error))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ void Internat::Init()
|
||||
// Save decimal point character
|
||||
struct lconv * localeInfo = localeconv();
|
||||
if (localeInfo)
|
||||
mDecimalSeparator = wxString(localeInfo->decimal_point, wxConvLocal).GetChar(0);
|
||||
mDecimalSeparator = wxString(wxSafeConvertMB2WX(localeInfo->decimal_point)).GetChar(0);
|
||||
|
||||
// wxLogDebug(wxT("Decimal separator set to '%c'"), mDecimalSeparator);
|
||||
|
||||
|
@ -92,7 +92,7 @@ void DevicePrefs::GetNamesAndLabels()
|
||||
for (int i = 0; i < nDevices; i++) {
|
||||
const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
|
||||
if (info->maxOutputChannels > 0 || info->maxInputChannels > 0) {
|
||||
wxString name(Pa_GetHostApiInfo(info->hostApi)->name, wxConvLocal);
|
||||
wxString name = wxSafeConvertMB2WX(Pa_GetHostApiInfo(info->hostApi)->name);
|
||||
if (mHostNames.Index(name) == wxNOT_FOUND) {
|
||||
mHostNames.Add(name);
|
||||
mHostLabels.Add(name);
|
||||
@ -120,7 +120,7 @@ void DevicePrefs::PopulateOrExchange(ShuttleGui & S)
|
||||
S.SetSizeHints(mHostNames);
|
||||
|
||||
S.AddPrompt(_("Using:"));
|
||||
S.AddFixedText(wxString(Pa_GetVersionText(), wxConvLocal));
|
||||
S.AddFixedText(wxString(wxSafeConvertMB2WX(Pa_GetVersionText())));
|
||||
}
|
||||
S.EndMultiColumn();
|
||||
}
|
||||
@ -169,7 +169,7 @@ void DevicePrefs::OnHost(wxCommandEvent & e)
|
||||
wxString apiName = mHostNames[mHost->GetCurrentSelection()];
|
||||
int nHosts = Pa_GetHostApiCount();
|
||||
for (int i = 0; i < nHosts; ++i) {
|
||||
wxString name(Pa_GetHostApiInfo(i)->name, wxConvLocal);
|
||||
wxString name = wxSafeConvertMB2WX(Pa_GetHostApiInfo(i)->name);
|
||||
if (name == apiName) {
|
||||
index = i;
|
||||
break;
|
||||
@ -201,7 +201,7 @@ void DevicePrefs::OnHost(wxCommandEvent & e)
|
||||
|
||||
recDevice = mRecordDevice;
|
||||
if (this->mRecordSource != wxT(""))
|
||||
recDevice += wxString(": ", wxConvLocal) + mRecordSource;
|
||||
recDevice += wxT(": ") + mRecordSource;
|
||||
|
||||
mRecord->Clear();
|
||||
for (i = 0; i < inMaps.size(); i++) {
|
||||
|
@ -100,7 +100,7 @@ void MidiIOPrefs::GetNamesAndLabels() {
|
||||
for (int i = 0; i < nDevices; i++) {
|
||||
const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
|
||||
if (info->output || info->input) { //should always happen
|
||||
wxString name(info->interf, wxConvLocal);
|
||||
wxString name = wxSafeConvertMB2WX(info->interf);
|
||||
if (mHostNames.Index(name) == wxNOT_FOUND) {
|
||||
mHostNames.Add(name);
|
||||
mHostLabels.Add(name);
|
||||
@ -195,9 +195,9 @@ void MidiIOPrefs::OnHost(wxCommandEvent & e)
|
||||
|
||||
for (int i = 0; i < nDevices; i++) {
|
||||
const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
|
||||
wxString interf(info->interf, wxConvLocal);
|
||||
wxString interf = wxSafeConvertMB2WX(info->interf);
|
||||
if (itemAtIndex.IsSameAs(interf)) {
|
||||
wxString name(info->name, wxConvLocal);
|
||||
wxString name = wxSafeConvertMB2WX(info->name);
|
||||
wxString device = wxString::Format(wxT("%s: %s"),
|
||||
interf.c_str(),
|
||||
name.c_str());
|
||||
@ -259,16 +259,16 @@ bool MidiIOPrefs::Apply()
|
||||
if (info) {
|
||||
gPrefs->Write(wxT("/MidiIO/PlaybackDevice"),
|
||||
wxString::Format(wxT("%s: %s"),
|
||||
wxString(info->interf, wxConvLocal).c_str(),
|
||||
wxString(info->name, wxConvLocal).c_str()));
|
||||
wxString(wxSafeConvertMB2WX(info->interf)).c_str(),
|
||||
wxString(wxSafeConvertMB2WX(info->name)).c_str()));
|
||||
}
|
||||
#ifdef EXPERIMENTAL_MIDI_IN
|
||||
info = (const PmDeviceInfo *) mRecord->GetClientData(mRecord->GetSelection());
|
||||
if (info) {
|
||||
gPrefs->Write(wxT("/MidiIO/RecordingDevice"),
|
||||
wxString::Format(wxT("%s: %s"),
|
||||
wxString(info->interf, wxConvLocal).c_str(),
|
||||
wxString(info->name, wxConvLocal).c_str()));
|
||||
wxString(wxSafeConvertMB2WX(info->interf)).c_str(),
|
||||
wxString(wxSafeConvertMB2WX(info->name)).c_str()));
|
||||
}
|
||||
#endif
|
||||
return gPrefs->Flush();
|
||||
|
@ -255,7 +255,7 @@ void DeviceToolBar::UpdatePrefs()
|
||||
if (sourceName == wxT(""))
|
||||
desc = devName;
|
||||
else
|
||||
desc = devName + wxString(": ", wxConvLocal) + sourceName;
|
||||
desc = devName + wxT(": ") + sourceName;
|
||||
|
||||
if (mInput->GetStringSelection() != desc &&
|
||||
mInput->FindString(desc) != wxNOT_FOUND) {
|
||||
@ -285,7 +285,7 @@ void DeviceToolBar::UpdatePrefs()
|
||||
if (sourceName == wxT(""))
|
||||
desc = devName;
|
||||
else
|
||||
desc = devName + wxString(": ", wxConvLocal) + sourceName;
|
||||
desc = devName + wxT(": ") + sourceName;
|
||||
|
||||
if (mOutput->GetStringSelection() != desc &&
|
||||
mOutput->FindString(desc) != wxNOT_FOUND) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user