internal override void ProcessMusicError(SoundMusicEventNotification eventNotification) { if (eventNotification.Event != SoundMusicEvent.ErrorOccurred) // no errors { return; } var soundMusicName = "Unknown"; if (CurrentMusic != null) { CurrentMusic.SetStateToStopped(); soundMusicName = CurrentMusic.Name; } Logger.Error("Error while playing the sound music '{0}'. Details follows:"); var errorEvent = (MediaPlayer.ErrorEventArgs)eventNotification.EventData; if (errorEvent.What == MediaError.Unknown && errorEvent.Extra == 0xfffffc0e) // MEDIA_ERROR_UNSUPPORTED (Hardware dependent?) { Logger.Error("The data format of the music file is not supported."); } else if ((uint)errorEvent.What == 0xffffffed) // underlying audio track returned -12 (no memory) -> try to recreate the player once more { Logger.Error("The OS did not have enough memory to create the audio track.", soundMusicName); } else { Logger.Error(" [Details: ErrorCode={1}, Extra={2}]", soundMusicName, errorEvent.What, errorEvent.Extra); } // reset the music player to a valid state for future plays ResetMusicPlayer(); }
internal override void ProcessMusicError(SoundMusicEventNotification eventNotification) { if (eventNotification.Event == SoundMusicEvent.ErrorOccurred) { var errorEventArgs = (AVErrorEventArgs)eventNotification.EventData; throw new AudioSystemInternalException("An error happened during music play back and was not handled by the AudioSystem. [error:" + errorEventArgs.Error.LocalizedDescription + "]."); } }
private void ProcessMusicError(SoundMusicEventNotification eventNotification) { var mediaEvent = (MediaEvent)eventNotification.EventData; var status = mediaEvent.Status; if (status.Failure) { mediaEvent.Dispose(); status.CheckError(); } }
private void ProcessMusicError(SoundMusicEventNotification eventNotification) { if (eventNotification.Event == SoundMusicEvent.ErrorOccurred) { var errorCodes = (MediaEngineErrorCodes)eventNotification.EventData; if (errorCodes.Parameter1 == (long)MediaEngineErr.SourceNotSupported) { if (currentMusic != null) { ResetMusicPlayer(); } else { throw new AudioSystemInternalException("Audio Engine is in an unconsistant state. CurrentMusic is null while Error on Unsupported media was reached."); } throw new InvalidOperationException("The data format of the source music file is not valid."); } throw new AudioSystemInternalException("An unhandled exception happened in media engine asynchronously. Error info [param1=" + errorCodes.Parameter1 + ", param2=" + errorCodes.Parameter2 + "]."); } }
private void ProcessMusicError(SoundMusicEventNotification eventNotification) { if (eventNotification.Event == SoundMusicEvent.ErrorOccurred) { var errorEventArgs = (AVErrorEventArgs) eventNotification.EventData; throw new AudioSystemInternalException("An error happened during music play back and was not handled by the AudioSystem. [error:" + errorEventArgs.Error.LocalizedDescription + "]."); } }
internal abstract void ProcessMusicError(SoundMusicEventNotification eventNotification);
internal override void ProcessMusicError(SoundMusicEventNotification eventNotification) { if (eventNotification.Event == SoundMusicEvent.ErrorOccurred) { var errorCodes = (MediaEngineErrorCodes) eventNotification.EventData; if (errorCodes.Parameter1 == (long)MediaEngineErr.SourceNotSupported) { if(CurrentMusic!=null) ResetMusicPlayer(); else throw new AudioSystemInternalException("Audio Engine is in an unconsistant state. CurrentMusic is null while Error on Unsupported media was reached."); throw new InvalidOperationException("The data format of the source music file is not valid."); } throw new AudioSystemInternalException("An unhandled exception happened in media engine asynchronously. Error info [param1="+errorCodes.Parameter1+", param2="+errorCodes.Parameter2+"]."); } }
/// <inheritDoc/> internal override void ProcessMusicError(SoundMusicEventNotification eventNotification) { throw new NotImplementedException(); }
internal override void ProcessMusicError(SoundMusicEventNotification eventNotification) { if (eventNotification.Event != SoundMusicEvent.ErrorOccurred) // no errors return; var soundMusicName = "Unknown"; if (CurrentMusic != null) { CurrentMusic.SetStateToStopped(); soundMusicName = CurrentMusic.Name; } Logger.Error("Error while playing the sound music '{0}'. Details follows:"); var errorEvent = (MediaPlayer.ErrorEventArgs)eventNotification.EventData; if (errorEvent.What == MediaError.Unknown && errorEvent.Extra == 0xfffffc0e) // MEDIA_ERROR_UNSUPPORTED (Hardware dependent?) { Logger.Error("The data format of the music file is not supported."); } else if ((uint)errorEvent.What == 0xffffffed) // underlying audio track returned -12 (no memory) -> try to recreate the player once more { Logger.Error("The OS did not have enough memory to create the audio track.", soundMusicName); } else { Logger.Error(" [Details: ErrorCode={1}, Extra={2}]", soundMusicName, errorEvent.What, errorEvent.Extra); } // reset the music player to a valid state for future plays ResetMusicPlayer(); }