Leave the old audio open when opening new audio fails for any reason
Originally committed to SVN as r6738.
This commit is contained in:
parent
b8212512e7
commit
cb75c42f04
1 changed files with 7 additions and 4 deletions
|
@ -150,13 +150,13 @@ void AudioController::OnAudioProviderChanged()
|
|||
|
||||
void AudioController::OpenAudio(const wxString &url)
|
||||
{
|
||||
CloseAudio();
|
||||
|
||||
if (!url)
|
||||
throw agi::InternalError("AudioController::OpenAudio() was passed an empty string. This must not happen.", 0);
|
||||
|
||||
wxString path_part;
|
||||
|
||||
AudioProvider *new_provider = 0;
|
||||
|
||||
if (url.StartsWith("dummy-audio:", &path_part))
|
||||
{
|
||||
/*
|
||||
|
@ -179,7 +179,7 @@ void AudioController::OpenAudio(const wxString &url)
|
|||
* in every channel even if one would be LFE.
|
||||
* "ln", length of signal in samples. ln/sr gives signal length in seconds.
|
||||
*/
|
||||
provider = new DummyAudioProvider(5*30*60*1000, path_part.StartsWith("noise"));
|
||||
new_provider = new DummyAudioProvider(5*30*60*1000, path_part.StartsWith("noise"));
|
||||
}
|
||||
else if (url.StartsWith("video-audio:", &path_part))
|
||||
{
|
||||
|
@ -215,7 +215,7 @@ void AudioController::OpenAudio(const wxString &url)
|
|||
* Assume it's not a URI but instead a filename in the platform's native format.
|
||||
*/
|
||||
try {
|
||||
provider = AudioProviderFactory::GetProvider(url);
|
||||
new_provider = AudioProviderFactory::GetProvider(url);
|
||||
StandardPaths::SetPathValue("?audio", wxFileName(url).GetPath());
|
||||
}
|
||||
catch (agi::UserCancelException const&) {
|
||||
|
@ -227,6 +227,9 @@ void AudioController::OpenAudio(const wxString &url)
|
|||
}
|
||||
}
|
||||
|
||||
CloseAudio();
|
||||
provider = new_provider;
|
||||
|
||||
try
|
||||
{
|
||||
player = AudioPlayerFactory::GetAudioPlayer();
|
||||
|
|
Loading…
Reference in a new issue