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 应用程序中没有声音


基础教程推荐
- NSString intValue 不能用于检索电话号码 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01