本文介绍了如何迅速降低音乐音量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个带有背景音乐循环的SpriteKit游戏.问题是音乐太大声.如何降低音量?
I am creating a SpriteKit Game with background music looping. The problem is that the music is too loud. How do I lower the volume?
这是我用来设置音乐的代码
Here is the code I used to set up the music
var backGroundMusic = AVAudioPlayer()
var bgMusicUrl:NSURL = NSBundle.mainBundle().URLForResource("BackGround", withExtension: "wav")
backGroundMusic = AVAudioPlayer(contentsOfURL:bgMusicUrl, error: nil)
backGroundMusic.numberOfLoops = (-1)
backGroundMusic.prepareToPlay()
backGroundMusic.play()
推荐答案
您尝试过吗?
backGroundMusic.volume = 0.5
音量从0.0到1.0(最大音量). https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVAudioPlayerClassReference/index.html
Volume goes from 0.0 to 1.0 (full volume). https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVAudioPlayerClassReference/index.html
这篇关于如何迅速降低音乐音量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!