tzachshabtay / MonoAGS

AGS (Adventure Game Studio) reimagined in Mono
https://tzachshabtay.github.io/MonoAGS/
Artistic License 2.0
27 stars 8 forks source link

Set looping sound's task result when stopped by user #254

Closed ghost closed 6 years ago

ghost commented 6 years ago

This sets ALSound's Task result when user explicitly calls Stop(), which fixes looping sounds not reporting completion when stopped that way.

For non-looping sounds Task result is being set right in Play() method, after finished waiting for the sound source. Which also happens if you call Stop(), so I believe same should happen when you call Stop() for looping sound too.

Note: not sure if it is necessary to check for "IsLooping" in Stop. If we don't, then there will be double _tcs.TrySetResult call for non-looping sounds, but that did not cause any issues when I tested it out.

tzachshabtay commented 6 years ago

No need to check "IsLooping" in "Stop", it's fine, the "Try" in "TrySetResult" has you covered.

And regarding the build failure, it's unrelated to this PR, AppVeyor seemed to bump dotnet core versions on their virtual machine and something is failing, apparently, so merging.