love2d / love

LÖVE is an awesome 2D game framework for Lua.
https://love2d.org
Other
5.05k stars 401 forks source link

Remove the default audio Source type #1087

Closed slime73 closed 8 years ago

slime73 commented 9 years ago

Original report by Alex Szpakowski (Bitbucket: slime73, GitHub: slime73).


Currently love.audio.newSource(filename) defaults to creating a streaming Source. It might be a bit more convenient for quickly getting things up and running, but it has a few downsides:

Static sources have none of those issues, but they also take a long time to do the full decode when they load, if the sound file is big or long. Since each Source type has unique downsides I don't think it makes much sense to have a default, even though it would be slightly less convenient for new users.

slime73 commented 9 years ago

Original comment by Landon “Karai” Manning (Bitbucket: karai17, GitHub: karai17).


Would it be a completely bad idea to set a different default based on the length of the audio? If a file is less than 10 seconds, it could be inferred as a sound effect, otherwise inferred as music?

slime73 commented 9 years ago

Original comment by Alex Szpakowski (Bitbucket: slime73, GitHub: slime73).


The length of a given sound file can't really be reliably determined until it's been completely loaded (i.e. not streaming).

File size could be used, but either way it would kind of be a 'hidden magic number' that could cause side effects in code that didn't expect the default argument value to change based on external factors.

slime73 commented 9 years ago

Original comment by Landon “Karai” Manning (Bitbucket: karai17, GitHub: karai17).


I recall determining a file's length, especially OGG, can be finicky (See: In The Groove 2 r21 patching). I generally don't think magic numbering is a good idea either.

slime73 commented 8 years ago

Original comment by Bart van Strien (Bitbucket: bartbes, GitHub: bartbes).


Remove the default source type (resolves #1082)