本文介绍了调节SKAction playSoundFileNamed的音量:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过SKAction .

Is there a way to regulate the volume of sound played via SKAction playSoundFileNamed:waitForCompletion:.

我想实现一个简单的音乐&我的游戏中的音效滑块.由于可以通过AVAudioPlayer播放背景音乐,因此可以轻松控制背景音乐,但是所有声音效果都是通过SKAction播放的.

I would like to implement a simple music & sound effects slider in my game. I can easily control background music since i play it via AVAudioPlayer, but all sound effects are played via SKAction.

推荐答案

不幸的是,您无法使用SKAction修改音量,因此您也必须使用AVAudioPlayer来实现效果.您可以按照您的想法使用runBlock实现自定义playSoundFileNamed:waitForCompletion:volume :,因此您的代码与使用playSoundFileNamed:waitForCompletion:不会有太大不同.

Unfortunately you can't modify the volume using SKAction, so you have to use AVAudioPlayer for your effects too.You could implement a custom playSoundFileNamed:waitForCompletion:volume: using runBlock as you already thought, so your code won't be very different then using playSoundFileNamed:waitForCompletion:.

这篇关于调节SKAction playSoundFileNamed的音量:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 08:25