mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
audio: Fix stop() not working for looped sound while sound is inactive
Fixes #559 Also fixes #1031 for FMOD
This commit is contained in:
parent
9f09857397
commit
e5eb5f8ed2
@ -259,6 +259,7 @@ stop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_start_time = 0.0;
|
_start_time = 0.0;
|
||||||
|
_paused = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -827,12 +828,13 @@ set_active(bool active) {
|
|||||||
} else {
|
} else {
|
||||||
// ...deactivate the sound.
|
// ...deactivate the sound.
|
||||||
if (status() == PLAYING) {
|
if (status() == PLAYING) {
|
||||||
|
PN_stdfloat time = get_time();
|
||||||
|
stop();
|
||||||
if (get_loop_count() == 0) {
|
if (get_loop_count() == 0) {
|
||||||
// ...we're pausing a looping sound.
|
// ...we're pausing a looping sound.
|
||||||
_paused = true;
|
_paused = true;
|
||||||
_start_time = get_time();
|
_start_time = time;
|
||||||
}
|
}
|
||||||
stop();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,6 +217,8 @@ stop() {
|
|||||||
_stream_queued.resize(0);
|
_stream_queued.resize(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_paused = false;
|
||||||
|
|
||||||
_manager->stopping_sound(this);
|
_manager->stopping_sound(this);
|
||||||
release_sound_data(false);
|
release_sound_data(false);
|
||||||
}
|
}
|
||||||
@ -828,13 +830,13 @@ set_active(bool active) {
|
|||||||
} else {
|
} else {
|
||||||
// ...deactivate the sound.
|
// ...deactivate the sound.
|
||||||
if (status()==PLAYING) {
|
if (status()==PLAYING) {
|
||||||
if (_loop_count==0) {
|
|
||||||
// ...we're pausing a looping sound.
|
|
||||||
_paused=true;
|
|
||||||
}
|
|
||||||
// Store off the current time so we can resume from where we paused.
|
// Store off the current time so we can resume from where we paused.
|
||||||
_start_time = get_time();
|
_start_time = get_time();
|
||||||
stop();
|
stop();
|
||||||
|
if (_loop_count == 0) {
|
||||||
|
// ...we're pausing a looping sound.
|
||||||
|
_paused = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user