Questions tagged [skaudionode]

29 questions
1
vote
1 answer

SKAudioNode completion not detected (using SKAction)

I need to know when an SKAudioNode has finished, but using the SKAction(:completion:) doesn't seem to work: audioNode.run(SKAction.play()) { // do something after it has finished } The sound plays fine, but the thing that is…
Joao
  • 579
  • 1
  • 4
  • 14
1
vote
1 answer

Trouble with SKAudioNode

In my app when the screen is touched I want to play my file "pewpew.mp3". It is not working. I've looked at several of these posts but none of the are working. This is my code: let shootNoise = SKAudioNode(fileNamed: "pewpew.mp3") …
J. Derbs
  • 107
  • 3
  • 10
1
vote
1 answer

Assign the SKAction returned when running play() on an SKAudioNode?

The docs seem to suggest that running play on an SKAudioNode returns an SKAction play() Creates an action that tells an audio node to start playback. class func play() -> SKAction So my wee logic tells me I can get at this returned Action, and…
Confused
  • 5,839
  • 6
  • 26
  • 65
1
vote
2 answers

My SKAudioNode stops when I transition to secondScene

I know this is meant to be fairly simple but I just can't figure it out! I have my song playing in the background in sceneOne. I then switch over to sceneTwo and the music completely stops. How can I make the background music continue? Below is my…
SamCurry
  • 29
  • 4
1
vote
0 answers

My mp3 won't play properly on SpriteKit Scene upon returning, using SKAudioNode and Swift

So basically, I play music on the first scene, and everything works fine. I transition to scene 2, and the music stops automatically, which is what I want. But then I transition back, and the music starts for half a second.. then just gets cut off…
Hien
  • 101
  • 1
  • 1
  • 6
1
vote
1 answer

SKAudioNode else/if off/on Case

I'm new to Swift coding and trying to figure out how to make looped audio with on/off function while touching a Node. I figured that the best way for me to implement it is through SKAudioNode, but I'm not sure what I'm doing wrong in the following…
Setera
  • 257
  • 2
  • 8
0
votes
1 answer

How come addChild() results in cannot convert value of type SKAudioNode to expected argument type UIViewController?

I copied the code below from a tutorial. However, an error about addChild pops up. It says, "Cannot convert value of type 'SKAudioNode' to expected argument type 'UIViewController'". How can I fix this? import AVFoundation import SpriteKit class…
Hi There
  • 23
  • 5
0
votes
1 answer

Why are there multiple SKSpriteNode and SKAudioNode objects when I only created one of each?

I created an SKSpriteNode object, but multiple objects are created, appearing as strings of them. The sound coming from the SKAudioNode object is also duplicated many times to give a reverberating effect. Here is the code below. I noticed it doing…
Daniel Brower
  • 1,264
  • 1
  • 11
  • 41
0
votes
0 answers

SKAudioNode only playing Musics in Mono

I'm developing a SpriteKit game, and I encountered a problem: The SKAudioNode instance only plays my game's background music in mono mode. I have the following instance in my SKScene class: var backgroundMusic : SKAudioNode? The following method…
ThiagoAM
  • 1,062
  • 8
  • 16
0
votes
1 answer

SKAudioNode has issues doing SKActions in Xcode 9b2

so i have a project that run perfectly fine on xcode 8 but when i am trying to run it on xcode 9b2 it crashes. i am creating audionode: let birdSound = SKAudioNode(fileNamed: "fly.mp3") add it to scene and it works. but if i am doing actions…
0
votes
0 answers

Best way to use sounds in gameScene

What is the best way to add sounds into a game. I've done some research, tried everything and all methods seem to have something wrong. For example: using SKAction.playFileNamed() has memory leaks, eventually will crash the app after extensive…
dre_84w934
  • 550
  • 5
  • 20
0
votes
1 answer

SKAudionode and Swift3

it been a year since I open my Xcode project and I see that there are some errors. Now I'm having problem with my audio code. it use to work good a year ago but now it says "fatal error: unexpectedly found nil while unwrapping an Optional…
0
votes
1 answer

works when gameScene is loaded first , but play for half a sec and immediately stops (no error) when loaded by another scene, why ?

in the gameScene.swift: declaration: var backgroundMusic: SKAudioNode! in didMoveToView: if let musicURL = NSBundle.mainBundle().URLForResource("Jalandhar", withExtension: "mp3") { backgroundMusic = SKAudioNode(URL: musicURL) …
Elazaron
  • 406
  • 8
  • 19
-1
votes
1 answer

SpriteKit not playing audio file?

I have made a custom class, SoundNode, to handle the playing of audio files. For now, it only plays the default "A2.mp3" class SoundNode : SKSpriteNode{ func playSound(){ run(SKAction.playSoundFileNamed("A2", waitForCompletion: false)) …
Erik Martin
  • 99
  • 1
  • 8
1
2