Repository navigation
Play audio sources from a start with an optional fade-in, and report a buffer's duration - #731
Merged
Merged
Conversation
…ffer's duration, and keep Looping set before Play
|
📦 Development package |
|
✅ Development package validation passed on all platforms. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #730
AudioBuffer.Durationis aTimeSpan?fromMIX_GetAudioDuration, rounded down to whole milliseconds. It is null for a sound that loops forever, such as a WAV loop whose play count is zero or an OGGLOOPSTARTtag without a count: SDL_mixer reportsMIX_DURATION_INFINITEfor these. A stream has no duration, because SDL_mixer hides the audio it creates inMIX_SetTrackIOStream.AudioSource.Play(TimeSpan start)andPlay(TimeSpan start, TimeSpan fadeIn)passMIX_PROP_PLAY_START_MILLISECOND_NUMBERandMIX_PROP_PLAY_FADE_IN_MILLISECONDS_NUMBERtoMIX_PlayTrack.Play()calls them with zero for both. A looping clip loops back to its beginning.ArgumentOutOfRangeException, and so does a start after the end of a buffer. SDL_mixer's seek past the end of a buffer fails without setting an error, so Pixely checks this itself. A start the decoder cannot seek to throwsPixelyException. Two examples: a start past the file's length in a WAV that loops forever, and a non-zero start in a stream whose content cannot seek.Looping = trueset beforePlay(), which never looped:MIX_PlayTrackresets the loop count, so the count now goes in its options.StubAudioSystemreports a zeroDurationand does not check a start against the end. This is documented indocs/testing.md.AudioSystemTestsplay the last 50 ms of a buffer and of a stream and wait for them to stop. They also check that a looping source still plays after a one-shot source with the same start has stopped, and they cover a WAV with an endlesssmplloop.