Playmusic freeze

Previous topic - Next topic


@SnooPI: nice tools but out of my artistic possibilities ;-)

So best advice is to use either small mod files (will check that in next project), use PlaySound with wav's, or changing music track only when in menu, this can be some solution, but only for games that have quite short level time play. Maybe this could be minimized by changing audio buffer size in source or something, btw. is ther way to force using SDL_mixer on Windows, as I assume it's using DxSound as default.

But if someone has similar problem and target platform is Windows you can use SDL2 Mixer, it plays mp3 files without freezes. Surely could be used on other platforms if someone has time to test and fix stuff..
Example lib in attachement, usage:
Code (glbasic) Select

SDL_vibes.MusicPlay("music.mp3", 0)
// other commands are similar: MusicIsPlaying(), MusicStop(), MusicPause(pause_it), needs volume control
// and on quit:

SDL2 just needs some setup: check this and You need to add SDL2_mixer stuff to that include/libs/dll..

ps. Maybe those Android issues are due using old SDL? hm..

edit: if target is 60fps with full game logic inbound, it still can freeze game for few frames - on hdd, on ssd didn't noticed drops when previously it could freeze game for 300ms, but this is a fast straight forward solution. Best would be either loading music files from other thread or just use couple SDLmusic object's as tracks, load them once and later just play - don't destroying object and reload it each time..
Check my source code editor for GLBasic - link Update: 20.04.2020