diff --git a/panda/src/audio/audioSound.h b/panda/src/audio/audioSound.h index 1ea77bb9e5..4f7116c080 100644 --- a/panda/src/audio/audioSound.h +++ b/panda/src/audio/audioSound.h @@ -47,11 +47,9 @@ PUBLISHED: * 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. diff --git a/panda/src/audiotraits/openalAudioSound.cxx b/panda/src/audiotraits/openalAudioSound.cxx index 5676e63f80..ff7d187a3d 100644 --- a/panda/src/audiotraits/openalAudioSound.cxx +++ b/panda/src/audiotraits/openalAudioSound.cxx @@ -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. + play(); + } } /**