emscripten-core / emscripten-core/emscripten

AL_SAMPLE_OFFSET Problem

Open
#19,558 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

I did some further investigating and found that:

1. Setting AL_SAMPLE_OFFSET (or AL_BYTE_OFFSET or AL_SEC_OFFSET) with alSourcei does, in fact, change the offset value if the source is stopped.
2. Calling alSourcePlay on the source resets the AL_SAMPLE_OFFSET to 0.
3. Calling alSourcei with AL_SAMPLE_OFFSET while the sound is playing has no effect at all.

The latter two points are in direct conflict with OpenAL specifications, which state that:

> When setting AL_SAMPLE_OFFSET on a source which is already playing, the playback
> will jump to the new offset unless the new offset is out of range, in which case an
> AL_INVALID_VALUE error is set. If the source is not playing, then the offset will be
> applied on the next alSourcePlay call. An alSourceStop, alSourceRewind, or a second
> alSourcePlay call will reset the offset to the beginning of the buffer

_Originally posted by @JacksonAllan in https://github.com/emscripten-core/emscripten/issues/3271#issuecomment-459155176_

I have the same issue as JacksonAllan. When i pause and replay a source, the offset is reset to 0. Is it a bug for AL_SAMPLE_OFFSET implementation or something special should be done to fix this problem?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.