Skip to content
Browse files

audio: sound.set_time() should take effect immediately

Fixes #770
  • Loading branch information
rdb committed Nov 3, 2019
1 parent 847ebf6 commit bbb334abea81bcc5871f5821f89cc55c7441e952
Showing with 10 additions and 7 deletions.
  1. +3 −5 panda/src/audio/audioSound.h
  2. +7 −2 panda/src/audiotraits/openalAudioSound.cxx
@@ -47,11 +47,9 @@ class EXPCL_PANDA_AUDIO AudioSound : public TypedReferenceCount {
* concept) to the seek position within a file. The value starts at 0.0 (the
* default) and ends at the value given by the length() method.
* The current time position will not change while the sound is playing; you
* must call play() again to effect the change. To play the same sound from
* a time offset a second time, explicitly set the time position again. When
* looping, the second and later loops will start from the beginning of the
* sound.
* In the past, this call did nothing if the sound was currently playing, and
* it was necessary to call play() to effect the change. This is no longer
* the case; the time change takes effect immediately.
* If a sound is playing, calling get_time() repeatedly will return different
* results over time. e.g.
@@ -564,13 +564,18 @@ push_fresh_buffers() {

* The next time you call play, the sound will start from the specified
* offset.
* Sets the offset within the sound. If the sound is currently playing, its
* position is updated immediately.
void OpenALAudioSound::
set_time(PN_stdfloat time) {
ReMutexHolder holder(OpenALAudioManager::_lock);
_start_time = time;

if (is_playing()) {
// Ensure that the position is updated immediately.


0 comments on commit bbb334a

Please sign in to comment.
You can’t perform that action at this time.