Skip to content

Commit a32b2b4

Browse files
committed
mixer: calling alSourcePlay() on a paused source was discarding offset.
Fixes #39.
1 parent 485967f commit a32b2b4

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

mojoal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,7 @@ static void migrate_playlist_requests(ALCcontext *ctx)
17741774
}
17751775
}
17761776
if (buffer) {
1777-
put_albuffer_to_audiostream(ctx, buffer, 0, src->stream);
1777+
put_albuffer_to_audiostream(ctx, buffer, src->offset, src->stream);
17781778
}
17791779

17801780
src->playlist_next = ctx->playlist;

tests/testposition.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,16 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
220220
case SDL_EVENT_KEY_DOWN:
221221
if (event->key.key == SDLK_ESCAPE) {
222222
return SDL_APP_SUCCESS;
223+
} else if (event->key.key == SDLK_SPACE) {
224+
const ALuint sid = objects[1].sid;
225+
ALint state = 0;
226+
alGetSourceiv(sid, AL_SOURCE_STATE, &state);
227+
if (state == AL_PLAYING) {
228+
alSourcePause(sid);
229+
} else if (state == AL_PAUSED) {
230+
alSourcePlay(sid);
231+
}
232+
return SDL_APP_CONTINUE;
223233
}
224234
break;
225235

0 commit comments

Comments
 (0)