Sound playback improvements - added optional offset and duration parameters#287
Open
mikedotalmond wants to merge 6 commits intoaduros:masterfrom
Open
Sound playback improvements - added optional offset and duration parameters#287mikedotalmond wants to merge 6 commits intoaduros:masterfrom
mikedotalmond wants to merge 6 commits intoaduros:masterfrom
Conversation
…und-sprite type applications --- Changes the onComplete behavior of one-shot Playback objects - once complete, the Playback is disposed/released for GC.
Author
|
Ah, I see I didn't update Mixer. Will fix. |
Author
|
Hmm, I see why those js.html.audio externs were left out... revert.... |
Author
|
Build appears to have failed on a firefox.js test - timed out after 10 mins. Not sure why. |
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.
Adds ability to play or loop regions of a sound, with optional offset and duration parameters.
play (volume :Float = 1.0, offset:Float=0, duration:Float=0) :Playbackloop (volume :Float = 1.0, offset:Float=0, duration:Float=0) :PlaybackThis will allow sound-sprite type behaviours - where many short sounds can be contained in, and played from, a single asset.
The update should be seamless across all platforms - and not break anything.. but I have changed how Playback objects are disposed:
In the case of the WebAudioPlayback, nodes were remaining in the audio graph after sounds completed. So playing lots of one-shot sounds created many
AudioBufferSourceNode -> GainNodepairs that were not being removed/collected.Note: I had to update the signatures for
AudioNode::connectandAudioNode::disconnectwhich are out of date in the haxe std library. The output and input parameters for these functions are optional so should be more like this...@:overload( function( destination : AudioNode, ?output : Int, ?input : Int ) :Void {} )function connect( destination : AudioParam, ?output : Int ) : Void;function disconnect( ?output : Int ) : Void;