improve comments for audio milliseconds computation

This commit is contained in:
2025-03-25 11:33:40 +01:00
parent 8bbcd29c56
commit 6aa4840777

View File

@@ -185,8 +185,9 @@ audiodata audio_wav_load(audiodevice const* dev, char const* fpath) {
return (audiodata){0}; return (audiodata){0};
} }
// calculate the time in miliseconds of the audio fragment
audio.ms = 1000 * (((audio.len) / (SDL_AUDIO_BITSIZE(dev->fmt) / 8)) / spec.channels / dev->freq); audio.ms = 1000 * (((audio.len) / (SDL_AUDIO_BITSIZE(dev->fmt) / 8)) / spec.channels / dev->freq);
// calculate the time in milliseconds of the audio fragment
// by dividing the audio bytelength by the format's bitsize, by the audio device's channels and the audio device's frequency
return audio; return audio;
} }