Skip to content

Querying AL_PROCESSED_BUFFERS #1295

Description

@minghia

When you call alSourceQueueBuffers to queue the audio but don't call alSourcePlay, a call to alGetSourceI(src, AL_BUFFERS_PROCESSED, &processed) returns the number of items queued not the number processed. I'm not sure how 1.25.2 does this calculation but 1.24.2 and 1.23.1 assign Current without checking whether or not Current is nullptr.

ase AL_BUFFERS_PROCESSED: CheckSize(1); if(Source->Looping || Source->SourceType != AL_STREAMING) { /* Buffers on a looping source are in a perpetual state of PENDING, * so don't report any as PROCESSED */ values[0] = 0; } else { int played{0}; if(Source->state != AL_INITIAL) { const VoiceBufferItem *Current{nullptr}; if(Voice *voice{GetSourceVoice(Source, Context)}) Current = voice->mCurrentBuffer.load(std::memory_order_relaxed); for(auto &item : Source->mQueue) { if(&item == Current) // If nothing has played Current is nullptr and this loop returns the number of items in mQueue break; ++played; } } values[0] = played; } return true;

I have a bug in my code where I'm not calling alSourcePlay but if processed is set to non-zero value. Anything queued is indicated as being processed when it hasn't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions