Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[All] Implement BASS stream creation on a separate thread to avoid lag #6

Open
Sonic49PH opened this issue May 31, 2022 · 3 comments
Open
Labels
bug Something isn't working

Comments

@Sonic49PH
Copy link

I had tried the latest release of the XNFSMusicPlayer, but in-game without music, it just halts for a split-second.

@xan1242
Copy link
Owner

xan1242 commented May 31, 2022

Yeah so this happens because the BASS library runs in the same thread as the game.

Meaning that if your storage is slow it can cause these kinds of issues (it's especially noticeable with online streams).

This entire music player needs a rewrite anyways so I don't think I can fix these issues right now. Maybe moving the playback to a separate thread could work.

@xan1242 xan1242 changed the title XNFSMusicPlayer causes the game to halt for a split-second in the latest version [All] Implement BASS stream creation on a separate thread to avoid lag Aug 21, 2022
@xan1242 xan1242 added the bug Something isn't working label Aug 21, 2022
@xan1242
Copy link
Owner

xan1242 commented Aug 22, 2022

This is very noticeable once you add a frametime graph like MangoHUD. It's definitively visible on larger streams. Maybe it's caused by BASS_STREAM_PRESCAN flag, I'm not too sure, but the solution definitively is moving all music processing to a separate thread and only use the game thread for messaging.

@xan1242
Copy link
Owner

xan1242 commented Aug 22, 2022

Branch multithread was created for this purpose:

https://github.com/xan1242/XNFSMusicPlayer/tree/multithread

Idea is simple - add a simple push/pop queue messaging system and pass that info to the second thread through a message buffer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants