MrWalkmanDev / AdaptiSound

Background Audio Manager for Godot 4.0
MIT License
65 stars 5 forks source link

Audio Manager ## Problemas con el Fade out 159 line #6

Closed Janakanty closed 1 month ago

Janakanty commented 1 month ago

Hey! You wrote that there is a problem with fade out in this function. Do you have an idea how to fix it today?

Audio Manager

func stop_music(can_fade := false, fade_out := 1.5):

      var track
      if can_fade == false:
          fade_out = 0.0  
      if current_playback != null:
          track = current_playback
          tools.check_fade(current_playback, fade_out, false)

      current_playback = null ## Problemas con el Fade out
      return track
Janakanty commented 1 month ago

Ok. AudioTools.gd. I solved the problem. Before it fade_out you killed it with a regular stop. I commented it out and it works.

Check if can use Fade_In or Fade_Out
func check_fade(node, fade_time, type: bool, skip_intro := false, loop_index := 0):
    if type:
        if node is AudioStreamPlayer:
            node.on_fade_in(0.0, fade_time)
            node.play()
        else:
            node.on_play(fade_time, skip_intro, loop_index)
    else:
        if node is AudioStreamPlayer:
            node.on_fade_out(fade_time)
            #node.stop()
        else:
            node.on_stop(fade_time)
MrWalkmanDev commented 1 month ago

Hey!, I thank you for solving that problem. The truth is I don't remember the code very well, I had to go over it again. And now that version 4.3 has the interactive features, I think I could create a new version but using those resources. thanks for your help :D