jarikomppa / soloud

Free, easy, portable audio engine for games
http://soloud-audio.com
Other
1.69k stars 270 forks source link

WAV loop points are not automatically applied #318

Open Kermalis opened 3 years ago

Kermalis commented 3 years ago

Expected behavior:

A wav file with loop points embedded should automatically set the correct sample to loop to.

Actual behavior:

The WavStream still loops from sample 0, ignoring the loop start marker in the file. Instead, math is needed to manually calculate the loop point in seconds. Seconds are inaccurate and causes gaps because it's not specific enough, especially with infinite decimal points involved. If the exact sample was used, then we wouldn't need to calculate seconds with all of the timing involved.

For example, a song at 110BPM, with 4/4 time signature, that should loop after 14 bars will place the loop at 30.5454~ seconds. This causes SoLoud to create a gap between the end and the loop even though the loop should be perfect. Given that we can easily embed the loop points in the wav, they should be used.

Seconds are just not accurate enough, when we can use exact samples from the file itself. Easier for everyone involved.