2

I've tried to fade volume of a SKAudioNode to 0 with duration, but the duration doesn't seem to affect, the audio stops immediately:

    let fireAudio = SoundManager.sharedInstance.fire //SKAudioNode
    let stopAudio = SKAction.stop()
    let fadeVolume = SKAction.changeVolumeTo(0.0, duration: 3.0)
    let remove = SKAction.removeFromParent()
    let sequence = SKAction.sequence([fadeVolume, stopAudio, remove])
    fireAudio?.runAction(sequence)

Any suggestion? thanks

Simone Pistecchia
  • 2,089
  • 2
  • 13
  • 21
  • 1
    I'm not sure but maybe `stopAudio` is executed just after `fadeVolume` is launched. Some actions have effect in time but are immediately sequenced. Insert a `waitForDuration` in between or just remove `stop` and `remove` to test. – Jean-Baptiste Yunès May 13 '16 at 13:34
  • thanks Jean-Baptiste Yunès I'll try at home! – Simone Pistecchia May 13 '16 at 13:38
  • @Jean-BaptisteYunès doesn't work. It seem don't work also if I do not apply the sequence. fireAudio?.runAction(SKAction.changeVolumeTo(0.0, duration: 3.0)) reduces the audio immediately to 0. Maybe I understood bad the parameters duration? – Simone Pistecchia May 15 '16 at 21:05
  • Strange... Your parameters are ok. – Jean-Baptiste Yunès May 16 '16 at 08:33
  • What library do you use for SoundManager? Are you sure that fading those sounds is compatible with SKAction? May be there exist a custom methods to animate these sounds... – Jean-Baptiste Yunès May 16 '16 at 08:42
  • @Jean-BaptisteYunès SoundManager is a simple init of a SKAudioNode son of SKNode – Simone Pistecchia May 16 '16 at 08:59
  • SKAudioNode seems broken for fading, see https://forums.developer.apple.com/thread/44637 – Jean-Baptiste Yunès May 16 '16 at 13:16
  • @Jean-BaptisteYunès thanks, I had read this forum, but in one month no bug fix? – Simone Pistecchia May 16 '16 at 13:24
  • @SimonePistecchia I'm not seeing where/how you initiate playing of the SKAudioNode. In the SoundManager? I'm having similar problems, but even worse, can't get anything to play from a sound manager style class. When does this actually get around to firing a play() command to the SKAudioNode? And have you had any success with SKAudioNode? – Confused Nov 04 '16 at 19:01
  • See this for a problem I'm having: http://stackoverflow.com/questions/40429475/copied-skaudionode-unresponsive-why – Confused Nov 04 '16 at 19:01
  • 1
    @Confused I've used a custom class of AVAudio and skaction for short sound... – Simone Pistecchia Nov 07 '16 at 12:46

0 Answers0