Use the per-platform default audio player from configure rather than always defaulting to portaudio
Originally committed to SVN as r5738.
This commit is contained in:
parent
bb4c10a140
commit
98777eff4e
4 changed files with 21 additions and 18 deletions
|
@ -58,15 +58,11 @@
|
|||
#include "compat.h"
|
||||
#include "main.h"
|
||||
|
||||
/// @brief Constructor
|
||||
///
|
||||
AudioPlayer::AudioPlayer() {
|
||||
provider = NULL;
|
||||
displayTimer = NULL;
|
||||
}
|
||||
|
||||
/// @brief Destructor
|
||||
///
|
||||
AudioPlayer::~AudioPlayer() {
|
||||
if (displayTimer) {
|
||||
displayTimer->Stop();
|
||||
|
@ -75,7 +71,6 @@ AudioPlayer::~AudioPlayer() {
|
|||
}
|
||||
|
||||
/// @brief Ask to stop later
|
||||
///
|
||||
void AudioPlayer::RequestStop() {
|
||||
wxCommandEvent event(wxEVT_STOP_AUDIO, 1000);
|
||||
event.SetEventObject(this);
|
||||
|
@ -88,16 +83,10 @@ BEGIN_EVENT_TABLE(AudioPlayer, wxEvtHandler)
|
|||
EVT_COMMAND (1000, wxEVT_STOP_AUDIO, AudioPlayer::OnStopAudio)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
/// @brief DOCME
|
||||
/// @param event
|
||||
///
|
||||
void AudioPlayer::OnStopAudio(wxCommandEvent &event) {
|
||||
Stop(false);
|
||||
}
|
||||
|
||||
/// @brief Get player
|
||||
/// @return
|
||||
///
|
||||
AudioPlayer* AudioPlayerFactory::GetAudioPlayer() {
|
||||
std::vector<std::string> list = GetClasses(OPT_GET("Audio/Player")->GetString());
|
||||
if (list.empty()) throw "No audio players are available.";
|
||||
|
@ -115,10 +104,6 @@ AudioPlayer* AudioPlayerFactory::GetAudioPlayer() {
|
|||
throw error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Register all factories
|
||||
///
|
||||
void AudioPlayerFactory::RegisterProviders() {
|
||||
#ifdef WITH_ALSA
|
||||
Register<AlsaPlayer>("ALSA");
|
||||
|
@ -141,4 +126,15 @@ void AudioPlayerFactory::RegisterProviders() {
|
|||
#endif
|
||||
}
|
||||
|
||||
std::string AudioPlayerFactory::GetDefault() {
|
||||
std::string def = OPT_GET("Audio/Player")->GetString();
|
||||
if (!def.empty())
|
||||
return def;
|
||||
#ifdef DEFAULT_PLAYER_AUDIO
|
||||
return DEFAULT_PLAYER_AUDIO;
|
||||
#else
|
||||
return "DirectSound";
|
||||
#endif
|
||||
}
|
||||
|
||||
template<> AudioPlayerFactory::map *FactoryBase<AudioPlayer *(*)()>::classes = NULL;
|
||||
|
|
|
@ -99,6 +99,8 @@ public:
|
|||
|
||||
class AudioPlayerFactory : public Factory0<AudioPlayer> {
|
||||
public:
|
||||
/// Get the name of the preferred audio play
|
||||
static std::string GetDefault();
|
||||
static void RegisterProviders();
|
||||
static AudioPlayer *GetAudioPlayer();
|
||||
};
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
"OSS" : {
|
||||
"Device" : "/dev/dsp"
|
||||
},
|
||||
"Player" : "portaudio",
|
||||
"Player" : "",
|
||||
"Plays When Stepping Video" : false,
|
||||
"Provider" : "ffmpegsource",
|
||||
"Renderer" : {
|
||||
|
|
|
@ -189,10 +189,15 @@ void OptionPage::OptionChoice(wxFlexGridSizer *flex, const wxString &name, const
|
|||
cb->Bind(wxEVT_COMMAND_COMBOBOX_SELECTED, IntCBUpdater(opt_name, parent));
|
||||
break;
|
||||
}
|
||||
case agi::OptionValue::Type_String:
|
||||
cb->SetValue(lagi_wxString(opt->GetString()));
|
||||
case agi::OptionValue::Type_String: {
|
||||
wxString val(lagi_wxString(opt->GetString()));
|
||||
if (cb->FindString(val) != wxNOT_FOUND)
|
||||
cb->SetStringSelection(val);
|
||||
else
|
||||
cb->SetSelection(0);
|
||||
cb->Bind(wxEVT_COMMAND_COMBOBOX_SELECTED, StringUpdater(opt_name, parent));
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw PreferenceNotSupported("Unsupported type");
|
||||
|
|
Loading…
Reference in a new issue