No Sound in Android Application with Libgdx(使用 Libgdx 在 Android 应用程序中没有声音)
问题描述
我正在使用 Libgdx 创建一个 Android 应用程序.如果我在桌面版本和模拟器上运行程序,声音效果很好.
I am creating an Android App with Libgdx. The sound works pretty well, if I run the program in the desktop-version and on the emulator as well.
当我在我的 Android 手机 (Galaxy S3) 上测试应用程序时,没有声音.除了完全丢失的声音之外,其他一切在我的设备上都运行良好.有谁知道这里可能是什么问题?
When I am testing the application on my android phone (Galaxy S3) there is no sound. Everything else works pretty fine on my device except the sound which is completely is missing. Do anyone know what the issue here could be?
向我索要代码或日志,我想为您发布!
Ask me for code or logs I’d like to post it for you!
问候
以下示例显示了我播放声音的方式:
The following example shows the way i play the sound:
import com.badlogic.gdx.audio.Sound;
public class LevelDesigner {
public LevelDesigner() {
Sound mp3Sound = Gdx.audio.newSound(Gdx.files.internal("data/sounds/sound.mp3"));
mp3Sound.loop();
}
}
推荐答案
有时声音在加载时播放的帧不同,请尝试等待一帧.或者在另一个班级玩.
Sometimes the sound doesn't play the same frame it was loaded, try waiting one frame. Or playing it in another class.
参考:加载后声音不播放
这篇关于使用 Libgdx 在 Android 应用程序中没有声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 Libgdx 在 Android 应用程序中没有声音


- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01