-
Notifications
You must be signed in to change notification settings - Fork 933
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
Load audio asychronously (fix #4880) #2928
Closed
Closed
Commits on Jan 27, 2021
-
Configuration menu - View commit details
-
Copy full SHA for ac69ecc - Browse repository at this point
Copy the full SHA ac69eccView commit details -
Configuration menu - View commit details
-
Copy full SHA for 66cbcd1 - Browse repository at this point
Copy the full SHA 66cbcd1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0e1618e - Browse repository at this point
Copy the full SHA 0e1618eView commit details -
Move Sound_Decoder::mResourceMgr into FFmpeg_Decoder
It's used only there.
Configuration menu - View commit details
-
Copy full SHA for 5136610 - Browse repository at this point
Copy the full SHA 5136610View commit details -
Configuration menu - View commit details
-
Copy full SHA for b533582 - Browse repository at this point
Copy the full SHA b533582View commit details -
Split volume into volume factor and SFX volume
Volume factor is passed as an argument when engine logic requires to play sound. SFX volume is loaded from ESM file. These values are not available at the same time and can change independently. With asynchronous sound loading SFX volume becomes available when access to the volume factor argument is lost therefore need to keep it as a separate field.
Configuration menu - View commit details
-
Copy full SHA for a5b6eb5 - Browse repository at this point
Copy the full SHA a5b6eb5View commit details -
Create audio decoders asychronously
To avoid initial file read from disk in the main thread. Use deadline to avoid noticable delay in actors speech start. This changed affects only voices and music. Sounds are not affected by this change. Decoder initialization requires to open file to read headers that leads to read from disk. This operation is performed by a separated thread via SceneUtil::WorkQueue. Created and initialized decoders are stored into a map file name -> decoder. Other data required to play voice stored into SoundManager state and used each update from the main thread to try to start playing voices and music when corresponding decoder is available. If it's not available play is delayed until next frame. When deadline to create decoder is reached main thread stops and waits until that decoder is created.
Configuration menu - View commit details
-
Copy full SHA for 9a6dc79 - Browse repository at this point
Copy the full SHA 9a6dc79View commit details -
To avoid initial file read from disk in the main thread. Use deadline to avoid noticable delay in actors speech start. This changed affects only sounds. Sounds are played more often than voices and music. There is a pool of created and initialized sound buffers that allows to play it from memory. When sound buffer initially requested openwm has to created decoder, read headers and potentially read all data. Initial request for sound buffer is performed in a separate thread via SceneUtil::WorkQueue. Created buffers are stored into a pool. If required sound buffer is present in the pool separate thread is not used. Other data required to play sound is stored SoundManager state and used each update from the main thread to try to start playing sounds when corresponding sound buffer is available. If it's not available play is delayed until the next frame. When deadline to load sound is reached main thread stops and waits until sound is loaded and added into the pool.
Configuration menu - View commit details
-
Copy full SHA for 491d9d6 - Browse repository at this point
Copy the full SHA 491d9d6View commit details -
Configuration menu - View commit details
-
Copy full SHA for d9e34fc - Browse repository at this point
Copy the full SHA d9e34fcView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.