AudioCommon: SupportsDPL2Decoder, SupportsLatencyControl, SupportsVolumeChanges

This commit is contained in:
Michael Maltese
2016-10-09 19:18:16 -07:00
parent 4834a90e63
commit 45903b7b4d
3 changed files with 32 additions and 15 deletions

View File

@ -117,6 +117,30 @@ std::vector<std::string> GetSoundBackends()
return backends; return backends;
} }
bool SupportsDPL2Decoder(const std::string& backend)
{
#ifndef __APPLE__
if (backend == BACKEND_OPENAL)
return true;
#endif
if (backend == BACKEND_PULSEAUDIO)
return true;
return false;
}
bool SupportsLatencyControl(const std::string& backend)
{
return backend == BACKEND_OPENAL;
}
bool SupportsVolumeChanges(const std::string& backend)
{
// FIXME: this one should ask the backend whether it supports it.
// but getting the backend from string etc. is probably
// too much just to enable/disable a stupid slider...
return backend == BACKEND_COREAUDIO || backend == BACKEND_OPENAL || backend == BACKEND_XAUDIO2;
}
void UpdateSoundStream() void UpdateSoundStream()
{ {
if (g_sound_stream) if (g_sound_stream)

View File

@ -18,6 +18,9 @@ namespace AudioCommon
void InitSoundStream(); void InitSoundStream();
void ShutdownSoundStream(); void ShutdownSoundStream();
std::vector<std::string> GetSoundBackends(); std::vector<std::string> GetSoundBackends();
bool SupportsDPL2Decoder(const std::string& backend);
bool SupportsLatencyControl(const std::string& backend);
bool SupportsVolumeChanges(const std::string& backend);
void UpdateSoundStream(); void UpdateSoundStream();
void ClearAudioBuffer(bool mute); void ClearAudioBuffer(bool mute);
void SendAIBuffer(const short* samples, unsigned int num_samples); void SendAIBuffer(const short* samples, unsigned int num_samples);

View File

@ -55,14 +55,9 @@ void AudioConfigPane::InitializeGUI()
m_audio_backend_choice->SetToolTip( m_audio_backend_choice->SetToolTip(
_("Changing this will have no effect while the emulator is running.")); _("Changing this will have no effect while the emulator is running."));
m_audio_latency_spinctrl->SetToolTip(_( m_audio_latency_spinctrl->SetToolTip(_(
"Sets the latency (in ms). Higher values may reduce audio crackling. OpenAL backend only.")); "Sets the latency (in ms). Higher values may reduce audio crackling. Certain backends only."));
#if defined(__APPLE__)
m_dpl2_decoder_checkbox->SetToolTip( m_dpl2_decoder_checkbox->SetToolTip(
_("Enables Dolby Pro Logic II emulation using 5.1 surround. Not available on OS X.")); _("Enables Dolby Pro Logic II emulation using 5.1 surround. Certain backends only."));
#else
m_dpl2_decoder_checkbox->SetToolTip(
_("Enables Dolby Pro Logic II emulation using 5.1 surround. OpenAL or Pulse backends only."));
#endif
const int space5 = FromDIP(5); const int space5 = FromDIP(5);
@ -133,14 +128,9 @@ void AudioConfigPane::LoadGUIValues()
void AudioConfigPane::ToggleBackendSpecificControls(const std::string& backend) void AudioConfigPane::ToggleBackendSpecificControls(const std::string& backend)
{ {
m_dpl2_decoder_checkbox->Enable(backend == BACKEND_OPENAL || backend == BACKEND_PULSEAUDIO); m_dpl2_decoder_checkbox->Enable(AudioCommon::SupportsDPL2Decoder(backend));
m_audio_latency_spinctrl->Enable(backend == BACKEND_OPENAL); m_audio_latency_spinctrl->Enable(AudioCommon::SupportsLatencyControl(backend));
m_volume_slider->Enable(AudioCommon::SupportsVolumeChanges(backend));
// FIXME: this one should ask the backend whether it supports it.
// but getting the backend from string etc. is probably
// too much just to enable/disable a stupid slider...
m_volume_slider->Enable(backend == BACKEND_COREAUDIO || backend == BACKEND_OPENAL ||
backend == BACKEND_XAUDIO2);
} }
void AudioConfigPane::RefreshGUI() void AudioConfigPane::RefreshGUI()