Possible Event Pool refactor #41
Replies: 3 comments 3 replies
-
The reason why the event pool is global is that we want the events to be bound to the id of the device rather than to the device object itself. That is because of the device object is destroyed in memory and then recreated later (which is the case when using a foreach for example), the idea is to still have the proper events bound to the device. Nevertheless, the best option would be to have the event pool properly handling events separatly for devices and sessions which would still require to have the id of both the device and the audio session but would still satisfy the condition explained above. With that explained, I guess it is exactly the code you have which I'd be really interested in seeing 😅. |
Beta Was this translation helpful? Give feedback.
-
You can view what I've done so far here, there's some noise in the javascript files because of my eslint configuration, but that would be the gist of it. |
Beta Was this translation helpful? Give feedback.
-
I'd like to keed the event pool with device descriptors instead of strings (even if it is the same at the end of the day). The way I would see this refactor of the event pools would be to have a tree in the event pool where the root would be the event pool, each first-level child would be an audio device with all its linked event callbacks and with additional children that would be all the audio sessions with registered events bound. This may not be very clear 😅, I can create a branch on the repo with the implementation of my idea so you could see. |
Beta Was this translation helpful? Give feedback.
-
So I've been looking into this package for a while, wanting to add some features, these include session volume & mute event handling, although I got some questions/suggestions.
First off, I'm not really experienced with C++, memory management, or common good practices. 😅
Making that point clear, putting together the code for volume and mute event handling wasn't particularly hard with what's currently available in the code base, I only had to modify the JS source code and add a few overrides here and there, and it's working as intended, here is a screenshot of how it could be used:
I have some questions regarding the EventPool object, currently, I'm using the same EventPool that is available on the mixer object, it comes with a few hindrances such as having to pass the audio session callback with the event pool reference to the session, and it all gets registered to one single event pool, I'm thinking of adding more events such as opening/closing new sessions to the event pool, so I can reload the available sessions in JS, register new events to them, and so on, but they will be new event pools with different methods and the such, I'm curious if I should, instead of binding everything to one single event pool, should I make an event pool for every Device/Session individually? Would it affect performance in some way? Any insight from you is greatly appreciated. 😁
Beta Was this translation helpful? Give feedback.
All reactions