-
Notifications
You must be signed in to change notification settings - Fork 28
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
Audio Playback stops after ~1 second in compatibility mode #2
Comments
Issue is more complex than it seems. Quoting slime:
|
I was able to fix this with the following patch. All it does is call the pool->update function in Event:pump(), which then triggers individual sources to decode more samples into their buffer. This function is normally called in a loop by a thread, so there are probably some inefficiencies introduced by calling it every frame. diff --git a/src/modules/audio/openal/Audio.h b/src/modules/audio/openal/Audio.h
index c73a0be7..2e63925a 100644
--- a/src/modules/audio/openal/Audio.h
+++ b/src/modules/audio/openal/Audio.h
@@ -130,6 +130,9 @@ class Audio : public love::audio::Audio
bool getEffectID(const char *name, ALuint &id);
+ // The Pool.
+ Pool *pool;
+
private:
void initializeEFX();
// The OpenAL device.
@@ -152,9 +155,6 @@ class Audio : public love::audio::Audio
int MAX_SCENE_EFFECTS = 64;
int MAX_SOURCE_EFFECTS = 64;
- // The Pool.
- Pool *pool;
-
class PoolThread: public thread::Threadable
{
protected:
diff --git a/src/modules/event/sdl/Event.cpp b/src/modules/event/sdl/Event.cpp
index a3f9ae39..af426001 100644
--- a/src/modules/event/sdl/Event.cpp
+++ b/src/modules/event/sdl/Event.cpp
@@ -30,6 +30,7 @@
#include "window/Window.h"
#include "common/Exception.h"
#include "audio/Audio.h"
+#include "audio/openal/Audio.h"
#include "common/config.h"
#include "timer/Timer.h"
@@ -129,6 +130,8 @@ void Event::pump()
msg->release();
}
}
+
+ Module::getInstance<love::audio::openal::Audio>(Module::M_AUDIO)->pool->update();
}
Message *Event::wait() |
Oh that's very cool @rameshvarun!!! I'll test on mine and merge soon. EDIT: I will probably tinker around with this to make this change happen only when the compat mode is being built, to prevent it from adversely affecting the full mode. |
Fixed in 8f9a7b8 |
Even with "static", audio stops playing after about 1 second. In Safari it only plays the first time :play() is called, in chrome it plays the first ~1 second each time :play() is called
The text was updated successfully, but these errors were encountered: