Skip to content

Conversation

@capdevon
Copy link
Contributor

@capdevon capdevon commented May 4, 2025

WIP: Not ready for review.

After studying the OpenAL API, this PR introduces small tweaks to make the code clearer and easier to understand.

Changes:

  • Error Checking: Added more consistent checkAlError calls after relevant OpenAL operations.
  • Initialization/Cleanup: Improved error handling and resource cleanup in initOpenAL, initEfx, and destroyOpenAL.
  • Device Handling: Added logic to handle device disconnection and renderer restart. (Note: restartAudioRenderer is currently missing Environment and Listener settings handling).
  • Comments and Logging: Added/updated comments and improved logging messages.

capdevon added 7 commits May 4, 2025 13:16
- remove recursive calls to updateSourceParam() method
- more checkAlError
- added helper methods
- added comments
- javadoc
- fix Destroys the OpenAL context, deleting sources, buffers, filters, and effects.
@yaRnMcDonuts yaRnMcDonuts added this to the v3.9.0 milestone May 6, 2025
@capdevon
Copy link
Contributor Author

capdevon commented May 8, 2025

Hi guys,
good news! The PR is finished and ready to be merged. For anyone reviewing, I recommend taking a quick look at the OpenAL documentation. Some of the function logic and design decisions might seem unusual at first glance, but they're often dictated by the OpenAL library itself.

@yaRnMcDonuts

capdevon added 4 commits May 10, 2025 01:22
You should consider using ArrayDeque when:

You need a collection that efficiently supports adding and removing elements from both ends. This makes it ideal for implementing data structures like queues and stacks.
You frequently perform removals from the beginning of the collection.
see ALAudioRenderer.newChannel() and ALAudioRenderer.freeChannel()
removes the repeated call to the `checkAlError` method. The repeated string creation and the associated overhead of the error checking can negatively impact performance, especially in a frequently executed game loop. By removing this redundant check, we aim to improve overall performance and reduce garbage collection pressure.
@yaRnMcDonuts
Copy link
Member

I'll merge this in ~24 hours

@yaRnMcDonuts yaRnMcDonuts merged commit 0925f98 into jMonkeyEngine:master May 18, 2025
16 checks passed
@capdevon capdevon deleted the capdevon-ALAudioRenderer branch June 15, 2025 22:52
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