Skip to content

Music module reliability#1315

Open
Eathox wants to merge 11 commits into
CBATeam:masterfrom
Eathox:isMusicPlaying-fix
Open

Music module reliability#1315
Eathox wants to merge 11 commits into
CBATeam:masterfrom
Eathox:isMusicPlaying-fix

Conversation

@Eathox
Copy link
Copy Markdown

@Eathox Eathox commented Mar 30, 2020

As you might know the CBA Music module isn't reliable in its current state. This is because the function CBA_fnc_isMusicPlaying is unable to detect when a song ended and cant handle music that was started without calling CBA_fnc_playMusic.

This pull request fixes most of these issues by utilizing the vanilla music event handlers, however this leave's one special case. That being playMusic "" since that doesn't trigger any of the currently present music events, this issue is fixed by incorporating an extra check in CBA_fnc_isMusicPlaying.

When merged this pull request will:

  • Fix CBA_fnc_isMusicPlaying incorrect return value (#1241, #1024)
  • Make CBA_fnc_getMusicPlaying use CBA_fnc_isMusicPlaying instead of a isNil check
  • Improve the reliability of the _trackTime value returned from CBA_fnc_getMusicPlaying
    (by using getMusicPlayedTime instead of a time based calculation)

Eathox added 2 commits March 30, 2020 01:32
_remainingTime can result in a negative number right round the end of track
Limited it to 0 since a negative number would be unexpected
@Eathox Eathox changed the title Fix for CBA_fnc_isMusicPlaying not handling music stop properly CBA_fnc_isMusicPlaying incorrect return value Mar 30, 2020
@Eathox Eathox changed the title CBA_fnc_isMusicPlaying incorrect return value Music module reliability Mar 30, 2020
@Eathox Eathox force-pushed the isMusicPlaying-fix branch from 3014c4a to bc040f9 Compare March 30, 2020 02:47
Comment thread addons/music/fnc_isMusicPlaying.sqf Outdated
Comment thread addons/music/XEH_preInit.sqf Outdated
Eathox added 4 commits March 30, 2020 19:21
Now clamping _trackTime instead of _remainingTime so that _trackTime can never go over the _duration
CBA_missionTime takes accTime in to account which doesn't affect music
@Eathox Eathox requested a review from commy2 August 28, 2020 12:39
Comment thread addons/music/fnc_isMusicPlaying.sqf Outdated
Eathox added 4 commits August 29, 2020 12:13
No longer change the minimum wait time based on FPS isntead use one that accommodates the worst case scenario.
This is to keep the system in sync in case of false positives.
Remove comment stating that only `CBA_fnc_playMusic` is supported
@Eathox Eathox requested a review from commy2 September 6, 2020 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants