-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
FEAT(plugin-api): Add function to mumble api to obtain current positional audio data provided by another plugin #6556
base: master
Are you sure you want to change the base?
Changes from all commits
6a8d789
ad56c6d
bec426b
890561f
944fa2f
d83226c
9ad2a82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -43,7 +43,7 @@ | |||||
# define MUMBLE_PLUGIN_API_MAJOR_MACRO 1 | ||||||
# endif | ||||||
# ifndef MUMBLE_PLUGIN_API_MINOR_MACRO | ||||||
# define MUMBLE_PLUGIN_API_MINOR_MACRO 2 | ||||||
# define MUMBLE_PLUGIN_API_MINOR_MACRO 3 | ||||||
# endif | ||||||
# ifndef MUMBLE_PLUGIN_API_PATCH_MACRO | ||||||
# define MUMBLE_PLUGIN_API_PATCH_MACRO 0 | ||||||
|
@@ -444,6 +444,42 @@ struct MumbleStringWrapper { | |||||
bool needsReleasing; | ||||||
}; | ||||||
|
||||||
struct PositionalDataNoQt; | ||||||
|
||||||
static void freePositionalDataStruct(PositionalDataNoQt *positionalData); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need this. |
||||||
|
||||||
struct PositionalDataNoQt { | ||||||
#ifdef __cplusplus | ||||||
// Prevents compilation but generic functions | ||||||
// such as the one below doesn't hinder compilation | ||||||
// ~PositionalDataNoQt() { | ||||||
// freePositionalDataStruct(this); | ||||||
// } | ||||||
// | ||||||
void freeStruct() { | ||||||
freePositionalDataStruct(this); | ||||||
} | ||||||
#endif | ||||||
|
||||||
float m_playerPos[3]; | ||||||
float m_playerDir[3]; | ||||||
float m_playerAxis[3]; | ||||||
float m_cameraPos[3]; | ||||||
float m_cameraDir[3]; | ||||||
float m_cameraAxis[3]; | ||||||
char *m_context; | ||||||
char *m_identity; | ||||||
}; | ||||||
|
||||||
void freePositionalDataStruct(PositionalDataNoQt *positionalData) { | ||||||
if (positionalData) { | ||||||
free(positionalData->m_context); | ||||||
free(positionalData->m_identity); | ||||||
} | ||||||
|
||||||
free(positionalData); | ||||||
} | ||||||
|
||||||
MUMBLE_EXTERN_C_END | ||||||
|
||||||
#endif // EXTERNAL_MUMBLE_PLUGIN_TYPES_ | ||||||
|
@@ -1515,6 +1551,21 @@ struct MUMBLE_API_STRUCT_NAME { | |||||
mumble_channelid_t channelID, | ||||||
const char **description); | ||||||
|
||||||
#if SELECTED_API_VERSION >= MUMBLE_PLUGIN_VERSION_CHECK(1, 3, 0) | ||||||
/** | ||||||
* Gets the positional audio data provided by OTHER plugins | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
which plugin has supplied the data is left unspecified. It's not like this function won't work if the positional data has been supplied by the same plugin that now asks for it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh yeah true, your wording is better and conveys what I wanted to get across, made other in caps to convey it is not like the similarly named (imo it is similar names) fetchPositionalData (in my brain, get and fetch are similar, now get and put are more distinct imo but I see no reason to change the existing name of api functions when we can just be clear in the doc comments) |
||||||
* | ||||||
* @param callerID The ID of the plugin calling this function | ||||||
* @param[out] outPositionalData A pointer to the memory location the PositionalData object should be written to | ||||||
* @returns The error code. If everything went well, STATUS_OK will be returned. | ||||||
* | ||||||
* @since Plugin interface v1.3.0 | ||||||
*/ | ||||||
mumble_error_t(MUMBLE_PLUGIN_CALLING_CONVENTION *getPositionalAudioData)(mumble_plugin_id_t callerID, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would turn this into multiple functions: One for retrieving the positional data, one for retrieving the identity and one for retrieving the context. Only the latter two involve dynamic memory allocations due to the involvement of strings (for which you should use the existing string wrapper classes). |
||||||
PositionalDataNoQt **outPositionalData); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
No need to allocate the passed struct on the heap (using e.g. |
||||||
#endif | ||||||
|
||||||
|
||||||
|
||||||
// -------- Request functions -------- | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a different name