fix: stream stops and dies on underflow

This commit is contained in:
MihailRis
2025-10-30 19:56:07 +03:00
parent ab7bf9c709
commit cf561e78a8
6 changed files with 60 additions and 27 deletions
+8 -1
View File
@@ -58,6 +58,7 @@ namespace audio {
bool keepSource;
char buffer[BUFFER_SIZE];
bool loop = false;
bool stopOnEnd = false;
bool preloadBuffer(uint buffer, bool loop);
void unqueueBuffers(uint alsource);
@@ -80,6 +81,10 @@ namespace audio {
void setTime(duration_t time) override;
static inline constexpr uint STREAM_BUFFERS = 3;
bool isStopOnEnd() const override;
void setStopOnEnd(bool stopOnEnd) override;
};
class ALInputDevice : public InputDevice {
@@ -117,7 +122,7 @@ namespace audio {
float volume = 0.0f;
public:
ALStream* stream = nullptr;
bool stopped = true;
bool manuallyStopped = true;
bool paused = false;
uint source;
duration_t duration = 0.0f;
@@ -157,6 +162,8 @@ namespace audio {
bool isRelative() const override;
int getPriority() const override;
bool isManuallyStopped() const override;
};
class ALAudio : public Backend {