-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add support for DSP buffer size #96
Conversation
src/godot_fmod.h
Outdated
@@ -111,6 +111,8 @@ namespace godot { | |||
int actualListenerNumber = 0; | |||
Listener listeners[FMOD_MAX_LISTENERS]; | |||
bool listenerWarning = true; | |||
unsigned int bufferlength = 0; |
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.
I think there is no value in storing those variables inside the class.
In the 2 getters, you can just create a local variable, pass its pointers to FMOD, then return it.
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.
I agree
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.
Will do!
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.
Fixed!
src/godot_fmod.cpp
Outdated
} | ||
} | ||
|
||
int Fmod::getSystemDSPBufferLength() { |
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.
I'm not sure if we should not return an array containing lenght and num instead of having two getter that does same things but only return partial information ?
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.
I had a long think about this: from a usability perspective, it will be quite confusing to Godot users to suddenly get an Array
as return type as it is not very explicit what these values actually mean. On the contrary, it is not performant to request both values separately, however, the FMOD C++ binding forces us to pass in both by reference always.
If you are happy I can make that change to return an Array
, however, it may get confusing to users what these values mean.
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.
I'm more on the side of having 2 getters. It's not like we need performance for that, it's just a simple API call. So it's better to favor usability.
We can also gave both: 2 separate getter returning one value, and one getter getSystemDSPInfo
that returns an array or dictionnary with string key.
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.
Pushed!
As explained in #91 there is currently the issue on certain systems that the audio plays back with delay. The reason is that the default DSP buffer size has the wrong configuration.
This pull request allows to configure the DSP buffer size like so in Godot:
I tested this with my game and the audio playback latency is now near real-time. No more audible lag after setting this in my game code!