mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 01:23:51 +00:00
audio: stop precast sound on spell completion, failure, or interrupt
Add AudioEngine::playSound2DStoppable() + stopSound() so callers can hold a handle and cancel playback early. SpellSoundManager::playPrecast() now stores the handle in activePrecastId_; stopPrecast() cuts the sound. playCast() calls stopPrecast() before playing the release sound, so the channeling audio never bleeds past cast time. SMSG_SPELL_FAILURE and SMSG_CAST_FAILED both call stopPrecast() so interrupted casts silence immediately.
This commit is contained in:
parent
e0d47040d3
commit
9d1616a11b
5 changed files with 100 additions and 3 deletions
|
|
@ -220,12 +220,22 @@ void SpellSoundManager::playPrecast(MagicSchool school, SpellPower power) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (library) {
|
||||
playSound(*library);
|
||||
if (library && !library->empty() && (*library)[0].loaded) {
|
||||
stopPrecast(); // Stop any previous precast still playing
|
||||
float volume = 0.75f * volumeScale_;
|
||||
activePrecastId_ = AudioEngine::instance().playSound2DStoppable((*library)[0].data, volume);
|
||||
}
|
||||
}
|
||||
|
||||
void SpellSoundManager::stopPrecast() {
|
||||
if (activePrecastId_ != 0) {
|
||||
AudioEngine::instance().stopSound(activePrecastId_);
|
||||
activePrecastId_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void SpellSoundManager::playCast(MagicSchool school) {
|
||||
stopPrecast(); // Ensure precast doesn't overlap the cast sound
|
||||
switch (school) {
|
||||
case MagicSchool::FIRE:
|
||||
playSound(castFireSounds_);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue