Log which audio provider is actually used

Originally committed to SVN as r6902.
This commit is contained in:
Thomas Goyne 2012-06-13 15:58:21 +00:00
parent d4635b723a
commit 05f63f14b2
1 changed files with 9 additions and 1 deletions

View File

@ -57,6 +57,8 @@
#include "frame_main.h" #include "frame_main.h"
#include "main.h" #include "main.h"
#include <libaegisub/log.h>
void AudioProvider::GetAudioWithVolume(void *buf, int64_t start, int64_t count, double volume) const { void AudioProvider::GetAudioWithVolume(void *buf, int64_t start, int64_t count, double volume) const {
try { try {
GetAudio(buf,start,count); GetAudio(buf,start,count);
@ -95,6 +97,7 @@ AudioProvider *AudioProviderFactory::GetProvider(wxString const& filename, int c
// Try a PCM provider first // Try a PCM provider first
try { try {
provider = CreatePCMAudioProvider(filename); provider = CreatePCMAudioProvider(filename);
LOG_D("audio_provider") << "Using PCM provider";
} }
catch (agi::FileNotFoundError const& err) { catch (agi::FileNotFoundError const& err) {
msg = "PCM audio provider: " + err.GetMessage() + " not found.\n"; msg = "PCM audio provider: " + err.GetMessage() + " not found.\n";
@ -104,6 +107,7 @@ AudioProvider *AudioProviderFactory::GetProvider(wxString const& filename, int c
msg += err.GetChainedMessage() + "\n"; msg += err.GetChainedMessage() + "\n";
} }
} }
if (!provider) { if (!provider) {
std::vector<std::string> list = GetClasses(OPT_GET("Audio/Provider")->GetString()); std::vector<std::string> list = GetClasses(OPT_GET("Audio/Provider")->GetString());
if (list.empty()) throw agi::NoAudioProvidersError("No audio providers are available.", 0); if (list.empty()) throw agi::NoAudioProvidersError("No audio providers are available.", 0);
@ -111,7 +115,10 @@ AudioProvider *AudioProviderFactory::GetProvider(wxString const& filename, int c
for (size_t i = 0; i < list.size() ; ++i) { for (size_t i = 0; i < list.size() ; ++i) {
try { try {
provider = Create(list[i], filename); provider = Create(list[i], filename);
if (provider) break; if (provider) {
LOG_D("audio_provider") << "Using audio provider: " << list[i];
break;
}
} }
catch (agi::FileNotFoundError const& err) { catch (agi::FileNotFoundError const& err) {
msg += list[i] + ": " + err.GetMessage() + " not found.\n"; msg += list[i] + ": " + err.GetMessage() + " not found.\n";
@ -127,6 +134,7 @@ AudioProvider *AudioProviderFactory::GetProvider(wxString const& filename, int c
} }
} }
} }
if (!provider) { if (!provider) {
if (found_audio) if (found_audio)
throw agi::AudioProviderOpenError(msg, 0); throw agi::AudioProviderOpenError(msg, 0);