1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-04 09:39:42 +02:00

Rewrite dump of audio and MIDI device data in AudioIOBase.cpp

This commit is contained in:
Paul Licameli 2019-12-24 12:20:04 -05:00
parent d2eb085bd6
commit dc0723f629

View File

@ -842,7 +842,8 @@ wxString AudioIOBase::GetDeviceInfo()
wxTextOutputStream s(o, wxEOL_UNIX);
if (IsStreamActive()) {
return _("Stream is active ... unable to gather information.\n");
return XO("Stream is active ... unable to gather information.\n")
.Translation();
}
@ -855,8 +856,8 @@ wxString AudioIOBase::GetDeviceInfo()
wxLogDebug(wxT("Portaudio reports %d audio devices"),cnt);
s << wxT("==============================\n");
s << wxString::Format(_("Default recording device number: %d\n"), recDeviceNum);
s << wxString::Format(_("Default playback device number: %d\n"), playDeviceNum);
s << XO("Default recording device number: %d\n").Format( recDeviceNum );
s << XO("Default playback device number: %d\n").Format( playDeviceNum);
wxString recDevice = gPrefs->Read(wxT("/AudioIO/RecordingDevice"), wxT(""));
wxString playDevice = gPrefs->Read(wxT("/AudioIO/PlaybackDevice"), wxT(""));
@ -864,7 +865,7 @@ wxString AudioIOBase::GetDeviceInfo()
// This gets info on all available audio devices (input and output)
if (cnt <= 0) {
s << _("No devices found\n");
s << XO("No devices found\n");
return o.GetString();
}
@ -875,25 +876,25 @@ wxString AudioIOBase::GetDeviceInfo()
info = Pa_GetDeviceInfo(j);
if (!info) {
s << wxString::Format(_("Device info unavailable for: %d\n"), j);
s << XO("Device info unavailable for: %d\n").Format( j );
continue;
}
wxString name = DeviceName(info);
s << wxString::Format(_("Device ID: %d\n"), j);
s << wxString::Format(_("Device name: %s\n"), name);
s << wxString::Format(_("Host name: %s\n"), HostName(info));
s << wxString::Format(_("Recording channels: %d\n"), info->maxInputChannels);
s << wxString::Format(_("Playback channels: %d\n"), info->maxOutputChannels);
s << wxString::Format(_("Low Recording Latency: %g\n"), info->defaultLowInputLatency);
s << wxString::Format(_("Low Playback Latency: %g\n"), info->defaultLowOutputLatency);
s << wxString::Format(_("High Recording Latency: %g\n"), info->defaultHighInputLatency);
s << wxString::Format(_("High Playback Latency: %g\n"), info->defaultHighOutputLatency);
s << XO("Device ID: %d\n").Format( j );
s << XO("Device name: %s\n").Format( name );
s << XO("Host name: %s\n").Format( HostName(info) );
s << XO("Recording channels: %d\n").Format( info->maxInputChannels );
s << XO("Playback channels: %d\n").Format( info->maxOutputChannels );
s << XO("Low Recording Latency: %g\n").Format( info->defaultLowInputLatency );
s << XO("Low Playback Latency: %g\n").Format( info->defaultLowOutputLatency );
s << XO("High Recording Latency: %g\n").Format( info->defaultHighInputLatency );
s << XO("High Playback Latency: %g\n").Format( info->defaultHighOutputLatency );
auto rates = GetSupportedPlaybackRates(j, 0.0);
/* i18n-hint: Supported, meaning made available by the system */
s << _("Supported Rates:\n");
s << XO("Supported Rates:\n");
for (int k = 0; k < (int) rates.size(); k++) {
s << wxT(" ") << (int)rates[k] << wxT("\n");
}
@ -919,27 +920,27 @@ wxString AudioIOBase::GetDeviceInfo()
s << wxT("==============================\n");
if (haveRecDevice)
s << wxString::Format(_("Selected recording device: %d - %s\n"), recDeviceNum, recDevice);
s << XO("Selected recording device: %d - %s\n").Format( recDeviceNum, recDevice );
else
s << wxString::Format(_("No recording device found for '%s'.\n"), recDevice);
s << XO("No recording device found for '%s'.\n").Format( recDevice );
if (havePlayDevice)
s << wxString::Format(_("Selected playback device: %d - %s\n"), playDeviceNum, playDevice);
s << XO("Selected playback device: %d - %s\n").Format( playDeviceNum, playDevice );
else
s << wxString::Format(_("No playback device found for '%s'.\n"), playDevice);
s << XO("No playback device found for '%s'.\n").Format( playDevice );
std::vector<long> supportedSampleRates;
if (havePlayDevice && haveRecDevice) {
supportedSampleRates = GetSupportedSampleRates(playDeviceNum, recDeviceNum);
s << _("Supported Rates:\n");
s << XO("Supported Rates:\n");
for (int k = 0; k < (int) supportedSampleRates.size(); k++) {
s << wxT(" ") << (int)supportedSampleRates[k] << wxT("\n");
}
}
else {
s << _("Cannot check mutual sample rates without both devices.\n");
s << XO("Cannot check mutual sample rates without both devices.\n");
return o.GetString();
}
@ -999,42 +1000,42 @@ wxString AudioIOBase::GetDeviceInfo()
}
if (error) {
s << wxString::Format(_("Received %d while opening devices\n"), error);
s << XO("Received %d while opening devices\n").Format( error );
return o.GetString();
}
PxMixer *PortMixer = Px_OpenMixer(stream, 0);
if (!PortMixer) {
s << _("Unable to open Portmixer\n");
s << XO("Unable to open Portmixer\n");
Pa_CloseStream(stream);
return o.GetString();
}
s << wxT("==============================\n");
s << _("Available mixers:\n");
s << XO("Available mixers:\n");
// FIXME: ? PortMixer errors on query not reported in GetDeviceInfo
cnt = Px_GetNumMixers(stream);
for (int i = 0; i < cnt; i++) {
wxString name = wxSafeConvertMB2WX(Px_GetMixerName(stream, i));
s << wxString::Format(_("%d - %s\n"), i, name);
s << XO("%d - %s\n").Format( i, name );
}
s << wxT("==============================\n");
s << _("Available recording sources:\n");
s << XO("Available recording sources:\n");
cnt = Px_GetNumInputSources(PortMixer);
for (int i = 0; i < cnt; i++) {
wxString name = wxSafeConvertMB2WX(Px_GetInputSourceName(PortMixer, i));
s << wxString::Format(_("%d - %s\n"), i, name);
s << XO("%d - %s\n").Format( i, name );
}
s << wxT("==============================\n");
s << _("Available playback volumes:\n");
s << XO("Available playback volumes:\n");
cnt = Px_GetNumOutputVolumes(PortMixer);
for (int i = 0; i < cnt; i++) {
wxString name = wxSafeConvertMB2WX(Px_GetOutputVolumeName(PortMixer, i));
s << wxString::Format(_("%d - %s\n"), i, name);
s << XO("%d - %s\n").Format( i, name );
}
// Determine mixer capabilities - it it doesn't support either
@ -1067,11 +1068,11 @@ wxString AudioIOBase::GetDeviceInfo()
s << wxT("==============================\n");
s << ( EmulateMixerInputVol
? _("Recording volume is emulated\n")
: _("Recording volume is native\n") );
? XO("Recording volume is emulated\n")
: XO("Recording volume is native\n") );
s << ( EmulateMixerOutputVol
? _("Playback volume is emulated\n")
: _("Playback volume is native\n") );
? XO("Playback volume is emulated\n")
: XO("Playback volume is native\n") );
Px_CloseMixer(PortMixer);
@ -1088,7 +1089,8 @@ wxString AudioIOBase::GetMidiDeviceInfo()
wxTextOutputStream s(o, wxEOL_UNIX);
if (IsStreamActive()) {
return _("Stream is active ... unable to gather information.\n");
return XO("Stream is active ... unable to gather information.\n")
.Translation();
}
@ -1101,15 +1103,15 @@ wxString AudioIOBase::GetMidiDeviceInfo()
wxLogDebug(wxT("PortMidi reports %d MIDI devices"), cnt);
s << wxT("==============================\n");
s << wxString::Format(_("Default recording device number: %d\n"), recDeviceNum);
s << wxString::Format(_("Default playback device number: %d\n"), playDeviceNum);
s << XO("Default recording device number: %d\n").Format( recDeviceNum );
s << XO("Default playback device number: %d\n").Format( playDeviceNum );
wxString recDevice = gPrefs->Read(wxT("/MidiIO/RecordingDevice"), wxT(""));
wxString playDevice = gPrefs->Read(wxT("/MidiIO/PlaybackDevice"), wxT(""));
// This gets info on all available audio devices (input and output)
if (cnt <= 0) {
s << _("No devices found\n");
s << XO("No devices found\n");
return o.GetString();
}
@ -1118,20 +1120,20 @@ wxString AudioIOBase::GetMidiDeviceInfo()
const PmDeviceInfo* info = Pm_GetDeviceInfo(i);
if (!info) {
s << wxString::Format(_("Device info unavailable for: %d\n"), i);
s << XO("Device info unavailable for: %d\n").Format( i );
continue;
}
wxString name = wxSafeConvertMB2WX(info->name);
wxString hostName = wxSafeConvertMB2WX(info->interf);
s << wxString::Format(_("Device ID: %d\n"), i);
s << wxString::Format(_("Device name: %s\n"), name);
s << wxString::Format(_("Host name: %s\n"), hostName);
s << XO("Device ID: %d\n").Format( i );
s << XO("Device name: %s\n").Format( name );
s << XO("Host name: %s\n").Format( hostName );
/* i18n-hint: Supported, meaning made available by the system */
s << wxString::Format(_("Supports output: %d\n"), info->output);
s << wxString::Format(_("Supports input: %d\n"), info->input);
s << wxString::Format(_("Opened: %d\n"), info->opened);
s << XO("Supports output: %d\n").Format( info->output );
s << XO("Supports input: %d\n").Format( info->input );
s << XO("Opened: %d\n").Format( info->opened );
if (name == playDevice && info->output)
playDeviceNum = i;
@ -1154,14 +1156,14 @@ wxString AudioIOBase::GetMidiDeviceInfo()
s << wxT("==============================\n");
if (haveRecDevice)
s << wxString::Format(_("Selected MIDI recording device: %d - %s\n"), recDeviceNum, recDevice);
s << XO("Selected MIDI recording device: %d - %s\n").Format( recDeviceNum, recDevice );
else
s << wxString::Format(_("No MIDI recording device found for '%s'.\n"), recDevice);
s << XO("No MIDI recording device found for '%s'.\n").Format( recDevice );
if (havePlayDevice)
s << wxString::Format(_("Selected MIDI playback device: %d - %s\n"), playDeviceNum, playDevice);
s << XO("Selected MIDI playback device: %d - %s\n").Format( playDeviceNum, playDevice );
else
s << wxString::Format(_("No MIDI playback device found for '%s'.\n"), playDevice);
s << XO("No MIDI playback device found for '%s'.\n").Format( playDevice );
// Mention our conditional compilation flags for Alpha only
#ifdef IS_ALPHA