excaliburjs / Excalibur

🎮 Your friendly TypeScript 2D game engine for the web 🗡️
https://excaliburjs.com
BSD 2-Clause "Simplified" License
1.81k stars 190 forks source link

Support "audio sprites" / playing a "clip" of an audio resource #803

Open alanag13 opened 7 years ago

alanag13 commented 7 years ago

Context

Currently, without adding some form of additional logic, there is no flexibility over the duration of a sound's play. Additionally, a separate file needs to be supplied / loaded for every audio resource in the game.

Proposal

Solve both problems by providing APIs to play "clips" from a file rather than only the entire file. Example:

//ex.SoundClip implements same interface as ex.Sound
var audioResource = Resources.someSoundProvidedOnLoad;
var clip = new ex.SoundClip(audioResource, /*ms starting point */ 3000, /*ms duration */ 15500);
clip.play(); //plays 15.5 seconds of audioResource, starting at the 3 second mark
kamranayub commented 7 years ago

Wasnt there already a sound sprite issue? Maybe only groups...

On Sun, May 7, 2017, 17:32 Alan Grgic notifications@github.com wrote:

Context

Currently, without adding some form of additional logic, there is no flexibility over the duration of a sound's play. Additionally, a separate file needs to be supplied / loaded for every audio resource in the game. Proposal

Solve both problems by providing APIs to play "clips" from a file rather than only the entire file. Example:

//ex.SoundClip implements same interface as ex.Sound var audioResource = Resources.someSoundProvidedOnLoad; var clip = new ex.SoundClip(audioResource, /ms starting point / 3000, /ms duration / 15500); clip.play(); //plays 15.5 seconds of audioResource, starting at the 3 second mark

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/excaliburjs/Excalibur/issues/803, or mute the thread https://github.com/notifications/unsubscribe-auth/AAiaa1pa58Gte7NTUnFFvgo7Zn222S2Bks5r3kaRgaJpZM4NTU7H .

alanag13 commented 7 years ago

I looked for one, but groups/sound manager was all i could find.

jedeen commented 7 years ago

It was https://github.com/excaliburjs/Excalibur/issues/4, but I've closed it in favor of this one, which follows our new issue template.

github-actions[bot] commented 3 years ago

This issue hasn't had any recent activity lately and is being marked as stale automatically.